From c11314be65f7cd4914544663b69295d1dd8db176 Mon Sep 17 00:00:00 2001 From: FilippeB Date: Thu, 22 Feb 2024 12:21:10 +0100 Subject: [PATCH 1/6] fix removed deprecation http-foundation ^7.0 'Request::getContentType' Signed-off-by: FilippeB --- src/EventListener/JsonApiProblemExceptionListener.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EventListener/JsonApiProblemExceptionListener.php b/src/EventListener/JsonApiProblemExceptionListener.php index 3ca5ed1..c8bd0e3 100644 --- a/src/EventListener/JsonApiProblemExceptionListener.php +++ b/src/EventListener/JsonApiProblemExceptionListener.php @@ -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; } From 991602c986792489ffd78139cbcf1c6c7f2fc466 Mon Sep 17 00:00:00 2001 From: FilippeB Date: Thu, 22 Feb 2024 12:21:29 +0100 Subject: [PATCH 2/6] fix removed deprecation symfony/http-kernel ^7.0 'HttpKernelInterface::MAIN_REQUEST' Signed-off-by: FilippeB --- test/EventListener/JsonApiProblemExceptionListenerTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/EventListener/JsonApiProblemExceptionListenerTest.php b/test/EventListener/JsonApiProblemExceptionListenerTest.php index b07795a..fef0e4c 100644 --- a/test/EventListener/JsonApiProblemExceptionListenerTest.php +++ b/test/EventListener/JsonApiProblemExceptionListenerTest.php @@ -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'); @@ -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 ); } From 4030db9b186c9def228b112adac407ed5c129d08 Mon Sep 17 00:00:00 2001 From: FilippeB Date: Thu, 22 Feb 2024 12:52:12 +0100 Subject: [PATCH 3/6] restrict symfony/http-kernel version ^7.0 Signed-off-by: FilippeB --- composer.json | 2 +- test/Transformer/ChainTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 3e9a909..9cdfeb0 100644 --- a/composer.json +++ b/composer.json @@ -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": "^7.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.39", diff --git a/test/Transformer/ChainTest.php b/test/Transformer/ChainTest.php index 0add6d1..e5a8545 100644 --- a/test/Transformer/ChainTest.php +++ b/test/Transformer/ChainTest.php @@ -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); From 4774a522fe0ff9cce00b43c0ffe7d64ca6e8bcfd Mon Sep 17 00:00:00 2001 From: FilippeB Date: Thu, 22 Feb 2024 14:31:10 +0100 Subject: [PATCH 4/6] add minimum supported versions --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 9cdfeb0..8315d16 100644 --- a/composer.json +++ b/composer.json @@ -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": "^7.0" + "symfony/http-kernel": "^5.4 || ^6.2 || ^7.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.39", From d56ab0ffc1ae3667c3be47d3d6a70ca60cc597c1 Mon Sep 17 00:00:00 2001 From: FilippeB Date: Fri, 23 Feb 2024 11:23:27 +0100 Subject: [PATCH 5/6] restrict http-kernel 6.4 and 7.0 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 8315d16..8c6bf4d 100644 --- a/composer.json +++ b/composer.json @@ -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.2 || ^7.0" + "symfony/http-kernel": "^6.4 || ^7.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.39", From 476cb3e1c87f3687055457aa515645c9dcd0c879 Mon Sep 17 00:00:00 2001 From: FilippeB Date: Fri, 23 Feb 2024 13:28:05 +0100 Subject: [PATCH 6/6] update cs fixer rules --- .php-cs-fixer.dist.php | 1 + 1 file changed, 1 insertion(+) diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index afaab51..eb8bb1a 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -88,5 +88,6 @@ 'import_constants' => true, 'import_functions' => true, ], + 'nullable_type_declaration_for_default_null_value' => true, ]) ;