Skip to content

Commit

Permalink
Merge pull request #24 from filippeb/master
Browse files Browse the repository at this point in the history
Fix removed symfony deprecations
  • Loading branch information
veewee authored Feb 23, 2024
2 parents 51872e9 + 476cb3e commit a153e5e
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,6 @@
'import_constants' => true,
'import_functions' => true,
],
'nullable_type_declaration_for_default_null_value' => true,
])
;
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"phpro/api-problem": "^1.0",
"symfony/dependency-injection": "^5.4 || ^6.0 || ^7.0",
"symfony/event-dispatcher": "^5.4 || ^6.0 || ^7.0",
"symfony/http-kernel": "^5.4 || ^6.0 || ^7.0"
"symfony/http-kernel": "^6.4 || ^7.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.39",
Expand Down
2 changes: 1 addition & 1 deletion src/EventListener/JsonApiProblemExceptionListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function onKernelException(ExceptionEvent $event): void
$request = $event->getRequest();
if (
false === mb_strpos($request->getPreferredFormat(), 'json')
&& false === mb_strpos((string) $request->getContentType(), 'json')
&& false === mb_strpos((string) $request->getContentTypeFormat(), 'json')
) {
return;
}
Expand Down
4 changes: 2 additions & 2 deletions test/EventListener/JsonApiProblemExceptionListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ private function parseDataForException(Exception $exception): array
];
}

private function buildEvent(Request $request, Exception $exception = null): ExceptionEvent
private function buildEvent(Request $request, ?Exception $exception = null): ExceptionEvent
{
$exception ??= new Exception('error');

Expand All @@ -208,7 +208,7 @@ private function buildEvent(Request $request, Exception $exception = null): Exce
return new ExceptionEvent(
$httpKernel->reveal(),
$request,
HttpKernelInterface::MASTER_REQUEST,
HttpKernelInterface::MAIN_REQUEST,
$exception
);
}
Expand Down
2 changes: 1 addition & 1 deletion test/Transformer/ChainTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function it_transforms_to_basic_exception_problem_when_no_transformer_mat
$this->assertInstanceOf(ExceptionApiProblem::class, $transformer->transform(new Exception()));
}

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

0 comments on commit a153e5e

Please sign in to comment.