Skip to content

Commit 27e1bb4

Browse files
authored
Merge pull request #334 from lcobucci/update-dependencies
Update dependencies
2 parents 46c0cf6 + e8a3f57 commit 27e1bb4

File tree

9 files changed

+59
-77
lines changed

9 files changed

+59
-77
lines changed

.github/workflows/phpunit.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
- "development"
2020
php-version:
2121
- "8.0"
22+
- "8.1"
2223
operating-system:
2324
- "ubuntu-latest"
2425

@@ -62,7 +63,7 @@ jobs:
6263
run: "make phpunit"
6364

6465
phpunit-rc:
65-
name: "PHPUnit tests on PHP 8"
66+
name: "PHPUnit tests on nightly"
6667

6768
runs-on: ${{ matrix.operating-system }}
6869

@@ -71,7 +72,7 @@ jobs:
7172
dependencies:
7273
- "locked"
7374
php-version:
74-
- "8.1"
75+
- "8.2"
7576
operating-system:
7677
- "ubuntu-latest"
7778

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"php": "^8.0",
1919
"ext-json": "*",
2020
"fig/http-message-util": "^1.1",
21-
"lcobucci/content-negotiation-middleware": "^3.0",
21+
"lcobucci/content-negotiation-middleware": "^3.1",
2222
"psr/http-factory": "^1.0",
2323
"psr/http-message": "^1.0",
2424
"psr/http-server-handler": "^1.0",
@@ -28,7 +28,7 @@
2828
"require-dev": {
2929
"infection/infection": "^0.25",
3030
"laminas/laminas-diactoros": "^2.8",
31-
"lcobucci/coding-standard": "^7.0",
31+
"lcobucci/coding-standard": "^8.0",
3232
"phpstan/extension-installer": "^1.1",
3333
"phpstan/phpstan": "^0.12",
3434
"phpstan/phpstan-deprecation-rules": "^0.12",

composer.lock

Lines changed: 30 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ErrorConversionMiddleware.php

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,11 @@ final class ErrorConversionMiddleware implements MiddlewareInterface
2525

2626
private const STATUS_URL = 'https://httpstatuses.com/';
2727

28-
private ResponseFactoryInterface $responseFactory;
29-
private DebugInfoStrategy $debugInfoStrategy;
30-
private StatusCodeExtractionStrategy $statusCodeExtractor;
31-
3228
public function __construct(
33-
ResponseFactoryInterface $responseFactory,
34-
DebugInfoStrategy $debugInfoStrategy,
35-
StatusCodeExtractionStrategy $statusCodeExtractor
29+
private ResponseFactoryInterface $responseFactory,
30+
private DebugInfoStrategy $debugInfoStrategy,
31+
private StatusCodeExtractionStrategy $statusCodeExtractor,
3632
) {
37-
$this->responseFactory = $responseFactory;
38-
$this->debugInfoStrategy = $debugInfoStrategy;
39-
$this->statusCodeExtractor = $statusCodeExtractor;
4033
}
4134

4235
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
@@ -49,7 +42,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
4942
return new UnformattedResponse(
5043
$response,
5144
$this->extractData($error, $response),
52-
['error' => $error]
45+
['error' => $error],
5346
);
5447
}
5548
}
@@ -66,7 +59,7 @@ private function generateResponse(ServerRequestInterface $request, Throwable $er
6659

6760
return $response->withAddedHeader(
6861
'Content-Type',
69-
self::CONTENT_TYPE_CONVERSION[$accept] . '; charset=' . $request->getHeaderLine('Accept-Charset')
62+
self::CONTENT_TYPE_CONVERSION[$accept] . '; charset=' . $request->getHeaderLine('Accept-Charset'),
7063
);
7164
}
7265

src/ErrorLoggingMiddleware.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,8 @@
1212

1313
final class ErrorLoggingMiddleware implements MiddlewareInterface
1414
{
15-
private LoggerInterface $logger;
16-
17-
public function __construct(LoggerInterface $logger)
15+
public function __construct(private LoggerInterface $logger)
1816
{
19-
$this->logger = $logger;
2017
}
2118

2219
/**

src/StatusCodeExtractionStrategy/ClassMap.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,9 @@ final class ClassMap implements StatusCodeExtractionStrategy
2121
Problem\ServiceUnavailable::class => StatusCodeInterface::STATUS_SERVICE_UNAVAILABLE,
2222
];
2323

24-
/** @var array<string, int> */
25-
private array $conversionMap;
26-
2724
/** @param array<string, int> $conversionMap */
28-
public function __construct(array $conversionMap = self::DEFAULT_MAP)
25+
public function __construct(private array $conversionMap = self::DEFAULT_MAP)
2926
{
30-
$this->conversionMap = $conversionMap;
3127
}
3228

3329
public function extractStatusCode(Throwable $error): int

tests/DebugInfoStrategy/NoTraceTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function extractDebugInfoShouldConvertExceptionInfoWithoutTheTrace(): voi
3131
'file' => __FILE__,
3232
'line' => __LINE__ + 2,
3333
],
34-
$strategy->extractDebugInfo(new RuntimeException('Testing', 11))
34+
$strategy->extractDebugInfo(new RuntimeException('Testing', 11)),
3535
);
3636
}
3737

@@ -77,10 +77,10 @@ public function extractDebugInfoShouldAlsoReturnPreviousExceptions(): void
7777
new InvalidArgumentException(
7878
'Oh no!',
7979
25,
80-
new LogicException('Bummer')
81-
)
82-
)
83-
)
80+
new LogicException('Bummer'),
81+
),
82+
),
83+
),
8484
);
8585
}
8686
}

tests/ErrorConversionMiddlewareTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function processShouldJustReturnTheResponseWhenEverythingIsAlright(): voi
5555
$middleware = new ErrorConversionMiddleware(
5656
$this->responseFactory,
5757
new NoDebugInfo(),
58-
$this->statusCodeExtractor
58+
$this->statusCodeExtractor,
5959
);
6060

6161
self::assertSame($response, $middleware->process(new ServerRequest(), $handler));
@@ -75,7 +75,7 @@ public function processShouldJustReturnTheResponseWhenEverythingIsAlright(): voi
7575
public function processShouldConvertTheExceptionIntoAnUnformattedResponseWithTheProblemDetails(
7676
Throwable $error,
7777
int $expectedStatusCode,
78-
array $expectedData
78+
array $expectedData,
7979
): void {
8080
$response = $this->handleProcessWithError(new ServerRequest(), $error);
8181

@@ -100,7 +100,7 @@ public function possibleConversions(): iterable
100100
yield 'typed exceptions' => [
101101
new SampleProblem\Typed(
102102
'Your current balance is 30, but that costs 50.',
103-
StatusCodeInterface::STATUS_FORBIDDEN
103+
StatusCodeInterface::STATUS_FORBIDDEN,
104104
),
105105
StatusCodeInterface::STATUS_FORBIDDEN,
106106
[
@@ -113,7 +113,7 @@ public function possibleConversions(): iterable
113113
yield 'titled exceptions' => [
114114
new SampleProblem\Titled(
115115
'Your current balance is 30, but that costs 50.',
116-
StatusCodeInterface::STATUS_FORBIDDEN
116+
StatusCodeInterface::STATUS_FORBIDDEN,
117117
),
118118
StatusCodeInterface::STATUS_FORBIDDEN,
119119
[
@@ -126,7 +126,7 @@ public function possibleConversions(): iterable
126126
yield 'detailed exceptions' => [
127127
new SampleProblem\Detailed(
128128
'Your current balance is 30, but that costs 50.',
129-
StatusCodeInterface::STATUS_FORBIDDEN
129+
StatusCodeInterface::STATUS_FORBIDDEN,
130130
),
131131
StatusCodeInterface::STATUS_FORBIDDEN,
132132
[
@@ -141,7 +141,7 @@ public function possibleConversions(): iterable
141141
yield 'typed+titled+detailed exceptions' => [
142142
new SampleProblem\All(
143143
'Your current balance is 30, but that costs 50.',
144-
StatusCodeInterface::STATUS_FORBIDDEN
144+
StatusCodeInterface::STATUS_FORBIDDEN,
145145
),
146146
StatusCodeInterface::STATUS_FORBIDDEN,
147147
[
@@ -229,12 +229,12 @@ public function processShouldModifyTheContentTypeHeaderForXml(): void
229229
private function handleProcessWithError(
230230
ServerRequestInterface $request,
231231
Throwable $error,
232-
?DebugInfoStrategy $debugInfoStrategy = null
232+
?DebugInfoStrategy $debugInfoStrategy = null,
233233
): ResponseInterface {
234234
$middleware = new ErrorConversionMiddleware(
235235
$this->responseFactory,
236236
$debugInfoStrategy ?? new NoDebugInfo(),
237-
$this->statusCodeExtractor
237+
$this->statusCodeExtractor,
238238
);
239239

240240
$handler = $this->createMock(RequestHandlerInterface::class);

0 commit comments

Comments
 (0)