From a4ad08be657d0702aee189b61f851a1e77dfd8e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20M=C3=B6nch?= Date: Thu, 20 Jul 2023 09:53:51 +0200 Subject: [PATCH] drop Symfony <5.4, allow doctrine/annotations 2.0 and adds CI runs for PHP 8.2 and Symfony 6.2/6.3 --- .github/workflows/continuous-integration.yml | 20 ++++----- FOSRestBundle.php | 2 +- .../Normalizer/FlattenExceptionNormalizer.php | 7 +++ Serializer/Normalizer/FormErrorNormalizer.php | 7 +++ .../Annotations/AbstractParamTest.php | 2 + .../Annotations/AbstractScalarParamTest.php | 2 + .../Controller/Annotations/FileParamTest.php | 2 + .../Controller/Annotations/QueryParamTest.php | 2 + .../Annotations/RequestParamTest.php | 2 + Tests/Functional/DependencyInjectionTest.php | 2 +- Tests/Functional/ParamFetcherTest.php | 6 +++ Tests/Functional/app/AppKernel.php | 2 +- .../Request/RequestBodyParamConverterTest.php | 2 +- composer.json | 43 +++++++++---------- phpunit.xml.dist | 2 +- 15 files changed, 66 insertions(+), 37 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 809ba69a3..dad14bd03 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -28,17 +28,9 @@ jobs: can-fail: false - php-version: 7.4 composer-flags: "" - symfony-require: "4.4.*" - can-fail: false - - php-version: 7.4 - composer-flags: "" - symfony-require: "5.3.*" + symfony-require: "5.4.*" can-fail: false coverage: yes - - php-version: 7.4 - composer-flags: "" - can-fail: false - symfony-require: "5.4.*" - php-version: 8.0 composer-flags: "" can-fail: false @@ -47,7 +39,15 @@ jobs: composer-flags: "" can-fail: false symfony-require: "6.1.*" - - php-version: 8.1 + - php-version: 8.2 + composer-flags: "" + can-fail: false + symfony-require: "6.2.*" + - php-version: 8.2 + composer-flags: "" + can-fail: false + symfony-require: "6.3.*" + - php-version: 8.2 composer-flags: "" can-fail: false diff --git a/FOSRestBundle.php b/FOSRestBundle.php index 5166a71ea..a45151843 100644 --- a/FOSRestBundle.php +++ b/FOSRestBundle.php @@ -32,7 +32,7 @@ class FOSRestBundle extends Bundle /** * {@inheritdoc} */ - public function build(ContainerBuilder $container) + public function build(ContainerBuilder $container): void { $container->addCompilerPass(new SerializerConfigurationPass()); $container->addCompilerPass(new ConfigurationCheckPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, -10); diff --git a/Serializer/Normalizer/FlattenExceptionNormalizer.php b/Serializer/Normalizer/FlattenExceptionNormalizer.php index 2f44a4965..15f0ab646 100644 --- a/Serializer/Normalizer/FlattenExceptionNormalizer.php +++ b/Serializer/Normalizer/FlattenExceptionNormalizer.php @@ -92,4 +92,11 @@ public function supportsNormalization($data, $format = null, array $context = [] return true; } + + public function getSupportedTypes(?string $format): array + { + return [ + FlattenException::class => false, + ]; + } } diff --git a/Serializer/Normalizer/FormErrorNormalizer.php b/Serializer/Normalizer/FormErrorNormalizer.php index 9d06e19b5..9c880adea 100644 --- a/Serializer/Normalizer/FormErrorNormalizer.php +++ b/Serializer/Normalizer/FormErrorNormalizer.php @@ -71,4 +71,11 @@ private function convertFormToArray(FormInterface $data): array return $form; } + + public function getSupportedTypes(?string $format): array + { + return [ + FormInterface::class => false, + ]; + } } diff --git a/Tests/Controller/Annotations/AbstractParamTest.php b/Tests/Controller/Annotations/AbstractParamTest.php index 17d24a240..20f81c7c5 100644 --- a/Tests/Controller/Annotations/AbstractParamTest.php +++ b/Tests/Controller/Annotations/AbstractParamTest.php @@ -23,6 +23,8 @@ */ class AbstractParamTest extends TestCase { + private $param; + protected function setUp(): void { $this->param = $this->getMockForAbstractClass(AbstractParam::class); diff --git a/Tests/Controller/Annotations/AbstractScalarParamTest.php b/Tests/Controller/Annotations/AbstractScalarParamTest.php index 57898dcdd..b5d35894f 100644 --- a/Tests/Controller/Annotations/AbstractScalarParamTest.php +++ b/Tests/Controller/Annotations/AbstractScalarParamTest.php @@ -26,6 +26,8 @@ */ class AbstractScalarParamTest extends TestCase { + private $param; + protected function setUp(): void { $this->param = $this->getMockForAbstractClass(AbstractScalarParam::class); diff --git a/Tests/Controller/Annotations/FileParamTest.php b/Tests/Controller/Annotations/FileParamTest.php index 5bd37edc3..c776cff3c 100644 --- a/Tests/Controller/Annotations/FileParamTest.php +++ b/Tests/Controller/Annotations/FileParamTest.php @@ -29,6 +29,8 @@ */ class FileParamTest extends TestCase { + private $param; + protected function setUp(): void { $this->param = $this->getMockBuilder(FileParam::class) diff --git a/Tests/Controller/Annotations/QueryParamTest.php b/Tests/Controller/Annotations/QueryParamTest.php index 079525a11..a658a061c 100644 --- a/Tests/Controller/Annotations/QueryParamTest.php +++ b/Tests/Controller/Annotations/QueryParamTest.php @@ -26,6 +26,8 @@ */ class QueryParamTest extends TestCase { + private $param; + protected function setUp(): void { $this->param = $this->getMockBuilder(QueryParam::class) diff --git a/Tests/Controller/Annotations/RequestParamTest.php b/Tests/Controller/Annotations/RequestParamTest.php index a6ae61ca1..719fc6ebe 100644 --- a/Tests/Controller/Annotations/RequestParamTest.php +++ b/Tests/Controller/Annotations/RequestParamTest.php @@ -26,6 +26,8 @@ */ class RequestParamTest extends TestCase { + private $param; + protected function setUp(): void { $this->param = $this->getMockBuilder(RequestParam::class) diff --git a/Tests/Functional/DependencyInjectionTest.php b/Tests/Functional/DependencyInjectionTest.php index af23f03b5..c946ce7ca 100644 --- a/Tests/Functional/DependencyInjectionTest.php +++ b/Tests/Functional/DependencyInjectionTest.php @@ -61,7 +61,7 @@ public function registerBundles(): array ]; } - public function registerContainerConfiguration(LoaderInterface $loader) + public function registerContainerConfiguration(LoaderInterface $loader): void { $loader->load(function (ContainerBuilder $container) { $container->loadFromExtension('framework', [ diff --git a/Tests/Functional/ParamFetcherTest.php b/Tests/Functional/ParamFetcherTest.php index e61312fd5..70cb30334 100644 --- a/Tests/Functional/ParamFetcherTest.php +++ b/Tests/Functional/ParamFetcherTest.php @@ -11,6 +11,7 @@ namespace FOS\RestBundle\Tests\Functional; +use Symfony\Bundle\FrameworkBundle\KernelBrowser; use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; @@ -28,6 +29,11 @@ class ParamFetcherTest extends WebTestCase 'foobar' => 'foo', ]; + /** + * @var KernelBrowser + */ + private $client; + private function createUploadedFile($path, $originalName, $mimeType = null, $error = null, $test = false) { $ref = new \ReflectionClass(UploadedFile::class); diff --git a/Tests/Functional/app/AppKernel.php b/Tests/Functional/app/AppKernel.php index 8aa6b4c18..46f5683f1 100644 --- a/Tests/Functional/app/AppKernel.php +++ b/Tests/Functional/app/AppKernel.php @@ -94,7 +94,7 @@ public function getLogDir(): string return sys_get_temp_dir().'/'.Kernel::VERSION.'/'.$this->testCase.'/logs'; } - public function registerContainerConfiguration(LoaderInterface $loader) + public function registerContainerConfiguration(LoaderInterface $loader): void { $loader->load($this->rootConfig); $loader->load(function (ContainerBuilder $container) { diff --git a/Tests/Request/RequestBodyParamConverterTest.php b/Tests/Request/RequestBodyParamConverterTest.php index 396f268fe..372f29672 100644 --- a/Tests/Request/RequestBodyParamConverterTest.php +++ b/Tests/Request/RequestBodyParamConverterTest.php @@ -32,7 +32,7 @@ class RequestBodyParamConverterTest extends TestCase { protected $serializer; - protected $converterBuilder; + protected $converter; protected function setUp(): void { diff --git a/composer.json b/composer.json index 542a0e07f..62469eea6 100644 --- a/composer.json +++ b/composer.json @@ -30,38 +30,38 @@ }, "require": { "php": "^7.2|^8.0", - "symfony/config": "^4.4|^5.3|^6.0", - "symfony/dependency-injection": "^4.4|^5.3|^6.0", - "symfony/event-dispatcher": "^4.4|^5.3|^6.0", + "symfony/config": "^5.4|^6.0", + "symfony/dependency-injection": "^5.4|^6.0", + "symfony/event-dispatcher": "^5.4|^6.0", "symfony/framework-bundle": "^4.4.1|^5.0|^6.0", - "symfony/http-foundation": "^4.4|^5.3|^6.0", - "symfony/http-kernel": "^4.4|^5.3|^6.0", - "symfony/routing": "^4.4|^5.3|^6.0", - "symfony/security-core": "^4.4|^5.3|^6.0", + "symfony/http-foundation": "^5.4|^6.0", + "symfony/http-kernel": "^5.4|^6.0", + "symfony/routing": "^5.4|^6.0", + "symfony/security-core": "^5.4|^6.0", "willdurand/jsonp-callback-validator": "^1.0|^2.0", "willdurand/negotiation": "^2.0|^3.0" }, "require-dev": { - "doctrine/annotations": "^1.13.2", + "doctrine/annotations": "^1.13.2|^2.0 ", "friendsofphp/php-cs-fixer": "^3.0", "jms/serializer": "^1.13|^2.0|^3.0", "jms/serializer-bundle": "^2.4.3|^3.0.1|^4.0|^5.0", "psr/http-message": "^1.0", "psr/log": "^1.0|^2.0|^3.0", "sensio/framework-extra-bundle": "^6.1", - "symfony/phpunit-bridge": "^5.3|^6.0", - "symfony/asset": "^4.4|^5.3|^6.0", - "symfony/browser-kit": "^4.4|^5.3|^6.0", - "symfony/css-selector": "^4.4|^5.3|^6.0", - "symfony/expression-language": "^4.4|^5.3|^6.0", - "symfony/form": "^4.4|^5.3|^6.0", - "symfony/mime": "^4.4|^5.3|^6.0", - "symfony/security-bundle": "^4.4|^5.3|^6.0", - "symfony/serializer": "^4.4|^5.3|^6.0", - "symfony/twig-bundle": "^4.4|^5.3|^6.0", - "symfony/validator": "^4.4|^5.3|^6.0", - "symfony/web-profiler-bundle": "^4.4|^5.3|^6.0", - "symfony/yaml": "^4.4|^5.3|^6.0" + "symfony/phpunit-bridge": "^5.4|^6.0", + "symfony/asset": "^5.4|^6.0", + "symfony/browser-kit": "^5.4|^6.0", + "symfony/css-selector": "^5.4|^6.0", + "symfony/expression-language": "^5.4|^6.0", + "symfony/form": "^5.4|^6.0", + "symfony/mime": "^5.4|^6.0", + "symfony/security-bundle": "^5.4|^6.0", + "symfony/serializer": "^5.4|^6.0", + "symfony/twig-bundle": "^5.4|^6.0", + "symfony/validator": "^5.4|^6.0", + "symfony/web-profiler-bundle": "^5.4|^6.0", + "symfony/yaml": "^5.4|^6.0" }, "suggest": { "sensio/framework-extra-bundle": "Add support for the request body converter and the view response listener, requires ^3.0", @@ -72,7 +72,6 @@ "conflict": { "doctrine/annotations": "<1.12", "sensio/framework-extra-bundle": "<6.1", - "symfony/error-handler": "<4.4.1", "jms/serializer-bundle": "<2.4.3|3.0.0", "jms/serializer": "<1.13.0" }, diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 54b3cf347..7f9b085e9 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -2,7 +2,7 @@ - +