diff --git a/Tests/Normalizer/AbstractObjectNormalizerTest.php b/Tests/Normalizer/AbstractObjectNormalizerTest.php index 2084d83b..49f19666 100644 --- a/Tests/Normalizer/AbstractObjectNormalizerTest.php +++ b/Tests/Normalizer/AbstractObjectNormalizerTest.php @@ -837,12 +837,12 @@ public function testDenormalizeWithCorrectOrderOfAttributeAndProperty() $this->assertSame('nested-id', $test->id); } - public function testNormalizeWithIgnoreAnnotationAndPrivateProperties() + public function testNormalizeWithIgnoreAttributeAndPrivateProperties() { - $classMetadataFactory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader())); + $classMetadataFactory = new ClassMetadataFactory(new AttributeLoader()); $serializer = new Serializer([new ObjectNormalizer($classMetadataFactory)]); - $this->assertSame(['foo' => 'foo'], $serializer->normalize(new ObjectDummyWithIgnoreAnnotationAndPrivateProperty())); + $this->assertSame(['foo' => 'foo'], $serializer->normalize(new ObjectDummyWithIgnoreAttributeAndPrivateProperty())); } public function testDenormalizeUntypedFormat() @@ -1054,11 +1054,11 @@ class ObjectDummyWithContextAttributeSkipNullValues public ?string $propertyWithNullSkipNullValues = null; } -class ObjectDummyWithIgnoreAnnotationAndPrivateProperty +class ObjectDummyWithIgnoreAttributeAndPrivateProperty { public $foo = 'foo'; - /** @Ignore */ + #[Ignore] public $ignored = 'ignored'; private $private = 'private'; diff --git a/Tests/Normalizer/GetSetMethodNormalizerTest.php b/Tests/Normalizer/GetSetMethodNormalizerTest.php index 5e9be09b..1d471981 100644 --- a/Tests/Normalizer/GetSetMethodNormalizerTest.php +++ b/Tests/Normalizer/GetSetMethodNormalizerTest.php @@ -16,7 +16,7 @@ use Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor; use Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor; use Symfony\Component\PropertyInfo\PropertyInfoExtractor; -use Symfony\Component\Serializer\Annotation\DiscriminatorMap; +use Symfony\Component\Serializer\Attribute\DiscriminatorMap; use Symfony\Component\Serializer\Exception\LogicException; use Symfony\Component\Serializer\Mapping\ClassDiscriminatorFromClassMetadata; use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory; @@ -494,7 +494,7 @@ protected function getNormalizerForSkipUninitializedValues(): NormalizerInterfac public function testNormalizeWithDiscriminator() { - $classMetadataFactory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader())); + $classMetadataFactory = new ClassMetadataFactory(new AttributeLoader()); $discriminator = new ClassDiscriminatorFromClassMetadata($classMetadataFactory); $normalizer = new GetSetMethodNormalizer($classMetadataFactory, null, null, $discriminator); @@ -503,7 +503,7 @@ public function testNormalizeWithDiscriminator() public function testDenormalizeWithDiscriminator() { - $classMetadataFactory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader())); + $classMetadataFactory = new ClassMetadataFactory(new AttributeLoader()); $discriminator = new ClassDiscriminatorFromClassMetadata($classMetadataFactory); $normalizer = new GetSetMethodNormalizer($classMetadataFactory, null, null, $discriminator); @@ -777,12 +777,10 @@ public function __call($key, $value) } } -/** - * @DiscriminatorMap(typeProperty="type", mapping={ - * "one" = GetSetMethodDiscriminatedDummyOne::class, - * "two" = GetSetMethodDiscriminatedDummyTwo::class, - * }) - */ +#[DiscriminatorMap(typeProperty: 'type', mapping: [ + 'one' => GetSetMethodDiscriminatedDummyOne::class, + 'two' => GetSetMethodDiscriminatedDummyTwo::class, +])] interface GetSetMethodDummyInterface { } diff --git a/Tests/Normalizer/PropertyNormalizerTest.php b/Tests/Normalizer/PropertyNormalizerTest.php index 8461ecee..631111d2 100644 --- a/Tests/Normalizer/PropertyNormalizerTest.php +++ b/Tests/Normalizer/PropertyNormalizerTest.php @@ -15,7 +15,7 @@ use Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor; use Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor; use Symfony\Component\PropertyInfo\PropertyInfoExtractor; -use Symfony\Component\Serializer\Annotation\DiscriminatorMap; +use Symfony\Component\Serializer\Attribute\DiscriminatorMap; use Symfony\Component\Serializer\Exception\LogicException; use Symfony\Component\Serializer\Mapping\ClassDiscriminatorFromClassMetadata; use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory; @@ -499,7 +499,7 @@ protected function getNormalizerForSkipUninitializedValues(): NormalizerInterfac public function testNormalizeWithDiscriminator() { - $classMetadataFactory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader())); + $classMetadataFactory = new ClassMetadataFactory(new AttributeLoader()); $discriminator = new ClassDiscriminatorFromClassMetadata($classMetadataFactory); $normalizer = new PropertyNormalizer($classMetadataFactory, null, null, $discriminator); @@ -508,7 +508,7 @@ public function testNormalizeWithDiscriminator() public function testDenormalizeWithDiscriminator() { - $classMetadataFactory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader())); + $classMetadataFactory = new ClassMetadataFactory(new AttributeLoader()); $discriminator = new ClassDiscriminatorFromClassMetadata($classMetadataFactory); $normalizer = new PropertyNormalizer($classMetadataFactory, null, null, $discriminator); @@ -621,12 +621,10 @@ public function getIntMatrix(): array } } -/** - * @DiscriminatorMap(typeProperty="type", mapping={ - * "one" = PropertyDiscriminatedDummyOne::class, - * "two" = PropertyDiscriminatedDummyTwo::class, - * }) - */ +#[DiscriminatorMap(typeProperty: 'type', mapping: [ + 'one' => PropertyDiscriminatedDummyOne::class, + 'two' => PropertyDiscriminatedDummyTwo::class, +])] interface PropertyDummyInterface { }