Skip to content

Commit 5b07fe6

Browse files
[FrameworkBundle][Serializer] Deprecate annotations
1 parent 62e115f commit 5b07fe6

27 files changed

+164
-129
lines changed

UPGRADE-6.4.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ Serializer
146146
----------
147147

148148
* Deprecate Doctrine annotations support in favor of native attributes
149-
* Deprecate passing an annotation reader to the constructor of `AnnotationLoader`
149+
* Deprecate `AnnotationLoader`, use `AttributeLoader` instead
150+
* Deprecate `AttributeLoader::loadAnnotations()`, use `AttributeLoader::loadAttributes()` instead
150151

151152
Templating
152153
----------

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.2",
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 & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@
162162
use Symfony\Component\Semaphore\Store\StoreFactory as SemaphoreStoreFactory;
163163
use Symfony\Component\Serializer\Encoder\DecoderInterface;
164164
use Symfony\Component\Serializer\Encoder\EncoderInterface;
165-
use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader;
165+
use Symfony\Component\Serializer\Mapping\Loader\AttributeLoader;
166166
use Symfony\Component\Serializer\Mapping\Loader\XmlFileLoader;
167167
use Symfony\Component\Serializer\Mapping\Loader\YamlFileLoader;
168168
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
@@ -1935,12 +1935,7 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
19351935
$container->removeDefinition('serializer.mapping.cache_class_metadata_factory');
19361936
}
19371937

1938-
$annotationLoader = new Definition(
1939-
AnnotationLoader::class,
1940-
[new Reference('annotation_reader', ContainerInterface::NULL_ON_INVALID_REFERENCE)]
1941-
);
1942-
1943-
$serializerLoaders[] = $annotationLoader;
1938+
$serializerLoaders[] = new Definition(AttributeLoader::class);
19441939
}
19451940

19461941
$fileRecorder = function ($extension, $path) use (&$serializerLoaders) {

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
@@ -44,7 +44,7 @@
4444
"symfony/ldap": "^5.4|^6.0|^7.0",
4545
"symfony/process": "^5.4|^6.0|^7.0",
4646
"symfony/rate-limiter": "^5.4|^6.0|^7.0",
47-
"symfony/serializer": "^5.4|^6.0|^7.0",
47+
"symfony/serializer": "^6.4|^7.0",
4848
"symfony/translation": "^5.4|^6.0|^7.0",
4949
"symfony/twig-bundle": "^5.4|^6.0|^7.0",
5050
"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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ CHANGELOG
55
---
66

77
* Deprecate Doctrine annotations support in favor of native attributes
8-
* Deprecate passing an annotation reader to the constructor of `AnnotationLoader`
98
* Allow the `Groups` attribute/annotation on classes
109
* JsonDecode: Add `json_decode_detailed_errors` option
10+
* Deprecate `AnnotationLoader`, use `AttributeLoader` instead
11+
* Deprecate `AttributeLoader::loadAnnotations()`, use `AttributeLoader::loadAttributes()` instead
1112

1213
6.3
1314
---

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