@@ -53,15 +53,15 @@ public function loadClassMetadata(ClassMetadataInterface $classMetadata): bool
53
53
$ className = $ reflectionClass ->name ;
54
54
$ loaded = false ;
55
55
$ classGroups = [];
56
- $ classContextAnnotation = null ;
56
+ $ classContextAttribute = null ;
57
57
58
58
$ attributesMetadata = $ classMetadata ->getAttributesMetadata ();
59
59
60
- foreach ($ this ->loadAttributes ($ reflectionClass ) as $ annotation ) {
60
+ foreach ($ this ->loadAttributes ($ reflectionClass ) as $ attribute ) {
61
61
match (true ) {
62
- $ annotation instanceof DiscriminatorMap => $ classMetadata ->setClassDiscriminatorMapping (new ClassDiscriminatorMapping ($ annotation ->getTypeProperty (), $ annotation ->getMapping ())),
63
- $ annotation instanceof Groups => $ classGroups = $ annotation ->getGroups (),
64
- $ annotation instanceof Context => $ classContextAnnotation = $ annotation ,
62
+ $ attribute instanceof DiscriminatorMap => $ classMetadata ->setClassDiscriminatorMapping (new ClassDiscriminatorMapping ($ attribute ->getTypeProperty (), $ attribute ->getMapping ())),
63
+ $ attribute instanceof Groups => $ classGroups = $ attribute ->getGroups (),
64
+ $ attribute instanceof Context => $ classContextAttribute = $ attribute ,
65
65
default => null ,
66
66
};
67
67
}
@@ -74,31 +74,31 @@ public function loadClassMetadata(ClassMetadataInterface $classMetadata): bool
74
74
75
75
$ attributeMetadata = $ attributesMetadata [$ property ->name ];
76
76
if ($ property ->getDeclaringClass ()->name === $ className ) {
77
- if ($ classContextAnnotation ) {
78
- $ this ->setAttributeContextsForGroups ($ classContextAnnotation , $ attributeMetadata );
77
+ if ($ classContextAttribute ) {
78
+ $ this ->setAttributeContextsForGroups ($ classContextAttribute , $ attributeMetadata );
79
79
}
80
80
81
81
foreach ($ classGroups as $ group ) {
82
82
$ attributeMetadata ->addGroup ($ group );
83
83
}
84
84
85
- foreach ($ this ->loadAttributes ($ property ) as $ annotation ) {
85
+ foreach ($ this ->loadAttributes ($ property ) as $ attribute ) {
86
86
$ loaded = true ;
87
87
88
- if ($ annotation instanceof Groups) {
89
- foreach ($ annotation ->getGroups () as $ group ) {
88
+ if ($ attribute instanceof Groups) {
89
+ foreach ($ attribute ->getGroups () as $ group ) {
90
90
$ attributeMetadata ->addGroup ($ group );
91
91
}
92
92
93
93
continue ;
94
94
}
95
95
96
96
match (true ) {
97
- $ annotation instanceof MaxDepth => $ attributeMetadata ->setMaxDepth ($ annotation ->getMaxDepth ()),
98
- $ annotation instanceof SerializedName => $ attributeMetadata ->setSerializedName ($ annotation ->getSerializedName ()),
99
- $ annotation instanceof SerializedPath => $ attributeMetadata ->setSerializedPath ($ annotation ->getSerializedPath ()),
100
- $ annotation instanceof Ignore => $ attributeMetadata ->setIgnore (true ),
101
- $ annotation instanceof Context => $ this ->setAttributeContextsForGroups ($ annotation , $ attributeMetadata ),
97
+ $ attribute instanceof MaxDepth => $ attributeMetadata ->setMaxDepth ($ attribute ->getMaxDepth ()),
98
+ $ attribute instanceof SerializedName => $ attributeMetadata ->setSerializedName ($ attribute ->getSerializedName ()),
99
+ $ attribute instanceof SerializedPath => $ attributeMetadata ->setSerializedPath ($ attribute ->getSerializedPath ()),
100
+ $ attribute instanceof Ignore => $ attributeMetadata ->setIgnore (true ),
101
+ $ attribute instanceof Context => $ this ->setAttributeContextsForGroups ($ attribute , $ attributeMetadata ),
102
102
default => null ,
103
103
};
104
104
}
@@ -126,43 +126,43 @@ public function loadClassMetadata(ClassMetadataInterface $classMetadata): bool
126
126
}
127
127
}
128
128
129
- foreach ($ this ->loadAttributes ($ method ) as $ annotation ) {
130
- if ($ annotation instanceof Groups) {
129
+ foreach ($ this ->loadAttributes ($ method ) as $ attribute ) {
130
+ if ($ attribute instanceof Groups) {
131
131
if (!$ accessorOrMutator ) {
132
132
throw new MappingException (\sprintf ('Groups on "%s::%s()" cannot be added. Groups can only be added on methods beginning with "get", "is", "has" or "set". ' , $ className , $ method ->name ));
133
133
}
134
134
135
- foreach ($ annotation ->getGroups () as $ group ) {
135
+ foreach ($ attribute ->getGroups () as $ group ) {
136
136
$ attributeMetadata ->addGroup ($ group );
137
137
}
138
- } elseif ($ annotation instanceof MaxDepth) {
138
+ } elseif ($ attribute instanceof MaxDepth) {
139
139
if (!$ accessorOrMutator ) {
140
140
throw new MappingException (\sprintf ('MaxDepth on "%s::%s()" cannot be added. MaxDepth can only be added on methods beginning with "get", "is", "has" or "set". ' , $ className , $ method ->name ));
141
141
}
142
142
143
- $ attributeMetadata ->setMaxDepth ($ annotation ->getMaxDepth ());
144
- } elseif ($ annotation instanceof SerializedName) {
143
+ $ attributeMetadata ->setMaxDepth ($ attribute ->getMaxDepth ());
144
+ } elseif ($ attribute instanceof SerializedName) {
145
145
if (!$ accessorOrMutator ) {
146
146
throw new MappingException (\sprintf ('SerializedName on "%s::%s()" cannot be added. SerializedName can only be added on methods beginning with "get", "is", "has" or "set". ' , $ className , $ method ->name ));
147
147
}
148
148
149
- $ attributeMetadata ->setSerializedName ($ annotation ->getSerializedName ());
150
- } elseif ($ annotation instanceof SerializedPath) {
149
+ $ attributeMetadata ->setSerializedName ($ attribute ->getSerializedName ());
150
+ } elseif ($ attribute instanceof SerializedPath) {
151
151
if (!$ accessorOrMutator ) {
152
152
throw new MappingException (\sprintf ('SerializedPath on "%s::%s()" cannot be added. SerializedPath can only be added on methods beginning with "get", "is", "has" or "set". ' , $ className , $ method ->name ));
153
153
}
154
154
155
- $ attributeMetadata ->setSerializedPath ($ annotation ->getSerializedPath ());
156
- } elseif ($ annotation instanceof Ignore) {
155
+ $ attributeMetadata ->setSerializedPath ($ attribute ->getSerializedPath ());
156
+ } elseif ($ attribute instanceof Ignore) {
157
157
if ($ accessorOrMutator ) {
158
158
$ attributeMetadata ->setIgnore (true );
159
159
}
160
- } elseif ($ annotation instanceof Context) {
160
+ } elseif ($ attribute instanceof Context) {
161
161
if (!$ accessorOrMutator ) {
162
162
throw new MappingException (\sprintf ('Context on "%s::%s()" cannot be added. Context can only be added on methods beginning with "get", "is", "has" or "set". ' , $ className , $ method ->name ));
163
163
}
164
164
165
- $ this ->setAttributeContextsForGroups ($ annotation , $ attributeMetadata );
165
+ $ this ->setAttributeContextsForGroups ($ attribute , $ attributeMetadata );
166
166
}
167
167
168
168
$ loaded = true ;
@@ -195,12 +195,12 @@ private function loadAttributes(\ReflectionMethod|\ReflectionClass|\ReflectionPr
195
195
}
196
196
}
197
197
198
- private function setAttributeContextsForGroups (Context $ annotation , AttributeMetadataInterface $ attributeMetadata ): void
198
+ private function setAttributeContextsForGroups (Context $ attribute , AttributeMetadataInterface $ attributeMetadata ): void
199
199
{
200
- $ context = $ annotation ->getContext ();
201
- $ groups = $ annotation ->getGroups ();
202
- $ normalizationContext = $ annotation ->getNormalizationContext ();
203
- $ denormalizationContext = $ annotation ->getDenormalizationContext ();
200
+ $ context = $ attribute ->getContext ();
201
+ $ groups = $ attribute ->getGroups ();
202
+ $ normalizationContext = $ attribute ->getNormalizationContext ();
203
+ $ denormalizationContext = $ attribute ->getDenormalizationContext ();
204
204
205
205
if ($ normalizationContext || $ context ) {
206
206
$ attributeMetadata ->setNormalizationContextForGroups ($ normalizationContext ?: $ context , $ groups );
0 commit comments