10000 [Serializer] Fix Serializer deprecations merge · symfony/symfony@61a23a3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 61a23a3

Browse files
[Serializer] Fix Serializer deprecations merge
1 parent f314f65 commit 61a23a3

File tree

7 files changed

+9
-276
lines changed

7 files changed

+9
-276
lines changed

UPGRADE-7.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,7 @@ Serializer
547547
// ...
548548
}
549549
```
550+
* Remove `AnnotationLoader`, use `AttributeLoader` instead
550551

551552
Templating
552553
----------

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1858,9 +1858,9 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
18581858

18591859
$serializerLoaders = [];
18601860
if (isset($config['enable_attributes']) && $config['enable_attributes']) {
1861-
$annotationLoader = new Definition(AttributeLoader::class);
1861+
$attributeLoader = new Definition(AttributeLoader::class);
18621862

1863-
$serializerLoaders[] = $annotationLoader;
1863+
$serializerLoaders[] = $attributeLoader;
18641864
}
18651865

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

src/Symfony/Component/Serializer/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ CHANGELOG
1313
* Require explicit argument when calling `AttributeMetadata::setSerializedName()` and `ClassMetadata::setClassDiscriminatorMapping()`
1414
* Add argument `$context` to `NormalizerInterface::supportsNormalization()` and `DenormalizerInterface::supportsDenormalization()`
1515
* Remove Doctrine annotations support in favor of native attributes
16-
* Remove the annotation reader parameter from the constructor of `AnnotationLoader`
16+
* Remove `AnnotationLoader`, use `AttributeLoader` instead
1717

1818
6.4
1919
---

src/Symfony/Component/Serializer/Mapping/Loader/AttributeLoader.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,3 @@ private function getPropertyAnnotations(\ReflectionProperty $reflector): array
307307
return $annotations;
308308
}
309309
}
310-
311-
if (!class_exists(AnnotationLoader::class, false)) {
312-
class_alias(AttributeLoader::class, AnnotationLoader::class);
313-
}

src/Symfony/Component/Serializer/Tests/Mapping/Loader/AnnotationLoaderTest.php

Lines changed: 0 additions & 257 deletions
This file was deleted.

src/Symfony/Component/Serializer/Tests/Mapping/Loader/AttributeLoaderTestCase.php renamed to src/Symfony/Component/Serializer/Tests/Mapping/Loader/AttributeLoaderTest.php

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,12 @@
1818
use Symfony\Component\Serializer\Mapping\AttributeMetadata;
1919
use Symfony\Component\Serializer\Mapping\ClassDiscriminatorMapping;
2020
use Symfony\Component\Serializer\Mapping\ClassMetadata;
21-
use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader;
2221
use Symfony\Component\Serializer\Mapping\Loader\AttributeLoader;
2322
use Symfony\Component\Serializer\Mapping\Loader\LoaderInterface;
2423
use Symfony\Component\Serializer\Tests\Fixtures\Attributes\AbstractDummy;
2524
use Symfony\Component\Serializer\Tests\Fixtures\Attributes\AbstractDummyFirstChild;
2625
use Symfony\Component\Serializer\Tests\Fixtures\Attributes\AbstractDummySecondChild;
2726
use Symfony\Component\Serializer\Tests\Fixtures\Attributes\AbstractDummyThirdChild;
28-
use Symfony\Component\Serializer\Tests\Fixtures\Attributes\BadAttributeDummy;
2927
use Symfony\Component\Serializer\Tests\Fixtures\Attributes\BadMethodContextDummy;
3028
use Symfony\Component\Serializer\Tests\Fixtures\Attributes\ContextDummyParent;
3129
use Symfony\Component\Serializer\Tests\Fixtures\Attributes\ContextDummyPromotedProperties;
@@ -46,19 +44,16 @@
4644
/**
4745
* @author Kévin Dunglas <dunglas@gmail.com>
4846
*/
49-
<<<<<<<< HEAD:src/Symfony/Component/Serializer/Tests/Mapping/Loader/AnnotationLoaderTest.php
50-
========
51-
abstract class AttributeLoaderTestCase extends TestCase
52-
>>>>>>>> 6.4:src/Symfony/Component/Serializer/Tests/Mapping/Loader/AttributeLoaderTestCase.php
47+
class AttributeLoaderTest extends TestCase
5348
{
5449
use ContextMappingTestTrait;
5550
use ExpectDeprecationTrait;
5651

57-
private AnnotationLoader $loader;
52+
protected AttributeLoader $loader;
5853

5954
protected function setUp(): void
6055
{
61-
$this->loader = new AnnotationLoader();
56+
$this->loader = new AttributeLoader();
6257
}
6358

6459
public function testInterface()
@@ -226,9 +221,7 @@ public function testLoadGrou 9E88 psOnClass()
226221
self::assertSame(['a'], $attributesMetadata['baz']->getGroups());
227222
}
228223

229-
abstract protected function createLoader(): AttributeLoader;
230-
231-
protected function getLoaderForContextMapping(): AnnotationLoader
224+
protected function getLoaderForContextMapping(): AttributeLoader
232225
{
233226
return $this->loader;
234227
}

src/Symfony/Component/Serializer/Tests/Mapping/Loader/AttributeLoaderWithAttributesTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use Symfony\Component\Serializer\Mapping\ClassMetadata;
1616
use Symfony\Component\Serializer\Mapping\Loader\AttributeLoader;
1717

18-
class AttributeLoaderWithAttributesTest extends AttributeLoaderTestCase
18+
class AttributeLoaderWithAttributesTest extends AttributeLoaderTest
1919
{
2020
protected function createLoader(): AttributeLoader
2121
{

0 commit comments

Comments
 (0)
0