Skip to content

Commit c817241

Browse files
feature #51470 [FrameworkBundle][Serializer] Deprecate annotations (alexandre-daubois)
This PR was merged into the 6.4 branch. Discussion ---------- [FrameworkBundle][Serializer] Deprecate annotations | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | no | Deprecations? | yes | Tickets | - | License | MIT | Doc PR | - Part of #51381 Commits ------- a658692 [FrameworkBundle][Serializer] Deprecate annotations
2 parents 1469612 + a658692 commit c817241

27 files changed

+440
-386
lines changed

UPGRADE-6.4.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ Serializer
206206
----------
207207

208208
* Deprecate Doctrine annotations support in favor of native attributes
209-
* Deprecate passing an annotation reader to the constructor of `AnnotationLoader`
209+
* Deprecate `AnnotationLoader`, use `AttributeLoader` instead
210210

211211
Templating
212212
----------

src/Symfony/Bridge/Twig/Tests/Extension/SerializerExtensionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
use Symfony\Component\Serializer\Encoder\JsonEncoder;
1919
use Symfony\Component\Serializer\Encoder\YamlEncoder;
2020
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory;
21-
use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader;
21+
use Symfony\Component\Serializer\Mapping\Loader\AttributeLoader;
2222
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
2323
use Symfony\Component\Serializer\Serializer;
2424
use Twig\Environment;
@@ -49,7 +49,7 @@ public static function serializerDataProvider(): \Generator
4949

5050
private function getTwig(string $template): Environment
5151
{
52-
$meta = new ClassMetadataFactory(new AnnotationLoader());
52+
$meta = new ClassMetadataFactory(new AttributeLoader());
5353
$runtime = new SerializerRuntime(new Serializer([new ObjectNormalizer($meta)], [new JsonEncoder(), new YamlEncoder()]));
5454

5555
$mockRuntimeLoader = $this->createMock(RuntimeLoaderInterface::class);

src/Symfony/Bridge/Twig/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"symfony/security-core": "^5.4|^6.0|^7.0",
4444
"symfony/security-csrf": "^5.4|^6.0|^7.0",
4545
"symfony/security-http": "^5.4|^6.0|^7.0",
46-
"symfony/serializer": "^6.2|^7.0",
46+
"symfony/serializer": "^6.4|^7.0",
4747
"symfony/stopwatch": "^5.4|^6.0|^7.0",
4848
"symfony/console": "^5.4|^6.0|^7.0",
4949
"symfony/expression-language": "^5.4|^6.0|^7.0",
@@ -61,7 +61,7 @@
6161
"symfony/http-foundation": "<5.4",
6262
"symfony/http-kernel": "<6.4",
6363
"symfony/mime": "<6.2",
64-
"symfony/serializer": "<6.2",
64+
"symfony/serializer": "<6.4",
6565
"symfony/translation": "<5.4",
6666
"symfony/workflow": "<5.4"
6767
},

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@
157157
use Symfony\Component\Semaphore\Store\StoreFactory as SemaphoreStoreFactory;
158158
use Symfony\Component\Serializer\Encoder\DecoderInterface;
159159
use Symfony\Component\Serializer\Encoder\EncoderInterface;
160-
use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader;
160+
use Symfony\Component\Serializer\Mapping\Loader\AttributeLoader;
161161
use Symfony\Component\Serializer\Mapping\Loader\XmlFileLoader;
162162
use Symfony\Component\Serializer\Mapping\Loader\YamlFileLoader;
163163
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
@@ -1932,7 +1932,7 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
19321932
$serializerLoaders = [];
19331933
if (isset($config['enable_attributes']) && $config['enable_attributes']) {
19341934
$annotationLoader = new Definition(
1935-
AnnotationLoader::class,
1935+
AttributeLoader::class,
19361936
[new Reference('annotation_reader', ContainerInterface::NULL_ON_INVALID_REFERENCE)]
19371937
);
19381938

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
use Symfony\Component\Notifier\TexterInterface;
6666
use Symfony\Component\PropertyAccess\PropertyAccessor;
6767
use Symfony\Component\Security\Core\AuthenticationEvents;
68-
use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader;
68+
use Symfony\Component\Serializer\Mapping\Loader\AttributeLoader;
6969
use Symfony\Component\Serializer\Mapping\Loader\XmlFileLoader;
7070
use Symfony\Component\Serializer\Mapping\Loader\YamlFileLoader;
7171
use Symfony\Component\Serializer\Normalizer\ConstraintViolationListNormalizer;
@@ -1489,7 +1489,7 @@ public function testSerializerEnabled()
14891489
$argument = $container->getDefinition('serializer.mapping.chain_loader')->getArgument(0);
14901490

14911491
$this->assertCount(2, $argument);
1492-
$this->assertEquals(AnnotationLoader::class, $argument[0]->getClass());
1492+
$this->assertEquals(AttributeLoader::class, $argument[0]->getClass());
14931493
$this->assertEquals(new Reference('serializer.name_converter.camel_case_to_snake_case'), $container->getDefinition('serializer.name_converter.metadata_aware')->getArgument(1));
14941494
$this->assertEquals(new Reference('property_info', ContainerBuilder::IGNORE_ON_INVALID_REFERENCE), $container->getDefinition('serializer.normalizer.object')->getArgument(3));
14951495
$this->assertArrayHasKey('circular_reference_handler', $container->getDefinition('serializer.normalizer.object')->getArgument(6));

src/Symfony/Bundle/SecurityBundle/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"symfony/ldap": "^5.4|^6.0|^7.0",
4646
"symfony/process": "^5.4|^6.0|^7.0",
4747
"symfony/rate-limiter": "^5.4|^6.0|^7.0",
48-
"symfony/serializer": "^5.4|^6.0|^7.0",
48+
"symfony/serializer": "^6.4|^7.0",
4949
"symfony/translation": "^5.4|^6.0|^7.0",
5050
"symfony/twig-bundle": "^5.4|^6.0|^7.0",
5151
"symfony/twig-bridge": "^5.4|^6.0|^7.0",

src/Symfony/Component/HttpKernel/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
"symfony/translation": "<5.4",
6767
"symfony/translation-contracts": "<2.5",
6868
"symfony/twig-bridge": "<5.4",
69-
"symfony/validator": "<5.4",
69+
"symfony/validator": "<6.4",
7070
"symfony/var-dumper": "<6.3",
7171
"twig/twig": "<2.13"
7272
},

src/Symfony/Component/PropertyInfo/Tests/Extractor/SerializerExtractorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
use Symfony\Component\PropertyInfo\Tests\Fixtures\Dummy;
1818
use Symfony\Component\PropertyInfo\Tests\Fixtures\IgnorePropertyDummy;
1919
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory;
20-
use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader;
20+
use Symfony\Component\Serializer\Mapping\Loader\AttributeLoader;
2121

2222
/**
2323
* @author Kévin Dunglas <dunglas@gmail.com>
@@ -28,7 +28,7 @@ class SerializerExtractorTest extends TestCase
2828

2929
protected function setUp(): void
3030
{
31-
$classMetadataFactory = new ClassMetadataFactory(new AnnotationLoader());
31+
$classMetadataFactory = new ClassMetadataFactory(new AttributeLoader());
3232
$this->extractor = new SerializerExtractor($classMetadataFactory);
3333
}
3434

src/Symfony/Component/PropertyInfo/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"symfony/string": "^5.4|^6.0|^7.0"
2828
},
2929
"require-dev": {
30-
"symfony/serializer": "^5.4|^6.0|^7.0",
30+
"symfony/serializer": "^6.4|^7.0",
3131
"symfony/cache": "^5.4|^6.0|^7.0",
3232
"symfony/dependency-injection": "^5.4|^6.0|^7.0",
3333
"phpdocumentor/reflection-docblock": "^5.2",
@@ -37,7 +37,7 @@
3737
"phpdocumentor/reflection-docblock": "<5.2",
3838
"phpdocumentor/type-resolver": "<1.5.1",
3939
"symfony/dependency-injection": "<5.4",
40-
"symfony/serializer": "<5.4"
40+
"symfony/serializer": "<6.4"
4141
},
4242
"autoload": {
4343
"psr-4": { "Symfony\\Component\\PropertyInfo\\": "" },

src/Symfony/Component/Serializer/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ CHANGELOG
66

77
* Allow `Context` attribute to target classes
88
* Deprecate Doctrine annotations support in favor of native attributes
9-
* Deprecate passing an annotation reader to the constructor of `AnnotationLoader`
109
* Allow the `Groups` attribute/annotation on classes
1110
* JsonDecode: Add `json_decode_detailed_errors` option
1211
* Make `ProblemNormalizer` give details about Messenger's `ValidationFailedException`
1312
* Add `XmlEncoder::CDATA_WRAPPING` context option
13+
* Deprecate `AnnotationLoader`, use `AttributeLoader` instead
1414

1515
6.3
1616
---

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy