diff --git a/.gitignore b/.gitignore index b44218aedc7..67c17cd55fa 100644 --- a/.gitignore +++ b/.gitignore @@ -17,4 +17,4 @@ composer.lock /tests/Metadata/Extractor/Adapter/*.yaml /vendor/ /Dockerfile - +tests/Fixtures/app/config/reference.php diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 365dd5b6ff1..b7155b62936 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -21,14 +21,16 @@ 'docs/guides', 'docs/var', 'src/Doctrine/Orm/Tests/var', - 'src/Doctrine/Odm/Tests/var' + 'src/Doctrine/Odm/Tests/var', ]) + ->notPath('tests/Fixtures/app/config/reference.php') ->notPath('src/Symfony/Bundle/DependencyInjection/Configuration.php') ->append([ 'tests/Fixtures/app/console', ]); return (new PhpCsFixer\Config()) + ->setUnsupportedPhpVersionAllowed(true) ->setRiskyAllowed(true) ->setRules([ '@DoctrineAnnotation' => true, diff --git a/composer.json b/composer.json index c25272ab5df..553ed57cbc9 100644 --- a/composer.json +++ b/composer.json @@ -53,7 +53,7 @@ "dev-main": "4.3.x-dev" }, "symfony": { - "require": "^6.4 || ^7.1" + "require": "^6.4 || ^7.1 || ^8.0" }, "pmu": { "projects": [ @@ -111,15 +111,15 @@ "psr/cache": "^1.0 || ^2.0 || ^3.0", "psr/container": "^1.0 || ^2.0", "symfony/deprecation-contracts": "^3.1", - "symfony/http-foundation": "^6.4.14 || ^7.0", - "symfony/http-kernel": "^6.4 || ^7.0", - "symfony/property-access": "^6.4 || ^7.0", - "symfony/property-info": "^6.4 || ^7.1", - "symfony/serializer": "^6.4 || ^7.0", + "symfony/http-foundation": "^6.4.14 || ^7.0 || ^8.0", + "symfony/http-kernel": "^6.4 || ^7.0 || ^8.0", + "symfony/property-access": "^6.4 || ^7.0 || ^8.0", + "symfony/property-info": "^6.4 || ^7.1 || ^8.0", + "symfony/serializer": "^6.4 || ^7.0 || ^8.0", "symfony/translation-contracts": "^3.3", - "symfony/type-info": "^7.3 || 7.4.x-dev", - "symfony/validator": "^6.4.11 || ^7.1", - "symfony/web-link": "^6.4 || ^7.1", + "symfony/type-info": "^7.4 || ^8.0", + "symfony/validator": "^6.4.11 || ^7.1 || ^8.0", + "symfony/web-link": "^6.4 || ^7.1 || ^8.0", "willdurand/negotiation": "^3.1" }, "require-dev": { @@ -129,7 +129,7 @@ "doctrine/cache": "^1.11 || ^2.1", "doctrine/common": "^3.2.2", "doctrine/dbal": "^4.0", - "doctrine/doctrine-bundle": "^2.11", + "doctrine/doctrine-bundle": "^2.11 || ^3.1", "doctrine/mongodb-odm": "^2.10", "doctrine/mongodb-odm-bundle": "^5.0", "doctrine/orm": "^2.17 || ^3.0", @@ -163,38 +163,38 @@ "soyuka/contexts": "^3.3.10", "soyuka/pmu": "^0.2.0", "soyuka/stubs-mongodb": "^1.0", - "symfony/asset": "^6.4 || ^7.0", - "symfony/browser-kit": "^6.4 || ^7.0", - "symfony/cache": "^6.4 || ^7.0", - "symfony/config": "^6.4 || ^7.0", - "symfony/console": "^6.4 || ^7.0", - "symfony/css-selector": "^6.4 || ^7.0", - "symfony/dependency-injection": "^6.4 || ^7.0", - "symfony/doctrine-bridge": "^6.4.2 || ^7.1", - "symfony/dom-crawler": "^6.4 || ^7.0", - "symfony/error-handler": "^6.4 || ^7.0", - "symfony/event-dispatcher": "^6.4 || ^7.0", - "symfony/expression-language": "^6.4 || ^7.0", - "symfony/finder": "^6.4 || ^7.0", - "symfony/form": "^6.4 || ^7.0", - "symfony/framework-bundle": "^6.4 || ^7.0 || 7.4.x-dev", - "symfony/http-client": "^6.4 || ^7.0", - "symfony/intl": "^6.4 || ^7.0", - "symfony/json-streamer": "7.4.x-dev", + "symfony/asset": "^6.4 || ^7.0 || ^8.0", + "symfony/browser-kit": "^6.4 || ^7.0 || ^8.0", + "symfony/cache": "^6.4 || ^7.0 || ^8.0", + "symfony/config": "^6.4 || ^7.0 || ^8.0", + "symfony/console": "^6.4 || ^7.0 || ^8.0", + "symfony/css-selector": "^6.4 || ^7.0 || ^8.0", + "symfony/dependency-injection": "^6.4 || ^7.0 || ^8.0", + "symfony/doctrine-bridge": "^6.4.2 || ^7.1 || ^8.0", + "symfony/dom-crawler": "^6.4 || ^7.0 || ^8.0", + "symfony/error-handler": "^6.4 || ^7.0 || ^8.0", + "symfony/event-dispatcher": "^6.4 || ^7.0 || ^8.0", + "symfony/expression-language": "^6.4 || ^7.0 || ^8.0", + "symfony/finder": "^6.4 || ^7.0 || ^8.0", + "symfony/form": "^6.4 || ^7.0 || ^8.0", + "symfony/framework-bundle": "^6.4 || ^7.0 || ^8.0", + "symfony/http-client": "^6.4 || ^7.0 || ^8.0", + "symfony/intl": "^6.4 || ^7.0 || ^8.0", + "symfony/json-streamer": "^7.4 || ^8.0", "symfony/maker-bundle": "^1.24", "symfony/mercure-bundle": "*", - "symfony/messenger": "^6.4 || ^7.0", - "symfony/object-mapper": "^7.3 || 7.4.x-dev", - "symfony/routing": "^6.4 || ^7.0", - "symfony/security-bundle": "^6.4 || ^7.0", - "symfony/security-core": "^6.4 || ^7.0", - "symfony/stopwatch": "^6.4 || ^7.0", - "symfony/string": "^6.4 || ^7.0", - "symfony/twig-bundle": "^6.4 || ^7.0", - "symfony/uid": "^6.4 || ^7.0", - "symfony/var-exporter": "^7.3 || ^7.4.x-dev", - "symfony/web-profiler-bundle": "^6.4 || ^7.0", - "symfony/yaml": "^6.4 || ^7.0", + "symfony/messenger": "^6.4 || ^7.0 || ^8.0", + "symfony/object-mapper": "^7.4 || ^8.0", + "symfony/routing": "^6.4 || ^7.0 || ^8.0", + "symfony/security-bundle": "^6.4 || ^7.0 || ^8.0", + "symfony/security-core": "^6.4 || ^7.0 || ^8.0", + "symfony/stopwatch": "^6.4 || ^7.0 || ^8.0", + "symfony/string": "^6.4 || ^7.0 || ^8.0", + "symfony/twig-bundle": "^6.4 || ^7.0 || ^8.0", + "symfony/uid": "^6.4 || ^7.0 || ^8.0", + "symfony/var-exporter": "^7.4 || ^8.0", + "symfony/web-profiler-bundle": "^6.4 || ^7.0 || ^8.0", + "symfony/yaml": "^6.4 || ^7.0 || ^8.0", "twig/twig": "^1.42.3 || ^2.12 || ^3.0", "webonyx/graphql-php": "^15.0" }, diff --git a/docs/config/packages/doctrine.yaml b/docs/config/packages/doctrine.yaml index 1d6e342f607..447f14111f4 100644 --- a/docs/config/packages/doctrine.yaml +++ b/docs/config/packages/doctrine.yaml @@ -2,6 +2,5 @@ doctrine: dbal: url: 'sqlite:///%kernel.project_dir%/var/%guide%.db' orm: - auto_generate_proxy_classes: true naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware auto_mapping: false diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 00d46a04a14..2165b919de2 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -42,6 +42,10 @@ parameters: ApiPlatform\Metadata\Resource\ResourceMetadataCollection: - handleNotFound ignoreErrors: + # ignore type todo remove in 5.0 + - + message: '#Symfony\\Component\\PropertyInfo\\Type#' + identifier: class.notFound # False positives - message: '#Call to an undefined method Negotiation\\AcceptHeader::getType\(\).#' - @@ -78,15 +82,10 @@ parameters: message: '#Service "test" is not registered in the container\.#' path: src/GraphQl/Tests/Type/TypesContainerTest.php - # Expected, due to optional interfaces - - '#Method Symfony\\Component\\Serializer\\NameConverter\\NameConverterInterface::denormalize\(\) invoked with (2|3|4) parameters, 1 required\.#' - - '#Method Symfony\\Component\\Serializer\\NameConverter\\NameConverterInterface::normalize\(\) invoked with (2|3|4) parameters, 1 required\.#' - # Expected, due to backward compatibility - '#Method GraphQL\\Type\\Definition\\WrappingType::getWrappedType\(\) invoked with 1 parameter, 0 required\.#' - '#Access to an undefined property GraphQL\\Type\\Definition\\NamedType&GraphQL\\Type\\Definition\\Type::\$name\.#' - "#Call to function method_exists\\(\\) with GraphQL\\\\Type\\\\Definition\\\\Type&GraphQL\\\\Type\\\\Definition\\\\WrappingType and 'getInnermostType' will always evaluate to true\\.#" - - "#Call to function method_exists\\(\\) with Symfony\\\\Component\\\\Console\\\\Application and 'addCommand' will always evaluate to false\\.#" - "#Call to function method_exists\\(\\) with 'Symfony\\\\\\\\Component\\\\\\\\PropertyInfo\\\\\\\\PropertyInfoExtractor' and 'getType' will always evaluate to true\\.#" - "#Call to function method_exists\\(\\) with 'Symfony\\\\\\\\Component\\\\\\\\HttpFoundation\\\\\\\\Request' and 'getContentTypeFormat' will always evaluate to true\\.#" - '#Call to an undefined method Symfony\\Component\\HttpFoundation\\Request::getContentType\(\)\.#' @@ -94,16 +93,6 @@ parameters: - "#Call to function method_exists\\(\\) with Symfony\\\\Component\\\\Serializer\\\\Normalizer\\\\NormalizerInterface and 'getSupportedTypes' will always evaluate to true\\.#" - "#Call to function method_exists\\(\\) with Doctrine\\\\ODM\\\\MongoDB\\\\Configuration and 'setMetadataCache' will always evaluate to true\\.#" - "#Call to function method_exists\\(\\) with Doctrine\\\\ODM\\\\MongoDB\\\\Mapping\\\\ClassMetadata\\|Doctrine\\\\ORM\\\\Mapping\\\\ClassMetadata and 'isChangeTrackingDef…' will always evaluate to true\\.#" - - - message: '#Instanceof between Symfony\\Component\\Serializer\\NameConverter\\NameConverterInterface and Symfony\\Component\\Serializer\\NameConverter\\MetadataAwareNameConverter will always evaluate to false\.#' - paths: - - src/GraphQl/Serializer/SerializerContextBuilder.php - - src/GraphQl/Type/FieldsBuilder.php - - - message: '#Instanceof between Symfony\\Component\\Serializer\\NameConverter\\NameConverterInterface\|null and Symfony\\Component\\Serializer\\NameConverter\\MetadataAwareNameConverter will always evaluate to false\.#' - paths: - - src/Serializer/AbstractConstraintViolationListNormalizer.php - - src/Symfony/Validator/Serializer/ValidationExceptionNormalizer.php # See https://github.com/phpstan/phpstan-symfony/issues/27 - diff --git a/src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/DummyFriend.php b/src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/DummyFriend.php index c10beef2a09..1669e4e7778 100644 --- a/src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/DummyFriend.php +++ b/src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/DummyFriend.php @@ -16,7 +16,7 @@ use ApiPlatform\Metadata\ApiProperty; use ApiPlatform\Metadata\ApiResource; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints as Assert; /** diff --git a/src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/EmbeddableDummy.php b/src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/EmbeddableDummy.php index dd41ef33bf6..3947be68b3c 100644 --- a/src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/EmbeddableDummy.php +++ b/src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/EmbeddableDummy.php @@ -14,7 +14,7 @@ namespace ApiPlatform\Doctrine\Common\Tests\Fixtures\TestBundle\Entity; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints as Assert; /** diff --git a/src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/FourthLevel.php b/src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/FourthLevel.php index 0a4b7288979..43a569d040e 100644 --- a/src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/FourthLevel.php +++ b/src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/FourthLevel.php @@ -18,7 +18,7 @@ use ApiPlatform\Metadata\Link; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Fourth Level. diff --git a/src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/ParentDummy.php b/src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/ParentDummy.php index 105b60e5291..2cadbbd07f0 100644 --- a/src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/ParentDummy.php +++ b/src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/ParentDummy.php @@ -14,7 +14,7 @@ namespace ApiPlatform\Doctrine\Common\Tests\Fixtures\TestBundle\Entity; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Parent Dummy. diff --git a/src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/RelatedDummy.php b/src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/RelatedDummy.php index 019d66c6234..46321b04379 100644 --- a/src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/RelatedDummy.php +++ b/src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/RelatedDummy.php @@ -23,7 +23,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints as Assert; /** diff --git a/src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/RelatedToDummyFriend.php b/src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/RelatedToDummyFriend.php index ecaf3785583..b2dfe6e6082 100644 --- a/src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/RelatedToDummyFriend.php +++ b/src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/RelatedToDummyFriend.php @@ -18,7 +18,7 @@ use ApiPlatform\Metadata\GetCollection; use ApiPlatform\Metadata\Link; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints as Assert; /** diff --git a/src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/ThirdLevel.php b/src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/ThirdLevel.php index b575f96e22a..b5343eca905 100644 --- a/src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/ThirdLevel.php +++ b/src/Doctrine/Common/Tests/Fixtures/TestBundle/Entity/ThirdLevel.php @@ -17,7 +17,7 @@ use ApiPlatform\Metadata\Get; use ApiPlatform\Metadata\Link; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Third Level. diff --git a/src/Doctrine/Common/composer.json b/src/Doctrine/Common/composer.json index bb2f3053cd7..b99b133d299 100644 --- a/src/Doctrine/Common/composer.json +++ b/src/Doctrine/Common/composer.json @@ -35,7 +35,7 @@ "doctrine/orm": "^2.17 || ^3.0", "phpspec/prophecy-phpunit": "^2.2", "phpunit/phpunit": "11.5.x-dev", - "symfony/type-info": "^7.3" + "symfony/type-info": "^7.3 || ^8.0" }, "conflict": { "doctrine/persistence": "<1.3" @@ -67,7 +67,7 @@ "dev-4.1": "4.1.x-dev" }, "symfony": { - "require": "^6.4 || ^7.0" + "require": "^6.4 || ^7.0 || ^8.0" }, "thanks": { "name": "api-platform/api-platform", diff --git a/src/Doctrine/Odm/Tests/AppKernel.php b/src/Doctrine/Odm/Tests/AppKernel.php index 0333f06741e..afeab361c17 100644 --- a/src/Doctrine/Odm/Tests/AppKernel.php +++ b/src/Doctrine/Odm/Tests/AppKernel.php @@ -20,6 +20,7 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Bundle\Bundle; use Symfony\Component\HttpKernel\Kernel; +use Symfony\Component\PropertyInfo\Type; /** * AppKernel for tests. @@ -77,11 +78,14 @@ protected function configureContainer(ContainerBuilder $c, LoaderInterface $load 'php_errors' => ['log' => true], 'router' => ['utf8' => true], 'http_method_override' => false, - 'annotations' => false, 'handle_all_throwables' => true, 'uid' => ['default_uuid_version' => 7, 'time_based_uuid_version' => 7], ]; + if (!class_exists(Type::class)) { + $c->setParameter('.json_streamer.lazy_ghosts_dir', __DIR__.'/cache/json_streamer_lazy_ghost'); + } + $c->prependExtensionConfig('framework', $config); $loader->load(__DIR__.'/config.yml'); diff --git a/src/Doctrine/Odm/Tests/PropertyInfo/DoctrineExtractorTest.php b/src/Doctrine/Odm/Tests/PropertyInfo/DoctrineExtractorTest.php index 017af790834..9edce418e72 100644 --- a/src/Doctrine/Odm/Tests/PropertyInfo/DoctrineExtractorTest.php +++ b/src/Doctrine/Odm/Tests/PropertyInfo/DoctrineExtractorTest.php @@ -84,13 +84,6 @@ public function testTestGetPropertiesWithEmbedded(): void ); } - #[IgnoreDeprecations] - #[\PHPUnit\Framework\Attributes\DataProvider('legacyTypesProvider')] - public function testExtractLegacy(string $property, ?array $type = null): void - { - $this->assertEquals($type, $this->createExtractor()->getTypes(DoctrineDummy::class, $property)); - } - #[\PHPUnit\Framework\Attributes\DataProvider('typesProvider')] public function testExtract(string $property, ?Type $type): void { @@ -100,6 +93,10 @@ public function testExtract(string $property, ?Type $type): void #[IgnoreDeprecations] public function testExtractWithEmbedOneLegacy(): void { + if (!class_exists(LegacyType::class)) { + $this->markTestSkipped(); + } + $expectedTypes = [ new LegacyType( LegacyType::BUILTIN_TYPE_OBJECT, @@ -127,6 +124,10 @@ public function testExtractWithEmbedOne(): void #[IgnoreDeprecations] public function testExtractWithEmbedManyLegacy(): void { + if (!class_exists(LegacyType::class)) { + $this->markTestSkipped(); + } + $expectedTypes = [ new LegacyType( LegacyType::BUILTIN_TYPE_OBJECT, @@ -157,6 +158,10 @@ public function testExtractWithEmbedMany(): void #[IgnoreDeprecations] public function testExtractEnumLegacy(): void { + if (!class_exists(LegacyType::class)) { + $this->markTestSkipped(); + } + $this->assertEquals([new LegacyType(LegacyType::BUILTIN_TYPE_OBJECT, false, EnumString::class)], $this->createExtractor()->getTypes(DoctrineEnum::class, 'enumString')); $this->assertEquals([new LegacyType(LegacyType::BUILTIN_TYPE_OBJECT, false, EnumInt::class)], $this->createExtractor()->getTypes(DoctrineEnum::class, 'enumInt')); $this->assertNull($this->createExtractor()->getTypes(DoctrineEnum::class, 'enumCustom')); @@ -170,9 +175,13 @@ public function testExtractEnum(): void } #[IgnoreDeprecations] - public static function legacyTypesProvider(): array + public function testExtractLegacy(): void { - return [ + if (!class_exists(LegacyType::class)) { + $this->markTestSkipped(); + } + + $legacyTypes = [ ['id', [new LegacyType(LegacyType::BUILTIN_TYPE_STRING)]], ['bin', [new LegacyType(LegacyType::BUILTIN_TYPE_STRING)]], ['binByteArray', [new LegacyType(LegacyType::BUILTIN_TYPE_STRING)]], @@ -194,7 +203,8 @@ public static function legacyTypesProvider(): array ['objectId', [new LegacyType(LegacyType::BUILTIN_TYPE_STRING)]], ['raw', null], ['foo', [new LegacyType(LegacyType::BUILTIN_TYPE_OBJECT, false, DoctrineRelation::class)]], - ['bar', + [ + 'bar', [ new LegacyType( LegacyType::BUILTIN_TYPE_OBJECT, @@ -206,7 +216,8 @@ public static function legacyTypesProvider(): array ), ], ], - ['indexedFoo', + [ + 'indexedFoo', [ new LegacyType( LegacyType::BUILTIN_TYPE_OBJECT, @@ -221,6 +232,10 @@ public static function legacyTypesProvider(): array ['customFoo', null], ['notMapped', null], ]; + + foreach ($legacyTypes as [$property, $t]) { + $this->assertEquals($t, $this->createExtractor()->getTypes(DoctrineDummy::class, $property)); + } } /** @@ -263,12 +278,16 @@ public function testGetPropertiesCatchException(): void #[IgnoreDeprecations] public function testGetTypesCatchExceptionLegacy(): void { + if (!class_exists(LegacyType::class)) { + $this->markTestSkipped(); + } + $this->assertNull($this->createExtractor()->getTypes('Not\Exist', 'baz')); } public function testGetTypesCatchException(): void { - $this->assertNull($this->createExtractor()->getType('Not\Exist', 'baz')); + $this->assertNull($this->createExtractor()->getType(\Not\Exist::class, 'baz')); // @phpstan-ignore-line } public function testGeneratedValueNotWritable(): void @@ -283,6 +302,10 @@ public function testGeneratedValueNotWritable(): void #[IgnoreDeprecations] public function testGetTypesWithEmbedManyOmittingTargetDocumentLegacy(): void { + if (!class_exists(LegacyType::class)) { + $this->markTestSkipped(); + } + $actualTypes = $this->createExtractor()->getTypes( DoctrineWithEmbedded::class, 'embedManyOmittingTargetDocument' diff --git a/src/Doctrine/Odm/composer.json b/src/Doctrine/Odm/composer.json index c634404c31f..cd1d2d93700 100644 --- a/src/Doctrine/Odm/composer.json +++ b/src/Doctrine/Odm/composer.json @@ -29,21 +29,21 @@ "api-platform/metadata": "^4.2", "api-platform/state": "^4.2.4", "doctrine/mongodb-odm": "^2.10", - "symfony/property-info": "^6.4 || ^7.1", - "symfony/type-info": "^7.3" + "symfony/property-info": "^6.4 || ^7.1 || ^8.0", + "symfony/type-info": "^7.3 || ^8.0" }, "require-dev": { - "doctrine/doctrine-bundle": "^2.11", + "doctrine/doctrine-bundle": "^2.11 || ^3.1", "doctrine/mongodb-odm-bundle": "^5.0", "phpspec/prophecy-phpunit": "^2.2", "phpunit/phpunit": "11.5.x-dev", - "symfony/cache": "^6.4 || ^7.0", - "symfony/framework-bundle": "^6.4 || ^7.0", - "symfony/property-access": "^6.4 || ^7.0", - "symfony/serializer": "^6.4 || ^7.0", - "symfony/uid": "^6.4 || ^7.0", - "symfony/validator": "^6.4.11 || ^7.0", - "symfony/yaml": "^6.4 || ^7.0" + "symfony/cache": "^6.4 || ^7.0 || ^8.0", + "symfony/framework-bundle": "^6.4 || ^7.0 || ^8.0", + "symfony/property-access": "^6.4 || ^7.0 || ^8.0", + "symfony/serializer": "^6.4 || ^7.0 || ^8.0", + "symfony/uid": "^6.4 || ^7.0 || ^8.0", + "symfony/validator": "^6.4.11 || ^7.0 || ^8.0", + "symfony/yaml": "^6.4 || ^7.0 || ^8.0" }, "autoload": { "psr-4": { @@ -67,7 +67,7 @@ "dev-4.1": "4.1.x-dev" }, "symfony": { - "require": "^6.4 || ^7.0" + "require": "^6.4 || ^7.0 || ^8.0" }, "thanks": { "name": "api-platform/api-platform", diff --git a/src/Doctrine/Orm/Tests/AppKernel.php b/src/Doctrine/Orm/Tests/AppKernel.php index 94b796bb140..d54549aa363 100644 --- a/src/Doctrine/Orm/Tests/AppKernel.php +++ b/src/Doctrine/Orm/Tests/AppKernel.php @@ -20,6 +20,7 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Bundle\Bundle; use Symfony\Component\HttpKernel\Kernel; +use Symfony\Component\PropertyInfo\Type; /** * AppKernel for tests. @@ -78,11 +79,14 @@ protected function configureContainer(ContainerBuilder $c, LoaderInterface $load 'php_errors' => ['log' => true], 'router' => ['utf8' => true], 'http_method_override' => false, - 'annotations' => false, 'handle_all_throwables' => true, 'uid' => ['default_uuid_version' => 7, 'time_based_uuid_version' => 7], ]; + if (!class_exists(Type::class)) { + $c->setParameter('.json_streamer.lazy_ghosts_dir', __DIR__.'/cache/json_streamer_lazy_ghost'); + } + $c->prependExtensionConfig('framework', $config); $loader->load(__DIR__.'/config.yml'); diff --git a/src/Doctrine/Orm/Tests/Fixtures/Entity/Company.php b/src/Doctrine/Orm/Tests/Fixtures/Entity/Company.php index 6fd14985be6..3568dcc8474 100644 --- a/src/Doctrine/Orm/Tests/Fixtures/Entity/Company.php +++ b/src/Doctrine/Orm/Tests/Fixtures/Entity/Company.php @@ -19,7 +19,7 @@ use ApiPlatform\Metadata\Link; use ApiPlatform\Metadata\Post; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource] #[GetCollection] diff --git a/src/Doctrine/Orm/Tests/Fixtures/Entity/CompositeItem.php b/src/Doctrine/Orm/Tests/Fixtures/Entity/CompositeItem.php index bbcea4fbbae..d9dd0451a87 100644 --- a/src/Doctrine/Orm/Tests/Fixtures/Entity/CompositeItem.php +++ b/src/Doctrine/Orm/Tests/Fixtures/Entity/CompositeItem.php @@ -17,7 +17,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Composite Item. diff --git a/src/Doctrine/Orm/Tests/Fixtures/Entity/CompositeLabel.php b/src/Doctrine/Orm/Tests/Fixtures/Entity/CompositeLabel.php index 59ec038d06a..e884005d0ab 100644 --- a/src/Doctrine/Orm/Tests/Fixtures/Entity/CompositeLabel.php +++ b/src/Doctrine/Orm/Tests/Fixtures/Entity/CompositeLabel.php @@ -15,7 +15,7 @@ use ApiPlatform\Metadata\ApiResource; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Composite Label. diff --git a/src/Doctrine/Orm/Tests/Fixtures/Entity/CompositeRelation.php b/src/Doctrine/Orm/Tests/Fixtures/Entity/CompositeRelation.php index c274d1648d6..8265ad052d0 100644 --- a/src/Doctrine/Orm/Tests/Fixtures/Entity/CompositeRelation.php +++ b/src/Doctrine/Orm/Tests/Fixtures/Entity/CompositeRelation.php @@ -15,7 +15,7 @@ use ApiPlatform\Metadata\ApiResource; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Composite Relation. diff --git a/src/Doctrine/Orm/Tests/Fixtures/Entity/DummyCarColor.php b/src/Doctrine/Orm/Tests/Fixtures/Entity/DummyCarColor.php index 3d873996c0d..816a0f8935a 100644 --- a/src/Doctrine/Orm/Tests/Fixtures/Entity/DummyCarColor.php +++ b/src/Doctrine/Orm/Tests/Fixtures/Entity/DummyCarColor.php @@ -17,7 +17,7 @@ use ApiPlatform\Metadata\ApiFilter; use ApiPlatform\Metadata\ApiResource; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation as Serializer; +use Symfony\Component\Serializer\Attribute as Serializer; use Symfony\Component\Validator\Constraints as Assert; #[ApiResource] diff --git a/src/Doctrine/Orm/Tests/Fixtures/Entity/DummyFriend.php b/src/Doctrine/Orm/Tests/Fixtures/Entity/DummyFriend.php index af44f589290..cccf46e706c 100644 --- a/src/Doctrine/Orm/Tests/Fixtures/Entity/DummyFriend.php +++ b/src/Doctrine/Orm/Tests/Fixtures/Entity/DummyFriend.php @@ -16,7 +16,7 @@ use ApiPlatform\Metadata\ApiProperty; use ApiPlatform\Metadata\ApiResource; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints as Assert; /** diff --git a/src/Doctrine/Orm/Tests/Fixtures/Entity/DummyPropertyWithDefaultValue.php b/src/Doctrine/Orm/Tests/Fixtures/Entity/DummyPropertyWithDefaultValue.php index 7bec9f939af..9a1ccb38354 100644 --- a/src/Doctrine/Orm/Tests/Fixtures/Entity/DummyPropertyWithDefaultValue.php +++ b/src/Doctrine/Orm/Tests/Fixtures/Entity/DummyPropertyWithDefaultValue.php @@ -15,7 +15,7 @@ use ApiPlatform\Metadata\ApiResource; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * DummyPropertyWithDefaultValue. diff --git a/src/Doctrine/Orm/Tests/Fixtures/Entity/EmbeddableDummy.php b/src/Doctrine/Orm/Tests/Fixtures/Entity/EmbeddableDummy.php index ed37405aab6..c47bed99191 100644 --- a/src/Doctrine/Orm/Tests/Fixtures/Entity/EmbeddableDummy.php +++ b/src/Doctrine/Orm/Tests/Fixtures/Entity/EmbeddableDummy.php @@ -15,7 +15,7 @@ use ApiPlatform\Metadata\ApiProperty; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints as Assert; /** diff --git a/src/Doctrine/Orm/Tests/Fixtures/Entity/EmbeddedDummy.php b/src/Doctrine/Orm/Tests/Fixtures/Entity/EmbeddedDummy.php index 2341b0ae240..7c843ff0b82 100644 --- a/src/Doctrine/Orm/Tests/Fixtures/Entity/EmbeddedDummy.php +++ b/src/Doctrine/Orm/Tests/Fixtures/Entity/EmbeddedDummy.php @@ -20,7 +20,7 @@ use ApiPlatform\Metadata\Post; use ApiPlatform\Metadata\Put; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints as Assert; /** diff --git a/src/Doctrine/Orm/Tests/Fixtures/Entity/Employee.php b/src/Doctrine/Orm/Tests/Fixtures/Entity/Employee.php index d2a7d47152a..e08fdb538a6 100644 --- a/src/Doctrine/Orm/Tests/Fixtures/Entity/Employee.php +++ b/src/Doctrine/Orm/Tests/Fixtures/Entity/Employee.php @@ -18,7 +18,7 @@ use ApiPlatform\Metadata\GetCollection; use ApiPlatform\Metadata\Post; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource] #[Post] diff --git a/src/Doctrine/Orm/Tests/Fixtures/Entity/FourthLevel.php b/src/Doctrine/Orm/Tests/Fixtures/Entity/FourthLevel.php index 0e193cdc354..ed6e67c51a7 100644 --- a/src/Doctrine/Orm/Tests/Fixtures/Entity/FourthLevel.php +++ b/src/Doctrine/Orm/Tests/Fixtures/Entity/FourthLevel.php @@ -18,7 +18,7 @@ use ApiPlatform\Metadata\Link; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Fourth Level. diff --git a/src/Doctrine/Orm/Tests/Fixtures/Entity/ParentDummy.php b/src/Doctrine/Orm/Tests/Fixtures/Entity/ParentDummy.php index c8f152150ce..a229bc769c9 100644 --- a/src/Doctrine/Orm/Tests/Fixtures/Entity/ParentDummy.php +++ b/src/Doctrine/Orm/Tests/Fixtures/Entity/ParentDummy.php @@ -14,7 +14,7 @@ namespace ApiPlatform\Doctrine\Orm\Tests\Fixtures\Entity; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Parent Dummy. diff --git a/src/Doctrine/Orm/Tests/Fixtures/Entity/PropertyCollectionIriOnly.php b/src/Doctrine/Orm/Tests/Fixtures/Entity/PropertyCollectionIriOnly.php index 7aaaaa60298..ac50cb90708 100644 --- a/src/Doctrine/Orm/Tests/Fixtures/Entity/PropertyCollectionIriOnly.php +++ b/src/Doctrine/Orm/Tests/Fixtures/Entity/PropertyCollectionIriOnly.php @@ -20,7 +20,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Assert that a property being a collection set with ApiProperty::UriTemplate to true returns only the IRI of the collection. diff --git a/src/Doctrine/Orm/Tests/Fixtures/Entity/PropertyCollectionIriOnlyRelation.php b/src/Doctrine/Orm/Tests/Fixtures/Entity/PropertyCollectionIriOnlyRelation.php index 1bdd72ccbb5..0c5f07e447a 100644 --- a/src/Doctrine/Orm/Tests/Fixtures/Entity/PropertyCollectionIriOnlyRelation.php +++ b/src/Doctrine/Orm/Tests/Fixtures/Entity/PropertyCollectionIriOnlyRelation.php @@ -17,7 +17,7 @@ use ApiPlatform\Metadata\Link; use ApiPlatform\Metadata\Post; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints\NotBlank; #[ diff --git a/src/Doctrine/Orm/Tests/Fixtures/Entity/PropertyUriTemplateOneToOneRelation.php b/src/Doctrine/Orm/Tests/Fixtures/Entity/PropertyUriTemplateOneToOneRelation.php index 7307e54984c..b8255426f77 100644 --- a/src/Doctrine/Orm/Tests/Fixtures/Entity/PropertyUriTemplateOneToOneRelation.php +++ b/src/Doctrine/Orm/Tests/Fixtures/Entity/PropertyUriTemplateOneToOneRelation.php @@ -18,7 +18,7 @@ use ApiPlatform\Metadata\Link; use ApiPlatform\Metadata\Post; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints\NotBlank; #[ diff --git a/src/Doctrine/Orm/Tests/Fixtures/Entity/RelatedDummy.php b/src/Doctrine/Orm/Tests/Fixtures/Entity/RelatedDummy.php index 4cf6f92c78d..e35427b26ee 100644 --- a/src/Doctrine/Orm/Tests/Fixtures/Entity/RelatedDummy.php +++ b/src/Doctrine/Orm/Tests/Fixtures/Entity/RelatedDummy.php @@ -27,7 +27,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints as Assert; /** diff --git a/src/Doctrine/Orm/Tests/Fixtures/Entity/RelatedToDummyFriend.php b/src/Doctrine/Orm/Tests/Fixtures/Entity/RelatedToDummyFriend.php index e0482b113df..fb810987dd7 100644 --- a/src/Doctrine/Orm/Tests/Fixtures/Entity/RelatedToDummyFriend.php +++ b/src/Doctrine/Orm/Tests/Fixtures/Entity/RelatedToDummyFriend.php @@ -18,7 +18,7 @@ use ApiPlatform\Metadata\GetCollection; use ApiPlatform\Metadata\Link; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints as Assert; /** diff --git a/src/Doctrine/Orm/Tests/Fixtures/Entity/ThirdLevel.php b/src/Doctrine/Orm/Tests/Fixtures/Entity/ThirdLevel.php index e3105c71a45..9cbd04ab9aa 100644 --- a/src/Doctrine/Orm/Tests/Fixtures/Entity/ThirdLevel.php +++ b/src/Doctrine/Orm/Tests/Fixtures/Entity/ThirdLevel.php @@ -19,7 +19,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Third Level. diff --git a/src/Doctrine/Orm/Tests/config.yml b/src/Doctrine/Orm/Tests/config.yml index f89f33e7d0f..a5b5288a40c 100644 --- a/src/Doctrine/Orm/Tests/config.yml +++ b/src/Doctrine/Orm/Tests/config.yml @@ -7,11 +7,9 @@ doctrine: symfony_uuid: Symfony\Bridge\Doctrine\Types\UuidType orm: - auto_generate_proxy_classes: '%kernel.debug%' controller_resolver: enabled: false auto_mapping: false - enable_lazy_ghost_objects: true mappings: ApiPlatform\Doctrine\Orm\Tests\Fixtures\Entity: type: attribute diff --git a/src/Doctrine/Orm/composer.json b/src/Doctrine/Orm/composer.json index af62c91eaf3..5a75a390a5a 100644 --- a/src/Doctrine/Orm/composer.json +++ b/src/Doctrine/Orm/composer.json @@ -27,23 +27,23 @@ "api-platform/doctrine-common": "^4.2.0-alpha.3@alpha", "api-platform/metadata": "^4.2", "api-platform/state": "^4.2.4", - "doctrine/orm": "^2.17 || ^3.0", - "symfony/type-info": "^7.3" + "doctrine/orm": "^2.17 || ^3.0" }, "require-dev": { - "doctrine/doctrine-bundle": "^2.11", + "doctrine/doctrine-bundle": "^2.11 || ^3.1", "phpspec/prophecy-phpunit": "^2.2", "phpunit/phpunit": "11.5.x-dev", "ramsey/uuid": "^4.7", "ramsey/uuid-doctrine": "^2.0", - "symfony/cache": "^6.4 || ^7.0", - "symfony/framework-bundle": "^6.4 || ^7.0", - "symfony/property-access": "^6.4 || ^7.0", - "symfony/serializer": "^6.4 || ^7.0", - "symfony/property-info": "^6.4 || ^7.1", - "symfony/uid": "^6.4 || ^7.0", - "symfony/validator": "^6.4.11 || ^7.0", - "symfony/yaml": "^6.4 || ^7.0" + "symfony/cache": "^6.4 || ^7.0 || ^8.0", + "symfony/framework-bundle": "^6.4 || ^7.0 || ^8.0", + "symfony/property-access": "^6.4 || ^7.0 || ^8.0", + "symfony/serializer": "^6.4 || ^7.0 || ^8.0", + "symfony/property-info": "^6.4 || ^7.1 || ^8.0", + "symfony/uid": "^6.4 || ^7.0 || ^8.0", + "symfony/validator": "^6.4.11 || ^7.0 || ^8.0", + "symfony/yaml": "^6.4 || ^7.0 || ^8.0", + "symfony/type-info": "^7.3 || ^8.0" }, "autoload": { "psr-4": { @@ -67,7 +67,7 @@ "dev-4.1": "4.1.x-dev" }, "symfony": { - "require": "^6.4 || ^7.0" + "require": "^6.4 || ^7.0 || ^8.0" }, "thanks": { "name": "api-platform/api-platform", diff --git a/src/Documentation/composer.json b/src/Documentation/composer.json index 56a27291efc..01bbdc9743c 100644 --- a/src/Documentation/composer.json +++ b/src/Documentation/composer.json @@ -31,7 +31,7 @@ "dev-4.1": "4.1.x-dev" }, "symfony": { - "require": "^6.4 || ^7.0" + "require": "^6.4 || ^7.0 || ^8.0" }, "thanks": { "name": "api-platform/api-platform", diff --git a/src/Elasticsearch/Serializer/NameConverter/InnerFieldsNameConverter.php b/src/Elasticsearch/Serializer/NameConverter/InnerFieldsNameConverter.php index 248c0ad476e..dbf5b306e61 100644 --- a/src/Elasticsearch/Serializer/NameConverter/InnerFieldsNameConverter.php +++ b/src/Elasticsearch/Serializer/NameConverter/InnerFieldsNameConverter.php @@ -13,7 +13,6 @@ namespace ApiPlatform\Elasticsearch\Serializer\NameConverter; -use Symfony\Component\Serializer\NameConverter\AdvancedNameConverterInterface; use Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter; use Symfony\Component\Serializer\NameConverter\NameConverterInterface; @@ -24,7 +23,7 @@ * * @author Baptiste Meyer */ -final class InnerFieldsNameConverter implements NameConverterInterface, AdvancedNameConverterInterface +final class InnerFieldsNameConverter implements NameConverterInterface { public function __construct(private readonly NameConverterInterface $inner = new CamelCaseToSnakeCaseNameConverter()) { diff --git a/src/Elasticsearch/Tests/Fixtures/Book.php b/src/Elasticsearch/Tests/Fixtures/Book.php index 9a5352d0769..2125fe13dd9 100644 --- a/src/Elasticsearch/Tests/Fixtures/Book.php +++ b/src/Elasticsearch/Tests/Fixtures/Book.php @@ -22,7 +22,7 @@ use ApiPlatform\Metadata\ApiResource; use ApiPlatform\Metadata\Get; use ApiPlatform\Metadata\GetCollection; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource(operations: [new Get(provider: ItemProvider::class), new GetCollection(provider: CollectionProvider::class)], normalizationContext: ['groups' => ['book:read']])] #[ApiFilter(OrderFilter::class, properties: ['id', 'library.id'])] diff --git a/src/Elasticsearch/Tests/Fixtures/Library.php b/src/Elasticsearch/Tests/Fixtures/Library.php index efdd0f278f6..69ac9414b2b 100644 --- a/src/Elasticsearch/Tests/Fixtures/Library.php +++ b/src/Elasticsearch/Tests/Fixtures/Library.php @@ -17,7 +17,7 @@ use ApiPlatform\Metadata\ApiFilter; use ApiPlatform\Metadata\ApiProperty; use ApiPlatform\Metadata\ApiResource; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource(normalizationContext: ['groups' => ['library:read']])] #[ApiFilter(TermFilter::class, properties: ['id', 'gender', 'age', 'firstName', 'books.id', 'books.date'])] diff --git a/src/Elasticsearch/Tests/Fixtures/Tweet.php b/src/Elasticsearch/Tests/Fixtures/Tweet.php index 1627a806e85..1eadf4a0b2a 100644 --- a/src/Elasticsearch/Tests/Fixtures/Tweet.php +++ b/src/Elasticsearch/Tests/Fixtures/Tweet.php @@ -18,7 +18,7 @@ use ApiPlatform\Metadata\ApiFilter; use ApiPlatform\Metadata\ApiProperty; use ApiPlatform\Metadata\ApiResource; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource(normalizationContext: ['groups' => ['tweet:read']])] #[ApiFilter(OrderFilter::class, properties: ['id', 'author.id'])] diff --git a/src/Elasticsearch/Tests/Fixtures/User.php b/src/Elasticsearch/Tests/Fixtures/User.php index 9028bf71475..95708cf4e39 100644 --- a/src/Elasticsearch/Tests/Fixtures/User.php +++ b/src/Elasticsearch/Tests/Fixtures/User.php @@ -17,7 +17,7 @@ use ApiPlatform\Metadata\ApiFilter; use ApiPlatform\Metadata\ApiProperty; use ApiPlatform\Metadata\ApiResource; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource(normalizationContext: ['groups' => ['user:read']])] #[ApiFilter(TermFilter::class, properties: ['id', 'gender', 'age', 'firstName', 'tweets.id', 'tweets.date'])] diff --git a/src/Elasticsearch/Tests/Serializer/NameConverter/InnerFieldsNameConverterTest.php b/src/Elasticsearch/Tests/Serializer/NameConverter/InnerFieldsNameConverterTest.php index 261a79fd632..dd443dcefed 100644 --- a/src/Elasticsearch/Tests/Serializer/NameConverter/InnerFieldsNameConverterTest.php +++ b/src/Elasticsearch/Tests/Serializer/NameConverter/InnerFieldsNameConverterTest.php @@ -16,7 +16,7 @@ use ApiPlatform\Elasticsearch\Serializer\NameConverter\InnerFieldsNameConverter; use PHPUnit\Framework\TestCase; use Prophecy\PhpUnit\ProphecyTrait; -use Symfony\Component\Serializer\NameConverter\AdvancedNameConverterInterface; +use Symfony\Component\Serializer\NameConverter\NameConverterInterface; class InnerFieldsNameConverterTest extends TestCase { @@ -25,14 +25,14 @@ class InnerFieldsNameConverterTest extends TestCase public function testConstruct(): void { self::assertInstanceOf( - AdvancedNameConverterInterface::class, - new InnerFieldsNameConverter($this->prophesize(AdvancedNameConverterInterface::class)->reveal()) + NameConverterInterface::class, + new InnerFieldsNameConverter($this->prophesize(NameConverterInterface::class)->reveal()) ); } public function testNormalize(): void { - $innerProphecy = $this->prophesize(AdvancedNameConverterInterface::class); + $innerProphecy = $this->prophesize(NameConverterInterface::class); $innerProphecy->normalize('fooBar', null, null, [])->willReturn('foo_bar')->shouldBeCalled(); $innerProphecy->normalize('bazQux', null, null, [])->willReturn('baz_qux')->shouldBeCalled(); @@ -43,7 +43,7 @@ public function testNormalize(): void public function testDenormalize(): void { - $innerProphecy = $this->prophesize(AdvancedNameConverterInterface::class); + $innerProphecy = $this->prophesize(NameConverterInterface::class); $innerProphecy->denormalize('foo_bar', null, null, [])->willReturn('fooBar')->shouldBeCalled(); $innerProphecy->denormalize('baz_qux', null, null, [])->willReturn('bazQux')->shouldBeCalled(); diff --git a/src/Elasticsearch/composer.json b/src/Elasticsearch/composer.json index 8cb8c5a3842..b23b4dfe7fc 100644 --- a/src/Elasticsearch/composer.json +++ b/src/Elasticsearch/composer.json @@ -28,13 +28,13 @@ "api-platform/serializer": "^4.2.4", "api-platform/state": "^4.2.4", "elasticsearch/elasticsearch": "^7.17 || ^8.4", - "symfony/cache": "^6.4 || ^7.0", - "symfony/console": "^6.4 || ^7.0", - "symfony/property-access": "^6.4 || ^7.0", - "symfony/property-info": "^6.4 || ^7.1", - "symfony/serializer": "^6.4 || ^7.0", - "symfony/type-info": "^7.3", - "symfony/uid": "^6.4 || ^7.0" + "symfony/cache": "^6.4 || ^7.0 || ^8.0", + "symfony/console": "^6.4 || ^7.0 || ^8.0", + "symfony/property-access": "^6.4 || ^7.0 || ^8.0", + "symfony/property-info": "^6.4 || ^7.1 || ^8.0", + "symfony/serializer": "^6.4 || ^7.0 || ^8.0", + "symfony/type-info": "^7.3 || ^8.0", + "symfony/uid": "^6.4 || ^7.0 || ^8.0" }, "require-dev": { "phpspec/prophecy-phpunit": "^2.2", @@ -67,7 +67,7 @@ "dev-4.1": "4.1.x-dev" }, "symfony": { - "require": "^6.4 || ^7.0" + "require": "^6.4 || ^7.0 || ^8.0" }, "thanks": { "name": "api-platform/api-platform", diff --git a/src/GraphQl/Serializer/SerializerContextBuilder.php b/src/GraphQl/Serializer/SerializerContextBuilder.php index 7ceef729ad1..571f3dae9b8 100644 --- a/src/GraphQl/Serializer/SerializerContextBuilder.php +++ b/src/GraphQl/Serializer/SerializerContextBuilder.php @@ -17,8 +17,6 @@ use ApiPlatform\Metadata\GraphQl\Operation; use ApiPlatform\Metadata\GraphQl\Subscription; use GraphQL\Type\Definition\ResolveInfo; -use Symfony\Component\Serializer\NameConverter\AdvancedNameConverterInterface; -use Symfony\Component\Serializer\NameConverter\MetadataAwareNameConverter; use Symfony\Component\Serializer\NameConverter\NameConverterInterface; use Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer; @@ -112,10 +110,7 @@ private function denormalizePropertyName(string $property, ?string $resourceClas if (null === $this->nameConverter) { return $property; } - if ($this->nameConverter instanceof AdvancedNameConverterInterface || $this->nameConverter instanceof MetadataAwareNameConverter) { - return $this->nameConverter->denormalize($property, $resourceClass, null, $context); - } - return $this->nameConverter->denormalize($property); + return $this->nameConverter->denormalize($property, $resourceClass, null, $context); } } diff --git a/src/GraphQl/Tests/Serializer/SerializerContextBuilderTest.php b/src/GraphQl/Tests/Serializer/SerializerContextBuilderTest.php index d4bc15990dc..e297069cd04 100644 --- a/src/GraphQl/Tests/Serializer/SerializerContextBuilderTest.php +++ b/src/GraphQl/Tests/Serializer/SerializerContextBuilderTest.php @@ -23,7 +23,7 @@ use PHPUnit\Framework\TestCase; use Prophecy\Argument; use Prophecy\PhpUnit\ProphecyTrait; -use Symfony\Component\Serializer\NameConverter\AdvancedNameConverterInterface; +use Symfony\Component\Serializer\NameConverter\NameConverterInterface; /** * @author Alan Poulain @@ -42,7 +42,7 @@ protected function setUp(): void $this->serializerContextBuilder = $this->buildSerializerContextBuilder(); } - private function buildSerializerContextBuilder(?AdvancedNameConverterInterface $advancedNameConverter = null): SerializerContextBuilder + private function buildSerializerContextBuilder(?NameConverterInterface $advancedNameConverter = null): SerializerContextBuilder { return new SerializerContextBuilder($advancedNameConverter ?? new CustomConverter()); } @@ -112,8 +112,8 @@ public function testCreateNormalizationContext(?string $resourceClass, string $o public static function createNormalizationContextProvider(): iterable { - $advancedNameConverterFactory = function (self $that): AdvancedNameConverterInterface { - $advancedNameConverterProphecy = $that->prophesize(AdvancedNameConverterInterface::class); + $advancedNameConverterFactory = function (self $that): NameConverterInterface { + $advancedNameConverterProphecy = $that->prophesize(NameConverterInterface::class); $advancedNameConverterProphecy->denormalize('field', 'myResource', null, Argument::type('array'))->willReturn('denormalizedField'); return $advancedNameConverterProphecy->reveal(); diff --git a/src/GraphQl/Tests/Type/FieldsBuilderTest.php b/src/GraphQl/Tests/Type/FieldsBuilderTest.php index dc95924e9af..a3b1e9420ff 100644 --- a/src/GraphQl/Tests/Type/FieldsBuilderTest.php +++ b/src/GraphQl/Tests/Type/FieldsBuilderTest.php @@ -46,7 +46,7 @@ use Prophecy\PhpUnit\ProphecyTrait; use Prophecy\Prophecy\ObjectProphecy; use Psr\Container\ContainerInterface; -use Symfony\Component\Serializer\NameConverter\AdvancedNameConverterInterface; +use Symfony\Component\Serializer\NameConverter\NameConverterInterface; use Symfony\Component\TypeInfo\Type; /** @@ -84,7 +84,7 @@ protected function setUp(): void $this->fieldsBuilder = $this->buildFieldsBuilder(); } - private function buildFieldsBuilder(?AdvancedNameConverterInterface $advancedNameConverter = null): FieldsBuilder + private function buildFieldsBuilder(?NameConverterInterface $advancedNameConverter = null): FieldsBuilder { return new FieldsBuilder($this->propertyNameCollectionFactoryProphecy->reveal(), $this->propertyMetadataFactoryProphecy->reveal(), $this->resourceMetadataCollectionFactoryProphecy->reveal(), $this->resourceClassResolverProphecy->reveal(), $this->typesContainerProphecy->reveal(), $this->typeBuilderProphecy->reveal(), $this->typeConverterProphecy->reveal(), $this->itemResolverFactoryProphecy->reveal(), $this->filterLocatorProphecy->reveal(), new Pagination(), $advancedNameConverter ?? new CustomConverter(), '__'); } @@ -504,8 +504,8 @@ public function testGetResourceObjectTypeFields(string $resourceClass, Operation public static function resourceObjectTypeFieldsProvider(): iterable { - $advancedNameConverterFactory = function (self $that): AdvancedNameConverterInterface { - $advancedNameConverterProphecy = $that->prophesize(AdvancedNameConverterInterface::class); + $advancedNameConverterFactory = function (self $that): NameConverterInterface { + $advancedNameConverterProphecy = $that->prophesize(NameConverterInterface::class); $advancedNameConverterProphecy->normalize('field', \stdClass::class)->willReturn('normalizedField'); return $advancedNameConverterProphecy->reveal(); diff --git a/src/GraphQl/Tests/Type/TypeBuilderTest.php b/src/GraphQl/Tests/Type/TypeBuilderTest.php index 2c6dbe5ad3b..ddef6ba5b4e 100644 --- a/src/GraphQl/Tests/Type/TypeBuilderTest.php +++ b/src/GraphQl/Tests/Type/TypeBuilderTest.php @@ -609,27 +609,23 @@ public function testGetEnumType(): void ]), $this->typeBuilder->getEnumType($operation)); } - #[DataProvider('legacyTypesProvider')] #[IgnoreDeprecations] - public function testIsCollectionLegacy(LegacyType $type, bool $expectedIsCollection): void + public function testIsCollectionLegacy(): void { - $this->expectUserDeprecationMessage('Since api-platform/graphql 4.2: The "ApiPlatform\GraphQl\Type\TypeBuilder::isCollection()" method is deprecated and will be removed.'); - $this->assertSame($expectedIsCollection, $this->typeBuilder->isCollection($type)); - } + if (!class_exists(LegacyType::class)) { + $this->markTestSkipped(); + } - public static function legacyTypesProvider(): array - { - return [ - [new LegacyType(LegacyType::BUILTIN_TYPE_BOOL), false], - [new LegacyType(LegacyType::BUILTIN_TYPE_OBJECT), false], - [new LegacyType(LegacyType::BUILTIN_TYPE_RESOURCE, false, null, false), false], - [new LegacyType(LegacyType::BUILTIN_TYPE_OBJECT, false, null, true), false], - [new LegacyType(LegacyType::BUILTIN_TYPE_ARRAY, false, null, true), false], - [new LegacyType(LegacyType::BUILTIN_TYPE_ARRAY, false, null, true, null, new LegacyType(LegacyType::BUILTIN_TYPE_OBJECT)), false], - [new LegacyType(LegacyType::BUILTIN_TYPE_OBJECT, false, 'className', true), false], - [new LegacyType(LegacyType::BUILTIN_TYPE_OBJECT, false, null, true, null, new LegacyType(LegacyType::BUILTIN_TYPE_OBJECT, false, 'className')), true], - [new LegacyType(LegacyType::BUILTIN_TYPE_ARRAY, false, null, true, null, new LegacyType(LegacyType::BUILTIN_TYPE_OBJECT, false, 'className')), true], - ]; + $this->expectUserDeprecationMessage('Since api-platform/graphql 4.2: The "ApiPlatform\GraphQl\Type\TypeBuilder::isCollection()" method is deprecated and will be removed.'); + $this->assertFalse($this->typeBuilder->isCollection(new LegacyType(LegacyType::BUILTIN_TYPE_BOOL))); + $this->assertFalse($this->typeBuilder->isCollection(new LegacyType(LegacyType::BUILTIN_TYPE_OBJECT))); + $this->assertFalse($this->typeBuilder->isCollection(new LegacyType(LegacyType::BUILTIN_TYPE_RESOURCE, false, null, false))); + $this->assertFalse($this->typeBuilder->isCollection(new LegacyType(LegacyType::BUILTIN_TYPE_OBJECT, false, null, true))); + $this->assertFalse($this->typeBuilder->isCollection(new LegacyType(LegacyType::BUILTIN_TYPE_ARRAY, false, null, true))); + $this->assertFalse($this->typeBuilder->isCollection(new LegacyType(LegacyType::BUILTIN_TYPE_ARRAY, false, null, true, null, new LegacyType(LegacyType::BUILTIN_TYPE_OBJECT)))); + $this->assertFalse($this->typeBuilder->isCollection(new LegacyType(LegacyType::BUILTIN_TYPE_OBJECT, false, 'className', true))); + $this->assertTrue($this->typeBuilder->isCollection(new LegacyType(LegacyType::BUILTIN_TYPE_OBJECT, false, null, true, null, new LegacyType(LegacyType::BUILTIN_TYPE_OBJECT, false, 'className')))); + $this->assertTrue($this->typeBuilder->isCollection(new LegacyType(LegacyType::BUILTIN_TYPE_ARRAY, false, null, true, null, new LegacyType(LegacyType::BUILTIN_TYPE_OBJECT, false, 'className')))); } public static function typesProvider(): array diff --git a/src/GraphQl/Tests/Type/TypeConverterTest.php b/src/GraphQl/Tests/Type/TypeConverterTest.php index fe6e4c96e76..9e601c15fd0 100644 --- a/src/GraphQl/Tests/Type/TypeConverterTest.php +++ b/src/GraphQl/Tests/Type/TypeConverterTest.php @@ -64,24 +64,14 @@ protected function setUp(): void $this->typeConverter = new TypeConverter($this->typeBuilderProphecy->reveal(), $this->typesContainerProphecy->reveal(), $this->resourceMetadataCollectionFactoryProphecy->reveal(), $this->propertyMetadataFactoryProphecy->reveal()); } - #[DataProvider('legacyConvertTypeProvider')] #[IgnoreDeprecations] - public function testConvertTypeLegacy(LegacyType $type, bool $input, int $depth, GraphQLType|string|null $expectedGraphqlType): void + public function testConvertTypeLegacy(): void { - $this->expectUserDeprecationMessage('Since api-platform/graphql 4.2: The "ApiPlatform\GraphQl\Type\TypeConverter::convertType()" method is deprecated, use "ApiPlatform\GraphQl\Type\TypeConverter::convertPhpType()" instead.'); + if (!class_exists(LegacyType::class)) { + $this->markTestSkipped(); + } - $this->typeBuilderProphecy->isCollection($type)->willReturn(false); - $this->resourceMetadataCollectionFactoryProphecy->create(Argument::type('string'))->willReturn(new ResourceMetadataCollection('resourceClass')); - $this->typeBuilderProphecy->getEnumType(Argument::type(Operation::class))->willReturn($expectedGraphqlType); - - $operation = (new Query())->withName('test'); - $graphqlType = $this->typeConverter->convertType($type, $input, $operation, 'resourceClass', 'rootClass', null, $depth); - $this->assertSame($expectedGraphqlType, $graphqlType); - } - - public static function legacyConvertTypeProvider(): array - { - return [ + $testCases = [ [new LegacyType(LegacyType::BUILTIN_TYPE_BOOL), false, 0, GraphQLType::boolean()], [new LegacyType(LegacyType::BUILTIN_TYPE_INT), false, 0, GraphQLType::int()], [new LegacyType(LegacyType::BUILTIN_TYPE_FLOAT), false, 0, GraphQLType::float()], @@ -95,6 +85,22 @@ public static function legacyConvertTypeProvider(): array [new LegacyType(LegacyType::BUILTIN_TYPE_NULL), false, 0, null], [new LegacyType(LegacyType::BUILTIN_TYPE_RESOURCE), false, 0, null], ]; + + foreach ($testCases as [$type, $input, $depth, $expectedGraphqlType]) { + /* @var LegacyType $type */ + /* @var bool $input */ + /* @var int $depth */ + /* @var GraphQLType|string|null $expectedGraphqlType */ + $this->expectUserDeprecationMessage('Since api-platform/graphql 4.2: The "ApiPlatform\GraphQl\Type\TypeConverter::convertType()" method is deprecated, use "ApiPlatform\GraphQl\Type\TypeConverter::convertPhpType()" instead.'); + + $this->typeBuilderProphecy->isCollection($type)->willReturn(false); + $this->resourceMetadataCollectionFactoryProphecy->create(Argument::type('string'))->willReturn(new ResourceMetadataCollection('resourceClass')); + $this->typeBuilderProphecy->getEnumType(Argument::type(Operation::class))->willReturn($expectedGraphqlType); + + $operation = (new Query())->withName('test'); + $graphqlType = $this->typeConverter->convertType($type, $input, $operation, 'resourceClass', 'rootClass', null, $depth); + $this->assertSame($expectedGraphqlType, $graphqlType); + } } #[DataProvider('convertTypeProvider')] @@ -129,6 +135,10 @@ public static function convertTypeProvider(): array #[IgnoreDeprecations] public function testConvertTypeNoGraphQlResourceMetadataLegacy(): void { + if (!class_exists(LegacyType::class)) { + $this->markTestSkipped(); + } + $type = new LegacyType(LegacyType::BUILTIN_TYPE_OBJECT, false, 'dummy'); $this->typeBuilderProphecy->isCollection($type)->shouldBeCalled()->willReturn(false); @@ -153,6 +163,9 @@ public function testConvertTypeNoGraphQlResourceMetadata(): void #[IgnoreDeprecations] public function testConvertTypeNodeResourceLegacy(): void { + if (!class_exists(LegacyType::class)) { + $this->markTestSkipped(); + } $type = new LegacyType(LegacyType::BUILTIN_TYPE_OBJECT, false, 'node'); $this->typeBuilderProphecy->isCollection($type)->shouldBeCalled()->willReturn(false); @@ -181,6 +194,9 @@ public function testConvertTypeNodeResource(): void #[IgnoreDeprecations] public function testConvertTypeResourceClassNotFoundLegacy(): void { + if (!class_exists(LegacyType::class)) { + $this->markTestSkipped(); + } $type = new LegacyType(LegacyType::BUILTIN_TYPE_OBJECT, false, 'dummy'); $this->typeBuilderProphecy->isCollection($type)->shouldBeCalled()->willReturn(false); @@ -205,6 +221,9 @@ public function testConvertTypeResourceClassNotFound(): void #[IgnoreDeprecations] public function testConvertTypeResourceIriLegacy(): void { + if (!class_exists(LegacyType::class)) { + $this->markTestSkipped(); + } $type = new LegacyType(LegacyType::BUILTIN_TYPE_OBJECT, false, 'dummy'); $graphqlResourceMetadata = new ResourceMetadataCollection('dummy', [(new ApiResource())->withGraphQlOperations(['test' => new Query()])]); @@ -233,6 +252,9 @@ public function testConvertTypeResourceIri(): void #[IgnoreDeprecations] public function testConvertTypeInputResourceLegacy(): void { + if (!class_exists(LegacyType::class)) { + $this->markTestSkipped(); + } $type = new LegacyType(LegacyType::BUILTIN_TYPE_OBJECT, false, 'dummy'); $operation = new Query(); $propertyMetadata = (new ApiProperty())->withWritableLink(true); @@ -264,34 +286,35 @@ public function testConvertTypeInputResource(): void $this->assertSame($expectedGraphqlType, $graphqlType); } - #[DataProvider('legacyConvertTypeResourceProvider')] #[IgnoreDeprecations] - public function testConvertTypeCollectionResourceLegacy(LegacyType $type, ObjectType $expectedGraphqlType): void + public function testConvertTypeCollectionResourceLegacy(): void { - $collectionOperation = new QueryCollection(); - $graphqlResourceMetadata = new ResourceMetadataCollection('dummyValue', [ - (new ApiResource())->withShortName('DummyValue')->withGraphQlOperations(['collection_query' => $collectionOperation]), - ]); - - $this->typeBuilderProphecy->isCollection($type)->shouldBeCalled()->willReturn(true); - $this->resourceMetadataCollectionFactoryProphecy->create('dummyValue')->shouldBeCalled()->willReturn($graphqlResourceMetadata); - $this->typeBuilderProphecy->getResourceObjectType($graphqlResourceMetadata, $collectionOperation, null, [ - 'input' => false, - 'wrapped' => false, - 'depth' => 0, - ])->shouldBeCalled()->willReturn($expectedGraphqlType); - - $rootOperation = (new Query())->withName('test'); - $graphqlType = $this->typeConverter->convertType($type, false, $rootOperation, 'resourceClass', 'rootClass', null, 0); - $this->assertSame($expectedGraphqlType, $graphqlType); - } - - public static function legacyConvertTypeResourceProvider(): array - { - return [ + if (!class_exists(LegacyType::class)) { + $this->markTestSkipped(); + } + $fixtures = [ [new LegacyType(LegacyType::BUILTIN_TYPE_OBJECT, false, null, true, null, new LegacyType(LegacyType::BUILTIN_TYPE_OBJECT, false, 'dummyValue')), new ObjectType(['name' => 'resourceObjectType', 'fields' => []])], [new LegacyType(LegacyType::BUILTIN_TYPE_ARRAY, false, null, true, null, new LegacyType(LegacyType::BUILTIN_TYPE_OBJECT, false, 'dummyValue')), new ObjectType(['name' => 'resourceObjectType', 'fields' => []])], ]; + + foreach ($fixtures as [$type, $expectedGraphqlType]) { + $collectionOperation = new QueryCollection(); + $graphqlResourceMetadata = new ResourceMetadataCollection('dummyValue', [ + (new ApiResource())->withShortName('DummyValue')->withGraphQlOperations(['collection_query' => $collectionOperation]), + ]); + + $this->typeBuilderProphecy->isCollection($type)->shouldBeCalled()->willReturn(true); + $this->resourceMetadataCollectionFactoryProphecy->create('dummyValue')->shouldBeCalled()->willReturn($graphqlResourceMetadata); + $this->typeBuilderProphecy->getResourceObjectType($graphqlResourceMetadata, $collectionOperation, null, [ + 'input' => false, + 'wrapped' => false, + 'depth' => 0, + ])->shouldBeCalled()->willReturn($expectedGraphqlType); + + $rootOperation = (new Query())->withName('test'); + $graphqlType = $this->typeConverter->convertType($type, false, $rootOperation, 'resourceClass', 'rootClass', null, 0); + $this->assertSame($expectedGraphqlType, $graphqlType); + } } #[DataProvider('convertTypeResourceProvider')] @@ -325,6 +348,9 @@ public static function convertTypeResourceProvider(): array #[IgnoreDeprecations] public function testConvertTypeCollectionEnumLegacy(): void { + if (!class_exists(LegacyType::class)) { + $this->markTestSkipped(); + } $type = new LegacyType(LegacyType::BUILTIN_TYPE_ARRAY, false, null, true, null, new LegacyType(LegacyType::BUILTIN_TYPE_OBJECT, false, GenderTypeEnum::class)); $expectedGraphqlType = new EnumType(['name' => 'GenderTypeEnum', 'values' => []]); $this->typeBuilderProphecy->isCollection($type)->shouldBeCalled()->willReturn(true); diff --git a/src/GraphQl/Type/FieldsBuilder.php b/src/GraphQl/Type/FieldsBuilder.php index cc8d2648a70..84da1ce9765 100644 --- a/src/GraphQl/Type/FieldsBuilder.php +++ b/src/GraphQl/Type/FieldsBuilder.php @@ -41,8 +41,6 @@ use Psr\Container\ContainerInterface; use Symfony\Component\PropertyInfo\PropertyInfoExtractor; use Symfony\Component\PropertyInfo\Type as LegacyType; -use Symfony\Component\Serializer\NameConverter\AdvancedNameConverterInterface; -use Symfony\Component\Serializer\NameConverter\MetadataAwareNameConverter; use Symfony\Component\Serializer\NameConverter\NameConverterInterface; use Symfony\Component\TypeInfo\Type; use Symfony\Component\TypeInfo\Type\CollectionType; @@ -741,10 +739,7 @@ private function normalizePropertyName(string $property, string $resourceClass): if (null === $this->nameConverter) { return $property; } - if ($this->nameConverter instanceof AdvancedNameConverterInterface || $this->nameConverter instanceof MetadataAwareNameConverter) { - return $this->nameConverter->normalize($property, $resourceClass); - } - return $this->nameConverter->normalize($property); + return $this->nameConverter->normalize($property, $resourceClass); } } diff --git a/src/GraphQl/composer.json b/src/GraphQl/composer.json index 6c36bc379ae..5f9c3c0d6fc 100644 --- a/src/GraphQl/composer.json +++ b/src/GraphQl/composer.json @@ -24,9 +24,9 @@ "api-platform/metadata": "^4.2", "api-platform/state": "^4.2.4", "api-platform/serializer": "^4.2.4", - "symfony/property-info": "^7.1", - "symfony/serializer": "^6.4 || ^7.1", - "symfony/type-info": "^7.3", + "symfony/property-info": "^7.1 || ^8.0", + "symfony/serializer": "^6.4 || ^7.1 || ^8.0", + "symfony/type-info": "^7.3 || ^8.0", "webonyx/graphql-php": "^15.0", "willdurand/negotiation": "^3.1" }, @@ -35,7 +35,7 @@ "api-platform/validator": "^4.2.4", "twig/twig": "^1.42.3 || ^2.12 || ^3.0", "symfony/mercure-bundle": "*", - "symfony/routing": "^6.4 || ^7.0", + "symfony/routing": "^6.4 || ^7.0 || ^8.0", "phpunit/phpunit": "11.5.x-dev" }, "autoload": { @@ -70,7 +70,7 @@ "dev-4.1": "4.1.x-dev" }, "symfony": { - "require": "^6.4 || ^7.0" + "require": "^6.4 || ^7.0 || ^8.0" }, "thanks": { "name": "api-platform/api-platform", diff --git a/src/Hal/Tests/Fixtures/MaxDepthDummy.php b/src/Hal/Tests/Fixtures/MaxDepthDummy.php index bc7ebb68b8e..a9240017d23 100644 --- a/src/Hal/Tests/Fixtures/MaxDepthDummy.php +++ b/src/Hal/Tests/Fixtures/MaxDepthDummy.php @@ -15,8 +15,8 @@ use ApiPlatform\Metadata\ApiProperty; use ApiPlatform\Metadata\ApiResource; -use Symfony\Component\Serializer\Annotation\Groups; -use Symfony\Component\Serializer\Annotation\MaxDepth; +use Symfony\Component\Serializer\Attribute\Groups; +use Symfony\Component\Serializer\Attribute\MaxDepth; /** * @author Brian Fox diff --git a/src/Hal/composer.json b/src/Hal/composer.json index f8584e77b4b..9f0c12a526d 100644 --- a/src/Hal/composer.json +++ b/src/Hal/composer.json @@ -26,7 +26,7 @@ "api-platform/metadata": "^4.2", "api-platform/documentation": "^4.2", "api-platform/serializer": "^4.2.4", - "symfony/type-info": "^7.3" + "symfony/type-info": "^7.3 || ^8.0" }, "autoload": { "psr-4": { @@ -54,7 +54,7 @@ "dev-4.1": "4.1.x-dev" }, "symfony": { - "require": "^6.4 || ^7.0" + "require": "^6.4 || ^7.0 || ^8.0" }, "thanks": { "name": "api-platform/api-platform", diff --git a/src/HttpCache/composer.json b/src/HttpCache/composer.json index 7194c2886c8..9ab73411415 100644 --- a/src/HttpCache/composer.json +++ b/src/HttpCache/composer.json @@ -25,14 +25,14 @@ "php": ">=8.2", "api-platform/metadata": "^4.2", "api-platform/state": "^4.2.4", - "symfony/http-foundation": "^6.4.14 || ^7.0" + "symfony/http-foundation": "^6.4.14 || ^7.0 || ^8.0" }, "require-dev": { - "guzzlehttp/guzzle": "^6.0 || ^7.0", - "symfony/dependency-injection": "^6.4 || ^7.0", + "guzzlehttp/guzzle": "^6.0 || ^7.0 || ^8.0", + "symfony/dependency-injection": "^6.4 || ^7.0 || ^8.0", "phpspec/prophecy-phpunit": "^2.2", - "symfony/http-client": "^6.4 || ^7.0", - "symfony/type-info": "^7.3", + "symfony/http-client": "^6.4 || ^7.0 || ^8.0", + "symfony/type-info": "^7.3 || ^8.0", "phpunit/phpunit": "11.5.x-dev" }, "autoload": { @@ -61,7 +61,7 @@ "dev-4.1": "4.1.x-dev" }, "symfony": { - "require": "^6.4 || ^7.0" + "require": "^6.4 || ^7.0 || ^8.0" }, "thanks": { "name": "api-platform/api-platform", diff --git a/src/Hydra/IriTemplate.php b/src/Hydra/IriTemplate.php index 78cb9782cc8..1dd368b5efd 100644 --- a/src/Hydra/IriTemplate.php +++ b/src/Hydra/IriTemplate.php @@ -14,7 +14,7 @@ namespace ApiPlatform\Hydra; use Symfony\Component\JsonStreamer\Attribute\StreamedName; -use Symfony\Component\Serializer\Annotation\SerializedName; +use Symfony\Component\Serializer\Attribute\SerializedName; final class IriTemplate { diff --git a/src/Hydra/IriTemplateMapping.php b/src/Hydra/IriTemplateMapping.php index 9cbb7502752..3994f40ad19 100644 --- a/src/Hydra/IriTemplateMapping.php +++ b/src/Hydra/IriTemplateMapping.php @@ -14,7 +14,7 @@ namespace ApiPlatform\Hydra; use Symfony\Component\JsonStreamer\Attribute\StreamedName; -use Symfony\Component\Serializer\Annotation\SerializedName; +use Symfony\Component\Serializer\Attribute\SerializedName; class IriTemplateMapping { diff --git a/src/Hydra/Serializer/HydraPrefixNameConverter.php b/src/Hydra/Serializer/HydraPrefixNameConverter.php index 370255bde89..6f373b0251f 100644 --- a/src/Hydra/Serializer/HydraPrefixNameConverter.php +++ b/src/Hydra/Serializer/HydraPrefixNameConverter.php @@ -14,10 +14,9 @@ namespace ApiPlatform\Hydra\Serializer; use ApiPlatform\JsonLd\ContextBuilder; -use Symfony\Component\Serializer\NameConverter\AdvancedNameConverterInterface; use Symfony\Component\Serializer\NameConverter\NameConverterInterface; -final readonly class HydraPrefixNameConverter implements NameConverterInterface, AdvancedNameConverterInterface +final readonly class HydraPrefixNameConverter implements NameConverterInterface { /** * @param array $defaultContext diff --git a/src/Hydra/State/JsonStreamerProvider.php b/src/Hydra/State/JsonStreamerProvider.php index 8e4e143baa9..696d8c1edbe 100644 --- a/src/Hydra/State/JsonStreamerProvider.php +++ b/src/Hydra/State/JsonStreamerProvider.php @@ -42,6 +42,13 @@ public function provide(Operation $operation, array $uriVariables = [], array $c $data = $this->jsonStreamReader->read($request->getContent(true), Type::object($operation->getClass())); $context['request']->attributes->set('deserialized', true); + if (\PHP_VERSION_ID > 80400) { + $refl = new \ReflectionClass($data); + if ($refl->isUninitializedLazyObject($data)) { + $refl->initializeLazyObject($data); + } + } + return $data; } } diff --git a/src/Hydra/Tests/Fixtures/NotAResource.php b/src/Hydra/Tests/Fixtures/NotAResource.php index 4906cf53fb1..bb60a9bea67 100644 --- a/src/Hydra/Tests/Fixtures/NotAResource.php +++ b/src/Hydra/Tests/Fixtures/NotAResource.php @@ -13,7 +13,7 @@ namespace ApiPlatform\Hydra\Tests\Fixtures; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * This class is not mapped as an API resource. diff --git a/src/Hydra/Tests/Serializer/ConstraintViolationNormalizerTest.php b/src/Hydra/Tests/Serializer/ConstraintViolationNormalizerTest.php index 96f1532f898..53a0d54ff0a 100644 --- a/src/Hydra/Tests/Serializer/ConstraintViolationNormalizerTest.php +++ b/src/Hydra/Tests/Serializer/ConstraintViolationNormalizerTest.php @@ -17,7 +17,6 @@ use PHPUnit\Framework\TestCase; use Prophecy\Argument; use Prophecy\PhpUnit\ProphecyTrait; -use Symfony\Component\Serializer\NameConverter\AdvancedNameConverterInterface; use Symfony\Component\Serializer\NameConverter\NameConverterInterface; use Symfony\Component\Validator\Constraints\NotNull; use Symfony\Component\Validator\ConstraintViolation; @@ -89,16 +88,9 @@ public static function nameConverterAndPayloadFieldsProvider(): iterable ], ]; - $advancedNameConverterFactory = function (self $that) { - $advancedNameConverterProphecy = $that->prophesize(AdvancedNameConverterInterface::class); - $advancedNameConverterProphecy->normalize(Argument::type('string'), null, Argument::type('string'))->will(fn ($args): string => '_'.$args[0]); - - return $advancedNameConverterProphecy->reveal(); - }; - $nameConverterFactory = function (self $that) { $nameConverterProphecy = $that->prophesize(NameConverterInterface::class); - $nameConverterProphecy->normalize(Argument::type('string'))->will(fn ($args): string => '_'.$args[0]); + $nameConverterProphecy->normalize(Argument::cetera())->will(fn ($args): string => '_'.$args[0]); return $nameConverterProphecy->reveal(); }; @@ -107,7 +99,6 @@ public static function nameConverterAndPayloadFieldsProvider(): iterable $expected = $nameConverterBasedExpectation; $expected[0]['payload'] = ['severity' => 'warning']; - yield [$advancedNameConverterFactory, ['severity', 'anotherField1'], $expected]; yield [$nameConverterFactory, ['severity', 'anotherField1'], $expected]; $expected = $basicExpectation; $expected[0]['payload'] = ['severity' => 'warning']; @@ -115,13 +106,11 @@ public static function nameConverterAndPayloadFieldsProvider(): iterable $expected = $nameConverterBasedExpectation; $expected[0]['payload'] = ['severity' => 'warning', 'anotherField2' => 'aValue']; - yield [$advancedNameConverterFactory, null, $expected]; yield [$nameConverterFactory, null, $expected]; $expected = $basicExpectation; $expected[0]['payload'] = ['severity' => 'warning', 'anotherField2' => 'aValue']; yield [$nullNameConverterFactory, null, $expected]; - yield [$advancedNameConverterFactory, [], $nameConverterBasedExpectation]; yield [$nameConverterFactory, [], $nameConverterBasedExpectation]; yield [$nullNameConverterFactory, [], $basicExpectation]; } diff --git a/src/Hydra/composer.json b/src/Hydra/composer.json index 9762845eb58..0e2614722c2 100644 --- a/src/Hydra/composer.json +++ b/src/Hydra/composer.json @@ -31,8 +31,8 @@ "api-platform/jsonld": "^4.2", "api-platform/json-schema": "^4.2", "api-platform/serializer": "^4.2.4", - "symfony/web-link": "^6.4 || ^7.1", - "symfony/type-info": "^7.3" + "symfony/web-link": "^6.4 || ^7.1 || ^8.0", + "symfony/type-info": "^7.3 || ^8.0" }, "require-dev": { "api-platform/doctrine-odm": "^4.2", @@ -68,7 +68,7 @@ "dev-4.1": "4.1.x-dev" }, "symfony": { - "require": "^6.4 || ^7.0" + "require": "^6.4 || ^7.0 || ^8.0" }, "thanks": { "name": "api-platform/api-platform", diff --git a/src/JsonApi/Serializer/ReservedAttributeNameConverter.php b/src/JsonApi/Serializer/ReservedAttributeNameConverter.php index f00977d7928..f0537c035e1 100644 --- a/src/JsonApi/Serializer/ReservedAttributeNameConverter.php +++ b/src/JsonApi/Serializer/ReservedAttributeNameConverter.php @@ -14,7 +14,6 @@ namespace ApiPlatform\JsonApi\Serializer; use ApiPlatform\Metadata\Exception\ProblemExceptionInterface; -use Symfony\Component\Serializer\NameConverter\AdvancedNameConverterInterface; use Symfony\Component\Serializer\NameConverter\NameConverterInterface; /** @@ -22,7 +21,7 @@ * * @author Baptiste Meyer */ -final class ReservedAttributeNameConverter implements NameConverterInterface, AdvancedNameConverterInterface +final class ReservedAttributeNameConverter implements NameConverterInterface { public const JSON_API_RESERVED_ATTRIBUTES = [ 'id' => '_id', diff --git a/src/JsonApi/Tests/Fixtures/RelatedDummy.php b/src/JsonApi/Tests/Fixtures/RelatedDummy.php index befb25d37c4..b0518a357c6 100644 --- a/src/JsonApi/Tests/Fixtures/RelatedDummy.php +++ b/src/JsonApi/Tests/Fixtures/RelatedDummy.php @@ -15,7 +15,7 @@ use ApiPlatform\Metadata\ApiProperty; use ApiPlatform\Metadata\ApiResource; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Related Dummy. diff --git a/src/JsonApi/composer.json b/src/JsonApi/composer.json index 50de99dd3a9..1e4190928c3 100644 --- a/src/JsonApi/composer.json +++ b/src/JsonApi/composer.json @@ -27,15 +27,15 @@ "api-platform/metadata": "^4.2", "api-platform/serializer": "^4.2.4", "api-platform/state": "^4.2.4", - "symfony/error-handler": "^6.4 || ^7.0", - "symfony/http-foundation": "^6.4.14 || ^7.0", - "symfony/type-info": "^7.3" + "symfony/error-handler": "^6.4 || ^7.0 || ^8.0", + "symfony/http-foundation": "^6.4.14 || ^7.0 || ^8.0", + "symfony/type-info": "^7.3 || ^8.0" }, "require-dev": { "phpspec/prophecy": "^1.19", "phpspec/prophecy-phpunit": "^2.2", "phpunit/phpunit": "11.5.x-dev", - "symfony/type-info": "^7.3" + "symfony/type-info": "^7.3 || ^8.0" }, "autoload": { "psr-4": { @@ -63,7 +63,7 @@ "dev-4.1": "4.1.x-dev" }, "symfony": { - "require": "^6.4 || ^7.0" + "require": "^6.4 || ^7.0 || ^8.0" }, "thanks": { "name": "api-platform/api-platform", diff --git a/src/JsonLd/composer.json b/src/JsonLd/composer.json index 55dfe896e64..a943fc85f06 100644 --- a/src/JsonLd/composer.json +++ b/src/JsonLd/composer.json @@ -57,7 +57,7 @@ "dev-4.1": "4.1.x-dev" }, "symfony": { - "require": "^6.4 || ^7.0" + "require": "^6.4 || ^7.0 || ^8.0" }, "thanks": { "name": "api-platform/api-platform", @@ -68,7 +68,7 @@ "test": "./vendor/bin/phpunit" }, "require-dev": { - "symfony/type-info": "^7.3", + "symfony/type-info": "^7.3 || ^8.0", "phpunit/phpunit": "11.5.x-dev" }, "repositories": [ diff --git a/src/JsonSchema/Tests/Fixtures/ApiResource/OverriddenOperationDummy.php b/src/JsonSchema/Tests/Fixtures/ApiResource/OverriddenOperationDummy.php index a5f1a39f808..9285dcc75fc 100644 --- a/src/JsonSchema/Tests/Fixtures/ApiResource/OverriddenOperationDummy.php +++ b/src/JsonSchema/Tests/Fixtures/ApiResource/OverriddenOperationDummy.php @@ -20,7 +20,7 @@ use ApiPlatform\Metadata\GetCollection; use ApiPlatform\Metadata\Post; use ApiPlatform\Metadata\Put; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints as Assert; /** diff --git a/src/JsonSchema/Tests/Metadata/Property/Factory/SchemaPropertyMetadataFactoryTest.php b/src/JsonSchema/Tests/Metadata/Property/Factory/SchemaPropertyMetadataFactoryTest.php index 70b5f81b6b9..17952f59609 100644 --- a/src/JsonSchema/Tests/Metadata/Property/Factory/SchemaPropertyMetadataFactoryTest.php +++ b/src/JsonSchema/Tests/Metadata/Property/Factory/SchemaPropertyMetadataFactoryTest.php @@ -32,6 +32,9 @@ class SchemaPropertyMetadataFactoryTest extends TestCase #[IgnoreDeprecations] public function testEnumLegacy(): void { + if (!class_exists(LegacyType::class)) { + $this->markTestSkipped(); + } $this->expectUserDeprecationMessage('Since api_platform/metadata 4.2: The "builtinTypes" argument of "ApiPlatform\Metadata\ApiProperty" is deprecated, use "nativeType" instead.'); $resourceClassResolver = $this->createMock(ResourceClassResolverInterface::class); $apiProperty = new ApiProperty(builtinTypes: [new LegacyType(builtinType: 'object', nullable: true, class: IntEnumAsIdentifier::class)]); @@ -56,6 +59,9 @@ public function testEnum(): void #[IgnoreDeprecations] public function testWithCustomOpenApiContextLegacy(): void { + if (!class_exists(LegacyType::class)) { + $this->markTestSkipped(); + } $this->expectUserDeprecationMessage('Since api_platform/metadata 4.2: The "builtinTypes" argument of "ApiPlatform\Metadata\ApiProperty" is deprecated, use "nativeType" instead.'); $resourceClassResolver = $this->createMock(ResourceClassResolverInterface::class); $apiProperty = new ApiProperty( @@ -86,6 +92,9 @@ public function testWithCustomOpenApiContext(): void #[IgnoreDeprecations] public function testWithCustomOpenApiContextWithoutTypeDefinitionLegacy(): void { + if (!class_exists(LegacyType::class)) { + $this->markTestSkipped(); + } $this->expectUserDeprecationMessage('Since api_platform/metadata 4.2: The "builtinTypes" argument of "ApiPlatform\Metadata\ApiProperty" is deprecated, use "nativeType" instead.'); $resourceClassResolver = $this->createMock(ResourceClassResolverInterface::class); $apiProperty = new ApiProperty( diff --git a/src/JsonSchema/Tests/SchemaFactoryTest.php b/src/JsonSchema/Tests/SchemaFactoryTest.php index b75107a57ea..78b8b4e6045 100644 --- a/src/JsonSchema/Tests/SchemaFactoryTest.php +++ b/src/JsonSchema/Tests/SchemaFactoryTest.php @@ -48,6 +48,9 @@ class SchemaFactoryTest extends TestCase #[IgnoreDeprecations] public function testBuildSchemaForNonResourceClassLegacy(): void { + if (!class_exists(LegacyType::class)) { + $this->markTestSkipped(); + } $this->expectUserDeprecationMessage('Since api-platform/metadata 4.2: The "ApiPlatform\Metadata\ApiProperty::withBuiltinTypes()" method is deprecated, use "ApiPlatform\Metadata\ApiProperty::withNativeType()" instead.'); $resourceMetadataFactoryProphecy = $this->prophesize(ResourceMetadataCollectionFactoryInterface::class); @@ -227,6 +230,9 @@ public function testBuildSchemaForNonResourceClass(): void #[IgnoreDeprecations] public function testBuildSchemaForNonResourceClassWithUnionIntersectTypesLegacy(): void { + if (!class_exists(LegacyType::class)) { + $this->markTestSkipped(); + } $this->expectUserDeprecationMessage('Since api-platform/metadata 4.2: The "ApiPlatform\Metadata\ApiProperty::withBuiltinTypes()" method is deprecated, use "ApiPlatform\Metadata\ApiProperty::withNativeType()" instead.'); $resourceMetadataFactoryProphecy = $this->prophesize(ResourceMetadataCollectionFactoryInterface::class); @@ -368,6 +374,9 @@ public function testBuildSchemaForNonResourceClassWithUnionIntersectTypes(): voi #[IgnoreDeprecations] public function testBuildSchemaWithSerializerGroupsLegacy(): void { + if (!class_exists(LegacyType::class)) { + $this->markTestSkipped(); + } $this->expectUserDeprecationMessage('Since api-platform/metadata 4.2: The "ApiPlatform\Metadata\ApiProperty::withBuiltinTypes()" method is deprecated, use "ApiPlatform\Metadata\ApiProperty::withNativeType()" instead.'); $shortName = (new \ReflectionClass(OverriddenOperationDummy::class))->getShortName(); $resourceMetadataFactoryProphecy = $this->prophesize(ResourceMetadataCollectionFactoryInterface::class); @@ -525,6 +534,9 @@ public function testBuildSchemaWithSerializerGroups(): void #[IgnoreDeprecations] public function testBuildSchemaForAssociativeArrayLegacy(): void { + if (!class_exists(LegacyType::class)) { + $this->markTestSkipped(); + } $this->expectUserDeprecationMessage('Since api-platform/metadata 4.2: The "ApiPlatform\Metadata\ApiProperty::withBuiltinTypes()" method is deprecated, use "ApiPlatform\Metadata\ApiProperty::withNativeType()" instead.'); $resourceMetadataFactoryProphecy = $this->prophesize(ResourceMetadataCollectionFactoryInterface::class); diff --git a/src/JsonSchema/composer.json b/src/JsonSchema/composer.json index 948c64ddeb8..3e629bd3295 100644 --- a/src/JsonSchema/composer.json +++ b/src/JsonSchema/composer.json @@ -26,11 +26,11 @@ "require": { "php": ">=8.2", "api-platform/metadata": "^4.2", - "symfony/console": "^6.4 || ^7.0", - "symfony/property-info": "^6.4 || ^7.1", - "symfony/serializer": "^6.4 || ^7.0", - "symfony/type-info": "^7.3", - "symfony/uid": "^6.4 || ^7.0" + "symfony/console": "^6.4 || ^7.0 || ^8.0", + "symfony/property-info": "^6.4 || ^7.1 || ^8.0", + "symfony/serializer": "^6.4 || ^7.0 || ^8.0", + "symfony/type-info": "^7.3 || ^8.0", + "symfony/uid": "^6.4 || ^7.0 || ^8.0" }, "require-dev": { "phpspec/prophecy-phpunit": "^2.2", @@ -62,7 +62,7 @@ "dev-4.1": "4.1.x-dev" }, "symfony": { - "require": "^6.4 || ^7.0" + "require": "^6.4 || ^7.0 || ^8.0" }, "thanks": { "name": "api-platform/api-platform", diff --git a/src/Laravel/ApiResource/Error.php b/src/Laravel/ApiResource/Error.php index e013746f8fc..771dbdb8d60 100644 --- a/src/Laravel/ApiResource/Error.php +++ b/src/Laravel/ApiResource/Error.php @@ -22,9 +22,9 @@ use ApiPlatform\Metadata\Exception\ProblemExceptionInterface; use ApiPlatform\State\ErrorProvider; use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface as SymfonyHttpExceptionInterface; -use Symfony\Component\Serializer\Annotation\Groups; -use Symfony\Component\Serializer\Annotation\Ignore; -use Symfony\Component\Serializer\Annotation\SerializedName; +use Symfony\Component\Serializer\Attribute\Groups; +use Symfony\Component\Serializer\Attribute\Ignore; +use Symfony\Component\Serializer\Attribute\SerializedName; use Symfony\Component\WebLink\Link; #[ErrorResource( diff --git a/src/Laravel/ApiResource/ValidationError.php b/src/Laravel/ApiResource/ValidationError.php index aa2117f49ab..47a3d269495 100644 --- a/src/Laravel/ApiResource/ValidationError.php +++ b/src/Laravel/ApiResource/ValidationError.php @@ -20,8 +20,8 @@ use ApiPlatform\Metadata\Exception\ProblemExceptionInterface; use ApiPlatform\Metadata\Exception\RuntimeException; use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface as SymfonyHttpExceptionInterface; -use Symfony\Component\Serializer\Annotation\Groups; -use Symfony\Component\Serializer\Annotation\SerializedName; +use Symfony\Component\Serializer\Attribute\Groups; +use Symfony\Component\Serializer\Attribute\SerializedName; use Symfony\Component\WebLink\Link; /** diff --git a/src/Laravel/Eloquent/Serializer/EloquentNameConverter.php b/src/Laravel/Eloquent/Serializer/EloquentNameConverter.php index 67fd8aa7749..c0c0e47064f 100644 --- a/src/Laravel/Eloquent/Serializer/EloquentNameConverter.php +++ b/src/Laravel/Eloquent/Serializer/EloquentNameConverter.php @@ -28,9 +28,9 @@ public function __construct(private readonly NameConverterInterface $nameConvert public function normalize(string $propertyName, ?string $class = null, ?string $format = null, array $context = []): string { try { - return $this->nameConverter->normalize($propertyName, $class, $format, $context); // @phpstan-ignore-line + return $this->nameConverter->normalize($propertyName, $class, $format, $context); } catch (UnexpectedPropertyException $e) { - return $this->nameConverter->denormalize($propertyName, $class, $format, $context); // @phpstan-ignore-line + return $this->nameConverter->denormalize($propertyName, $class, $format, $context); } } @@ -40,9 +40,9 @@ public function normalize(string $propertyName, ?string $class = null, ?string $ public function denormalize(string $propertyName, ?string $class = null, ?string $format = null, array $context = []): string { try { - return $this->nameConverter->denormalize($propertyName, $class, $format, $context); // @phpstan-ignore-line + return $this->nameConverter->denormalize($propertyName, $class, $format, $context); } catch (UnexpectedPropertyException $e) { - return $this->nameConverter->normalize($propertyName, $class, $format, $context); // @phpstan-ignore-line + return $this->nameConverter->normalize($propertyName, $class, $format, $context); } } } diff --git a/src/Laravel/Eloquent/Serializer/Mapping/Loader/RelationMetadataLoader.php b/src/Laravel/Eloquent/Serializer/Mapping/Loader/RelationMetadataLoader.php index 53f74a0a715..30915eb424c 100644 --- a/src/Laravel/Eloquent/Serializer/Mapping/Loader/RelationMetadataLoader.php +++ b/src/Laravel/Eloquent/Serializer/Mapping/Loader/RelationMetadataLoader.php @@ -66,10 +66,10 @@ public function loadClassMetadata(ClassMetadataInterface $classMetadata): bool $attribute = $a->newInstance(); match (true) { - $attribute instanceof Groups => array_map([$attributeMetadata, 'addGroup'], $attribute->getGroups()), - $attribute instanceof MaxDepth => $attributeMetadata->setMaxDepth($attribute->getMaxDepth()), - $attribute instanceof SerializedName => $attributeMetadata->setSerializedName($attribute->getSerializedName()), - $attribute instanceof SerializedPath => $attributeMetadata->setSerializedPath($attribute->getSerializedPath()), + $attribute instanceof Groups => array_map([$attributeMetadata, 'addGroup'], $attribute->groups), + $attribute instanceof MaxDepth => $attributeMetadata->setMaxDepth($attribute->maxDepth), + $attribute instanceof SerializedName => $attributeMetadata->setSerializedName($attribute->serializedName), + $attribute instanceof SerializedPath => $attributeMetadata->setSerializedPath($attribute->serializedPath), $attribute instanceof Ignore => $attributeMetadata->setIgnore(true), $attribute instanceof Context => $this->setAttributeContextsForGroups($attribute, $attributeMetadata), default => null, @@ -82,10 +82,11 @@ public function loadClassMetadata(ClassMetadataInterface $classMetadata): bool private function setAttributeContextsForGroups(Context $annotation, AttributeMetadataInterface $attributeMetadata): void { - $context = $annotation->getContext(); - $groups = $annotation->getGroups(); - $normalizationContext = $annotation->getNormalizationContext(); - $denormalizationContext = $annotation->getDenormalizationContext(); + $context = $annotation->context; + $groups = $annotation->groups; + $normalizationContext = $annotation->normalizationContext; + $denormalizationContext = $annotation->denormalizationContext; + if ($normalizationContext || $context) { $attributeMetadata->setNormalizationContextForGroups($normalizationContext ?: $context, $groups); } diff --git a/src/Laravel/Routing/SkolemIriConverter.php b/src/Laravel/Routing/SkolemIriConverter.php index fcb67798536..51474426a41 100644 --- a/src/Laravel/Routing/SkolemIriConverter.php +++ b/src/Laravel/Routing/SkolemIriConverter.php @@ -56,7 +56,7 @@ public function getResourceFromIri(string $iri, array $context = [], ?Operation public function getIriFromResource(object|string $resource, int $referenceType = UrlGeneratorInterface::ABS_PATH, ?Operation $operation = null, array $context = []): string { $referenceType = $operation ? ($operation->getUrlGenerationStrategy() ?? $referenceType) : $referenceType; - if (($isObject = \is_object($resource)) && $this->objectHashMap->contains($resource)) { + if (($isObject = \is_object($resource)) && $this->objectHashMap->offsetExists($resource)) { return $this->router->generate('api_genid', ['id' => $this->objectHashMap[$resource]], $referenceType); } diff --git a/src/Laravel/composer.json b/src/Laravel/composer.json index bef91599d2d..d776f3b8617 100644 --- a/src/Laravel/composer.json +++ b/src/Laravel/composer.json @@ -48,8 +48,8 @@ "illuminate/support": "^11.0 || ^12.0", "laravel/framework": "^11.0 || ^12.0", "symfony/deprecation-contracts": "^3.6", - "symfony/type-info": "^7.2", - "symfony/web-link": "^6.4 || ^7.1", + "symfony/type-info": "^7.4 || ^8.0", + "symfony/web-link": "^6.4 || ^7.4 || ^8.0", "willdurand/negotiation": "^3.1" }, "require-dev": { @@ -62,7 +62,7 @@ "phpdocumentor/type-resolver": "^1.7", "phpstan/phpdoc-parser": "^1.29 || ^2.0", "phpunit/phpunit": "11.5.x-dev", - "symfony/http-client": "^7.3" + "symfony/http-client": "^7.4 || ^8.0" }, "autoload": { "psr-4": { @@ -96,7 +96,7 @@ "dev-4.1": "4.1.x-dev" }, "symfony": { - "require": "^6.4 || ^7.1" + "require": "^6.4 || ^7.4 || ^8.0" }, "thanks": { "name": "api-platform/api-platform", diff --git a/src/Laravel/workbench/app/ApiResource/Home.php b/src/Laravel/workbench/app/ApiResource/Home.php index aab095d6937..ad6c371f739 100644 --- a/src/Laravel/workbench/app/ApiResource/Home.php +++ b/src/Laravel/workbench/app/ApiResource/Home.php @@ -17,7 +17,7 @@ use ApiPlatform\Metadata\ApiResource; use ApiPlatform\Metadata\Get; use ApiPlatform\Metadata\Operation; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; use Workbench\App\Models\Order; use Workbench\Database\Factories\OrderFactory; diff --git a/src/Laravel/workbench/app/ApiResource/Issue7338Input.php b/src/Laravel/workbench/app/ApiResource/Issue7338Input.php index 8e9a013270e..db8f79d1a51 100644 --- a/src/Laravel/workbench/app/ApiResource/Issue7338Input.php +++ b/src/Laravel/workbench/app/ApiResource/Issue7338Input.php @@ -13,7 +13,7 @@ namespace Workbench\App\ApiResource; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; class Issue7338Input { diff --git a/src/Laravel/workbench/app/ApiResource/Issue7338Output.php b/src/Laravel/workbench/app/ApiResource/Issue7338Output.php index 1f5c5bee032..7535eeb710f 100644 --- a/src/Laravel/workbench/app/ApiResource/Issue7338Output.php +++ b/src/Laravel/workbench/app/ApiResource/Issue7338Output.php @@ -14,7 +14,7 @@ namespace Workbench\App\ApiResource; use ApiPlatform\Metadata\ApiProperty; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; class Issue7338Output { diff --git a/src/Laravel/workbench/app/Models/BookWithRelation.php b/src/Laravel/workbench/app/Models/BookWithRelation.php index 24e3821978f..ecac69feeca 100644 --- a/src/Laravel/workbench/app/Models/BookWithRelation.php +++ b/src/Laravel/workbench/app/Models/BookWithRelation.php @@ -19,7 +19,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource( operations: [ diff --git a/src/Metadata/ApiProperty.php b/src/Metadata/ApiProperty.php index 43f2552ab70..28c6d09870d 100644 --- a/src/Metadata/ApiProperty.php +++ b/src/Metadata/ApiProperty.php @@ -236,7 +236,7 @@ public function __construct( if ($this->builtinTypes) { trigger_deprecation('api_platform/metadata', '4.2', \sprintf('The "builtinTypes" argument of "%s" is deprecated, use "nativeType" instead.', __CLASS__)); $this->nativeType ??= PropertyInfoToTypeInfoHelper::convertLegacyTypesToType($this->builtinTypes); - } elseif ($this->nativeType) { + } elseif ($this->nativeType && class_exists(LegacyType::class)) { $this->builtinTypes = PropertyInfoToTypeInfoHelper::convertTypeToLegacyTypes($this->nativeType) ?? []; } } diff --git a/src/Metadata/Property/Factory/PropertyInfoPropertyMetadataFactory.php b/src/Metadata/Property/Factory/PropertyInfoPropertyMetadataFactory.php index 6c9f36dd35d..ba9b24b8adf 100644 --- a/src/Metadata/Property/Factory/PropertyInfoPropertyMetadataFactory.php +++ b/src/Metadata/Property/Factory/PropertyInfoPropertyMetadataFactory.php @@ -49,7 +49,7 @@ public function create(string $resourceClass, string $property, array $options = // TODO: remove in 5.x if (!method_exists(PropertyInfoExtractor::class, 'getType')) { if (!$propertyMetadata->getBuiltinTypes()) { - $types = $this->propertyInfo->getTypes($resourceClass, $property, $options) ?? []; + $types = $this->propertyInfo->getTypes($resourceClass, $property, $options) ?? []; // @phpstan-ignore-line foreach ($types as $i => $type) { // Temp fix for https://github.com/symfony/symfony/pull/52699 diff --git a/src/Metadata/Tests/Fixtures/ApiResource/DummyCar.php b/src/Metadata/Tests/Fixtures/ApiResource/DummyCar.php index 619fd479343..a132dc1adda 100644 --- a/src/Metadata/Tests/Fixtures/ApiResource/DummyCar.php +++ b/src/Metadata/Tests/Fixtures/ApiResource/DummyCar.php @@ -20,7 +20,7 @@ use ApiPlatform\Metadata\Post; use ApiPlatform\Metadata\Put; use ApiPlatform\OpenApi\Model\Operation as OpenApiOperation; -use Symfony\Component\Serializer\Annotation as Serializer; +use Symfony\Component\Serializer\Attribute as Serializer; #[ApiResource(operations: [new Get(openapi: new OpenApiOperation(tags: [])), new Put(), new Delete(), new Post(), new GetCollection()], sunset: '2050-01-01', normalizationContext: ['groups' => ['colors']])] class DummyCar diff --git a/src/Metadata/Tests/Fixtures/ApiResource/DummyIgnoreProperty.php b/src/Metadata/Tests/Fixtures/ApiResource/DummyIgnoreProperty.php index 57082f9fafd..5a0c04397b6 100644 --- a/src/Metadata/Tests/Fixtures/ApiResource/DummyIgnoreProperty.php +++ b/src/Metadata/Tests/Fixtures/ApiResource/DummyIgnoreProperty.php @@ -13,8 +13,8 @@ namespace ApiPlatform\Metadata\Tests\Fixtures\ApiResource; -use Symfony\Component\Serializer\Annotation\Groups; -use Symfony\Component\Serializer\Annotation\Ignore; +use Symfony\Component\Serializer\Attribute\Groups; +use Symfony\Component\Serializer\Attribute\Ignore; class DummyIgnoreProperty { diff --git a/src/Metadata/Tests/Fixtures/ApiResource/DummyPropertyWithDefaultValue.php b/src/Metadata/Tests/Fixtures/ApiResource/DummyPropertyWithDefaultValue.php index b3233a2cfe4..6f9e143caae 100644 --- a/src/Metadata/Tests/Fixtures/ApiResource/DummyPropertyWithDefaultValue.php +++ b/src/Metadata/Tests/Fixtures/ApiResource/DummyPropertyWithDefaultValue.php @@ -14,7 +14,7 @@ namespace ApiPlatform\Metadata\Tests\Fixtures\ApiResource; use ApiPlatform\Metadata\ApiResource; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * DummyPropertyWithDefaultValue. diff --git a/src/Metadata/Tests/Fixtures/DummyIgnoreProperty.php b/src/Metadata/Tests/Fixtures/DummyIgnoreProperty.php index 7ebae40c9b2..2f0472c6a9e 100644 --- a/src/Metadata/Tests/Fixtures/DummyIgnoreProperty.php +++ b/src/Metadata/Tests/Fixtures/DummyIgnoreProperty.php @@ -13,8 +13,8 @@ namespace ApiPlatform\Metadata\Tests\Fixtures; -use Symfony\Component\Serializer\Annotation\Groups; -use Symfony\Component\Serializer\Annotation\Ignore; +use Symfony\Component\Serializer\Attribute\Groups; +use Symfony\Component\Serializer\Attribute\Ignore; class DummyIgnoreProperty { diff --git a/src/Metadata/Tests/Util/PropertyInfoToTypeInfoHelperTest.php b/src/Metadata/Tests/Util/PropertyInfoToTypeInfoHelperTest.php index 88b9e04541a..0725ed3ad9d 100644 --- a/src/Metadata/Tests/Util/PropertyInfoToTypeInfoHelperTest.php +++ b/src/Metadata/Tests/Util/PropertyInfoToTypeInfoHelperTest.php @@ -30,79 +30,75 @@ class PropertyInfoToTypeInfoHelperTest extends TestCase { - /** - * @param list|null $legacyTypes - */ - #[\PHPUnit\Framework\Attributes\DataProvider('convertLegacyTypesToTypeDataProvider')] - public function testConvertLegacyTypesToType(?Type $type, ?array $legacyTypes): void + public function testConvertLegacyTypesToType(): void { - $this->assertEquals($type, PropertyInfoToTypeInfoHelper::convertLegacyTypesToType($legacyTypes)); - } + if (!class_exists(LegacyType::class)) { + $this->markTestSkipped(); + } - /** - * @return iterable|null}> - */ - public static function convertLegacyTypesToTypeDataProvider(): iterable - { - yield [null, null]; - yield [Type::null(), [new LegacyType('null')]]; - // yield [Type::void(), [new LegacyType('void')]]; - yield [Type::int(), [new LegacyType('int')]]; - yield [Type::object(\stdClass::class), [new LegacyType('object', false, \stdClass::class)]]; - yield [ - Type::generic(Type::object(\stdClass::class), Type::string(), Type::int()), - [new LegacyType('object', false, 'stdClass', false, [new LegacyType('string')], new LegacyType('int'))], - ]; - yield [Type::nullable(Type::int()), [new LegacyType('int', true)]]; - yield [Type::union(Type::int(), Type::string()), [new LegacyType('int'), new LegacyType('string')]]; - yield [ - Type::union(Type::int(), Type::string(), Type::null()), - [new LegacyType('int', true), new LegacyType('string', true)], + $type = Type::collection(Type::builtin(TypeIdentifier::ARRAY), Type::int(), Type::string()); // @phpstan-ignore-line + + $tests = [ + [null, null], + [Type::null(), [new LegacyType('null')]], + // [Type::void(), [new LegacyType('void')]], + [Type::int(), [new LegacyType('int')]], + [Type::object(\stdClass::class), [new LegacyType('object', false, \stdClass::class)]], + [ + Type::generic(Type::object(\stdClass::class), Type::string(), Type::int()), + [new LegacyType('object', false, 'stdClass', false, [new LegacyType('string')], new LegacyType('int'))], + ], + [Type::nullable(Type::int()), [new LegacyType('int', true)]], + [Type::union(Type::int(), Type::string()), [new LegacyType('int'), new LegacyType('string')]], + [ + Type::union(Type::int(), Type::string(), Type::null()), + [new LegacyType('int', true), new LegacyType('string', true)], + ], + [$type, [new LegacyType('array', false, null, true, [new LegacyType('string')], new LegacyType('int'))]], ]; - $type = Type::collection(Type::builtin(TypeIdentifier::ARRAY), Type::int(), Type::string()); // @phpstan-ignore-line - yield [$type, [new LegacyType('array', false, null, true, [new LegacyType('string')], new LegacyType('int'))]]; + foreach ($tests as [$expected, $legacyTypes]) { + $this->assertEquals($expected, PropertyInfoToTypeInfoHelper::convertLegacyTypesToType($legacyTypes)); + } } - /** - * @param list|null $legacyTypes - */ - #[\PHPUnit\Framework\Attributes\DataProvider('convertTypeToLegacyTypesDataProvider')] - public function testConvertTypeToLegacyTypes(?array $legacyTypes, ?Type $type): void + public function testConvertTypeToLegacyTypes(): void { - $this->assertEquals($legacyTypes, PropertyInfoToTypeInfoHelper::convertTypeToLegacyTypes($type)); - } + if (!class_exists(LegacyType::class)) { + $this->markTestSkipped(); + } - /** - * @return iterable|null, 1: ?Type, 2?: bool}> - */ - public static function convertTypeToLegacyTypesDataProvider(): iterable - { - yield [null, null]; - yield [null, Type::mixed()]; - yield [null, Type::never()]; - yield [[new LegacyType('null')], Type::null()]; - yield [[new LegacyType('null')], Type::void()]; - yield [[new LegacyType('int')], Type::int()]; - yield [[new LegacyType('object', false, \stdClass::class)], Type::object(\stdClass::class)]; - yield [ - [new LegacyType('object', false, \Traversable::class, true, null, new LegacyType('int'))], - Type::generic(Type::object(\Traversable::class), Type::int()), - ]; - yield [ - [new LegacyType('array', false, null, true, new LegacyType('int'), new LegacyType('string'))], - Type::generic(Type::builtin(TypeIdentifier::ARRAY), Type::int(), Type::string()), // @phpstan-ignore-line + $tests = [ + [null, null], + [null, Type::mixed()], + [null, Type::never()], + [[new LegacyType('null')], Type::null()], + [[new LegacyType('null')], Type::void()], + [[new LegacyType('int')], Type::int()], + [[new LegacyType('object', false, \stdClass::class)], Type::object(\stdClass::class)], + [ + [new LegacyType('object', false, \Traversable::class, true, null, new LegacyType('int'))], + Type::generic(Type::object(\Traversable::class), Type::int()), + ], + [ + [new LegacyType('array', false, null, true, new LegacyType('int'), new LegacyType('string'))], + Type::generic(Type::builtin(TypeIdentifier::ARRAY), Type::int(), Type::string()), // @phpstan-ignore-line + ], + [ + [new LegacyType('array', false, null, true, new LegacyType('int'), new LegacyType('string'))], + Type::collection(Type::builtin(TypeIdentifier::ARRAY), Type::string(), Type::int()), // @phpstan-ignore-line + ], + [[new LegacyType('int', true)], Type::nullable(Type::int())], + [[new LegacyType('int'), new LegacyType('string')], Type::union(Type::int(), Type::string())], + [ + [new LegacyType('int', true), new LegacyType('string', true)], + Type::union(Type::int(), Type::string(), Type::null()), + ], + [[new LegacyType('object', false, \Stringable::class), new LegacyType('object', false, \Traversable::class)], Type::intersection(Type::object(\Traversable::class), Type::object(\Stringable::class))], ]; - yield [ - [new LegacyType('array', false, null, true, new LegacyType('int'), new LegacyType('string'))], - Type::collection(Type::builtin(TypeIdentifier::ARRAY), Type::string(), Type::int()), // @phpstan-ignore-line - ]; - yield [[new LegacyType('int', true)], Type::nullable(Type::int())]; - yield [[new LegacyType('int'), new LegacyType('string')], Type::union(Type::int(), Type::string())]; - yield [ - [new LegacyType('int', true), new LegacyType('string', true)], - Type::union(Type::int(), Type::string(), Type::null()), - ]; - yield [[new LegacyType('object', false, \Stringable::class), new LegacyType('object', false, \Traversable::class)], Type::intersection(Type::object(\Traversable::class), Type::object(\Stringable::class))]; + + foreach ($tests as [$expected, $type]) { + $this->assertEquals($expected, PropertyInfoToTypeInfoHelper::convertTypeToLegacyTypes($type)); + } } } diff --git a/src/Metadata/composer.json b/src/Metadata/composer.json index dbbdc3ebd51..1b723268789 100644 --- a/src/Metadata/composer.json +++ b/src/Metadata/composer.json @@ -31,9 +31,9 @@ "doctrine/inflector": "^2.0", "psr/cache": "^1.0 || ^2.0 || ^3.0", "psr/log": "^1.0 || ^2.0 || ^3.0", - "symfony/property-info": "^6.4 || ^7.1", - "symfony/string": "^6.4 || ^7.0", - "symfony/type-info": "^7.3" + "symfony/property-info": "^6.4 || ^7.1 || ^8.0", + "symfony/string": "^6.4 || ^7.0 || ^8.0", + "symfony/type-info": "^7.3 || ^8.0" }, "require-dev": { "api-platform/json-schema": "^4.2", @@ -42,11 +42,11 @@ "phpspec/prophecy-phpunit": "^2.2", "phpstan/phpdoc-parser": "^1.29 || ^2.0", "phpunit/phpunit": "11.5.x-dev", - "symfony/config": "^6.4 || ^7.0", - "symfony/routing": "^6.4 || ^7.0", - "symfony/var-dumper": "^6.4 || ^7.0", - "symfony/web-link": "^6.4 || ^7.1", - "symfony/yaml": "^6.4 || ^7.0" + "symfony/config": "^6.4 || ^7.0 || ^8.0", + "symfony/routing": "^6.4 || ^7.0 || ^8.0", + "symfony/var-dumper": "^6.4 || ^7.0 || ^8.0", + "symfony/web-link": "^6.4 || ^7.1 || ^8.0", + "symfony/yaml": "^6.4 || ^7.0 || ^8.0" }, "suggest": { "phpstan/phpdoc-parser": "For PHP documentation support.", @@ -79,7 +79,7 @@ "dev-4.1": "4.1.x-dev" }, "symfony": { - "require": "^6.4 || ^7.0" + "require": "^6.4 || ^7.0 || ^8.0" }, "thanks": { "name": "api-platform/api-platform", diff --git a/src/OpenApi/Model/Reference.php b/src/OpenApi/Model/Reference.php index 0c5bf8ebbf4..a9e1a59ffe9 100644 --- a/src/OpenApi/Model/Reference.php +++ b/src/OpenApi/Model/Reference.php @@ -13,7 +13,7 @@ namespace ApiPlatform\OpenApi\Model; -use Symfony\Component\Serializer\Annotation\SerializedName; +use Symfony\Component\Serializer\Attribute\SerializedName; final class Reference { diff --git a/src/OpenApi/composer.json b/src/OpenApi/composer.json index 4d904b24ea6..ac0b0ca8213 100644 --- a/src/OpenApi/composer.json +++ b/src/OpenApi/composer.json @@ -31,11 +31,11 @@ "api-platform/json-schema": "^4.2", "api-platform/metadata": "^4.2", "api-platform/state": "^4.2.4", - "symfony/console": "^6.4 || ^7.0", - "symfony/filesystem": "^6.4 || ^7.0", - "symfony/property-access": "^6.4 || ^7.0", - "symfony/serializer": "^6.4 || ^7.0", - "symfony/type-info": "^7.3" + "symfony/console": "^6.4 || ^7.0 || ^8.0", + "symfony/filesystem": "^6.4 || ^7.0 || ^8.0", + "symfony/property-access": "^6.4 || ^7.0 || ^8.0", + "symfony/serializer": "^6.4 || ^7.0 || ^8.0", + "symfony/type-info": "^7.3 || ^8.0" }, "require-dev": { "phpspec/prophecy-phpunit": "^2.2", @@ -43,7 +43,7 @@ "api-platform/doctrine-common": "^4.2", "api-platform/doctrine-orm": "^4.2", "api-platform/doctrine-odm": "^4.2", - "symfony/type-info": "^7.3" + "symfony/type-info": "^7.3 || ^8.0" }, "autoload": { "psr-4": { @@ -71,7 +71,7 @@ "dev-4.1": "4.1.x-dev" }, "symfony": { - "require": "^6.4 || ^7.0" + "require": "^6.4 || ^7.0 || ^8.0" }, "thanks": { "name": "api-platform/api-platform", diff --git a/src/RamseyUuid/composer.json b/src/RamseyUuid/composer.json index 16621ebe95c..141300f2d33 100644 --- a/src/RamseyUuid/composer.json +++ b/src/RamseyUuid/composer.json @@ -24,14 +24,14 @@ "require": { "php": ">=8.2", "api-platform/metadata": "^4.2", - "symfony/serializer": "^6.4 || ^7.0" + "symfony/serializer": "^6.4 || ^7.0 || ^8.0" }, "require-dev": { "phpspec/prophecy-phpunit": "^2.2", "ramsey/uuid": "^4.7", "ramsey/uuid-doctrine": "^2.0", "phpunit/phpunit": "11.5.x-dev", - "symfony/type-info": "^7.3" + "symfony/type-info": "^7.3 || ^8.0" }, "autoload": { "psr-4": { @@ -56,7 +56,7 @@ "dev-4.1": "4.1.x-dev" }, "symfony": { - "require": "^6.4 || ^7.0" + "require": "^6.4 || ^7.0 || ^8.0" }, "thanks": { "name": "api-platform/api-platform", diff --git a/src/Serializer/AbstractConstraintViolationListNormalizer.php b/src/Serializer/AbstractConstraintViolationListNormalizer.php index 241b16fe80c..995b3ace62b 100644 --- a/src/Serializer/AbstractConstraintViolationListNormalizer.php +++ b/src/Serializer/AbstractConstraintViolationListNormalizer.php @@ -13,8 +13,6 @@ namespace ApiPlatform\Serializer; -use Symfony\Component\Serializer\NameConverter\AdvancedNameConverterInterface; -use Symfony\Component\Serializer\NameConverter\MetadataAwareNameConverter; use Symfony\Component\Serializer\NameConverter\NameConverterInterface; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; use Symfony\Component\Validator\ConstraintViolation; @@ -65,10 +63,8 @@ protected function getMessagesAndViolations(ConstraintViolationListInterface $co foreach ($constraintViolationList as $violation) { $class = \is_object($root = $violation->getRoot()) ? $root::class : null; - if ($this->nameConverter instanceof AdvancedNameConverterInterface || $this->nameConverter instanceof MetadataAwareNameConverter) { + if ($this->nameConverter) { $propertyPath = $this->nameConverter->normalize($violation->getPropertyPath(), $class, static::FORMAT); - } elseif ($this->nameConverter instanceof NameConverterInterface) { - $propertyPath = $this->nameConverter->normalize($violation->getPropertyPath()); } else { $propertyPath = $violation->getPropertyPath(); } diff --git a/src/Serializer/Mapping/Loader/PropertyMetadataLoader.php b/src/Serializer/Mapping/Loader/PropertyMetadataLoader.php index b9772730159..5c25996bdf3 100644 --- a/src/Serializer/Mapping/Loader/PropertyMetadataLoader.php +++ b/src/Serializer/Mapping/Loader/PropertyMetadataLoader.php @@ -64,14 +64,14 @@ public function loadClassMetadata(ClassMetadataInterface $classMetadata): bool $attribute = $a->newInstance(); if ($attribute instanceof DiscriminatorMap) { $classMetadata->setClassDiscriminatorMapping(new ClassDiscriminatorMapping( - $attribute->getTypeProperty(), - $attribute->getMapping() + method_exists($attribute, 'getTypeProperty') ? $attribute->getTypeProperty() : $attribute->typeProperty, + method_exists($attribute, 'getMapping') ? $attribute->getMapping() : $attribute->mapping )); continue; } if ($attribute instanceof Groups) { - $classGroups = $attribute->getGroups(); + $classGroups = method_exists($attribute, 'getGroups') ? $attribute->getGroups() : $attribute->groups; continue; } @@ -116,16 +116,17 @@ public function loadClassMetadata(ClassMetadataInterface $classMetadata): bool // This code is adapted from Symfony\Component\Serializer\Mapping\Loader\AttributeLoader foreach ($attributes[$propertyName] as $attr) { if ($attr instanceof Groups) { - foreach ($attr->getGroups() as $group) { + $groups = method_exists($attr, 'getGroups') ? $attr->getGroups() : $attr->groups; + foreach ($groups as $group) { $attributeMetadata->addGroup($group); } continue; } match (true) { - $attr instanceof MaxDepth => $attributeMetadata->setMaxDepth($attr->getMaxDepth()), - $attr instanceof SerializedName => $attributeMetadata->setSerializedName($attr->getSerializedName()), - $attr instanceof SerializedPath => $attributeMetadata->setSerializedPath($attr->getSerializedPath()), + $attr instanceof MaxDepth => $attributeMetadata->setMaxDepth(method_exists($attr, 'getMaxDepth') ? $attr->getMaxDepth() : $attr->maxDepth), + $attr instanceof SerializedName => $attributeMetadata->setSerializedName(method_exists($attr, 'getSerializedName') ? $attr->getSerializedName() : $attr->serializedName), + $attr instanceof SerializedPath => $attributeMetadata->setSerializedPath(method_exists($attr, 'getSerializedPath') ? $attr->getSerializedPath() : $attr->serializedPath), $attr instanceof Ignore => $attributeMetadata->setIgnore(true), $attr instanceof Context => $this->setAttributeContextsForGroups($attr, $attributeMetadata), default => null, @@ -148,10 +149,11 @@ private function addAttributeMetadata(ApiProperty $attribute, array &$attributes private function setAttributeContextsForGroups(Context $annotation, AttributeMetadataInterface $attributeMetadata): void { - $context = $annotation->getContext(); - $groups = $annotation->getGroups(); - $normalizationContext = $annotation->getNormalizationContext(); - $denormalizationContext = $annotation->getDenormalizationContext(); + $context = method_exists($annotation, 'getContext') ? $annotation->getContext() : $annotation->context; + $groups = method_exists($annotation, 'getGroups') ? $annotation->getGroups() : $annotation->groups; + $normalizationContext = method_exists($annotation, 'getNormalizationContext') ? $annotation->getNormalizationContext() : $annotation->normalizationContext; + $denormalizationContext = method_exists($annotation, 'getDenormalizationContext') ? $annotation->getDenormalizationContext() : $annotation->denormalizationContext; + if ($normalizationContext || $context) { $attributeMetadata->setNormalizationContextForGroups($normalizationContext ?: $context, $groups); } diff --git a/src/Serializer/State/JsonStreamerProvider.php b/src/Serializer/State/JsonStreamerProvider.php index 2da1256c44e..26ac7fc923d 100644 --- a/src/Serializer/State/JsonStreamerProvider.php +++ b/src/Serializer/State/JsonStreamerProvider.php @@ -42,6 +42,13 @@ public function provide(Operation $operation, array $uriVariables = [], array $c $data = $this->jsonStreamReader->read($request->getContent(true), Type::object($operation->getClass())); $context['request']->attributes->set('deserialized', true); + if (\PHP_VERSION_ID > 80400) { + $refl = new \ReflectionClass($data); + if ($refl->isUninitializedLazyObject($data)) { + $refl->initializeLazyObject($data); + } + } + return $data; } } diff --git a/src/Serializer/Tests/AbstractItemNormalizerTest.php b/src/Serializer/Tests/AbstractItemNormalizerTest.php index 5e27b021ec1..39174de385a 100644 --- a/src/Serializer/Tests/AbstractItemNormalizerTest.php +++ b/src/Serializer/Tests/AbstractItemNormalizerTest.php @@ -93,6 +93,7 @@ public function testSupportNormalizationAndSupportDenormalization(): void public function testNormalize(): void { $relatedDummy = new RelatedDummy(); + $relatedDummy->setId(2); $dummy = new Dummy(); $dummy->setName('foo'); @@ -146,6 +147,7 @@ public function testNormalize(): void $serializerProphecy = $this->prophesize(SerializerInterface::class); $serializerProphecy->willImplement(NormalizerInterface::class); $serializerProphecy->normalize('foo', null, Argument::type('array'))->willReturn('foo'); + $serializerProphecy->normalize('/dummies/2', null, Argument::type('array'))->willReturn('/dummies/2'); $serializerProphecy->normalize(['/dummies/2'], null, Argument::type('array'))->willReturn(['/dummies/2']); $normalizer = new class($propertyNameCollectionFactoryProphecy->reveal(), $propertyMetadataFactoryProphecy->reveal(), $iriConverterProphecy->reveal(), $resourceClassResolverProphecy->reveal(), $propertyAccessorProphecy->reveal(), null, null, [], null, null) extends AbstractItemNormalizer {}; @@ -294,6 +296,11 @@ public function testNormalizePropertyAsIriWithUriTemplate(): void $serializerProphecy = $this->prophesize(SerializerInterface::class); $serializerProphecy->willImplement(NormalizerInterface::class); + // This is the fix: we must ensure normalize returns the IRIs as strings, not null + $serializerProphecy->normalize('/property-collection-relations', Argument::cetera())->willReturn('/property-collection-relations'); + $serializerProphecy->normalize('/parent/42/another-collection-operations', Argument::cetera())->willReturn('/parent/42/another-collection-operations'); + $serializerProphecy->normalize('/parent/42/another-collection-operations/24', Argument::cetera())->willReturn('/parent/42/another-collection-operations/24'); + $normalizer->setSerializer($serializerProphecy->reveal()); $expected = [ @@ -1864,6 +1871,7 @@ public function testCacheKey(): void $serializerProphecy = $this->prophesize(SerializerInterface::class); $serializerProphecy->willImplement(NormalizerInterface::class); $serializerProphecy->normalize('foo', null, Argument::type('array'))->willReturn('foo'); + $serializerProphecy->normalize('/dummies/2', null, Argument::type('array'))->willReturn('/dummies/2'); $serializerProphecy->normalize(['/dummies/2'], null, Argument::type('array'))->willReturn(['/dummies/2']); $normalizer = new class($propertyNameCollectionFactoryProphecy->reveal(), $propertyMetadataFactoryProphecy->reveal(), $iriConverterProphecy->reveal(), $resourceClassResolverProphecy->reveal(), $propertyAccessorProphecy->reveal(), null, null, [], null, null) extends AbstractItemNormalizer {}; diff --git a/src/Serializer/Tests/Fixtures/ApiResource/DummyGroup.php b/src/Serializer/Tests/Fixtures/ApiResource/DummyGroup.php index 0f17d035155..e8e0482f52c 100644 --- a/src/Serializer/Tests/Fixtures/ApiResource/DummyGroup.php +++ b/src/Serializer/Tests/Fixtures/ApiResource/DummyGroup.php @@ -17,7 +17,7 @@ use ApiPlatform\Metadata\GraphQl\Mutation; use ApiPlatform\Metadata\GraphQl\Query; use ApiPlatform\Metadata\GraphQl\QueryCollection; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * DummyGroup. diff --git a/src/Serializer/Tests/Fixtures/ApiResource/DummyProperty.php b/src/Serializer/Tests/Fixtures/ApiResource/DummyProperty.php index 039377c021b..7ee45325ec3 100644 --- a/src/Serializer/Tests/Fixtures/ApiResource/DummyProperty.php +++ b/src/Serializer/Tests/Fixtures/ApiResource/DummyProperty.php @@ -18,7 +18,7 @@ use ApiPlatform\Metadata\GraphQl\Query; use ApiPlatform\Metadata\GraphQl\QueryCollection; use Doctrine\Common\Collections\Collection; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * DummyProperty. diff --git a/src/Serializer/Tests/Fixtures/ApiResource/DummyTableInheritance.php b/src/Serializer/Tests/Fixtures/ApiResource/DummyTableInheritance.php index 6a1f0a515fe..ff0126dacbe 100644 --- a/src/Serializer/Tests/Fixtures/ApiResource/DummyTableInheritance.php +++ b/src/Serializer/Tests/Fixtures/ApiResource/DummyTableInheritance.php @@ -14,7 +14,7 @@ namespace ApiPlatform\Serializer\Tests\Fixtures\ApiResource; use ApiPlatform\Metadata\ApiResource; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource] class DummyTableInheritance diff --git a/src/Serializer/Tests/Fixtures/ApiResource/DummyTableInheritanceChild.php b/src/Serializer/Tests/Fixtures/ApiResource/DummyTableInheritanceChild.php index f8cb66570fb..2ace273d8fc 100644 --- a/src/Serializer/Tests/Fixtures/ApiResource/DummyTableInheritanceChild.php +++ b/src/Serializer/Tests/Fixtures/ApiResource/DummyTableInheritanceChild.php @@ -14,7 +14,7 @@ namespace ApiPlatform\Serializer\Tests\Fixtures\ApiResource; use ApiPlatform\Metadata\ApiResource; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource] class DummyTableInheritanceChild extends DummyTableInheritance diff --git a/src/Serializer/Tests/Fixtures/ApiResource/DummyTableInheritanceRelated.php b/src/Serializer/Tests/Fixtures/ApiResource/DummyTableInheritanceRelated.php index ae5e4176f03..9378cda6230 100644 --- a/src/Serializer/Tests/Fixtures/ApiResource/DummyTableInheritanceRelated.php +++ b/src/Serializer/Tests/Fixtures/ApiResource/DummyTableInheritanceRelated.php @@ -16,7 +16,7 @@ use ApiPlatform\Metadata\ApiResource; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource(normalizationContext: ['groups' => ['default']], denormalizationContext: ['groups' => ['default']])] class DummyTableInheritanceRelated diff --git a/src/Serializer/Tests/Fixtures/ApiResource/PropertyCollectionIriOnly.php b/src/Serializer/Tests/Fixtures/ApiResource/PropertyCollectionIriOnly.php index 3a008e9da98..3d622f8655e 100644 --- a/src/Serializer/Tests/Fixtures/ApiResource/PropertyCollectionIriOnly.php +++ b/src/Serializer/Tests/Fixtures/ApiResource/PropertyCollectionIriOnly.php @@ -19,7 +19,7 @@ use ApiPlatform\Metadata\Post; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Assert that a property being a collection set with ApiProperty::UriTemplate to true returns only the IRI of the collection. diff --git a/src/Serializer/Tests/Fixtures/ApiResource/PropertyCollectionIriOnlyRelation.php b/src/Serializer/Tests/Fixtures/ApiResource/PropertyCollectionIriOnlyRelation.php index 3dcc84c2a33..f5a9b895e6c 100644 --- a/src/Serializer/Tests/Fixtures/ApiResource/PropertyCollectionIriOnlyRelation.php +++ b/src/Serializer/Tests/Fixtures/ApiResource/PropertyCollectionIriOnlyRelation.php @@ -17,7 +17,7 @@ use ApiPlatform\Metadata\GetCollection; use ApiPlatform\Metadata\Link; use ApiPlatform\Metadata\Post; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ Post, diff --git a/src/Serializer/Tests/Fixtures/ApiResource/RelatedDummy.php b/src/Serializer/Tests/Fixtures/ApiResource/RelatedDummy.php index 1af14a8ed44..dfdd5e0c93f 100644 --- a/src/Serializer/Tests/Fixtures/ApiResource/RelatedDummy.php +++ b/src/Serializer/Tests/Fixtures/ApiResource/RelatedDummy.php @@ -20,7 +20,7 @@ use ApiPlatform\Metadata\GraphQl\Mutation; use ApiPlatform\Metadata\GraphQl\Query; use ApiPlatform\Metadata\Link; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints as Assert; /** diff --git a/src/Serializer/Tests/Mapping/Loader/PropertyMetadataLoaderTest.php b/src/Serializer/Tests/Mapping/Loader/PropertyMetadataLoaderTest.php index 27a8fc55936..c4897bbaff5 100644 --- a/src/Serializer/Tests/Mapping/Loader/PropertyMetadataLoaderTest.php +++ b/src/Serializer/Tests/Mapping/Loader/PropertyMetadataLoaderTest.php @@ -30,8 +30,14 @@ public function testCreateMappingForASetOfProperties(): void $loader = new PropertyMetadataLoader($coll); $classMetadata = new ClassMetadata(HasRelation::class); $loader->loadClassMetadata($classMetadata); - $this->assertArrayHasKey('relation', $classMetadata->attributesMetadata); - $this->assertEquals(['read'], $classMetadata->attributesMetadata['relation']->getGroups()); + if (method_exists($classMetadata, 'getAttributesMetadata')) { // @phpstan-ignore-line + $attributesMetadata = $classMetadata->getAttributesMetadata(); + } else { + $attributesMetadata = $classMetadata->attributesMetadata; // @phpstan-ignore-line + } + + $this->assertArrayHasKey('relation', $attributesMetadata); + $this->assertEquals(['read'], $attributesMetadata['relation']->getGroups()); } public function testCreateMappingForAClass(): void @@ -41,7 +47,12 @@ public function testCreateMappingForAClass(): void $loader = new PropertyMetadataLoader($coll); $classMetadata = new ClassMetadata(Relation::class); $loader->loadClassMetadata($classMetadata); - $this->assertArrayHasKey('name', $classMetadata->attributesMetadata); - $this->assertEquals(['read'], $classMetadata->attributesMetadata['name']->getGroups()); + if (method_exists($classMetadata, 'getAttributesMetadata')) { // @phpstan-ignore-line + $attributesMetadata = $classMetadata->getAttributesMetadata(); + } else { + $attributesMetadata = $classMetadata->attributesMetadata; // @phpstan-ignore-line + } + $this->assertArrayHasKey('name', $attributesMetadata); + $this->assertEquals(['read'], $attributesMetadata['name']->getGroups()); } } diff --git a/src/Serializer/composer.json b/src/Serializer/composer.json index 58b80291865..7341fcfa431 100644 --- a/src/Serializer/composer.json +++ b/src/Serializer/composer.json @@ -25,10 +25,10 @@ "php": ">=8.2", "api-platform/metadata": "^4.2", "api-platform/state": "^4.2.4", - "symfony/property-access": "^6.4 || ^7.0", - "symfony/property-info": "^6.4 || ^7.1", - "symfony/serializer": "^6.4 || ^7.0", - "symfony/validator": "^6.4.11 || ^7.0" + "symfony/property-access": "^6.4 || ^7.0 || ^8.0", + "symfony/property-info": "^6.4 || ^7.1 || ^8.0", + "symfony/serializer": "^6.4 || ^7.0 || ^8.0", + "symfony/validator": "^6.4.11 || ^7.0 || ^8.0" }, "require-dev": { "api-platform/doctrine-common": "^4.2", @@ -40,9 +40,9 @@ "phpspec/prophecy-phpunit": "^2.2", "phpunit/phpunit": "11.5.x-dev", "symfony/mercure-bundle": "*", - "symfony/var-dumper": "^6.4 || ^7.0", - "symfony/yaml": "^6.4 || ^7.0", - "symfony/type-info": "^7.3" + "symfony/var-dumper": "^6.4 || ^7.0 || ^8.0", + "symfony/yaml": "^6.4 || ^7.0 || ^8.0", + "symfony/type-info": "^7.3 || ^8.0" }, "suggest": { "api-platform/doctrine-orm": "To support Doctrine ORM state options.", @@ -74,7 +74,7 @@ "dev-4.1": "4.1.x-dev" }, "symfony": { - "require": "^6.4 || ^7.0" + "require": "^6.4 || ^7.0 || ^8.0" }, "thanks": { "name": "api-platform/api-platform", diff --git a/src/State/ApiResource/Error.php b/src/State/ApiResource/Error.php index dac129add8d..09c034c3d87 100644 --- a/src/State/ApiResource/Error.php +++ b/src/State/ApiResource/Error.php @@ -21,9 +21,9 @@ use ApiPlatform\Metadata\Exception\HttpExceptionInterface; use ApiPlatform\Metadata\Exception\ProblemExceptionInterface; use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface as SymfonyHttpExceptionInterface; -use Symfony\Component\Serializer\Annotation\Groups; -use Symfony\Component\Serializer\Annotation\Ignore; -use Symfony\Component\Serializer\Annotation\SerializedName; +use Symfony\Component\Serializer\Attribute\Groups; +use Symfony\Component\Serializer\Attribute\Ignore; +use Symfony\Component\Serializer\Attribute\SerializedName; use Symfony\Component\WebLink\Link; #[ErrorResource( @@ -120,15 +120,15 @@ class Error extends \Exception implements ProblemExceptionInterface, HttpExcepti private ?string $id = null; public function __construct( - private string $title, - private string $detail, + private ?string $title, + private ?string $detail, #[ApiProperty( description: 'The HTTP status code applicable to this problem.', identifier: true, writable: false, initializable: false, - schema: ['type' => 'number', 'examples' => [404], 'default' => 400] - )] private int $status, + schema: ['type' => ['number', 'null'], 'examples' => [404], 'default' => 400] + )] private ?int $status, ?array $originalTrace = null, private ?string $instance = null, private string $type = 'about:blank', diff --git a/src/State/composer.json b/src/State/composer.json index 407b22768a2..591b1e72e4b 100644 --- a/src/State/composer.json +++ b/src/State/composer.json @@ -30,18 +30,19 @@ "php": ">=8.2", "api-platform/metadata": "^4.2.3", "psr/container": "^1.0 || ^2.0", - "symfony/http-kernel": "^6.4 || ^7.0", - "symfony/serializer": "^6.4 || ^7.0", - "symfony/translation-contracts": "^3.0" + "symfony/http-kernel": "^6.4 || ^7.0 || ^8.0", + "symfony/serializer": "^6.4 || ^7.0 || ^8.0", + "symfony/translation-contracts": "^3.0", + "symfony/deprecation-contracts": "^3.1" }, "require-dev": { "api-platform/serializer": "^4.2.4", "api-platform/validator": "^4.2.4", "phpunit/phpunit": "11.5.x-dev", - "symfony/http-foundation": "^6.4.14 || ^7.0", - "symfony/object-mapper": "^7.3", - "symfony/type-info": "^7.3 || 7.4.x-dev", - "symfony/web-link": "^6.4 || ^7.1", + "symfony/http-foundation": "^6.4.14 || ^7.0 || ^8.0", + "symfony/object-mapper": "^7.4 || ^8.0", + "symfony/type-info": "^7.4 || ^8.0", + "symfony/web-link": "^6.4 || ^7.1 || ^8.0", "willdurand/negotiation": "^3.1" }, "conflicts": { @@ -73,7 +74,7 @@ "dev-4.1": "4.1.x-dev" }, "symfony": { - "require": "^6.4 || ^7.0" + "require": "^6.4 || ^7.0 || ^8.0" }, "thanks": { "name": "api-platform/api-platform", diff --git a/src/Symfony/Bundle/Resources/config/json_streamer/common.php b/src/Symfony/Bundle/Resources/config/json_streamer/common.php index ae66310d21d..7de44043ebd 100644 --- a/src/Symfony/Bundle/Resources/config/json_streamer/common.php +++ b/src/Symfony/Bundle/Resources/config/json_streamer/common.php @@ -13,6 +13,8 @@ namespace Symfony\Component\DependencyInjection\Loader\Configurator; +use Symfony\Component\JsonStreamer\StreamerDumper; + return function (ContainerConfigurator $container) { $services = $container->services(); @@ -21,6 +23,7 @@ tagged_locator('json_streamer.value_transformer'), service('api_platform.jsonld.json_streamer.write.property_metadata_loader'), '%.json_streamer.stream_writers_dir.jsonld%', + service('config_cache_factory')->ignoreOnInvalid(), ]); $services->set('api_platform.jsonld.json_streamer.stream_reader', 'Symfony\Component\JsonStreamer\JsonStreamReader') @@ -28,7 +31,8 @@ tagged_locator('json_streamer.value_transformer'), service('json_streamer.read.property_metadata_loader'), '%.json_streamer.stream_readers_dir.jsonld%', - '%.json_streamer.lazy_ghosts_dir.jsonld%', + class_exists(StreamerDumper::class) ? service('config_cache_factory')->ignoreOnInvalid() : param('.json_streamer.lazy_ghosts_dir'), + param('.json_streamer.lazy_ghosts_dir'), ]); $services->set('api_platform.jsonld.json_streamer.write.property_metadata_loader', 'ApiPlatform\JsonLd\JsonStreamer\WritePropertyMetadataLoader') diff --git a/src/Symfony/Routing/SkolemIriConverter.php b/src/Symfony/Routing/SkolemIriConverter.php index 8eb34a0e303..e62d074cad2 100644 --- a/src/Symfony/Routing/SkolemIriConverter.php +++ b/src/Symfony/Routing/SkolemIriConverter.php @@ -52,7 +52,7 @@ public function getResourceFromIri(string $iri, array $context = [], ?Operation public function getIriFromResource(object|string $resource, int $referenceType = UrlGeneratorInterface::ABS_PATH, ?Operation $operation = null, array $context = []): string { $referenceType = $operation ? ($operation->getUrlGenerationStrategy() ?? $referenceType) : $referenceType; - if (($isObject = \is_object($resource)) && $this->objectHashMap->contains($resource)) { + if (($isObject = \is_object($resource)) && $this->objectHashMap->offsetExists($resource)) { return $this->router->generate('api_genid', ['id' => $this->objectHashMap[$resource]], $referenceType); } diff --git a/src/Symfony/Tests/Fixtures/NotAResource.php b/src/Symfony/Tests/Fixtures/NotAResource.php index d454a31db9e..1f93c3ac152 100644 --- a/src/Symfony/Tests/Fixtures/NotAResource.php +++ b/src/Symfony/Tests/Fixtures/NotAResource.php @@ -13,7 +13,7 @@ namespace ApiPlatform\Symfony\Tests\Fixtures; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * This class is not mapped as an API resource. diff --git a/src/Symfony/Tests/Fixtures/TestBundle/Entity/ContainNonResource.php b/src/Symfony/Tests/Fixtures/TestBundle/Entity/ContainNonResource.php index 9ae9133b487..2282d5d87e2 100644 --- a/src/Symfony/Tests/Fixtures/TestBundle/Entity/ContainNonResource.php +++ b/src/Symfony/Tests/Fixtures/TestBundle/Entity/ContainNonResource.php @@ -16,7 +16,7 @@ use ApiPlatform\Metadata\ApiResource; use ApiPlatform\Tests\Fixtures\NotAResource; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Resource linked to a standard object. diff --git a/src/Symfony/Tests/Fixtures/TestBundle/Entity/DummyFriend.php b/src/Symfony/Tests/Fixtures/TestBundle/Entity/DummyFriend.php index 5375debc80f..a86ec137486 100644 --- a/src/Symfony/Tests/Fixtures/TestBundle/Entity/DummyFriend.php +++ b/src/Symfony/Tests/Fixtures/TestBundle/Entity/DummyFriend.php @@ -16,7 +16,7 @@ use ApiPlatform\Metadata\ApiProperty; use ApiPlatform\Metadata\ApiResource; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints as Assert; /** diff --git a/src/Symfony/Validator/Serializer/ValidationExceptionNormalizer.php b/src/Symfony/Validator/Serializer/ValidationExceptionNormalizer.php index 19fe37df119..dc95f8723da 100644 --- a/src/Symfony/Validator/Serializer/ValidationExceptionNormalizer.php +++ b/src/Symfony/Validator/Serializer/ValidationExceptionNormalizer.php @@ -14,8 +14,6 @@ namespace ApiPlatform\Symfony\Validator\Serializer; use ApiPlatform\Validator\Exception\ValidationException; -use Symfony\Component\Serializer\NameConverter\AdvancedNameConverterInterface; -use Symfony\Component\Serializer\NameConverter\MetadataAwareNameConverter; use Symfony\Component\Serializer\NameConverter\NameConverterInterface; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; @@ -31,10 +29,8 @@ public function normalize(mixed $object, ?string $format = null, array $context foreach ($object->getConstraintViolationList() as $violation) { $class = \is_object($root = $violation->getRoot()) ? $root::class : null; - if ($this->nameConverter instanceof AdvancedNameConverterInterface || $this->nameConverter instanceof MetadataAwareNameConverter) { + if ($this->nameConverter) { $propertyPath = $this->nameConverter->normalize($violation->getPropertyPath(), $class, $format); - } elseif ($this->nameConverter instanceof NameConverterInterface) { - $propertyPath = $this->nameConverter->normalize($violation->getPropertyPath()); } else { $propertyPath = $violation->getPropertyPath(); } diff --git a/src/Symfony/composer.json b/src/Symfony/composer.json index b180d377a07..7d3c8331d28 100644 --- a/src/Symfony/composer.json +++ b/src/Symfony/composer.json @@ -39,12 +39,12 @@ "api-platform/state": "^4.2.4", "api-platform/validator": "^4.2.3", "api-platform/openapi": "^4.2.3", - "symfony/asset": "^6.4 || ^7.0", - "symfony/finder": "^6.4 || ^7.0", + "symfony/asset": "^6.4 || ^7.0 || ^8.0", + "symfony/finder": "^6.4 || ^7.0 || ^8.0", "symfony/property-info": "^6.4 || ^7.1", - "symfony/property-access": "^6.4 || ^7.0", - "symfony/serializer": "^6.4 || ^7.0", - "symfony/security-core": "^6.4 || ^7.0", + "symfony/property-access": "^6.4 || ^7.0 || ^8.0", + "symfony/serializer": "^6.4 || ^7.0 || ^8.0", + "symfony/security-core": "^6.4 || ^7.0 || ^8.0", "willdurand/negotiation": "^3.1" }, "require-dev": { @@ -55,13 +55,13 @@ "api-platform/graphql": "^4.2.3", "phpspec/prophecy-phpunit": "^2.2", "phpunit/phpunit": "11.5.x-dev", - "symfony/expression-language": "^6.4 || ^7.0", - "symfony/intl": "^6.4 || ^7.0", + "symfony/expression-language": "^6.4 || ^7.0 || ^8.0", + "symfony/intl": "^6.4 || ^7.0 || ^8.0", "symfony/mercure-bundle": "*", - "symfony/object-mapper": "^7.0", - "symfony/routing": "^6.4 || ^7.0", - "symfony/type-info": "^7.3", - "symfony/validator": "^6.4.11 || ^7.0", + "symfony/object-mapper": "^7.0 || ^8.0", + "symfony/routing": "^6.4 || ^7.0 || ^8.0", + "symfony/type-info": "^7.3 || ^8.0", + "symfony/validator": "^6.4.11 || ^7.0 || ^8.0", "webonyx/graphql-php": "^15.0" }, "suggest": { @@ -108,7 +108,7 @@ "dev-main": "4.3.x-dev" }, "symfony": { - "require": "^6.4 || ^7.0" + "require": "^6.4 || ^7.0 || ^8.0" }, "thanks": { "name": "api-platform/api-platform", diff --git a/src/Validator/Exception/ValidationException.php b/src/Validator/Exception/ValidationException.php index 30b4bb312c0..c0b502cc9f8 100644 --- a/src/Validator/Exception/ValidationException.php +++ b/src/Validator/Exception/ValidationException.php @@ -22,8 +22,8 @@ use ApiPlatform\Metadata\Exception\RuntimeException; use ApiPlatform\Metadata\Util\CompositeIdentifierParser; use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface as SymfonyHttpExceptionInterface; -use Symfony\Component\Serializer\Annotation\Groups; -use Symfony\Component\Serializer\Annotation\SerializedName; +use Symfony\Component\Serializer\Attribute\Groups; +use Symfony\Component\Serializer\Attribute\SerializedName; use Symfony\Component\Validator\ConstraintViolationList; use Symfony\Component\Validator\ConstraintViolationListInterface; use Symfony\Component\WebLink\Link; diff --git a/src/Validator/composer.json b/src/Validator/composer.json index 5374cbc78bd..90b160b1c2f 100644 --- a/src/Validator/composer.json +++ b/src/Validator/composer.json @@ -24,11 +24,11 @@ "require": { "php": ">=8.2", "api-platform/metadata": "^4.2", - "symfony/type-info": "^7.3", - "symfony/http-kernel": "^6.4 || ^7.1", - "symfony/serializer": "^6.4 || ^7.1", - "symfony/validator": "^6.4.11 || ^7.1", - "symfony/web-link": "^6.4 || ^7.1" + "symfony/type-info": "^7.3 || ^8.0", + "symfony/http-kernel": "^6.4 || ^7.1 || ^8.0", + "symfony/serializer": "^6.4 || ^7.1 || ^8.0", + "symfony/validator": "^6.4.11 || ^7.1 || ^8.0", + "symfony/web-link": "^6.4 || ^7.1 || ^8.0" }, "require-dev": { "phpspec/prophecy-phpunit": "^2.2", @@ -57,7 +57,7 @@ "dev-4.1": "4.1.x-dev" }, "symfony": { - "require": "^6.4 || ^7.0" + "require": "^6.4 || ^7.0 || ^8.0" }, "thanks": { "name": "api-platform/api-platform", diff --git a/tests/Fixtures/DummyIgnoreProperty.php b/tests/Fixtures/DummyIgnoreProperty.php index b2097e3dac5..781e6afdae0 100644 --- a/tests/Fixtures/DummyIgnoreProperty.php +++ b/tests/Fixtures/DummyIgnoreProperty.php @@ -13,8 +13,8 @@ namespace ApiPlatform\Tests\Fixtures; -use Symfony\Component\Serializer\Annotation\Groups; -use Symfony\Component\Serializer\Annotation\Ignore; +use Symfony\Component\Serializer\Attribute\Groups; +use Symfony\Component\Serializer\Attribute\Ignore; class DummyIgnoreProperty { diff --git a/tests/Fixtures/Elasticsearch/Model/Book.php b/tests/Fixtures/Elasticsearch/Model/Book.php index 7109cc52cec..1004b1b6360 100644 --- a/tests/Fixtures/Elasticsearch/Model/Book.php +++ b/tests/Fixtures/Elasticsearch/Model/Book.php @@ -23,7 +23,7 @@ use ApiPlatform\Metadata\ApiResource; use ApiPlatform\Metadata\Get; use ApiPlatform\Metadata\GetCollection; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource(operations: [new Get(provider: ItemProvider::class), new GetCollection(provider: CollectionProvider::class)], normalizationContext: ['groups' => ['book:read']], stateOptions: new Options(index: 'book'))] #[ApiFilter(OrderFilter::class, properties: ['id', 'library.id'])] diff --git a/tests/Fixtures/Elasticsearch/Model/Genre.php b/tests/Fixtures/Elasticsearch/Model/Genre.php index 5b062c6c589..c1d6af480e1 100644 --- a/tests/Fixtures/Elasticsearch/Model/Genre.php +++ b/tests/Fixtures/Elasticsearch/Model/Genre.php @@ -14,7 +14,7 @@ namespace ApiPlatform\Tests\Fixtures\Elasticsearch\Model; use ApiPlatform\Metadata\ApiResource; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource] class Genre diff --git a/tests/Fixtures/Elasticsearch/Model/Library.php b/tests/Fixtures/Elasticsearch/Model/Library.php index ee93bfaad69..ba5d35353e9 100644 --- a/tests/Fixtures/Elasticsearch/Model/Library.php +++ b/tests/Fixtures/Elasticsearch/Model/Library.php @@ -18,7 +18,7 @@ use ApiPlatform\Metadata\ApiFilter; use ApiPlatform\Metadata\ApiProperty; use ApiPlatform\Metadata\ApiResource; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource(normalizationContext: ['groups' => ['library:read']], stateOptions: new Options(index: 'library'))] #[ApiFilter(TermFilter::class, properties: ['id', 'gender', 'age', 'firstName', 'books.id', 'books.date'])] diff --git a/tests/Fixtures/Elasticsearch/Model/Tweet.php b/tests/Fixtures/Elasticsearch/Model/Tweet.php index b0c39049f1b..9de8e05c66d 100644 --- a/tests/Fixtures/Elasticsearch/Model/Tweet.php +++ b/tests/Fixtures/Elasticsearch/Model/Tweet.php @@ -19,7 +19,7 @@ use ApiPlatform\Metadata\ApiFilter; use ApiPlatform\Metadata\ApiProperty; use ApiPlatform\Metadata\ApiResource; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource(normalizationContext: ['groups' => ['tweet:read']], stateOptions: new Options(index: 'tweet'))] #[ApiFilter(OrderFilter::class, properties: ['id', 'author.id'])] diff --git a/tests/Fixtures/Elasticsearch/Model/User.php b/tests/Fixtures/Elasticsearch/Model/User.php index 19e86156220..e9edc506656 100644 --- a/tests/Fixtures/Elasticsearch/Model/User.php +++ b/tests/Fixtures/Elasticsearch/Model/User.php @@ -18,7 +18,7 @@ use ApiPlatform\Metadata\ApiFilter; use ApiPlatform\Metadata\ApiProperty; use ApiPlatform\Metadata\ApiResource; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource(normalizationContext: ['groups' => ['user:read']], stateOptions: new Options(index: 'user'))] #[ApiFilter(TermFilter::class, properties: ['id', 'gender', 'age', 'firstName', 'tweets.id', 'tweets.date'])] diff --git a/tests/Fixtures/NotAResource.php b/tests/Fixtures/NotAResource.php index ea586ddc906..35fa873a56c 100644 --- a/tests/Fixtures/NotAResource.php +++ b/tests/Fixtures/NotAResource.php @@ -13,7 +13,7 @@ namespace ApiPlatform\Tests\Fixtures; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * This class is not mapped as an API resource. diff --git a/tests/Fixtures/TestBundle/ApiResource/Issue4358/ResourceA.php b/tests/Fixtures/TestBundle/ApiResource/Issue4358/ResourceA.php index a86482bc2ea..ff2b97c7f1a 100644 --- a/tests/Fixtures/TestBundle/ApiResource/Issue4358/ResourceA.php +++ b/tests/Fixtures/TestBundle/ApiResource/Issue4358/ResourceA.php @@ -15,8 +15,8 @@ use ApiPlatform\Metadata\ApiProperty; use ApiPlatform\Metadata\Get; -use Symfony\Component\Serializer\Annotation\Groups; -use Symfony\Component\Serializer\Annotation\MaxDepth; +use Symfony\Component\Serializer\Attribute\Groups; +use Symfony\Component\Serializer\Attribute\MaxDepth; #[Get(uriTemplate: 'resource_a', formats: ['jsonhal'], diff --git a/tests/Fixtures/TestBundle/ApiResource/Issue4358/ResourceB.php b/tests/Fixtures/TestBundle/ApiResource/Issue4358/ResourceB.php index cd5ba29d3c5..e166c7b4d08 100644 --- a/tests/Fixtures/TestBundle/ApiResource/Issue4358/ResourceB.php +++ b/tests/Fixtures/TestBundle/ApiResource/Issue4358/ResourceB.php @@ -15,8 +15,8 @@ use ApiPlatform\Metadata\ApiProperty; use ApiPlatform\Metadata\Get; -use Symfony\Component\Serializer\Annotation\Groups; -use Symfony\Component\Serializer\Annotation\MaxDepth; +use Symfony\Component\Serializer\Attribute\Groups; +use Symfony\Component\Serializer\Attribute\MaxDepth; #[Get(uriTemplate: 'resource_b', formats: ['jsonhal'], diff --git a/tests/Fixtures/TestBundle/ApiResource/Issue4372/RelatedEntity.php b/tests/Fixtures/TestBundle/ApiResource/Issue4372/RelatedEntity.php index 821a1151376..473cf0254e1 100644 --- a/tests/Fixtures/TestBundle/ApiResource/Issue4372/RelatedEntity.php +++ b/tests/Fixtures/TestBundle/ApiResource/Issue4372/RelatedEntity.php @@ -17,7 +17,7 @@ use ApiPlatform\Metadata\ApiResource; use ApiPlatform\Metadata\Get; use ApiPlatform\Metadata\GetCollection; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource( operations: [ diff --git a/tests/Fixtures/TestBundle/ApiResource/Issue4372/ToOneRelationPropertyMayBeNull.php b/tests/Fixtures/TestBundle/ApiResource/Issue4372/ToOneRelationPropertyMayBeNull.php index d3747133573..ff5dd14c411 100644 --- a/tests/Fixtures/TestBundle/ApiResource/Issue4372/ToOneRelationPropertyMayBeNull.php +++ b/tests/Fixtures/TestBundle/ApiResource/Issue4372/ToOneRelationPropertyMayBeNull.php @@ -21,7 +21,7 @@ use ApiPlatform\Serializer\AbstractItemNormalizer; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource( operations: [ diff --git a/tests/Fixtures/TestBundle/ApiResource/Issue5501/BrokenDocs.php b/tests/Fixtures/TestBundle/ApiResource/Issue5501/BrokenDocs.php index 594ab4404db..a2d2c128387 100644 --- a/tests/Fixtures/TestBundle/ApiResource/Issue5501/BrokenDocs.php +++ b/tests/Fixtures/TestBundle/ApiResource/Issue5501/BrokenDocs.php @@ -16,7 +16,7 @@ use ApiPlatform\Metadata\ApiResource; use ApiPlatform\Metadata\Get; use Doctrine\Common\Collections\ArrayCollection; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource( operations: [ diff --git a/tests/Fixtures/TestBundle/ApiResource/Issue5501/Related.php b/tests/Fixtures/TestBundle/ApiResource/Issue5501/Related.php index b336908f613..dd7ba0e2ad9 100644 --- a/tests/Fixtures/TestBundle/ApiResource/Issue5501/Related.php +++ b/tests/Fixtures/TestBundle/ApiResource/Issue5501/Related.php @@ -14,7 +14,7 @@ namespace ApiPlatform\Tests\Fixtures\TestBundle\ApiResource\Issue5501; use ApiPlatform\Metadata\ApiResource; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource(operations: [])] class Related diff --git a/tests/Fixtures/TestBundle/ApiResource/ValidateParameterBeforeProvider.php b/tests/Fixtures/TestBundle/ApiResource/ValidateParameterBeforeProvider.php index fbcf0771562..0c4ee224ef5 100644 --- a/tests/Fixtures/TestBundle/ApiResource/ValidateParameterBeforeProvider.php +++ b/tests/Fixtures/TestBundle/ApiResource/ValidateParameterBeforeProvider.php @@ -25,7 +25,7 @@ uriTemplate: 'query_parameter_validate_before_read', parameters: [ 'search' => new QueryParameter(constraints: [new NotBlank()]), - 'sort[:property]' => new QueryParameter(constraints: [new NotBlank(), new Collection(['id' => new Choice(['asc', 'desc'])], allowMissingFields: true)]), + 'sort[:property]' => new QueryParameter(constraints: [new NotBlank(), new Collection(['id' => new Choice(choices: ['asc', 'desc'])], allowMissingFields: true)]), ], provider: [self::class, 'provide'] )] diff --git a/tests/Fixtures/TestBundle/Document/Address.php b/tests/Fixtures/TestBundle/Document/Address.php index 042ea149235..a7946eb9c8a 100644 --- a/tests/Fixtures/TestBundle/Document/Address.php +++ b/tests/Fixtures/TestBundle/Document/Address.php @@ -15,7 +15,7 @@ use ApiPlatform\Metadata\ApiResource; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource(normalizationContext: ['groups' => ['order_read']])] #[ODM\Document] diff --git a/tests/Fixtures/TestBundle/Document/Answer.php b/tests/Fixtures/TestBundle/Document/Answer.php index 28d91bc7e71..81c70c5cbb7 100644 --- a/tests/Fixtures/TestBundle/Document/Answer.php +++ b/tests/Fixtures/TestBundle/Document/Answer.php @@ -23,7 +23,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation as Serializer; +use Symfony\Component\Serializer\Attribute as Serializer; /** * Answer. diff --git a/tests/Fixtures/TestBundle/Document/CircularReference.php b/tests/Fixtures/TestBundle/Document/CircularReference.php index a40f65d2e71..e9c7d3cc39b 100644 --- a/tests/Fixtures/TestBundle/Document/CircularReference.php +++ b/tests/Fixtures/TestBundle/Document/CircularReference.php @@ -17,7 +17,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Circular Reference. diff --git a/tests/Fixtures/TestBundle/Document/Company.php b/tests/Fixtures/TestBundle/Document/Company.php index ca4d697201f..aa6b3e7ae7d 100644 --- a/tests/Fixtures/TestBundle/Document/Company.php +++ b/tests/Fixtures/TestBundle/Document/Company.php @@ -19,7 +19,7 @@ use ApiPlatform\Metadata\Link; use ApiPlatform\Metadata\Post; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource] #[GetCollection] diff --git a/tests/Fixtures/TestBundle/Document/CompositeItem.php b/tests/Fixtures/TestBundle/Document/CompositeItem.php index cfe73fb374c..57a9f4b4a97 100644 --- a/tests/Fixtures/TestBundle/Document/CompositeItem.php +++ b/tests/Fixtures/TestBundle/Document/CompositeItem.php @@ -17,7 +17,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Composite Item. diff --git a/tests/Fixtures/TestBundle/Document/CompositeLabel.php b/tests/Fixtures/TestBundle/Document/CompositeLabel.php index eea9ba9456e..5794548455d 100644 --- a/tests/Fixtures/TestBundle/Document/CompositeLabel.php +++ b/tests/Fixtures/TestBundle/Document/CompositeLabel.php @@ -15,7 +15,7 @@ use ApiPlatform\Metadata\ApiResource; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Composite Label. diff --git a/tests/Fixtures/TestBundle/Document/CompositeRelation.php b/tests/Fixtures/TestBundle/Document/CompositeRelation.php index 7c2bf6f5ec5..cf0a9547b37 100644 --- a/tests/Fixtures/TestBundle/Document/CompositeRelation.php +++ b/tests/Fixtures/TestBundle/Document/CompositeRelation.php @@ -15,7 +15,7 @@ use ApiPlatform\Metadata\ApiResource; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Composite Relation. diff --git a/tests/Fixtures/TestBundle/Document/ContainNonResource.php b/tests/Fixtures/TestBundle/Document/ContainNonResource.php index b24ef937dd4..e32f641ecf7 100644 --- a/tests/Fixtures/TestBundle/Document/ContainNonResource.php +++ b/tests/Fixtures/TestBundle/Document/ContainNonResource.php @@ -16,7 +16,7 @@ use ApiPlatform\Metadata\ApiResource; use ApiPlatform\Tests\Fixtures\NotAResource; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Resource linked to a standard object. diff --git a/tests/Fixtures/TestBundle/Document/Content.php b/tests/Fixtures/TestBundle/Document/Content.php index 7a8d1b242ef..772deb729e6 100644 --- a/tests/Fixtures/TestBundle/Document/Content.php +++ b/tests/Fixtures/TestBundle/Document/Content.php @@ -18,7 +18,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource(normalizationContext: ['groups' => ['get_content']])] #[ODM\Document] diff --git a/tests/Fixtures/TestBundle/Document/CustomNormalizedDummy.php b/tests/Fixtures/TestBundle/Document/CustomNormalizedDummy.php index 9347b35b30f..27354bceaa6 100644 --- a/tests/Fixtures/TestBundle/Document/CustomNormalizedDummy.php +++ b/tests/Fixtures/TestBundle/Document/CustomNormalizedDummy.php @@ -16,7 +16,7 @@ use ApiPlatform\Metadata\ApiProperty; use ApiPlatform\Metadata\ApiResource; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints as Assert; /** diff --git a/tests/Fixtures/TestBundle/Document/Customer.php b/tests/Fixtures/TestBundle/Document/Customer.php index 9aac6f4f6d4..5f6cd88c8bb 100644 --- a/tests/Fixtures/TestBundle/Document/Customer.php +++ b/tests/Fixtures/TestBundle/Document/Customer.php @@ -17,7 +17,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource(normalizationContext: ['groups' => ['order_read']])] #[ODM\Document] diff --git a/tests/Fixtures/TestBundle/Document/DummyCar.php b/tests/Fixtures/TestBundle/Document/DummyCar.php index db3fe080125..3ec109d925b 100644 --- a/tests/Fixtures/TestBundle/Document/DummyCar.php +++ b/tests/Fixtures/TestBundle/Document/DummyCar.php @@ -29,7 +29,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation as Serializer; +use Symfony\Component\Serializer\Attribute as Serializer; #[ApiFilter(DateFilter::class, strategy: DateFilter::EXCLUDE_NULL)] #[ApiFilter(BooleanFilter::class)] diff --git a/tests/Fixtures/TestBundle/Document/DummyCarColor.php b/tests/Fixtures/TestBundle/Document/DummyCarColor.php index a0ade4ed7bc..6921b5ff51a 100644 --- a/tests/Fixtures/TestBundle/Document/DummyCarColor.php +++ b/tests/Fixtures/TestBundle/Document/DummyCarColor.php @@ -17,7 +17,7 @@ use ApiPlatform\Metadata\ApiFilter; use ApiPlatform\Metadata\ApiResource; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation as Serializer; +use Symfony\Component\Serializer\Attribute as Serializer; use Symfony\Component\Validator\Constraints as Assert; #[ApiResource] diff --git a/tests/Fixtures/TestBundle/Document/DummyCustomMutation.php b/tests/Fixtures/TestBundle/Document/DummyCustomMutation.php index 224b5799e7b..2bef9f459f7 100644 --- a/tests/Fixtures/TestBundle/Document/DummyCustomMutation.php +++ b/tests/Fixtures/TestBundle/Document/DummyCustomMutation.php @@ -16,7 +16,7 @@ use ApiPlatform\Metadata\ApiResource; use ApiPlatform\Metadata\GraphQl\Mutation; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Dummy with a custom GraphQL mutation resolver. diff --git a/tests/Fixtures/TestBundle/Document/DummyDifferentGraphQlSerializationGroup.php b/tests/Fixtures/TestBundle/Document/DummyDifferentGraphQlSerializationGroup.php index 9f154aa58f0..af402a45107 100644 --- a/tests/Fixtures/TestBundle/Document/DummyDifferentGraphQlSerializationGroup.php +++ b/tests/Fixtures/TestBundle/Document/DummyDifferentGraphQlSerializationGroup.php @@ -17,7 +17,7 @@ use ApiPlatform\Metadata\GraphQl\Query; use ApiPlatform\Metadata\GraphQl\QueryCollection; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Dummy with different serialization groups for item_query and collection_query. diff --git a/tests/Fixtures/TestBundle/Document/DummyEntityWithConstructor.php b/tests/Fixtures/TestBundle/Document/DummyEntityWithConstructor.php index b9e0ef6d7f8..192eef47951 100644 --- a/tests/Fixtures/TestBundle/Document/DummyEntityWithConstructor.php +++ b/tests/Fixtures/TestBundle/Document/DummyEntityWithConstructor.php @@ -20,7 +20,7 @@ use ApiPlatform\Metadata\Put; use ApiPlatform\Tests\Fixtures\DummyObjectWithoutConstructor; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Dummy entity built with constructor. diff --git a/tests/Fixtures/TestBundle/Document/DummyFriend.php b/tests/Fixtures/TestBundle/Document/DummyFriend.php index acdfc482b70..dbee6c9a427 100644 --- a/tests/Fixtures/TestBundle/Document/DummyFriend.php +++ b/tests/Fixtures/TestBundle/Document/DummyFriend.php @@ -16,7 +16,7 @@ use ApiPlatform\Metadata\ApiProperty; use ApiPlatform\Metadata\ApiResource; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints as Assert; /** diff --git a/tests/Fixtures/TestBundle/Document/DummyGroup.php b/tests/Fixtures/TestBundle/Document/DummyGroup.php index f5519375c42..a6b407fe11e 100644 --- a/tests/Fixtures/TestBundle/Document/DummyGroup.php +++ b/tests/Fixtures/TestBundle/Document/DummyGroup.php @@ -18,7 +18,7 @@ use ApiPlatform\Metadata\GraphQl\Query; use ApiPlatform\Metadata\GraphQl\QueryCollection; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * DummyGroup. diff --git a/tests/Fixtures/TestBundle/Document/DummyProperty.php b/tests/Fixtures/TestBundle/Document/DummyProperty.php index c61c2c01902..7f31fd8daa0 100644 --- a/tests/Fixtures/TestBundle/Document/DummyProperty.php +++ b/tests/Fixtures/TestBundle/Document/DummyProperty.php @@ -19,7 +19,7 @@ use ApiPlatform\Metadata\GraphQl\QueryCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * DummyProperty. diff --git a/tests/Fixtures/TestBundle/Document/DummyTableInheritance.php b/tests/Fixtures/TestBundle/Document/DummyTableInheritance.php index 811403e3ada..774145386a8 100644 --- a/tests/Fixtures/TestBundle/Document/DummyTableInheritance.php +++ b/tests/Fixtures/TestBundle/Document/DummyTableInheritance.php @@ -15,7 +15,7 @@ use ApiPlatform\Metadata\ApiResource; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource] #[ODM\Document] diff --git a/tests/Fixtures/TestBundle/Document/DummyTableInheritanceChild.php b/tests/Fixtures/TestBundle/Document/DummyTableInheritanceChild.php index 1b17170603d..3547fc44d33 100644 --- a/tests/Fixtures/TestBundle/Document/DummyTableInheritanceChild.php +++ b/tests/Fixtures/TestBundle/Document/DummyTableInheritanceChild.php @@ -15,7 +15,7 @@ use ApiPlatform\Metadata\ApiResource; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource] #[ODM\Document] diff --git a/tests/Fixtures/TestBundle/Document/DummyTableInheritanceDifferentChild.php b/tests/Fixtures/TestBundle/Document/DummyTableInheritanceDifferentChild.php index 833dc1d54a2..2380c5d350f 100644 --- a/tests/Fixtures/TestBundle/Document/DummyTableInheritanceDifferentChild.php +++ b/tests/Fixtures/TestBundle/Document/DummyTableInheritanceDifferentChild.php @@ -15,7 +15,7 @@ use ApiPlatform\Metadata\ApiResource; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource] #[ODM\Document] diff --git a/tests/Fixtures/TestBundle/Document/DummyTableInheritanceRelated.php b/tests/Fixtures/TestBundle/Document/DummyTableInheritanceRelated.php index bc8c735310b..2df83b891b1 100644 --- a/tests/Fixtures/TestBundle/Document/DummyTableInheritanceRelated.php +++ b/tests/Fixtures/TestBundle/Document/DummyTableInheritanceRelated.php @@ -17,7 +17,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource(normalizationContext: ['groups' => ['default']], denormalizationContext: ['groups' => ['default']])] #[ODM\Document] diff --git a/tests/Fixtures/TestBundle/Document/DummyValidationSerializedName.php b/tests/Fixtures/TestBundle/Document/DummyValidationSerializedName.php index 8d1d875eed2..2b4f7bdfaeb 100644 --- a/tests/Fixtures/TestBundle/Document/DummyValidationSerializedName.php +++ b/tests/Fixtures/TestBundle/Document/DummyValidationSerializedName.php @@ -17,7 +17,7 @@ use ApiPlatform\Metadata\GetCollection; use ApiPlatform\Metadata\Post; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\SerializedName; +use Symfony\Component\Serializer\Attribute\SerializedName; use Symfony\Component\Validator\Constraints as Assert; #[ApiResource(operations: [ diff --git a/tests/Fixtures/TestBundle/Document/EmbeddableDummy.php b/tests/Fixtures/TestBundle/Document/EmbeddableDummy.php index bb2d8dae48c..7e09b431f08 100644 --- a/tests/Fixtures/TestBundle/Document/EmbeddableDummy.php +++ b/tests/Fixtures/TestBundle/Document/EmbeddableDummy.php @@ -14,7 +14,7 @@ namespace ApiPlatform\Tests\Fixtures\TestBundle\Document; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints as Assert; /** diff --git a/tests/Fixtures/TestBundle/Document/EmbeddedDummy.php b/tests/Fixtures/TestBundle/Document/EmbeddedDummy.php index aa3e5370bcc..1a41ebf0309 100644 --- a/tests/Fixtures/TestBundle/Document/EmbeddedDummy.php +++ b/tests/Fixtures/TestBundle/Document/EmbeddedDummy.php @@ -20,7 +20,7 @@ use ApiPlatform\Metadata\Post; use ApiPlatform\Metadata\Put; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints as Assert; /** diff --git a/tests/Fixtures/TestBundle/Document/Employee.php b/tests/Fixtures/TestBundle/Document/Employee.php index 339c1b0d734..892c9d1e6a5 100644 --- a/tests/Fixtures/TestBundle/Document/Employee.php +++ b/tests/Fixtures/TestBundle/Document/Employee.php @@ -18,7 +18,7 @@ use ApiPlatform\Metadata\GetCollection; use ApiPlatform\Metadata\Post; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource] #[Post] diff --git a/tests/Fixtures/TestBundle/Document/FourthLevel.php b/tests/Fixtures/TestBundle/Document/FourthLevel.php index bf653bfbc37..d2a9412d1ef 100644 --- a/tests/Fixtures/TestBundle/Document/FourthLevel.php +++ b/tests/Fixtures/TestBundle/Document/FourthLevel.php @@ -18,7 +18,7 @@ use ApiPlatform\Metadata\Link; use Doctrine\Common\Collections\Collection; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Fourth Level. diff --git a/tests/Fixtures/TestBundle/Document/MaxDepthDummy.php b/tests/Fixtures/TestBundle/Document/MaxDepthDummy.php index 05a34c5046f..0957d78881b 100644 --- a/tests/Fixtures/TestBundle/Document/MaxDepthDummy.php +++ b/tests/Fixtures/TestBundle/Document/MaxDepthDummy.php @@ -15,8 +15,8 @@ use ApiPlatform\Metadata\ApiResource; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; -use Symfony\Component\Serializer\Annotation\MaxDepth; +use Symfony\Component\Serializer\Attribute\Groups; +use Symfony\Component\Serializer\Attribute\MaxDepth; /** * @author Brian Fox diff --git a/tests/Fixtures/TestBundle/Document/MaxDepthEagerDummy.php b/tests/Fixtures/TestBundle/Document/MaxDepthEagerDummy.php index 5fef239b342..6aa501f3adc 100644 --- a/tests/Fixtures/TestBundle/Document/MaxDepthEagerDummy.php +++ b/tests/Fixtures/TestBundle/Document/MaxDepthEagerDummy.php @@ -15,8 +15,8 @@ use ApiPlatform\Metadata\ApiResource; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; -use Symfony\Component\Serializer\Annotation\MaxDepth; +use Symfony\Component\Serializer\Attribute\Groups; +use Symfony\Component\Serializer\Attribute\MaxDepth; /** * @author Brian Fox diff --git a/tests/Fixtures/TestBundle/Document/OptionalRequiredDummy.php b/tests/Fixtures/TestBundle/Document/OptionalRequiredDummy.php index 878bcdbb870..3b25155a8cb 100644 --- a/tests/Fixtures/TestBundle/Document/OptionalRequiredDummy.php +++ b/tests/Fixtures/TestBundle/Document/OptionalRequiredDummy.php @@ -20,7 +20,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * OptionalRequiredDummy. Used to test GraphQL Schema generation for nullable embedded relations. @@ -32,7 +32,7 @@ ], )] #[ODM\Document] -class OptionalRequiredDummy +class OptionalRequiredDummy implements \Stringable { #[ApiProperty(writable: false)] #[ODM\Id(strategy: 'INCREMENT', type: 'int')] diff --git a/tests/Fixtures/TestBundle/Document/Order.php b/tests/Fixtures/TestBundle/Document/Order.php index 0d01d99d01d..0079175e299 100644 --- a/tests/Fixtures/TestBundle/Document/Order.php +++ b/tests/Fixtures/TestBundle/Document/Order.php @@ -15,7 +15,7 @@ use ApiPlatform\Metadata\ApiResource; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints as Assert; #[ApiResource(normalizationContext: ['groups' => ['order_read']], forceEager: false)] diff --git a/tests/Fixtures/TestBundle/Document/OverriddenOperationDummy.php b/tests/Fixtures/TestBundle/Document/OverriddenOperationDummy.php index 1d10123afcc..1fa4a150f4b 100644 --- a/tests/Fixtures/TestBundle/Document/OverriddenOperationDummy.php +++ b/tests/Fixtures/TestBundle/Document/OverriddenOperationDummy.php @@ -21,7 +21,7 @@ use ApiPlatform\Metadata\Post; use ApiPlatform\Metadata\Put; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints as Assert; /** diff --git a/tests/Fixtures/TestBundle/Document/ParentDummy.php b/tests/Fixtures/TestBundle/Document/ParentDummy.php index 09f6569cf11..06714953424 100644 --- a/tests/Fixtures/TestBundle/Document/ParentDummy.php +++ b/tests/Fixtures/TestBundle/Document/ParentDummy.php @@ -14,7 +14,7 @@ namespace ApiPlatform\Tests\Fixtures\TestBundle\Document; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Parent Dummy. diff --git a/tests/Fixtures/TestBundle/Document/PatchDummyRelation.php b/tests/Fixtures/TestBundle/Document/PatchDummyRelation.php index 20092e36bb8..3161c7c25d4 100644 --- a/tests/Fixtures/TestBundle/Document/PatchDummyRelation.php +++ b/tests/Fixtures/TestBundle/Document/PatchDummyRelation.php @@ -19,7 +19,7 @@ use ApiPlatform\Metadata\Patch; use ApiPlatform\Metadata\Post; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * @author Kévin Dunglas diff --git a/tests/Fixtures/TestBundle/Document/Person.php b/tests/Fixtures/TestBundle/Document/Person.php index 14a243c4a39..eee37487fee 100644 --- a/tests/Fixtures/TestBundle/Document/Person.php +++ b/tests/Fixtures/TestBundle/Document/Person.php @@ -19,7 +19,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Person. diff --git a/tests/Fixtures/TestBundle/Document/PersonToPet.php b/tests/Fixtures/TestBundle/Document/PersonToPet.php index 819221e7d82..ee82f8914b8 100644 --- a/tests/Fixtures/TestBundle/Document/PersonToPet.php +++ b/tests/Fixtures/TestBundle/Document/PersonToPet.php @@ -14,7 +14,7 @@ namespace ApiPlatform\Tests\Fixtures\TestBundle\Document; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * PersonToPet. diff --git a/tests/Fixtures/TestBundle/Document/Pet.php b/tests/Fixtures/TestBundle/Document/Pet.php index 653aab39553..1f881afe2da 100644 --- a/tests/Fixtures/TestBundle/Document/Pet.php +++ b/tests/Fixtures/TestBundle/Document/Pet.php @@ -17,7 +17,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Pet. diff --git a/tests/Fixtures/TestBundle/Document/PropertyCollectionIriOnly.php b/tests/Fixtures/TestBundle/Document/PropertyCollectionIriOnly.php index c9dca0cdcc5..e34361f858f 100644 --- a/tests/Fixtures/TestBundle/Document/PropertyCollectionIriOnly.php +++ b/tests/Fixtures/TestBundle/Document/PropertyCollectionIriOnly.php @@ -20,7 +20,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Assert that a property being a collection set with ApiProperty::utiTemplate to true returns only the IRI of the collection. diff --git a/tests/Fixtures/TestBundle/Document/PropertyCollectionIriOnlyRelation.php b/tests/Fixtures/TestBundle/Document/PropertyCollectionIriOnlyRelation.php index af90a375e5e..cce05085a2d 100644 --- a/tests/Fixtures/TestBundle/Document/PropertyCollectionIriOnlyRelation.php +++ b/tests/Fixtures/TestBundle/Document/PropertyCollectionIriOnlyRelation.php @@ -20,7 +20,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ Post, diff --git a/tests/Fixtures/TestBundle/Document/PropertyUriTemplateOneToOneRelation.php b/tests/Fixtures/TestBundle/Document/PropertyUriTemplateOneToOneRelation.php index a521afb13e5..2e4b14c2060 100644 --- a/tests/Fixtures/TestBundle/Document/PropertyUriTemplateOneToOneRelation.php +++ b/tests/Fixtures/TestBundle/Document/PropertyUriTemplateOneToOneRelation.php @@ -18,7 +18,7 @@ use ApiPlatform\Metadata\Link; use ApiPlatform\Metadata\Post; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ Post, diff --git a/tests/Fixtures/TestBundle/Document/RelatedDummy.php b/tests/Fixtures/TestBundle/Document/RelatedDummy.php index 6a3678b6484..d61a7adfa35 100644 --- a/tests/Fixtures/TestBundle/Document/RelatedDummy.php +++ b/tests/Fixtures/TestBundle/Document/RelatedDummy.php @@ -27,7 +27,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints as Assert; /** diff --git a/tests/Fixtures/TestBundle/Document/RelatedNormalizedDummy.php b/tests/Fixtures/TestBundle/Document/RelatedNormalizedDummy.php index fa434c0a655..e7ff4782cbc 100644 --- a/tests/Fixtures/TestBundle/Document/RelatedNormalizedDummy.php +++ b/tests/Fixtures/TestBundle/Document/RelatedNormalizedDummy.php @@ -18,7 +18,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints as Assert; /** diff --git a/tests/Fixtures/TestBundle/Document/RelatedToDummyFriend.php b/tests/Fixtures/TestBundle/Document/RelatedToDummyFriend.php index 8955436b628..f68b87cf7d7 100644 --- a/tests/Fixtures/TestBundle/Document/RelatedToDummyFriend.php +++ b/tests/Fixtures/TestBundle/Document/RelatedToDummyFriend.php @@ -18,7 +18,7 @@ use ApiPlatform\Metadata\GetCollection; use ApiPlatform\Metadata\Link; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints as Assert; /** diff --git a/tests/Fixtures/TestBundle/Document/RelationEmbedder.php b/tests/Fixtures/TestBundle/Document/RelationEmbedder.php index 0e57190dc90..df28a673fc2 100644 --- a/tests/Fixtures/TestBundle/Document/RelationEmbedder.php +++ b/tests/Fixtures/TestBundle/Document/RelationEmbedder.php @@ -20,7 +20,7 @@ use ApiPlatform\Metadata\Post; use ApiPlatform\Metadata\Put; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Relation Embedder. diff --git a/tests/Fixtures/TestBundle/Document/ThirdLevel.php b/tests/Fixtures/TestBundle/Document/ThirdLevel.php index ef482a6564a..a5cd5c420f4 100644 --- a/tests/Fixtures/TestBundle/Document/ThirdLevel.php +++ b/tests/Fixtures/TestBundle/Document/ThirdLevel.php @@ -19,7 +19,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Third Level. diff --git a/tests/Fixtures/TestBundle/Document/User.php b/tests/Fixtures/TestBundle/Document/User.php index e7741ea0f26..30a2c58e86d 100644 --- a/tests/Fixtures/TestBundle/Document/User.php +++ b/tests/Fixtures/TestBundle/Document/User.php @@ -26,7 +26,7 @@ use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; use Symfony\Component\Security\Core\User\UserInterface; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * A User. diff --git a/tests/Fixtures/TestBundle/Document/VoDummyCar.php b/tests/Fixtures/TestBundle/Document/VoDummyCar.php index 28609813c15..00f81db14c7 100644 --- a/tests/Fixtures/TestBundle/Document/VoDummyCar.php +++ b/tests/Fixtures/TestBundle/Document/VoDummyCar.php @@ -17,7 +17,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource(normalizationContext: ['groups' => ['car_read']], denormalizationContext: ['groups' => ['car_write']])] #[ODM\Document] diff --git a/tests/Fixtures/TestBundle/Document/VoDummyDriver.php b/tests/Fixtures/TestBundle/Document/VoDummyDriver.php index 47053d4b937..168cbb4bb80 100644 --- a/tests/Fixtures/TestBundle/Document/VoDummyDriver.php +++ b/tests/Fixtures/TestBundle/Document/VoDummyDriver.php @@ -15,7 +15,7 @@ use ApiPlatform\Metadata\ApiResource; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource] #[ODM\Document] diff --git a/tests/Fixtures/TestBundle/Document/VoDummyInspection.php b/tests/Fixtures/TestBundle/Document/VoDummyInspection.php index 31b8c4d51ca..29ef49d9017 100644 --- a/tests/Fixtures/TestBundle/Document/VoDummyInspection.php +++ b/tests/Fixtures/TestBundle/Document/VoDummyInspection.php @@ -15,7 +15,7 @@ use ApiPlatform\Metadata\ApiResource; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource(graphQlOperations: [], normalizationContext: ['groups' => ['inspection_read']], denormalizationContext: ['groups' => ['inspection_write']], extraProperties: ['standard_put' => false])] #[ODM\Document] diff --git a/tests/Fixtures/TestBundle/Document/VoDummyInsuranceCompany.php b/tests/Fixtures/TestBundle/Document/VoDummyInsuranceCompany.php index bbc576d787a..3fc642ecc24 100644 --- a/tests/Fixtures/TestBundle/Document/VoDummyInsuranceCompany.php +++ b/tests/Fixtures/TestBundle/Document/VoDummyInsuranceCompany.php @@ -15,7 +15,7 @@ use ApiPlatform\Metadata\ApiResource; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource] #[ODM\Document] diff --git a/tests/Fixtures/TestBundle/Document/VoDummyVehicle.php b/tests/Fixtures/TestBundle/Document/VoDummyVehicle.php index cd84cf99916..c77440652f1 100644 --- a/tests/Fixtures/TestBundle/Document/VoDummyVehicle.php +++ b/tests/Fixtures/TestBundle/Document/VoDummyVehicle.php @@ -16,7 +16,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ODM\MappedSuperclass] abstract class VoDummyVehicle diff --git a/tests/Fixtures/TestBundle/Dto/CustomOutputEntityWrapperDto.php b/tests/Fixtures/TestBundle/Dto/CustomOutputEntityWrapperDto.php index 700e5fdc5b4..f5041b0d36a 100644 --- a/tests/Fixtures/TestBundle/Dto/CustomOutputEntityWrapperDto.php +++ b/tests/Fixtures/TestBundle/Dto/CustomOutputEntityWrapperDto.php @@ -14,7 +14,7 @@ namespace ApiPlatform\Tests\Fixtures\TestBundle\Dto; use ApiPlatform\Tests\Fixtures\TestBundle\Entity\WrappedResponseEntity; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; class CustomOutputEntityWrapperDto { diff --git a/tests/Fixtures/TestBundle/Dto/PasswordResetRequest.php b/tests/Fixtures/TestBundle/Dto/PasswordResetRequest.php index 5aabbac378d..be20bd3f3c1 100644 --- a/tests/Fixtures/TestBundle/Dto/PasswordResetRequest.php +++ b/tests/Fixtures/TestBundle/Dto/PasswordResetRequest.php @@ -13,7 +13,7 @@ namespace ApiPlatform\Tests\Fixtures\TestBundle\Dto; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; final class PasswordResetRequest { diff --git a/tests/Fixtures/TestBundle/Dto/PasswordResetRequestResult.php b/tests/Fixtures/TestBundle/Dto/PasswordResetRequestResult.php index 97c37ce8b74..5635d5f533a 100644 --- a/tests/Fixtures/TestBundle/Dto/PasswordResetRequestResult.php +++ b/tests/Fixtures/TestBundle/Dto/PasswordResetRequestResult.php @@ -13,7 +13,7 @@ namespace ApiPlatform\Tests\Fixtures\TestBundle\Dto; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; final class PasswordResetRequestResult { diff --git a/tests/Fixtures/TestBundle/Dto/RecoverPasswordInput.php b/tests/Fixtures/TestBundle/Dto/RecoverPasswordInput.php index 49984346547..8c8a4f7fc30 100644 --- a/tests/Fixtures/TestBundle/Dto/RecoverPasswordInput.php +++ b/tests/Fixtures/TestBundle/Dto/RecoverPasswordInput.php @@ -14,7 +14,7 @@ namespace ApiPlatform\Tests\Fixtures\TestBundle\Dto; use ApiPlatform\Tests\Fixtures\TestBundle\Entity\User; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; class RecoverPasswordInput { diff --git a/tests/Fixtures/TestBundle/Dto/RecoverPasswordOutput.php b/tests/Fixtures/TestBundle/Dto/RecoverPasswordOutput.php index f1f0d0752c9..44700c7e50f 100644 --- a/tests/Fixtures/TestBundle/Dto/RecoverPasswordOutput.php +++ b/tests/Fixtures/TestBundle/Dto/RecoverPasswordOutput.php @@ -14,7 +14,7 @@ namespace ApiPlatform\Tests\Fixtures\TestBundle\Dto; use ApiPlatform\Tests\Fixtures\TestBundle\Entity\Dummy; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; class RecoverPasswordOutput { diff --git a/tests/Fixtures/TestBundle/Entity/Address.php b/tests/Fixtures/TestBundle/Entity/Address.php index 1acf767e757..31ef01b6aae 100644 --- a/tests/Fixtures/TestBundle/Entity/Address.php +++ b/tests/Fixtures/TestBundle/Entity/Address.php @@ -15,7 +15,7 @@ use ApiPlatform\Metadata\ApiResource; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource] #[ORM\Entity] diff --git a/tests/Fixtures/TestBundle/Entity/Answer.php b/tests/Fixtures/TestBundle/Entity/Answer.php index ec22268a5be..0eda5f4063a 100644 --- a/tests/Fixtures/TestBundle/Entity/Answer.php +++ b/tests/Fixtures/TestBundle/Entity/Answer.php @@ -23,7 +23,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation as Serializer; +use Symfony\Component\Serializer\Attribute as Serializer; /** * Answer. diff --git a/tests/Fixtures/TestBundle/Entity/CircularReference.php b/tests/Fixtures/TestBundle/Entity/CircularReference.php index 1c7bdf06844..c4f36d51ff8 100644 --- a/tests/Fixtures/TestBundle/Entity/CircularReference.php +++ b/tests/Fixtures/TestBundle/Entity/CircularReference.php @@ -17,7 +17,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Circular Reference. diff --git a/tests/Fixtures/TestBundle/Entity/Company.php b/tests/Fixtures/TestBundle/Entity/Company.php index 976e23d3380..caac42fc8fc 100644 --- a/tests/Fixtures/TestBundle/Entity/Company.php +++ b/tests/Fixtures/TestBundle/Entity/Company.php @@ -21,7 +21,7 @@ use ApiPlatform\Metadata\Operation; use ApiPlatform\Metadata\Post; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource] #[GetCollection] diff --git a/tests/Fixtures/TestBundle/Entity/CompositeItem.php b/tests/Fixtures/TestBundle/Entity/CompositeItem.php index e049b5bbf8f..5954245ba48 100644 --- a/tests/Fixtures/TestBundle/Entity/CompositeItem.php +++ b/tests/Fixtures/TestBundle/Entity/CompositeItem.php @@ -17,7 +17,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Composite Item. diff --git a/tests/Fixtures/TestBundle/Entity/CompositeLabel.php b/tests/Fixtures/TestBundle/Entity/CompositeLabel.php index f94218d6550..1bba1b6edc6 100644 --- a/tests/Fixtures/TestBundle/Entity/CompositeLabel.php +++ b/tests/Fixtures/TestBundle/Entity/CompositeLabel.php @@ -15,7 +15,7 @@ use ApiPlatform\Metadata\ApiResource; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Composite Label. diff --git a/tests/Fixtures/TestBundle/Entity/CompositeRelation.php b/tests/Fixtures/TestBundle/Entity/CompositeRelation.php index 183a726cb14..a876c6088df 100644 --- a/tests/Fixtures/TestBundle/Entity/CompositeRelation.php +++ b/tests/Fixtures/TestBundle/Entity/CompositeRelation.php @@ -15,7 +15,7 @@ use ApiPlatform\Metadata\ApiResource; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Composite Relation. diff --git a/tests/Fixtures/TestBundle/Entity/ContainNonResource.php b/tests/Fixtures/TestBundle/Entity/ContainNonResource.php index b1d0236609f..29c72a39c93 100644 --- a/tests/Fixtures/TestBundle/Entity/ContainNonResource.php +++ b/tests/Fixtures/TestBundle/Entity/ContainNonResource.php @@ -16,7 +16,7 @@ use ApiPlatform\Metadata\ApiResource; use ApiPlatform\Tests\Fixtures\NotAResource; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Resource linked to a standard object. diff --git a/tests/Fixtures/TestBundle/Entity/Content.php b/tests/Fixtures/TestBundle/Entity/Content.php index 4a447c3748a..13bd298b54e 100644 --- a/tests/Fixtures/TestBundle/Entity/Content.php +++ b/tests/Fixtures/TestBundle/Entity/Content.php @@ -18,7 +18,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource(normalizationContext: ['groups' => ['get_content']])] #[ORM\Entity] diff --git a/tests/Fixtures/TestBundle/Entity/CustomNormalizedDummy.php b/tests/Fixtures/TestBundle/Entity/CustomNormalizedDummy.php index f76228e4f16..70c80c48fc0 100644 --- a/tests/Fixtures/TestBundle/Entity/CustomNormalizedDummy.php +++ b/tests/Fixtures/TestBundle/Entity/CustomNormalizedDummy.php @@ -16,7 +16,7 @@ use ApiPlatform\Metadata\ApiProperty; use ApiPlatform\Metadata\ApiResource; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints as Assert; /** diff --git a/tests/Fixtures/TestBundle/Entity/Customer.php b/tests/Fixtures/TestBundle/Entity/Customer.php index 1d3f6d42a13..dcc9de473cf 100644 --- a/tests/Fixtures/TestBundle/Entity/Customer.php +++ b/tests/Fixtures/TestBundle/Entity/Customer.php @@ -17,7 +17,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource] #[ORM\Entity] diff --git a/tests/Fixtures/TestBundle/Entity/DummyCar.php b/tests/Fixtures/TestBundle/Entity/DummyCar.php index 3991a1da6a8..7749d3ccc9b 100644 --- a/tests/Fixtures/TestBundle/Entity/DummyCar.php +++ b/tests/Fixtures/TestBundle/Entity/DummyCar.php @@ -29,7 +29,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation as Serializer; +use Symfony\Component\Serializer\Attribute as Serializer; #[ApiFilter(DateFilter::class, strategy: DateFilter::EXCLUDE_NULL)] #[ApiFilter(BooleanFilter::class)] diff --git a/tests/Fixtures/TestBundle/Entity/DummyCarColor.php b/tests/Fixtures/TestBundle/Entity/DummyCarColor.php index 83de8c8bbae..f1d90e2ebac 100644 --- a/tests/Fixtures/TestBundle/Entity/DummyCarColor.php +++ b/tests/Fixtures/TestBundle/Entity/DummyCarColor.php @@ -17,7 +17,7 @@ use ApiPlatform\Metadata\ApiFilter; use ApiPlatform\Metadata\ApiResource; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation as Serializer; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints as Assert; #[ApiResource] @@ -38,7 +38,7 @@ class DummyCarColor #[ApiFilter(SearchFilter::class)] #[ORM\Column(nullable: false)] #[Assert\NotBlank] - #[Serializer\Groups(['colors'])] + #[Groups(['colors'])] private string $prop = ''; public function getId(): ?int diff --git a/tests/Fixtures/TestBundle/Entity/DummyCustomMutation.php b/tests/Fixtures/TestBundle/Entity/DummyCustomMutation.php index 4aa12998c6f..e37d1ebc04a 100644 --- a/tests/Fixtures/TestBundle/Entity/DummyCustomMutation.php +++ b/tests/Fixtures/TestBundle/Entity/DummyCustomMutation.php @@ -16,7 +16,7 @@ use ApiPlatform\Metadata\ApiResource; use ApiPlatform\Metadata\GraphQl\Mutation; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Dummy with a custom GraphQL mutation resolver. diff --git a/tests/Fixtures/TestBundle/Entity/DummyDifferentGraphQlSerializationGroup.php b/tests/Fixtures/TestBundle/Entity/DummyDifferentGraphQlSerializationGroup.php index 5de1690e540..7370cbbe161 100644 --- a/tests/Fixtures/TestBundle/Entity/DummyDifferentGraphQlSerializationGroup.php +++ b/tests/Fixtures/TestBundle/Entity/DummyDifferentGraphQlSerializationGroup.php @@ -17,7 +17,7 @@ use ApiPlatform\Metadata\GraphQl\Query; use ApiPlatform\Metadata\GraphQl\QueryCollection; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Dummy with different serialization groups for item_query and collection_query. diff --git a/tests/Fixtures/TestBundle/Entity/DummyEntityWithConstructor.php b/tests/Fixtures/TestBundle/Entity/DummyEntityWithConstructor.php index 0e6f6087e60..d43d415a03d 100644 --- a/tests/Fixtures/TestBundle/Entity/DummyEntityWithConstructor.php +++ b/tests/Fixtures/TestBundle/Entity/DummyEntityWithConstructor.php @@ -20,7 +20,7 @@ use ApiPlatform\Metadata\Put; use ApiPlatform\Tests\Fixtures\DummyObjectWithoutConstructor; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Dummy entity built with constructor. diff --git a/tests/Fixtures/TestBundle/Entity/DummyFriend.php b/tests/Fixtures/TestBundle/Entity/DummyFriend.php index 2d3e5709fbb..0d34e1cc2dd 100644 --- a/tests/Fixtures/TestBundle/Entity/DummyFriend.php +++ b/tests/Fixtures/TestBundle/Entity/DummyFriend.php @@ -16,7 +16,7 @@ use ApiPlatform\Metadata\ApiProperty; use ApiPlatform\Metadata\ApiResource; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints as Assert; /** diff --git a/tests/Fixtures/TestBundle/Entity/DummyGroup.php b/tests/Fixtures/TestBundle/Entity/DummyGroup.php index 5586c0d1077..0a40c553866 100644 --- a/tests/Fixtures/TestBundle/Entity/DummyGroup.php +++ b/tests/Fixtures/TestBundle/Entity/DummyGroup.php @@ -18,7 +18,7 @@ use ApiPlatform\Metadata\GraphQl\Query; use ApiPlatform\Metadata\GraphQl\QueryCollection; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * DummyGroup. diff --git a/tests/Fixtures/TestBundle/Entity/DummyProperty.php b/tests/Fixtures/TestBundle/Entity/DummyProperty.php index d0d6b84032b..d6c1fec4e2d 100644 --- a/tests/Fixtures/TestBundle/Entity/DummyProperty.php +++ b/tests/Fixtures/TestBundle/Entity/DummyProperty.php @@ -19,7 +19,7 @@ use ApiPlatform\Metadata\GraphQl\QueryCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * DummyProperty. diff --git a/tests/Fixtures/TestBundle/Entity/DummyPropertyWithDefaultValue.php b/tests/Fixtures/TestBundle/Entity/DummyPropertyWithDefaultValue.php index 8aeed68c43a..b6a8fe584be 100644 --- a/tests/Fixtures/TestBundle/Entity/DummyPropertyWithDefaultValue.php +++ b/tests/Fixtures/TestBundle/Entity/DummyPropertyWithDefaultValue.php @@ -15,7 +15,7 @@ use ApiPlatform\Metadata\ApiResource; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * DummyPropertyWithDefaultValue. diff --git a/tests/Fixtures/TestBundle/Entity/DummyTableInheritance.php b/tests/Fixtures/TestBundle/Entity/DummyTableInheritance.php index 391f1d92081..43681ffbfb2 100644 --- a/tests/Fixtures/TestBundle/Entity/DummyTableInheritance.php +++ b/tests/Fixtures/TestBundle/Entity/DummyTableInheritance.php @@ -15,7 +15,7 @@ use ApiPlatform\Metadata\ApiResource; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource] #[ORM\Entity] diff --git a/tests/Fixtures/TestBundle/Entity/DummyTableInheritanceChild.php b/tests/Fixtures/TestBundle/Entity/DummyTableInheritanceChild.php index 6adaa87b185..1e9b536a713 100644 --- a/tests/Fixtures/TestBundle/Entity/DummyTableInheritanceChild.php +++ b/tests/Fixtures/TestBundle/Entity/DummyTableInheritanceChild.php @@ -15,7 +15,7 @@ use ApiPlatform\Metadata\ApiResource; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource] #[ORM\Entity] diff --git a/tests/Fixtures/TestBundle/Entity/DummyTableInheritanceDifferentChild.php b/tests/Fixtures/TestBundle/Entity/DummyTableInheritanceDifferentChild.php index 383d2d999c4..94d749f122b 100644 --- a/tests/Fixtures/TestBundle/Entity/DummyTableInheritanceDifferentChild.php +++ b/tests/Fixtures/TestBundle/Entity/DummyTableInheritanceDifferentChild.php @@ -15,7 +15,7 @@ use ApiPlatform\Metadata\ApiResource; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource] #[ORM\Entity] diff --git a/tests/Fixtures/TestBundle/Entity/DummyTableInheritanceRelated.php b/tests/Fixtures/TestBundle/Entity/DummyTableInheritanceRelated.php index e0032d28b4f..f9359f1f2b7 100644 --- a/tests/Fixtures/TestBundle/Entity/DummyTableInheritanceRelated.php +++ b/tests/Fixtures/TestBundle/Entity/DummyTableInheritanceRelated.php @@ -17,7 +17,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource(normalizationContext: ['groups' => ['default']], denormalizationContext: ['groups' => ['default']])] #[ORM\Entity] diff --git a/tests/Fixtures/TestBundle/Entity/DummyValidationSerializedName.php b/tests/Fixtures/TestBundle/Entity/DummyValidationSerializedName.php index 8e331031ab5..c9bb7cbd98f 100644 --- a/tests/Fixtures/TestBundle/Entity/DummyValidationSerializedName.php +++ b/tests/Fixtures/TestBundle/Entity/DummyValidationSerializedName.php @@ -17,7 +17,7 @@ use ApiPlatform\Metadata\GetCollection; use ApiPlatform\Metadata\Post; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\SerializedName; +use Symfony\Component\Serializer\Attribute\SerializedName; use Symfony\Component\Validator\Constraints as Assert; #[ApiResource(operations: [ diff --git a/tests/Fixtures/TestBundle/Entity/EmbeddableDummy.php b/tests/Fixtures/TestBundle/Entity/EmbeddableDummy.php index e3bc042b3c9..70aa043b522 100644 --- a/tests/Fixtures/TestBundle/Entity/EmbeddableDummy.php +++ b/tests/Fixtures/TestBundle/Entity/EmbeddableDummy.php @@ -15,7 +15,7 @@ use ApiPlatform\Metadata\ApiProperty; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints as Assert; /** diff --git a/tests/Fixtures/TestBundle/Entity/EmbeddedDummy.php b/tests/Fixtures/TestBundle/Entity/EmbeddedDummy.php index b85fddffc55..8ac522de7fe 100644 --- a/tests/Fixtures/TestBundle/Entity/EmbeddedDummy.php +++ b/tests/Fixtures/TestBundle/Entity/EmbeddedDummy.php @@ -20,7 +20,7 @@ use ApiPlatform\Metadata\Post; use ApiPlatform\Metadata\Put; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints as Assert; /** diff --git a/tests/Fixtures/TestBundle/Entity/Employee.php b/tests/Fixtures/TestBundle/Entity/Employee.php index 66916b8d9b5..4ce7b9a3526 100644 --- a/tests/Fixtures/TestBundle/Entity/Employee.php +++ b/tests/Fixtures/TestBundle/Entity/Employee.php @@ -19,7 +19,7 @@ use ApiPlatform\Metadata\Link; use ApiPlatform\Metadata\Post; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints\Expression; #[ApiResource] diff --git a/tests/Fixtures/TestBundle/Entity/FourthLevel.php b/tests/Fixtures/TestBundle/Entity/FourthLevel.php index b62eaed1b27..cb0313b5dec 100644 --- a/tests/Fixtures/TestBundle/Entity/FourthLevel.php +++ b/tests/Fixtures/TestBundle/Entity/FourthLevel.php @@ -18,7 +18,7 @@ use ApiPlatform\Metadata\Link; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Fourth Level. diff --git a/tests/Fixtures/TestBundle/Entity/Issue5587/Business.php b/tests/Fixtures/TestBundle/Entity/Issue5587/Business.php index acf60ae7c4e..2471dfb2d9c 100644 --- a/tests/Fixtures/TestBundle/Entity/Issue5587/Business.php +++ b/tests/Fixtures/TestBundle/Entity/Issue5587/Business.php @@ -20,7 +20,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource( shortName: 'issue5584_business', diff --git a/tests/Fixtures/TestBundle/Entity/Issue5587/Employee.php b/tests/Fixtures/TestBundle/Entity/Issue5587/Employee.php index 4d37d03007b..d2bac3b73b8 100644 --- a/tests/Fixtures/TestBundle/Entity/Issue5587/Employee.php +++ b/tests/Fixtures/TestBundle/Entity/Issue5587/Employee.php @@ -16,7 +16,7 @@ use ApiPlatform\Metadata\ApiResource; use ApiPlatform\Metadata\Post; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource( shortName: 'issue5584_employee', diff --git a/tests/Fixtures/TestBundle/Entity/Issue5793/BagOfTests.php b/tests/Fixtures/TestBundle/Entity/Issue5793/BagOfTests.php index 74494409068..0a953efaa8e 100644 --- a/tests/Fixtures/TestBundle/Entity/Issue5793/BagOfTests.php +++ b/tests/Fixtures/TestBundle/Entity/Issue5793/BagOfTests.php @@ -18,7 +18,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ORM\Entity] #[ApiResource( diff --git a/tests/Fixtures/TestBundle/Entity/Issue5793/NonResourceTestEntity.php b/tests/Fixtures/TestBundle/Entity/Issue5793/NonResourceTestEntity.php index f6d4fe1d1a6..63790b16439 100644 --- a/tests/Fixtures/TestBundle/Entity/Issue5793/NonResourceTestEntity.php +++ b/tests/Fixtures/TestBundle/Entity/Issue5793/NonResourceTestEntity.php @@ -14,7 +14,7 @@ namespace ApiPlatform\Tests\Fixtures\TestBundle\Entity\Issue5793; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ORM\Entity] class NonResourceTestEntity diff --git a/tests/Fixtures/TestBundle/Entity/Issue5793/TestEntity.php b/tests/Fixtures/TestBundle/Entity/Issue5793/TestEntity.php index 72c2129f531..e4e2b32e407 100644 --- a/tests/Fixtures/TestBundle/Entity/Issue5793/TestEntity.php +++ b/tests/Fixtures/TestBundle/Entity/Issue5793/TestEntity.php @@ -15,7 +15,7 @@ use ApiPlatform\Metadata\ApiResource; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ORM\Entity] #[ApiResource] diff --git a/tests/Fixtures/TestBundle/Entity/Issue5998/ProductCode.php b/tests/Fixtures/TestBundle/Entity/Issue5998/ProductCode.php index fe828a8bb19..73d758d90e0 100644 --- a/tests/Fixtures/TestBundle/Entity/Issue5998/ProductCode.php +++ b/tests/Fixtures/TestBundle/Entity/Issue5998/ProductCode.php @@ -16,7 +16,7 @@ use ApiPlatform\Metadata\ApiResource; use ApiPlatform\Metadata\Get; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource] #[Get] diff --git a/tests/Fixtures/TestBundle/Entity/Issue5998/SaveProduct.php b/tests/Fixtures/TestBundle/Entity/Issue5998/SaveProduct.php index d75b243ce7b..9529733e35b 100644 --- a/tests/Fixtures/TestBundle/Entity/Issue5998/SaveProduct.php +++ b/tests/Fixtures/TestBundle/Entity/Issue5998/SaveProduct.php @@ -15,7 +15,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; class SaveProduct { diff --git a/tests/Fixtures/TestBundle/Entity/Issue6225/Bar6225.php b/tests/Fixtures/TestBundle/Entity/Issue6225/Bar6225.php index d2658ff41c7..6841ef44182 100644 --- a/tests/Fixtures/TestBundle/Entity/Issue6225/Bar6225.php +++ b/tests/Fixtures/TestBundle/Entity/Issue6225/Bar6225.php @@ -15,7 +15,7 @@ use ApiPlatform\Metadata\ApiResource; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Uid\Uuid; #[ORM\Entity] diff --git a/tests/Fixtures/TestBundle/Entity/Issue6225/Foo6225.php b/tests/Fixtures/TestBundle/Entity/Issue6225/Foo6225.php index 7f625901db2..ba035331d24 100644 --- a/tests/Fixtures/TestBundle/Entity/Issue6225/Foo6225.php +++ b/tests/Fixtures/TestBundle/Entity/Issue6225/Foo6225.php @@ -17,7 +17,7 @@ use ApiPlatform\Metadata\Patch; use ApiPlatform\Metadata\Post; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Uid\Uuid; #[ORM\Entity()] diff --git a/tests/Fixtures/TestBundle/Entity/MaxDepthDummy.php b/tests/Fixtures/TestBundle/Entity/MaxDepthDummy.php index 01ae4d14c16..6ce73290254 100644 --- a/tests/Fixtures/TestBundle/Entity/MaxDepthDummy.php +++ b/tests/Fixtures/TestBundle/Entity/MaxDepthDummy.php @@ -16,8 +16,8 @@ use ApiPlatform\Metadata\ApiProperty; use ApiPlatform\Metadata\ApiResource; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; -use Symfony\Component\Serializer\Annotation\MaxDepth; +use Symfony\Component\Serializer\Attribute\Groups; +use Symfony\Component\Serializer\Attribute\MaxDepth; /** * @author Brian Fox diff --git a/tests/Fixtures/TestBundle/Entity/MaxDepthEagerDummy.php b/tests/Fixtures/TestBundle/Entity/MaxDepthEagerDummy.php index 80f8ca62424..3a796b31542 100644 --- a/tests/Fixtures/TestBundle/Entity/MaxDepthEagerDummy.php +++ b/tests/Fixtures/TestBundle/Entity/MaxDepthEagerDummy.php @@ -15,8 +15,8 @@ use ApiPlatform\Metadata\ApiResource; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; -use Symfony\Component\Serializer\Annotation\MaxDepth; +use Symfony\Component\Serializer\Attribute\Groups; +use Symfony\Component\Serializer\Attribute\MaxDepth; /** * @author Brian Fox diff --git a/tests/Fixtures/TestBundle/Entity/OptionalRequiredDummy.php b/tests/Fixtures/TestBundle/Entity/OptionalRequiredDummy.php index 4ac60db1e85..49dd6604206 100644 --- a/tests/Fixtures/TestBundle/Entity/OptionalRequiredDummy.php +++ b/tests/Fixtures/TestBundle/Entity/OptionalRequiredDummy.php @@ -20,7 +20,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * OptionalRequiredDummy. Used to test GraphQL Schema generation for nullable embedded relations. @@ -32,7 +32,7 @@ ], )] #[ORM\Entity] -class OptionalRequiredDummy +class OptionalRequiredDummy implements \Stringable { #[ApiProperty(writable: false)] #[ORM\Column(type: 'integer')] diff --git a/tests/Fixtures/TestBundle/Entity/Order.php b/tests/Fixtures/TestBundle/Entity/Order.php index 11febcf8285..3588afdbd56 100644 --- a/tests/Fixtures/TestBundle/Entity/Order.php +++ b/tests/Fixtures/TestBundle/Entity/Order.php @@ -15,7 +15,7 @@ use ApiPlatform\Metadata\ApiResource; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints as Assert; #[ApiResource(normalizationContext: ['groups' => ['order_read']], forceEager: false)] diff --git a/tests/Fixtures/TestBundle/Entity/OverriddenOperationDummy.php b/tests/Fixtures/TestBundle/Entity/OverriddenOperationDummy.php index dfed1078532..aa56dbcfbdc 100644 --- a/tests/Fixtures/TestBundle/Entity/OverriddenOperationDummy.php +++ b/tests/Fixtures/TestBundle/Entity/OverriddenOperationDummy.php @@ -21,7 +21,7 @@ use ApiPlatform\Metadata\Post; use ApiPlatform\Metadata\Put; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints as Assert; /** diff --git a/tests/Fixtures/TestBundle/Entity/ParentDummy.php b/tests/Fixtures/TestBundle/Entity/ParentDummy.php index 185830f8cb0..b99b88f53b9 100644 --- a/tests/Fixtures/TestBundle/Entity/ParentDummy.php +++ b/tests/Fixtures/TestBundle/Entity/ParentDummy.php @@ -14,7 +14,7 @@ namespace ApiPlatform\Tests\Fixtures\TestBundle\Entity; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Parent Dummy. diff --git a/tests/Fixtures/TestBundle/Entity/PatchDummyRelation.php b/tests/Fixtures/TestBundle/Entity/PatchDummyRelation.php index 28b5b26d326..fd16148b9ce 100644 --- a/tests/Fixtures/TestBundle/Entity/PatchDummyRelation.php +++ b/tests/Fixtures/TestBundle/Entity/PatchDummyRelation.php @@ -19,7 +19,7 @@ use ApiPlatform\Metadata\Patch; use ApiPlatform\Metadata\Post; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * @author Kévin Dunglas diff --git a/tests/Fixtures/TestBundle/Entity/Person.php b/tests/Fixtures/TestBundle/Entity/Person.php index d17c774ca75..f73c4890381 100644 --- a/tests/Fixtures/TestBundle/Entity/Person.php +++ b/tests/Fixtures/TestBundle/Entity/Person.php @@ -19,7 +19,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Person. diff --git a/tests/Fixtures/TestBundle/Entity/PersonToPet.php b/tests/Fixtures/TestBundle/Entity/PersonToPet.php index 30b1f7c9aaf..e41465c6088 100644 --- a/tests/Fixtures/TestBundle/Entity/PersonToPet.php +++ b/tests/Fixtures/TestBundle/Entity/PersonToPet.php @@ -14,7 +14,7 @@ namespace ApiPlatform\Tests\Fixtures\TestBundle\Entity; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * PersonToPet. diff --git a/tests/Fixtures/TestBundle/Entity/Pet.php b/tests/Fixtures/TestBundle/Entity/Pet.php index 85706a4f6a3..56eeff0c3b3 100644 --- a/tests/Fixtures/TestBundle/Entity/Pet.php +++ b/tests/Fixtures/TestBundle/Entity/Pet.php @@ -17,7 +17,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Pet. diff --git a/tests/Fixtures/TestBundle/Entity/PropertyCollectionIriOnly.php b/tests/Fixtures/TestBundle/Entity/PropertyCollectionIriOnly.php index b5cddfe49d0..75eb57474fd 100644 --- a/tests/Fixtures/TestBundle/Entity/PropertyCollectionIriOnly.php +++ b/tests/Fixtures/TestBundle/Entity/PropertyCollectionIriOnly.php @@ -20,7 +20,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Assert that a property being a collection set with ApiProperty::UriTemplate to true returns only the IRI of the collection. diff --git a/tests/Fixtures/TestBundle/Entity/PropertyCollectionIriOnlyRelation.php b/tests/Fixtures/TestBundle/Entity/PropertyCollectionIriOnlyRelation.php index 4eae5c6a749..491390c7ebd 100644 --- a/tests/Fixtures/TestBundle/Entity/PropertyCollectionIriOnlyRelation.php +++ b/tests/Fixtures/TestBundle/Entity/PropertyCollectionIriOnlyRelation.php @@ -20,7 +20,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints\NotBlank; #[ diff --git a/tests/Fixtures/TestBundle/Entity/PropertyUriTemplateOneToOneRelation.php b/tests/Fixtures/TestBundle/Entity/PropertyUriTemplateOneToOneRelation.php index 3debae85f38..e9dc120746a 100644 --- a/tests/Fixtures/TestBundle/Entity/PropertyUriTemplateOneToOneRelation.php +++ b/tests/Fixtures/TestBundle/Entity/PropertyUriTemplateOneToOneRelation.php @@ -18,7 +18,7 @@ use ApiPlatform\Metadata\Link; use ApiPlatform\Metadata\Post; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints\NotBlank; #[ diff --git a/tests/Fixtures/TestBundle/Entity/RelatedDummy.php b/tests/Fixtures/TestBundle/Entity/RelatedDummy.php index f51c467159a..b8a3f562363 100644 --- a/tests/Fixtures/TestBundle/Entity/RelatedDummy.php +++ b/tests/Fixtures/TestBundle/Entity/RelatedDummy.php @@ -27,7 +27,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints as Assert; /** diff --git a/tests/Fixtures/TestBundle/Entity/RelatedNormalizedDummy.php b/tests/Fixtures/TestBundle/Entity/RelatedNormalizedDummy.php index 4c7598f3ece..3eecf03ac29 100644 --- a/tests/Fixtures/TestBundle/Entity/RelatedNormalizedDummy.php +++ b/tests/Fixtures/TestBundle/Entity/RelatedNormalizedDummy.php @@ -18,7 +18,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints as Assert; /** diff --git a/tests/Fixtures/TestBundle/Entity/RelatedToDummyFriend.php b/tests/Fixtures/TestBundle/Entity/RelatedToDummyFriend.php index c584c30596b..d550249dd03 100644 --- a/tests/Fixtures/TestBundle/Entity/RelatedToDummyFriend.php +++ b/tests/Fixtures/TestBundle/Entity/RelatedToDummyFriend.php @@ -18,7 +18,7 @@ use ApiPlatform\Metadata\GetCollection; use ApiPlatform\Metadata\Link; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints as Assert; /** diff --git a/tests/Fixtures/TestBundle/Entity/RelationEmbedder.php b/tests/Fixtures/TestBundle/Entity/RelationEmbedder.php index 7007edb167d..805f932a76c 100644 --- a/tests/Fixtures/TestBundle/Entity/RelationEmbedder.php +++ b/tests/Fixtures/TestBundle/Entity/RelationEmbedder.php @@ -20,7 +20,7 @@ use ApiPlatform\Metadata\Post; use ApiPlatform\Metadata\Put; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Relation Embedder. diff --git a/tests/Fixtures/TestBundle/Entity/RelationGroupImpactOnCollection.php b/tests/Fixtures/TestBundle/Entity/RelationGroupImpactOnCollection.php index 1a9a2e9b163..e3a7c36cf08 100644 --- a/tests/Fixtures/TestBundle/Entity/RelationGroupImpactOnCollection.php +++ b/tests/Fixtures/TestBundle/Entity/RelationGroupImpactOnCollection.php @@ -18,7 +18,7 @@ use ApiPlatform\Metadata\Get; use ApiPlatform\Metadata\GetCollection; use ApiPlatform\Metadata\Operation; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource( provider: [RelationGroupImpactOnCollection::class, 'getData'], diff --git a/tests/Fixtures/TestBundle/Entity/RelationGroupImpactOnCollectionRelation.php b/tests/Fixtures/TestBundle/Entity/RelationGroupImpactOnCollectionRelation.php index fd411af31be..d5580201852 100644 --- a/tests/Fixtures/TestBundle/Entity/RelationGroupImpactOnCollectionRelation.php +++ b/tests/Fixtures/TestBundle/Entity/RelationGroupImpactOnCollectionRelation.php @@ -14,7 +14,7 @@ namespace ApiPlatform\Tests\Fixtures\TestBundle\Entity; use ApiPlatform\Metadata\ApiResource; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource] class RelationGroupImpactOnCollectionRelation diff --git a/tests/Fixtures/TestBundle/Entity/ThirdLevel.php b/tests/Fixtures/TestBundle/Entity/ThirdLevel.php index 672d2e5ba78..4f48aaf0fcc 100644 --- a/tests/Fixtures/TestBundle/Entity/ThirdLevel.php +++ b/tests/Fixtures/TestBundle/Entity/ThirdLevel.php @@ -19,7 +19,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * Third Level. diff --git a/tests/Fixtures/TestBundle/Entity/UidIdentified.php b/tests/Fixtures/TestBundle/Entity/UidIdentified.php index abcc9d94ec7..e3d1ee3ba62 100644 --- a/tests/Fixtures/TestBundle/Entity/UidIdentified.php +++ b/tests/Fixtures/TestBundle/Entity/UidIdentified.php @@ -16,8 +16,6 @@ use ApiPlatform\Metadata\ApiProperty; use ApiPlatform\Metadata\Put; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Ignore as LegacyIgnore; -use Symfony\Component\Serializer\Annotation\SerializedName as LegacySerializedName; use Symfony\Component\Serializer\Attribute\Ignore; use Symfony\Component\Serializer\Attribute\SerializedName; use Symfony\Component\Uid\Uuid; @@ -40,13 +38,11 @@ class UidIdentified #[ORM\GeneratedValue] #[ApiProperty(identifier: false)] #[Ignore] - #[LegacyIgnore] private ?int $id = null; #[ORM\Column(type: 'symfony_uuid', unique: true, nullable: false)] #[ApiProperty(identifier: true)] #[SerializedName('id')] - #[LegacySerializedName('id')] private ?Uuid $uuid = null; /** diff --git a/tests/Fixtures/TestBundle/Entity/User.php b/tests/Fixtures/TestBundle/Entity/User.php index 6890002ca8f..6e8d0594a67 100644 --- a/tests/Fixtures/TestBundle/Entity/User.php +++ b/tests/Fixtures/TestBundle/Entity/User.php @@ -27,7 +27,7 @@ use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; use Symfony\Component\Security\Core\User\UserInterface; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; /** * A User. diff --git a/tests/Fixtures/TestBundle/Entity/VoDummyCar.php b/tests/Fixtures/TestBundle/Entity/VoDummyCar.php index 290266d84ec..cd7ce9d49c6 100644 --- a/tests/Fixtures/TestBundle/Entity/VoDummyCar.php +++ b/tests/Fixtures/TestBundle/Entity/VoDummyCar.php @@ -17,7 +17,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource(normalizationContext: ['groups' => ['car_read']], denormalizationContext: ['groups' => ['car_write']])] #[ORM\Entity] diff --git a/tests/Fixtures/TestBundle/Entity/VoDummyDriver.php b/tests/Fixtures/TestBundle/Entity/VoDummyDriver.php index 5f4c147371c..6cebcfaec39 100644 --- a/tests/Fixtures/TestBundle/Entity/VoDummyDriver.php +++ b/tests/Fixtures/TestBundle/Entity/VoDummyDriver.php @@ -15,7 +15,7 @@ use ApiPlatform\Metadata\ApiResource; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource] #[ORM\Entity] diff --git a/tests/Fixtures/TestBundle/Entity/VoDummyInspection.php b/tests/Fixtures/TestBundle/Entity/VoDummyInspection.php index 2fccd9b1b20..e5a3c805359 100644 --- a/tests/Fixtures/TestBundle/Entity/VoDummyInspection.php +++ b/tests/Fixtures/TestBundle/Entity/VoDummyInspection.php @@ -15,7 +15,7 @@ use ApiPlatform\Metadata\ApiResource; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource(graphQlOperations: [], normalizationContext: ['groups' => ['inspection_read']], denormalizationContext: ['groups' => ['inspection_write']], extraProperties: ['standard_put' => false])] #[ORM\Entity] diff --git a/tests/Fixtures/TestBundle/Entity/VoDummyInsuranceCompany.php b/tests/Fixtures/TestBundle/Entity/VoDummyInsuranceCompany.php index 5874bf3e4ea..2d15e07e3d5 100644 --- a/tests/Fixtures/TestBundle/Entity/VoDummyInsuranceCompany.php +++ b/tests/Fixtures/TestBundle/Entity/VoDummyInsuranceCompany.php @@ -15,7 +15,7 @@ use ApiPlatform\Metadata\ApiResource; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource] #[ORM\Entity] diff --git a/tests/Fixtures/TestBundle/Entity/VoDummyVehicle.php b/tests/Fixtures/TestBundle/Entity/VoDummyVehicle.php index 2b6f0e5b86d..653108dec3e 100644 --- a/tests/Fixtures/TestBundle/Entity/VoDummyVehicle.php +++ b/tests/Fixtures/TestBundle/Entity/VoDummyVehicle.php @@ -16,7 +16,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ORM\MappedSuperclass] abstract class VoDummyVehicle diff --git a/tests/Fixtures/TestBundle/Entity/WrappedResponseEntity.php b/tests/Fixtures/TestBundle/Entity/WrappedResponseEntity.php index 18807eb008f..abd9d1ac51e 100644 --- a/tests/Fixtures/TestBundle/Entity/WrappedResponseEntity.php +++ b/tests/Fixtures/TestBundle/Entity/WrappedResponseEntity.php @@ -17,7 +17,7 @@ use ApiPlatform\Metadata\Get; use ApiPlatform\Tests\Fixtures\TestBundle\Dto\CustomOutputEntityWrapperDto; use Doctrine\ORM\Mapping as ORM; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource(operations: [new Get(normalizationContext: ['groups' => ['read']], output: CustomOutputEntityWrapperDto::class )])] diff --git a/tests/Fixtures/TestBundle/Mercure/TestHub.php b/tests/Fixtures/TestBundle/Mercure/TestHub.php index 9dd9e7404d8..f0af040e4bd 100644 --- a/tests/Fixtures/TestBundle/Mercure/TestHub.php +++ b/tests/Fixtures/TestBundle/Mercure/TestHub.php @@ -37,8 +37,13 @@ public function getUpdates(): array return $this->updates; } + // @TODO: remove in 4.3 public function getUrl(): string { + if (!method_exists($this->hub, 'getUrl')) { + throw new \RuntimeException(); + } + return $this->hub->getUrl(); } @@ -49,6 +54,10 @@ public function getPublicUrl(): string public function getProvider(): TokenProviderInterface { + if (!method_exists($this->hub, 'getProvider')) { + throw new \RuntimeException(); + } + return $this->hub->getProvider(); } diff --git a/tests/Fixtures/TestBundle/Model/EmptyArrayAsObject.php b/tests/Fixtures/TestBundle/Model/EmptyArrayAsObject.php index 1ee54afc389..8a5df3ce965 100644 --- a/tests/Fixtures/TestBundle/Model/EmptyArrayAsObject.php +++ b/tests/Fixtures/TestBundle/Model/EmptyArrayAsObject.php @@ -16,7 +16,7 @@ use ApiPlatform\Metadata\ApiResource; use ApiPlatform\Metadata\Get; use ApiPlatform\Tests\Fixtures\TestBundle\State\EmptyArrayAsObjectProvider; -use Symfony\Component\Serializer\Annotation\Context; +use Symfony\Component\Serializer\Attribute\Context; use Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer; use Symfony\Component\Serializer\Serializer; diff --git a/tests/Fixtures/TestBundle/Model/ProductInterface.php b/tests/Fixtures/TestBundle/Model/ProductInterface.php index 05f1c9f67d8..033d0690a02 100644 --- a/tests/Fixtures/TestBundle/Model/ProductInterface.php +++ b/tests/Fixtures/TestBundle/Model/ProductInterface.php @@ -16,7 +16,7 @@ use ApiPlatform\Metadata\ApiProperty; use ApiPlatform\Metadata\ApiResource; use ApiPlatform\Tests\Fixtures\TestBundle\State\ProductProvider; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints as Assert; #[ApiResource(shortName: 'Product', uriVariables: 'code', provider: ProductProvider::class, normalizationContext: ['groups' => ['product_read']], denormalizationContext: ['groups' => ['product_write']])] diff --git a/tests/Fixtures/TestBundle/Model/TaxonInterface.php b/tests/Fixtures/TestBundle/Model/TaxonInterface.php index 23ce666d0e5..e872c58ac98 100644 --- a/tests/Fixtures/TestBundle/Model/TaxonInterface.php +++ b/tests/Fixtures/TestBundle/Model/TaxonInterface.php @@ -15,7 +15,7 @@ use ApiPlatform\Metadata\ApiProperty; use ApiPlatform\Metadata\ApiResource; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; use Symfony\Component\Validator\Constraints as Assert; #[ApiResource(shortName: 'Taxon', uriVariables: 'code', normalizationContext: ['groups' => ['taxon_read']], denormalizationContext: ['groups' => ['taxon_write']])] diff --git a/tests/Fixtures/TestBundle/Security/SecuredDummyAttributeBasedVoter.php b/tests/Fixtures/TestBundle/Security/SecuredDummyAttributeBasedVoter.php index a934b4c8774..33b7aac052f 100644 --- a/tests/Fixtures/TestBundle/Security/SecuredDummyAttributeBasedVoter.php +++ b/tests/Fixtures/TestBundle/Security/SecuredDummyAttributeBasedVoter.php @@ -14,6 +14,7 @@ namespace ApiPlatform\Tests\Fixtures\TestBundle\Security; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\Security\Core\Authorization\Voter\Vote; use Symfony\Component\Security\Core\Authorization\Voter\Voter; use Symfony\Component\Security\Core\User\UserInterface; @@ -38,7 +39,7 @@ protected function supports(string $attribute, mixed $subject): bool return \in_array($subject, array_keys(self::RBAC), true); } - protected function voteOnAttribute(string $attribute, mixed $subject, TokenInterface $token): bool + protected function voteOnAttribute(string $attribute, mixed $subject, TokenInterface $token, ?Vote $vote = null): bool { $user = $token->getUser(); if (!$user instanceof UserInterface || !\is_string($subject)) { diff --git a/tests/Fixtures/app/AppKernel.php b/tests/Fixtures/app/AppKernel.php index f72ea29f877..2a74b0d9b13 100644 --- a/tests/Fixtures/app/AppKernel.php +++ b/tests/Fixtures/app/AppKernel.php @@ -22,6 +22,7 @@ use ApiPlatform\Tests\Fixtures\TestBundle\Document\User as UserDocument; use ApiPlatform\Tests\Fixtures\TestBundle\Entity\User; use ApiPlatform\Tests\Fixtures\TestBundle\TestBundle; +use Doctrine\Bundle\DoctrineBundle\Command\Proxy\ValidateSchemaCommand; use Doctrine\Bundle\DoctrineBundle\ConnectionFactory; use Doctrine\Bundle\DoctrineBundle\DoctrineBundle; use Doctrine\Bundle\MongoDBBundle\Command\TailCursorDoctrineODMCommand; @@ -41,6 +42,7 @@ use Symfony\Component\HttpFoundation\Session\SessionFactory; use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\PasswordHasher\Hasher\NativePasswordHasher; +use Symfony\Component\PropertyInfo\Type; use Symfony\Component\Security\Core\Authorization\Strategy\AccessDecisionStrategyInterface; use Symfony\Component\Security\Core\User\User as SymfonyCoreUser; use Symfony\Component\Security\Core\User\UserInterface; @@ -160,6 +162,12 @@ protected function configureContainer(ContainerBuilder $c, LoaderInterface $load ]; } + // SF 8.1 removed configuration + if (!class_exists(Type::class)) { + unset($config['annotations']); + $c->setParameter('.json_streamer.lazy_ghosts_dir', __DIR__.'/cache/json_streamer_lazy_ghost'); + } + $c->prependExtensionConfig('framework', $config); $alg = class_exists(NativePasswordHasher::class, false) || class_exists('Symfony\Component\Security\Core\Encoder\NativePasswordEncoder') ? 'auto' : 'bcrypt'; @@ -281,11 +289,19 @@ class_exists(NativePasswordHasher::class) ? 'password_hashers' : 'encoders' => [ if (defined(ConnectionFactory::class.'::DEFAULT_SCHEME_MAP')) { $c->prependExtensionConfig('doctrine', [ 'orm' => [ - 'report_fields_where_declared' => true, 'controller_resolver' => ['auto_mapping' => false], - 'enable_lazy_ghost_objects' => true, ], ]); + + if (class_exists(ValidateSchemaCommand::class)) { + $c->prependExtensionConfig('doctrine', [ + 'orm' => [ + 'auto_generate_proxy_classes' => '%kernel.debug%', + 'report_fields_where_declared' => true, + 'enable_lazy_ghost_objects' => true, + ], + ]); + } } $loader->load(__DIR__.'/config/config_swagger.php'); diff --git a/tests/Fixtures/app/config/config_common.yml b/tests/Fixtures/app/config/config_common.yml index f9d2cd2afba..93d168e982d 100644 --- a/tests/Fixtures/app/config/config_common.yml +++ b/tests/Fixtures/app/config/config_common.yml @@ -13,7 +13,6 @@ doctrine: symfony_uuid: Symfony\Bridge\Doctrine\Types\UuidType orm: - auto_generate_proxy_classes: '%kernel.debug%' mappings: TestBundle: type: 'attribute' diff --git a/tests/Fixtures/app/config/reference.php b/tests/Fixtures/app/config/reference.php deleted file mode 100644 index 1ea3e33cee4..00000000000 --- a/tests/Fixtures/app/config/reference.php +++ /dev/null @@ -1,807 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -declare(strict_types=1); - -// This file is auto-generated and is for apps only. Bundles SHOULD NOT rely on its content. - -namespace Symfony\Component\DependencyInjection\Loader\Configurator; - -/** - * This class provides array-shapes for configuring the services and bundles of an application. - * - * Services declared with the config() method below are autowired and autoconfigured by default. - * - * This is for apps only. Bundles SHOULD NOT use it. - * - * Example: - * - * ```php - * // config/services.php - * namespace Symfony\Component\DependencyInjection\Loader\Configurator; - * - * return App::config([ - * 'services' => [ - * 'App\\' => [ - * 'resource' => '../src/', - * ], - * ], - * ]); - * ``` - * - * @psalm-type ImportsConfig = list - * @psalm-type ParametersConfig = array|null>|null> - * @psalm-type ArgumentsType = list|array - * @psalm-type CallType = array|array{0:string, 1?:ArgumentsType, 2?:bool}|array{method:string, arguments?:ArgumentsType, returns_clone?:bool} - * @psalm-type TagsType = list>> // arrays inside the list must have only one element, with the tag name as the key - * @psalm-type CallbackType = string|array{0:string|ReferenceConfigurator,1:string}|\Closure|ReferenceConfigurator|ExpressionConfigurator - * @psalm-type DeprecationType = array{package: string, version: string, message?: string} - * @psalm-type DefaultsType = array{ - * public?: bool, - * tags?: TagsType, - * resource_tags?: TagsType, - * autowire?: bool, - * autoconfigure?: bool, - * bind?: array, - * } - * @psalm-type InstanceofType = array{ - * shared?: bool, - * lazy?: bool|string, - * public?: bool, - * properties?: array, - * configurator?: CallbackType, - * calls?: list, - * tags?: TagsType, - * resource_tags?: TagsType, - * autowire?: bool, - * bind?: array, - * constructor?: string, - * } - * @psalm-type DefinitionType = array{ - * class?: string, - * file?: string, - * parent?: string, - * shared?: bool, - * synthetic?: bool, - * lazy?: bool|string, - * public?: bool, - * abstract?: bool, - * deprecated?: DeprecationType, - * factory?: CallbackType, - * configurator?: CallbackType, - * arguments?: ArgumentsType, - * properties?: array, - * calls?: list, - * tags?: TagsType, - * resource_tags?: TagsType, - * decorates?: string, - * decoration_inner_name?: string, - * decoration_priority?: int, - * decoration_on_invalid?: 'exception'|'ignore'|null, - * autowire?: bool, - * autoconfigure?: bool, - * bind?: array, - * constructor?: string, - * from_callable?: CallbackType, - * } - * @psalm-type AliasType = string|array{ - * alias: string, - * public?: bool, - * deprecated?: DeprecationType, - * } - * @psalm-type PrototypeType = array{ - * resource: string, - * namespace?: string, - * exclude?: string|list, - * parent?: string, - * shared?: bool, - * lazy?: bool|string, - * public?: bool, - * abstract?: bool, - * deprecated?: DeprecationType, - * factory?: CallbackType, - * arguments?: ArgumentsType, - * properties?: array, - * configurator?: CallbackType, - * calls?: list, - * tags?: TagsType, - * resource_tags?: TagsType, - * autowire?: bool, - * autoconfigure?: bool, - * bind?: array, - * constructor?: string, - * } - * @psalm-type StackType = array{ - * stack: list>, - * public?: bool, - * deprecated?: DeprecationType, - * } - * @psalm-type ServicesConfig = array{ - * _defaults?: DefaultsType, - * _instanceof?: InstanceofType, - * ... - * } - * @psalm-type ExtensionType = array - * @psalm-type FrameworkConfig = array{ - * secret?: scalar|null, - * http_method_override?: bool, // Set true to enable support for the '_method' request parameter to determine the intended HTTP method on POST requests. // Default: false - * allowed_http_method_override?: list|null, - * trust_x_sendfile_type_header?: scalar|null, // Set true to enable support for xsendfile in binary file responses. // Default: "%env(bool:default::SYMFONY_TRUST_X_SENDFILE_TYPE_HEADER)%" - * ide?: scalar|null, // Default: "%env(default::SYMFONY_IDE)%" - * test?: bool, - * default_locale?: scalar|null, // Default: "en" - * set_locale_from_accept_language?: bool, // Whether to use the Accept-Language HTTP header to set the Request locale (only when the "_locale" request attribute is not passed). // Default: false - * set_content_language_from_locale?: bool, // Whether to set the Content-Language HTTP header on the Response using the Request locale. // Default: false - * enabled_locales?: list, - * trusted_hosts?: list, - * trusted_proxies?: mixed, // Default: ["%env(default::SYMFONY_TRUSTED_PROXIES)%"] - * trusted_headers?: list, - * error_controller?: scalar|null, // Default: "error_controller" - * handle_all_throwables?: bool, // HttpKernel will handle all kinds of \Throwable. // Default: true - * csrf_protection?: bool|array{ - * enabled?: scalar|null, // Default: null - * stateless_token_ids?: list, - * check_header?: scalar|null, // Whether to check the CSRF token in a header in addition to a cookie when using stateless protection. // Default: false - * cookie_name?: scalar|null, // The name of the cookie to use when using stateless protection. // Default: "csrf-token" - * }, - * form?: bool|array{ // Form configuration - * enabled?: bool, // Default: true - * csrf_protection?: array{ - * enabled?: scalar|null, // Default: null - * token_id?: scalar|null, // Default: null - * field_name?: scalar|null, // Default: "_token" - * field_attr?: array, - * }, - * }, - * http_cache?: bool|array{ // HTTP cache configuration - * enabled?: bool, // Default: false - * debug?: bool, // Default: "%kernel.debug%" - * trace_level?: "none"|"short"|"full", - * trace_header?: scalar|null, - * default_ttl?: int, - * private_headers?: list, - * skip_response_headers?: list, - * allow_reload?: bool, - * allow_revalidate?: bool, - * stale_while_revalidate?: int, - * stale_if_error?: int, - * terminate_on_cache_hit?: bool, - * }, - * esi?: bool|array{ // ESI configuration - * enabled?: bool, // Default: false - * }, - * ssi?: bool|array{ // SSI configuration - * enabled?: bool, // Default: false - * }, - * fragments?: bool|array{ // Fragments configuration - * enabled?: bool, // Default: false - * hinclude_default_template?: scalar|null, // Default: null - * path?: scalar|null, // Default: "/_fragment" - * }, - * profiler?: bool|array{ // Profiler configuration - * enabled?: bool, // Default: false - * collect?: bool, // Default: true - * collect_parameter?: scalar|null, // The name of the parameter to use to enable or disable collection on a per request basis. // Default: null - * only_exceptions?: bool, // Default: false - * only_main_requests?: bool, // Default: false - * dsn?: scalar|null, // Default: "file:%kernel.cache_dir%/profiler" - * collect_serializer_data?: bool, // Enables the serializer data collector and profiler panel. // Default: false - * }, - * workflows?: bool|array{ - * enabled?: bool, // Default: false - * workflows?: array, - * definition_validators?: list, - * support_strategy?: scalar|null, - * initial_marking?: list, - * events_to_dispatch?: list|null, - * places?: list, - * }>, - * transitions: list, - * to?: list, - * weight?: int, // Default: 1 - * metadata?: list, - * }>, - * metadata?: list, - * }>, - * }, - * router?: bool|array{ // Router configuration - * enabled?: bool, // Default: false - * resource: scalar|null, - * type?: scalar|null, - * cache_dir?: scalar|null, // Deprecated: Setting the "framework.router.cache_dir.cache_dir" configuration option is deprecated. It will be removed in version 8.0. // Default: "%kernel.build_dir%" - * default_uri?: scalar|null, // The default URI used to generate URLs in a non-HTTP context. // Default: null - * http_port?: scalar|null, // Default: 80 - * https_port?: scalar|null, // Default: 443 - * strict_requirements?: scalar|null, // set to true to throw an exception when a parameter does not match the requirements set to false to disable exceptions when a parameter does not match the requirements (and return null instead) set to null to disable parameter checks against requirements 'true' is the preferred configuration in development mode, while 'false' or 'null' might be preferred in production // Default: true - * utf8?: bool, // Default: true - * }, - * session?: bool|array{ // Session configuration - * enabled?: bool, // Default: false - * storage_factory_id?: scalar|null, // Default: "session.storage.factory.native" - * handler_id?: scalar|null, // Defaults to using the native session handler, or to the native *file* session handler if "save_path" is not null. - * name?: scalar|null, - * cookie_lifetime?: scalar|null, - * cookie_path?: scalar|null, - * cookie_domain?: scalar|null, - * cookie_secure?: true|false|"auto", // Default: "auto" - * cookie_httponly?: bool, // Default: true - * cookie_samesite?: null|"lax"|"strict"|"none", // Default: "lax" - * use_cookies?: bool, - * gc_divisor?: scalar|null, - * gc_probability?: scalar|null, - * gc_maxlifetime?: scalar|null, - * save_path?: scalar|null, // Defaults to "%kernel.cache_dir%/sessions" if the "handler_id" option is not null. - * metadata_update_threshold?: int, // Seconds to wait between 2 session metadata updates. // Default: 0 - * sid_length?: int, // Deprecated: Setting the "framework.session.sid_length.sid_length" configuration option is deprecated. It will be removed in version 8.0. No alternative is provided as PHP 8.4 has deprecated the related option. - * sid_bits_per_character?: int, // Deprecated: Setting the "framework.session.sid_bits_per_character.sid_bits_per_character" configuration option is deprecated. It will be removed in version 8.0. No alternative is provided as PHP 8.4 has deprecated the related option. - * }, - * request?: bool|array{ // Request configuration - * enabled?: bool, // Default: false - * formats?: array>, - * }, - * assets?: bool|array{ // Assets configuration - * enabled?: bool, // Default: true - * strict_mode?: bool, // Throw an exception if an entry is missing from the manifest.json. // Default: false - * version_strategy?: scalar|null, // Default: null - * version?: scalar|null, // Default: null - * version_format?: scalar|null, // Default: "%%s?%%s" - * json_manifest_path?: scalar|null, // Default: null - * base_path?: scalar|null, // Default: "" - * base_urls?: list, - * packages?: array, - * }>, - * }, - * asset_mapper?: bool|array{ // Asset Mapper configuration - * enabled?: bool, // Default: false - * paths?: array, - * excluded_patterns?: list, - * exclude_dotfiles?: bool, // If true, any files starting with "." will be excluded from the asset mapper. // Default: true - * server?: bool, // If true, a "dev server" will return the assets from the public directory (true in "debug" mode only by default). // Default: true - * public_prefix?: scalar|null, // The public path where the assets will be written to (and served from when "server" is true). // Default: "/assets/" - * missing_import_mode?: "strict"|"warn"|"ignore", // Behavior if an asset cannot be found when imported from JavaScript or CSS files - e.g. "import './non-existent.js'". "strict" means an exception is thrown, "warn" means a warning is logged, "ignore" means the import is left as-is. // Default: "warn" - * extensions?: array, - * importmap_path?: scalar|null, // The path of the importmap.php file. // Default: "%kernel.project_dir%/importmap.php" - * importmap_polyfill?: scalar|null, // The importmap name that will be used to load the polyfill. Set to false to disable. // Default: "es-module-shims" - * importmap_script_attributes?: array, - * vendor_dir?: scalar|null, // The directory to store JavaScript vendors. // Default: "%kernel.project_dir%/assets/vendor" - * precompress?: bool|array{ // Precompress assets with Brotli, Zstandard and gzip. - * enabled?: bool, // Default: false - * formats?: list, - * extensions?: list, - * }, - * }, - * translator?: bool|array{ // Translator configuration - * enabled?: bool, // Default: true - * fallbacks?: list, - * logging?: bool, // Default: false - * formatter?: scalar|null, // Default: "translator.formatter.default" - * cache_dir?: scalar|null, // Default: "%kernel.cache_dir%/translations" - * default_path?: scalar|null, // The default path used to load translations. // Default: "%kernel.project_dir%/translations" - * paths?: list, - * pseudo_localization?: bool|array{ - * enabled?: bool, // Default: false - * accents?: bool, // Default: true - * expansion_factor?: float, // Default: 1.0 - * brackets?: bool, // Default: true - * parse_html?: bool, // Default: false - * localizable_html_attributes?: list, - * }, - * providers?: array, - * locales?: list, - * }>, - * globals?: array, - * domain?: string, - * }>, - * }, - * validation?: bool|array{ // Validation configuration - * enabled?: bool, // Default: true - * cache?: scalar|null, // Deprecated: Setting the "framework.validation.cache.cache" configuration option is deprecated. It will be removed in version 8.0. - * enable_attributes?: bool, // Default: true - * static_method?: list, - * translation_domain?: scalar|null, // Default: "validators" - * email_validation_mode?: "html5"|"html5-allow-no-tld"|"strict"|"loose", // Default: "html5" - * mapping?: array{ - * paths?: list, - * }, - * not_compromised_password?: bool|array{ - * enabled?: bool, // When disabled, compromised passwords will be accepted as valid. // Default: true - * endpoint?: scalar|null, // API endpoint for the NotCompromisedPassword Validator. // Default: null - * }, - * disable_translation?: bool, // Default: false - * auto_mapping?: array, - * }>, - * }, - * annotations?: bool|array{ - * enabled?: bool, // Default: false - * }, - * serializer?: bool|array{ // Serializer configuration - * enabled?: bool, // Default: true - * enable_attributes?: bool, // Default: true - * name_converter?: scalar|null, - * circular_reference_handler?: scalar|null, - * max_depth_handler?: scalar|null, - * mapping?: array{ - * paths?: list, - * }, - * default_context?: list, - * named_serializers?: array, - * include_built_in_normalizers?: bool, // Whether to include the built-in normalizers // Default: true - * include_built_in_encoders?: bool, // Whether to include the built-in encoders // Default: true - * }>, - * }, - * property_access?: bool|array{ // Property access configuration - * enabled?: bool, // Default: true - * magic_call?: bool, // Default: false - * magic_get?: bool, // Default: true - * magic_set?: bool, // Default: true - * throw_exception_on_invalid_index?: bool, // Default: false - * throw_exception_on_invalid_property_path?: bool, // Default: true - * }, - * type_info?: bool|array{ // Type info configuration - * enabled?: bool, // Default: true - * aliases?: array, - * }, - * property_info?: bool|array{ // Property info configuration - * enabled?: bool, // Default: true - * with_constructor_extractor?: bool, // Registers the constructor extractor. - * }, - * cache?: array{ // Cache configuration - * prefix_seed?: scalar|null, // Used to namespace cache keys when using several apps with the same shared backend. // Default: "_%kernel.project_dir%.%kernel.container_class%" - * app?: scalar|null, // App related cache pools configuration. // Default: "cache.adapter.filesystem" - * system?: scalar|null, // System related cache pools configuration. // Default: "cache.adapter.system" - * directory?: scalar|null, // Default: "%kernel.share_dir%/pools/app" - * default_psr6_provider?: scalar|null, - * default_redis_provider?: scalar|null, // Default: "redis://localhost" - * default_valkey_provider?: scalar|null, // Default: "valkey://localhost" - * default_memcached_provider?: scalar|null, // Default: "memcached://localhost" - * default_doctrine_dbal_provider?: scalar|null, // Default: "database_connection" - * default_pdo_provider?: scalar|null, // Default: null - * pools?: array, - * tags?: scalar|null, // Default: null - * public?: bool, // Default: false - * default_lifetime?: scalar|null, // Default lifetime of the pool. - * provider?: scalar|null, // Overwrite the setting from the default provider for this adapter. - * early_expiration_message_bus?: scalar|null, - * clearer?: scalar|null, - * }>, - * }, - * php_errors?: array{ // PHP errors handling configuration - * log?: mixed, // Use the application logger instead of the PHP logger for logging PHP errors. // Default: true - * throw?: bool, // Throw PHP errors as \ErrorException instances. // Default: true - * }, - * exceptions?: array, - * web_link?: bool|array{ // Web links configuration - * enabled?: bool, // Default: true - * }, - * lock?: bool|string|array{ // Lock configuration - * enabled?: bool, // Default: false - * resources?: array>, - * }, - * semaphore?: bool|string|array{ // Semaphore configuration - * enabled?: bool, // Default: false - * resources?: array, - * }, - * messenger?: bool|array{ // Messenger configuration - * enabled?: bool, // Default: true - * routing?: array, - * }>, - * serializer?: array{ - * default_serializer?: scalar|null, // Service id to use as the default serializer for the transports. // Default: "messenger.transport.native_php_serializer" - * symfony_serializer?: array{ - * format?: scalar|null, // Serialization format for the messenger.transport.symfony_serializer service (which is not the serializer used by default). // Default: "json" - * context?: array, - * }, - * }, - * transports?: array, - * failure_transport?: scalar|null, // Transport name to send failed messages to (after all retries have failed). // Default: null - * retry_strategy?: string|array{ - * service?: scalar|null, // Service id to override the retry strategy entirely. // Default: null - * max_retries?: int, // Default: 3 - * delay?: int, // Time in ms to delay (or the initial value when multiplier is used). // Default: 1000 - * multiplier?: float, // If greater than 1, delay will grow exponentially for each retry: this delay = (delay * (multiple ^ retries)). // Default: 2 - * max_delay?: int, // Max time in ms that a retry should ever be delayed (0 = infinite). // Default: 0 - * jitter?: float, // Randomness to apply to the delay (between 0 and 1). // Default: 0.1 - * }, - * rate_limiter?: scalar|null, // Rate limiter name to use when processing messages. // Default: null - * }>, - * failure_transport?: scalar|null, // Transport name to send failed messages to (after all retries have failed). // Default: null - * stop_worker_on_signals?: list, - * default_bus?: scalar|null, // Default: null - * buses?: array, - * }>, - * }>, - * }, - * scheduler?: bool|array{ // Scheduler configuration - * enabled?: bool, // Default: false - * }, - * disallow_search_engine_index?: bool, // Enabled by default when debug is enabled. // Default: true - * http_client?: bool|array{ // HTTP Client configuration - * enabled?: bool, // Default: true - * max_host_connections?: int, // The maximum number of connections to a single host. - * default_options?: array{ - * headers?: array, - * vars?: list, - * max_redirects?: int, // The maximum number of redirects to follow. - * http_version?: scalar|null, // The default HTTP version, typically 1.1 or 2.0, leave to null for the best version. - * resolve?: array, - * proxy?: scalar|null, // The URL of the proxy to pass requests through or null for automatic detection. - * no_proxy?: scalar|null, // A comma separated list of hosts that do not require a proxy to be reached. - * timeout?: float, // The idle timeout, defaults to the "default_socket_timeout" ini parameter. - * max_duration?: float, // The maximum execution time for the request+response as a whole. - * bindto?: scalar|null, // A network interface name, IP address, a host name or a UNIX socket to bind to. - * verify_peer?: bool, // Indicates if the peer should be verified in a TLS context. - * verify_host?: bool, // Indicates if the host should exist as a certificate common name. - * cafile?: scalar|null, // A certificate authority file. - * capath?: scalar|null, // A directory that contains multiple certificate authority files. - * local_cert?: scalar|null, // A PEM formatted certificate file. - * local_pk?: scalar|null, // A private key file. - * passphrase?: scalar|null, // The passphrase used to encrypt the "local_pk" file. - * ciphers?: scalar|null, // A list of TLS ciphers separated by colons, commas or spaces (e.g. "RC3-SHA:TLS13-AES-128-GCM-SHA256"...) - * peer_fingerprint?: array{ // Associative array: hashing algorithm => hash(es). - * sha1?: mixed, - * pin-sha256?: mixed, - * md5?: mixed, - * }, - * crypto_method?: scalar|null, // The minimum version of TLS to accept; must be one of STREAM_CRYPTO_METHOD_TLSv*_CLIENT constants. - * extra?: list, - * rate_limiter?: scalar|null, // Rate limiter name to use for throttling requests. // Default: null - * caching?: bool|array{ // Caching configuration. - * enabled?: bool, // Default: false - * cache_pool?: string, // The taggable cache pool to use for storing the responses. // Default: "cache.http_client" - * shared?: bool, // Indicates whether the cache is shared (public) or private. // Default: true - * max_ttl?: int, // The maximum TTL (in seconds) allowed for cached responses. Null means no cap. // Default: null - * }, - * retry_failed?: bool|array{ - * enabled?: bool, // Default: false - * retry_strategy?: scalar|null, // service id to override the retry strategy. // Default: null - * http_codes?: array, - * }>, - * max_retries?: int, // Default: 3 - * delay?: int, // Time in ms to delay (or the initial value when multiplier is used). // Default: 1000 - * multiplier?: float, // If greater than 1, delay will grow exponentially for each retry: delay * (multiple ^ retries). // Default: 2 - * max_delay?: int, // Max time in ms that a retry should ever be delayed (0 = infinite). // Default: 0 - * jitter?: float, // Randomness in percent (between 0 and 1) to apply to the delay. // Default: 0.1 - * }, - * }, - * mock_response_factory?: scalar|null, // The id of the service that should generate mock responses. It should be either an invokable or an iterable. - * scoped_clients?: array, - * headers?: array, - * max_redirects?: int, // The maximum number of redirects to follow. - * http_version?: scalar|null, // The default HTTP version, typically 1.1 or 2.0, leave to null for the best version. - * resolve?: array, - * proxy?: scalar|null, // The URL of the proxy to pass requests through or null for automatic detection. - * no_proxy?: scalar|null, // A comma separated list of hosts that do not require a proxy to be reached. - * timeout?: float, // The idle timeout, defaults to the "default_socket_timeout" ini parameter. - * max_duration?: float, // The maximum execution time for the request+response as a whole. - * bindto?: scalar|null, // A network interface name, IP address, a host name or a UNIX socket to bind to. - * verify_peer?: bool, // Indicates if the peer should be verified in a TLS context. - * verify_host?: bool, // Indicates if the host should exist as a certificate common name. - * cafile?: scalar|null, // A certificate authority file. - * capath?: scalar|null, // A directory that contains multiple certificate authority files. - * local_cert?: scalar|null, // A PEM formatted certificate file. - * local_pk?: scalar|null, // A private key file. - * passphrase?: scalar|null, // The passphrase used to encrypt the "local_pk" file. - * ciphers?: scalar|null, // A list of TLS ciphers separated by colons, commas or spaces (e.g. "RC3-SHA:TLS13-AES-128-GCM-SHA256"...). - * peer_fingerprint?: array{ // Associative array: hashing algorithm => hash(es). - * sha1?: mixed, - * pin-sha256?: mixed, - * md5?: mixed, - * }, - * crypto_method?: scalar|null, // The minimum version of TLS to accept; must be one of STREAM_CRYPTO_METHOD_TLSv*_CLIENT constants. - * extra?: list, - * rate_limiter?: scalar|null, // Rate limiter name to use for throttling requests. // Default: null - * caching?: bool|array{ // Caching configuration. - * enabled?: bool, // Default: false - * cache_pool?: string, // The taggable cache pool to use for storing the responses. // Default: "cache.http_client" - * shared?: bool, // Indicates whether the cache is shared (public) or private. // Default: true - * max_ttl?: int, // The maximum TTL (in seconds) allowed for cached responses. Null means no cap. // Default: null - * }, - * retry_failed?: bool|array{ - * enabled?: bool, // Default: false - * retry_strategy?: scalar|null, // service id to override the retry strategy. // Default: null - * http_codes?: array, - * }>, - * max_retries?: int, // Default: 3 - * delay?: int, // Time in ms to delay (or the initial value when multiplier is used). // Default: 1000 - * multiplier?: float, // If greater than 1, delay will grow exponentially for each retry: delay * (multiple ^ retries). // Default: 2 - * max_delay?: int, // Max time in ms that a retry should ever be delayed (0 = infinite). // Default: 0 - * jitter?: float, // Randomness in percent (between 0 and 1) to apply to the delay. // Default: 0.1 - * }, - * }>, - * }, - * mailer?: bool|array{ // Mailer configuration - * enabled?: bool, // Default: true - * message_bus?: scalar|null, // The message bus to use. Defaults to the default bus if the Messenger component is installed. // Default: null - * dsn?: scalar|null, // Default: null - * transports?: array, - * envelope?: array{ // Mailer Envelope configuration - * sender?: scalar|null, - * recipients?: list, - * allowed_recipients?: list, - * }, - * headers?: array, - * dkim_signer?: bool|array{ // DKIM signer configuration - * enabled?: bool, // Default: false - * key?: scalar|null, // Key content, or path to key (in PEM format with the `file://` prefix) // Default: "" - * domain?: scalar|null, // Default: "" - * select?: scalar|null, // Default: "" - * passphrase?: scalar|null, // The private key passphrase // Default: "" - * options?: array, - * }, - * smime_signer?: bool|array{ // S/MIME signer configuration - * enabled?: bool, // Default: false - * key?: scalar|null, // Path to key (in PEM format) // Default: "" - * certificate?: scalar|null, // Path to certificate (in PEM format without the `file://` prefix) // Default: "" - * passphrase?: scalar|null, // The private key passphrase // Default: null - * extra_certificates?: scalar|null, // Default: null - * sign_options?: int, // Default: null - * }, - * smime_encrypter?: bool|array{ // S/MIME encrypter configuration - * enabled?: bool, // Default: false - * repository?: scalar|null, // S/MIME certificate repository service. This service shall implement the `Symfony\Component\Mailer\EventListener\SmimeCertificateRepositoryInterface`. // Default: "" - * cipher?: int, // A set of algorithms used to encrypt the message // Default: null - * }, - * }, - * secrets?: bool|array{ - * enabled?: bool, // Default: true - * vault_directory?: scalar|null, // Default: "%kernel.project_dir%/config/secrets/%kernel.runtime_environment%" - * local_dotenv_file?: scalar|null, // Default: "%kernel.project_dir%/.env.%kernel.runtime_environment%.local" - * decryption_env_var?: scalar|null, // Default: "base64:default::SYMFONY_DECRYPTION_SECRET" - * }, - * notifier?: bool|array{ // Notifier configuration - * enabled?: bool, // Default: false - * message_bus?: scalar|null, // The message bus to use. Defaults to the default bus if the Messenger component is installed. // Default: null - * chatter_transports?: array, - * texter_transports?: array, - * notification_on_failed_messages?: bool, // Default: false - * channel_policy?: array>, - * admin_recipients?: list, - * }, - * rate_limiter?: bool|array{ // Rate limiter configuration - * enabled?: bool, // Default: false - * limiters?: array, - * limit?: int, // The maximum allowed hits in a fixed interval or burst. - * interval?: scalar|null, // Configures the fixed interval if "policy" is set to "fixed_window" or "sliding_window". The value must be a number followed by "second", "minute", "hour", "day", "week" or "month" (or their plural equivalent). - * rate?: array{ // Configures the fill rate if "policy" is set to "token_bucket". - * interval?: scalar|null, // Configures the rate interval. The value must be a number followed by "second", "minute", "hour", "day", "week" or "month" (or their plural equivalent). - * amount?: int, // Amount of tokens to add each interval. // Default: 1 - * }, - * }>, - * }, - * uid?: bool|array{ // Uid configuration - * enabled?: bool, // Default: true - * default_uuid_version?: 7|6|4|1, // Default: 7 - * name_based_uuid_version?: 5|3, // Default: 5 - * name_based_uuid_namespace?: scalar|null, - * time_based_uuid_version?: 7|6|1, // Default: 7 - * time_based_uuid_node?: scalar|null, - * }, - * html_sanitizer?: bool|array{ // HtmlSanitizer configuration - * enabled?: bool, // Default: false - * sanitizers?: array, - * block_elements?: list, - * drop_elements?: list, - * allow_attributes?: array, - * drop_attributes?: array, - * force_attributes?: array>, - * force_https_urls?: bool, // Transforms URLs using the HTTP scheme to use the HTTPS scheme instead. // Default: false - * allowed_link_schemes?: list, - * allowed_link_hosts?: list|null, - * allow_relative_links?: bool, // Allows relative URLs to be used in links href attributes. // Default: false - * allowed_media_schemes?: list, - * allowed_media_hosts?: list|null, - * allow_relative_medias?: bool, // Allows relative URLs to be used in media source attributes (img, audio, video, ...). // Default: false - * with_attribute_sanitizers?: list, - * without_attribute_sanitizers?: list, - * max_input_length?: int, // The maximum length allowed for the sanitized input. // Default: 0 - * }>, - * }, - * webhook?: bool|array{ // Webhook configuration - * enabled?: bool, // Default: false - * message_bus?: scalar|null, // The message bus to use. // Default: "messenger.default_bus" - * routing?: array, - * }, - * remote-event?: bool|array{ // RemoteEvent configuration - * enabled?: bool, // Default: false - * }, - * json_streamer?: bool|array{ // JSON streamer configuration - * enabled?: bool, // Default: true - * }, - * } - * @psalm-type ConfigType = array{ - * imports?: ImportsConfig, - * parameters?: ParametersConfig, - * services?: ServicesConfig, - * framework?: FrameworkConfig, - * "when@test"?: array{ - * imports?: ImportsConfig, - * parameters?: ParametersConfig, - * services?: ServicesConfig, - * framework?: FrameworkConfig, - * }, - * ..., - * }> - * } - */ -final class App extends AppReference -{ - /** - * @param ConfigType $config - * - * @psalm-return ConfigType - */ - public static function config(array $config): array - { - return parent::config($config); - } -} - -namespace Symfony\Component\Routing\Loader\Configurator; - -/** - * This class provides array-shapes for configuring the routes of an application. - * - * Example: - * - * ```php - * // config/routes.php - * namespace Symfony\Component\Routing\Loader\Configurator; - * - * return Routes::config([ - * 'controllers' => [ - * 'resource' => 'routing.controllers', - * ], - * ]); - * ``` - * - * @psalm-type RouteConfig = array{ - * path: string|array, - * controller?: string, - * methods?: string|list, - * requirements?: array, - * defaults?: array, - * options?: array, - * host?: string|array, - * schemes?: string|list, - * condition?: string, - * locale?: string, - * format?: string, - * utf8?: bool, - * stateless?: bool, - * } - * @psalm-type ImportConfig = array{ - * resource: string, - * type?: string, - * exclude?: string|list, - * prefix?: string|array, - * name_prefix?: string, - * trailing_slash_on_root?: bool, - * controller?: string, - * methods?: string|list, - * requirements?: array, - * defaults?: array, - * options?: array, - * host?: string|array, - * schemes?: string|list, - * condition?: string, - * locale?: string, - * format?: string, - * utf8?: bool, - * stateless?: bool, - * } - * @psalm-type AliasConfig = array{ - * alias: string, - * deprecated?: array{package:string, version:string, message?:string}, - * } - * @psalm-type RoutesConfig = array{ - * "when@test"?: array, - * ... - * } - */ -final class Routes extends RoutesReference -{ - /** - * @param RoutesConfig $config - * - * @psalm-return RoutesConfig - */ - public static function config(array $config): array - { - return parent::config($config); - } -} diff --git a/tests/Fixtures/app/config/routing_mercure.yml b/tests/Fixtures/app/config/routing_mercure.yml index a53938bb9c0..8f00918cd14 100644 --- a/tests/Fixtures/app/config/routing_mercure.yml +++ b/tests/Fixtures/app/config/routing_mercure.yml @@ -1,2 +1,2 @@ _main: - resource: routing_test.yml + resource: routing_test.php diff --git a/tests/Fixtures/app/config/routing_mongodb.php b/tests/Fixtures/app/config/routing_mongodb.php new file mode 100644 index 00000000000..80a26028b73 --- /dev/null +++ b/tests/Fixtures/app/config/routing_mongodb.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +use Symfony\Bundle\WebProfilerBundle\WebProfilerBundle; +use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; + +return function (RoutingConfigurator $routes) { + $routes->import('routing_common.yml'); + $routes->import('@TestBundle/Controller/MongoDbOdm', 'attribute'); + + if (class_exists(WebProfilerBundle::class)) { + // 2. Resolve the actual directory of the bundle + $reflection = new ReflectionClass(WebProfilerBundle::class); + $bundleDir = dirname($reflection->getFileName()); + + // 3. Check if the PHP config exists on the filesystem + $usePhp = file_exists($bundleDir.'/Resources/config/routing/wdt.php'); + $ext = $usePhp ? 'php' : 'xml'; + + // 4. Import dynamically based on the extension found + $routes->import("@WebProfilerBundle/Resources/config/routing/wdt.$ext") + ->prefix('/_wdt'); + + $routes->import("@WebProfilerBundle/Resources/config/routing/profiler.$ext") + ->prefix('/_profiler'); + } +}; diff --git a/tests/Fixtures/app/config/routing_mongodb.yml b/tests/Fixtures/app/config/routing_mongodb.yml index 1ac9a8ad499..691266c01db 100644 --- a/tests/Fixtures/app/config/routing_mongodb.yml +++ b/tests/Fixtures/app/config/routing_mongodb.yml @@ -1,14 +1,2 @@ _main: - resource: routing_common.yml - -controller: - resource: '@TestBundle/Controller/MongoDbOdm' - type: attribute - -web_profiler_wdt: - resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml' - prefix: /_wdt - -web_profiler_profiler: - resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml' - prefix: /_profiler + resource: routing_mongodb.php diff --git a/tests/Fixtures/app/config/routing_mysql.yml b/tests/Fixtures/app/config/routing_mysql.yml index a53938bb9c0..8f00918cd14 100644 --- a/tests/Fixtures/app/config/routing_mysql.yml +++ b/tests/Fixtures/app/config/routing_mysql.yml @@ -1,2 +1,2 @@ _main: - resource: routing_test.yml + resource: routing_test.php diff --git a/tests/Fixtures/app/config/routing_orm_v3.yml b/tests/Fixtures/app/config/routing_orm_v3.yml index a53938bb9c0..8f00918cd14 100644 --- a/tests/Fixtures/app/config/routing_orm_v3.yml +++ b/tests/Fixtures/app/config/routing_orm_v3.yml @@ -1,2 +1,2 @@ _main: - resource: routing_test.yml + resource: routing_test.php diff --git a/tests/Fixtures/app/config/routing_postgres.yml b/tests/Fixtures/app/config/routing_postgres.yml index a53938bb9c0..8f00918cd14 100644 --- a/tests/Fixtures/app/config/routing_postgres.yml +++ b/tests/Fixtures/app/config/routing_postgres.yml @@ -1,2 +1,2 @@ _main: - resource: routing_test.yml + resource: routing_test.php diff --git a/tests/Fixtures/app/config/routing_sqlite.yml b/tests/Fixtures/app/config/routing_sqlite.yml index a53938bb9c0..8f00918cd14 100644 --- a/tests/Fixtures/app/config/routing_sqlite.yml +++ b/tests/Fixtures/app/config/routing_sqlite.yml @@ -1,2 +1,2 @@ _main: - resource: routing_test.yml + resource: routing_test.php diff --git a/tests/Fixtures/app/config/routing_test.php b/tests/Fixtures/app/config/routing_test.php new file mode 100644 index 00000000000..4d74d8b24ee --- /dev/null +++ b/tests/Fixtures/app/config/routing_test.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +declare(strict_types=1); + +use Symfony\Bundle\WebProfilerBundle\WebProfilerBundle; +use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; + +return function (RoutingConfigurator $routes) { + $routes->import('routing_common.yml'); + $routes->import('@TestBundle/Controller/Orm', 'attribute'); + + if (class_exists(WebProfilerBundle::class)) { + // 2. Resolve the actual directory of the bundle + $reflection = new ReflectionClass(WebProfilerBundle::class); + $bundleDir = dirname($reflection->getFileName()); + + // 3. Check if the PHP config exists on the filesystem + $usePhp = file_exists($bundleDir.'/Resources/config/routing/wdt.php'); + $ext = $usePhp ? 'php' : 'xml'; + + // 4. Import dynamically based on the extension found + $routes->import("@WebProfilerBundle/Resources/config/routing/wdt.$ext") + ->prefix('/_wdt'); + + $routes->import("@WebProfilerBundle/Resources/config/routing/profiler.$ext") + ->prefix('/_profiler'); + } +}; diff --git a/tests/Fixtures/app/config/routing_test.yml b/tests/Fixtures/app/config/routing_test.yml index 094ea139e08..8f00918cd14 100644 --- a/tests/Fixtures/app/config/routing_test.yml +++ b/tests/Fixtures/app/config/routing_test.yml @@ -1,14 +1,2 @@ _main: - resource: routing_common.yml - -controller: - resource: '@TestBundle/Controller/Orm' - type: attribute - -web_profiler_wdt: - resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml' - prefix: /_wdt - -web_profiler_profiler: - resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml' - prefix: /_profiler + resource: routing_test.php diff --git a/tests/Functional/JsonStreamerTest.php b/tests/Functional/JsonStreamerTest.php index bc24ad2d14f..7247e0e069d 100644 --- a/tests/Functional/JsonStreamerTest.php +++ b/tests/Functional/JsonStreamerTest.php @@ -136,7 +136,12 @@ public function testJsonStreamerCollectionJsonLd(): void $buffer .= $chunk; }); - $r = self::createClient()->request('GET', '/json_stream_resources', ['headers' => ['accept' => 'application/ld+json']]); + try { + $r = self::createClient()->request('GET', '/json_stream_resources', ['headers' => ['accept' => 'application/ld+json']]); + } finally { + ob_end_clean(); + } + $res = json_decode($r->getBrowserKitResponse()->getContent(), true); $this->assertIsArray($res); diff --git a/tests/Functional/OpenApiTest.php b/tests/Functional/OpenApiTest.php index 6912d7154d9..e65ad3134b7 100644 --- a/tests/Functional/OpenApiTest.php +++ b/tests/Functional/OpenApiTest.php @@ -143,22 +143,25 @@ public function testErrorsAreDocumented(): void 'readOnly' => true, 'description' => 'A short, human-readable summary of the problem.', 'type' => [ - 0 => 'string', - 1 => 'null', + 'string', + 'null', ], ], 'detail' => [ 'readOnly' => true, 'description' => 'A human-readable explanation specific to this occurrence of the problem.', 'type' => [ - 0 => 'string', - 1 => 'null', + 'string', + 'null', ], ], 'status' => [ - 'type' => 'number', + 'type' => [ + 'number', + 'null', + ], 'examples' => [ - 0 => 404, + 404, ], 'default' => 400, ], @@ -166,8 +169,8 @@ public function testErrorsAreDocumented(): void 'readOnly' => true, 'description' => 'A URI reference that identifies the specific occurrence of the problem. It may or may not yield further information if dereferenced.', 'type' => [ - 0 => 'string', - 1 => 'null', + 'string', + 'null', ], ], 'type' => [ @@ -178,8 +181,8 @@ public function testErrorsAreDocumented(): void 'description' => [ 'readOnly' => true, 'type' => [ - 0 => 'string', - 1 => 'null', + 'string', + 'null', ], ], ], diff --git a/tests/Problem/Serializer/ConstraintViolationNormalizerTest.php b/tests/Problem/Serializer/ConstraintViolationNormalizerTest.php index f6e4039c5a2..47f519b8640 100644 --- a/tests/Problem/Serializer/ConstraintViolationNormalizerTest.php +++ b/tests/Problem/Serializer/ConstraintViolationNormalizerTest.php @@ -17,7 +17,6 @@ use PHPUnit\Framework\TestCase; use Prophecy\Argument; use Prophecy\PhpUnit\ProphecyTrait; -use Symfony\Component\Serializer\NameConverter\AdvancedNameConverterInterface; use Symfony\Component\Serializer\NameConverter\NameConverterInterface; use Symfony\Component\Validator\Constraints\NotNull; use Symfony\Component\Validator\ConstraintViolation; @@ -81,17 +80,7 @@ public static function nameConverterProvider(): iterable $nameConverterFactory = function (self $that): NameConverterInterface { $nameConverterProphecy = $that->prophesize(NameConverterInterface::class); - $nameConverterProphecy->normalize(Argument::type('string'))->will(fn ($args) => '_'.$args[0]); - - return $nameConverterProphecy->reveal(); - }; - yield [$nameConverterFactory, $expected]; - - $nameConverterFactory = function (self $that): NameConverterInterface { - $nameConverterProphecy = $that->prophesize(AdvancedNameConverterInterface::class); - $nameConverterProphecy->normalize(Argument::type('string'), null, Argument::type('string'))->will( - fn ($args) => '_'.$args[0] - ); + $nameConverterProphecy->normalize(Argument::cetera())->will(fn ($args) => '_'.$args[0]); return $nameConverterProphecy->reveal(); }; diff --git a/tests/Symfony/Bundle/Command/DebugResourceCommandTest.php b/tests/Symfony/Bundle/Command/DebugResourceCommandTest.php index 5c0f3b8c384..92006a89c10 100644 --- a/tests/Symfony/Bundle/Command/DebugResourceCommandTest.php +++ b/tests/Symfony/Bundle/Command/DebugResourceCommandTest.php @@ -37,7 +37,7 @@ private function getCommandTester(?DataDumperInterface $dumper = null): CommandT $application->setCatchExceptions(false); $application->setAutoExit(false); - if (method_exists($application, 'addCommand')) { + if (method_exists($application, 'addCommand')) { // @phpstan-ignore-line $application->addCommand(new DebugResourceCommand(new AttributesResourceMetadataCollectionFactory(), new VarCloner(), $dumper ?? new CliDumper())); } else { $application->add(new DebugResourceCommand(new AttributesResourceMetadataCollectionFactory(), new VarCloner(), $dumper ?? new CliDumper()));