|
11 | 11 |
|
12 | 12 | namespace Symfony\Component\Serializer\Mapping\Loader;
|
13 | 13 |
|
14 |
| -use Doctrine\Common\Annotations\Reader; |
15 | 14 | use Symfony\Component\Serializer\Annotation\Context;
|
16 | 15 | use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
|
17 | 16 | use Symfony\Component\Serializer\Annotation\Groups;
|
@@ -43,14 +42,6 @@ class AnnotationLoader implements LoaderInterface
|
43 | 42 | Context::class,
|
44 | 43 | ];
|
45 | 44 |
|
46 |
| - public function __construct( |
47 |
| - private readonly ?Reader $reader = null, |
48 |
| - ) { |
49 |
| - if ($reader) { |
50 |
| - trigger_deprecation('symfony/validator', '6.4', 'Passing a "%s" instance as argument 1 to "%s()" is deprecated, pass null or omit the parameter instead.', get_debug_type($reader), __METHOD__); |
51 |
| - } |
52 |
| - } |
53 |
| - |
54 | 45 | public function loadClassMetadata(ClassMetadataInterface $classMetadata): bool
|
55 | 46 | {
|
56 | 47 | $reflectionClass = $classMetadata->getReflectionClass();
|
@@ -187,20 +178,6 @@ public function loadAnnotations(\ReflectionMethod|\ReflectionClass|\ReflectionPr
|
187 | 178 | }
|
188 | 179 | }
|
189 | 180 | }
|
190 |
| - |
191 |
| - if (null === $this->reader) { |
192 |
| - return; |
193 |
| - } |
194 |
| - |
195 |
| - if ($reflector instanceof \ReflectionClass) { |
196 |
| - yield from $this->getClassAnnotations($reflector); |
197 |
| - } |
198 |
| - if ($reflector instanceof \ReflectionMethod) { |
199 |
| - yield from $this->getMethodAnnotations($reflector); |
200 |
| - } |
201 |
| - if ($reflector instanceof \ReflectionProperty) { |
202 |
| - yield from $this->getPropertyAnnotations($reflector); |
203 |
| - } |
204 | 181 | }
|
205 | 182 |
|
206 | 183 | private function setAttributeContextsForGroups(Context $annotation, AttributeMetadataInterface $attributeMetadata): void
|
@@ -229,49 +206,4 @@ private function isKnownAttribute(string $attributeName): bool
|
229 | 206 |
|
230 | 207 | return false;
|
231 | 208 | }
|
232 |
| - |
233 |
| - /** |
234 |
| - * @return object[] |
235 |
| - */ |
236 |
| - private function getClassAnnotations(\ReflectionClass $reflector): array |
237 |
| - { |
238 |
| - if ($annotations = array_filter( |
239 |
| - $this->reader->getClassAnnotations($reflector), |
240 |
| - fn (object $annotation): bool => $this->isKnownAttribute($annotation::class), |
241 |
| - )) { |
242 |
| - trigger_deprecation('symfony/serializer', '6.4', 'Class "%s" uses Doctrine Annotations to configure serialization, which is deprecated. Use PHP attributes instead.', $reflector->getName()); |
243 |
| - } |
244 |
| - |
245 |
| - return $annotations; |
246 |
| - } |
247 |
| - |
248 |
| - /** |
249 |
| - * @return object[] |
250 |
| - */ |
251 |
| -
10000
private function getMethodAnnotations(\ReflectionMethod $reflector): array |
252 |
| - { |
253 |
| - if ($annotations = array_filter( |
254 |
| - $this->reader->getMethodAnnotations($reflector), |
255 |
| - fn (object $annotation): bool => $this->isKnownAttribute($annotation::class), |
256 |
| - )) { |
257 |
| - trigger_deprecation('symfony/serializer', '6.4', 'Method "%s::%s()" uses Doctrine Annotations to configure serialization, which is deprecated. Use PHP attributes instead.', $reflector->getDeclaringClass()->getName(), $reflector->getName()); |
258 |
| - } |
259 |
| - |
260 |
| - return $annotations; |
261 |
| - } |
262 |
| - |
263 |
| - /** |
264 |
| - * @return object[] |
265 |
| - */ |
266 |
| - private function getPropertyAnnotations(\ReflectionProperty $reflector): array |
267 |
| - { |
268 |
| - if ($annotations = array_filter( |
269 |
| - $this->reader->getPropertyAnnotations($reflector), |
270 |
| - fn (object $annotation): bool => $this->isKnownAttribute($annotation::class), |
271 |
| - )) { |
272 |
| - trigger_deprecation('symfony/serializer', '6.4', 'Property "%s::$%s" uses Doctrine Annotations to configure serialization, which is deprecated. Use PHP attributes instead.', $reflector->getDeclaringClass()->getName(), $reflector->getName()); |
273 |
| - } |
274 |
| - |
275 |
| - return $annotations; |
276 |
| - } |
277 | 209 | }
|
0 commit comments