File tree Expand file tree Collapse file tree 4 files changed +23
-3
lines changed
src/Symfony/Component/PropertyInfo Expand file tree Collapse file tree 4 files changed +23
-3
lines changed Original file line number Diff line number Diff line change 1111
1212namespace Symfony \Component \PropertyInfo \Tests \Extractor ;
1313
14+ use Doctrine \Common \Annotations \AnnotationReader ;
1415use PHPUnit \Framework \TestCase ;
1516use Symfony \Component \PropertyInfo \Extractor \SerializerExtractor ;
1617use Symfony \Component \PropertyInfo \Tests \Fixtures \AdderRemoverDummy ;
1718use Symfony \Component \PropertyInfo \Tests \Fixtures \Dummy ;
1819use Symfony \Component \PropertyInfo \Tests \Fixtures \IgnorePropertyDummy ;
1920use Symfony \Component \Serializer \Mapping \Factory \ClassMetadataFactory ;
21+ use Symfony \Component \Serializer \Mapping \Loader \AnnotationLoader ;
2022use Symfony \Component \Serializer \Mapping \Loader \AttributeLoader ;
2123
2224/**
@@ -28,7 +30,11 @@ class SerializerExtractorTest extends TestCase
2830
2931 protected function setUp (): void
3032 {
31- $ classMetadataFactory = new ClassMetadataFactory (new AttributeLoader ());
33+ if (class_exists (AttributeLoader::class)) {
34+ $ classMetadataFactory = new ClassMetadataFactory (new AttributeLoader ());
35+ } else {
36+ $ classMetadataFactory = new ClassMetadataFactory (new AnnotationLoader (new AnnotationReader ()));
37+ }
3238 $ this ->extractor = new SerializerExtractor ($ classMetadataFactory );
3339 }
3440
Original file line number Diff line number Diff line change 1111
1212namespace Symfony \Component \PropertyInfo \Tests \Fixtures ;
1313
14+ use Symfony \Component \Serializer \Annotation \Groups as GroupsAnnotation ;
1415use Symfony \Component \Serializer \Attribute \Groups ;
1516
1617/**
@@ -42,6 +43,7 @@ class Dummy extends ParentDummy
4243
4344 /**
4445 * @var \DateTimeImmutable[]
46+ * @GroupsAnnotation({"a", "b"})
4547 */
4648 #[Groups(['a ' , 'b ' ])]
4749 public $ collection ;
Original file line number Diff line number Diff line change 1111
1212namespace Symfony \Component \PropertyInfo \Tests \Fixtures ;
1313
14+ use Symfony \Component \Serializer \Annotation \Groups as GroupsAnnotation ;
15+ use Symfony \Component \Serializer \Annotation \Ignore as IgnoreAnnotation ;
1416use Symfony \Component \Serializer \Attribute \Groups ;
1517use Symfony \Component \Serializer \Attribute \Ignore ;
1618
1921 */
2022class IgnorePropertyDummy
2123{
24+ /**
25+ * @GroupsAnnotation({"a"})
26+ */
2227 #[Groups(['a ' ])]
2328 public $ visibleProperty ;
2429
30+ /**
31+ * @GroupsAnnotation({"a"})
32+ * @IgnoreAnnotation
33+ */
2534 #[Groups(['a ' ]), Ignore]
2635 private $ ignoredProperty ;
2736}
Original file line number Diff line number Diff line change 2727 "symfony/string" : " ^5.4|^6.0|^7.0"
2828 },
2929 "require-dev" : {
30- "symfony/serializer" : " ^6.4|^7.0" ,
30+ "doctrine/annotations" : " ^1.12|^2" ,
31+ "symfony/serializer" : " ^5.4|^6.4|^7.0" ,
3132 "symfony/cache" : " ^5.4|^6.0|^7.0" ,
3233 "symfony/dependency-injection" : " ^5.4|^6.0|^7.0" ,
3334 "phpdocumentor/reflection-docblock" : " ^5.2" ,
3435 "phpstan/phpdoc-parser" : " ^1.0|^2.0"
3536 },
3637 "conflict" : {
38+ "doctrine/annotations" : " <1.12" ,
3739 "phpdocumentor/reflection-docblock" : " <5.2" ,
3840 "phpdocumentor/type-resolver" : " <1.5.1" ,
39- "symfony/dependency-injection" : " <5.4"
41+ "symfony/dependency-injection" : " <5.4" ,
42+ "symfony/dependency-injection" : " <5.4|>=6.0,<6.4"
4043 },
4144 "autoload" : {
4245 "psr-4" : { "Symfony\\ Component\\ PropertyInfo\\ " : " " },
You can’t perform that action at this time.
0 commit comments