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 11
11
12
12
namespace Symfony \Component \PropertyInfo \Tests \Extractor ;
13
13
14
+ use Doctrine \Common \Annotations \AnnotationReader ;
14
15
use PHPUnit \Framework \TestCase ;
15
16
use Symfony \Component \PropertyInfo \Extractor \SerializerExtractor ;
16
17
use Symfony \Component \PropertyInfo \Tests \Fixtures \AdderRemoverDummy ;
17
18
use Symfony \Component \PropertyInfo \Tests \Fixtures \Dummy ;
18
19
use Symfony \Component \PropertyInfo \Tests \Fixtures \IgnorePropertyDummy ;
19
20
use Symfony \Component \Serializer \Mapping \Factory \ClassMetadataFactory ;
21
+ use Symfony \Component \Serializer \Mapping \Loader \AnnotationLoader ;
20
22
use Symfony \Component \Serializer \Mapping \Loader \AttributeLoader ;
21
23
22
24
/**
@@ -28,7 +30,11 @@ class SerializerExtractorTest extends TestCase
28
30
29
31
protected function setUp (): void
30
32
{
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
+ }
32
38
$ this ->extractor = new SerializerExtractor ($ classMetadataFactory );
33
39
}
34
40
Original file line number Diff line number Diff line change 11
11
12
12
namespace Symfony \Component \PropertyInfo \Tests \Fixtures ;
13
13
14
+ use Symfony \Component \Serializer \Annotation \Groups as GroupsAnnotation ;
14
15
use Symfony \Component \Serializer \Attribute \Groups ;
15
16
16
17
/**
@@ -42,6 +43,7 @@ class Dummy extends ParentDummy
42
43
43
44
/**
44
45
* @var \DateTimeImmutable[]
46
+ * @GroupsAnnotation({"a", "b"})
45
47
*/
46
48
#[Groups(['a ' , 'b ' ])]
47
49
public $ collection ;
Original file line number Diff line number Diff line change 11
11
12
12
namespace Symfony \Component \PropertyInfo \Tests \Fixtures ;
13
13
14
+ use Symfony \Component \Serializer \Annotation \Groups as GroupsAnnotation ;
15
+ use Symfony \Component \Serializer \Annotation \Ignore as IgnoreAnnotation ;
14
16
use Symfony \Component \Serializer \Attribute \Groups ;
15
17
use Symfony \Component \Serializer \Attribute \Ignore ;
16
18
19
21
*/
20
22
class IgnorePropertyDummy
21
23
{
24
+ /**
25
+ * @GroupsAnnotation({"a"})
26
+ */
22
27
#[Groups(['a ' ])]
23
28
public $ visibleProperty ;
24
29
30
+ /**
31
+ * @GroupsAnnotation({"a"})
32
+ * @IgnoreAnnotation
33
+ */
25
34
#[Groups(['a ' ]), Ignore]
26
35
private $ ignoredProperty ;
27
36
}
Original file line number Diff line number Diff line change 27
27
"symfony/string" : " ^5.4|^6.0|^7.0"
28
28
},
29
29
"require-dev" : {
30
- "symfony/serializer" : " ^6.4|^7.0" ,
30
+ "doctrine/annotations" : " ^1.12|^2" ,
31
+ "symfony/serializer" : " ^5.4|^6.4|^7.0" ,
31
32
"symfony/cache" : " ^5.4|^6.0|^7.0" ,
32
33
"symfony/dependency-injection" : " ^5.4|^6.0|^7.0" ,
33
34
"phpdocumentor/reflection-docblock" : " ^5.2" ,
34
35
"phpstan/phpdoc-parser" : " ^1.0|^2.0"
35
36
},
36
37
"conflict" : {
38
+ "doctrine/annotations" : " <1.12" ,
37
39
"phpdocumentor/reflection-docblock" : " <5.2" ,
38
40
"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"
40
43
},
41
44
"autoload" : {
42
45
"psr-4" : { "Symfony\\ Component\\ PropertyInfo\\ " : " " },
You can’t perform that action at this time.
0 commit comments