Skip to content

Commit a153e5e

Browse files
authored
Merge pull request #24 from filippeb/master
Fix removed symfony deprecations
2 parents 51872e9 + 476cb3e commit a153e5e

5 files changed

Lines changed: 6 additions & 5 deletions

File tree

.php-cs-fixer.dist.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,6 @@
8888
'import_constants' => true,
8989
'import_functions' => true,
9090
],
91+
'nullable_type_declaration_for_default_null_value' => true,
9192
])
9293
;

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"phpro/api-problem": "^1.0",
1515
"symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0",
1616
"symfony/event-dispatcher": "^5.4 || ^6.0 || ^7.0",
17-
"symfony/http-kernel": "^5.4 || ^6.0 || ^7.0"
17+
"symfony/http-kernel": "^6.4 || ^7.0"
1818
},
1919
"require-dev": {
2020
"friendsofphp/php-cs-fixer": "^3.39",

src/EventListener/JsonApiProblemExceptionListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function onKernelException(ExceptionEvent $event): void
3636
$request = $event->getRequest();
3737
if (
3838
false === mb_strpos($request->getPreferredFormat(), 'json')
39-
&& false === mb_strpos((string) $request->getContentType(), 'json')
39+
&& false === mb_strpos((string) $request->getContentTypeFormat(), 'json')
4040
) {
4141
return;
4242
}

test/EventListener/JsonApiProblemExceptionListenerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ private function parseDataForException(Exception $exception): array
199199
];
200200
}
201201

202-
private function buildEvent(Request $request, Exception $exception = null): ExceptionEvent
202+
private function buildEvent(Request $request, ?Exception $exception = null): ExceptionEvent
203203
{
204204
$exception ??= new Exception('error');
205205

@@ -208,7 +208,7 @@ private function buildEvent(Request $request, Exception $exception = null): Exce
208208
return new ExceptionEvent(
209209
$httpKernel->reveal(),
210210
$request,
211-
HttpKernelInterface::MASTER_REQUEST,
211+
HttpKernelInterface::MAIN_REQUEST,
212212
$exception
213213
);
214214
}

test/Transformer/ChainTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function it_transforms_to_basic_exception_problem_when_no_transformer_mat
5555
$this->assertInstanceOf(ExceptionApiProblem::class, $transformer->transform(new Exception()));
5656
}
5757

58-
private function mockTransformer(bool $accepts, ApiProblemInterface $apiProblem = null): ExceptionTransformerInterface
58+
private function mockTransformer(bool $accepts, ?ApiProblemInterface $apiProblem = null): ExceptionTransformerInterface
5959
{
6060
/** @var ExceptionTransformerInterface|ObjectProphecy $transformer */
6161
$transformer = $this->prophesize(ExceptionTransformerInterface::class);

0 commit comments

Comments
 (0)