diff --git a/src/Metadata/Driver/AttributeDriver/AttributeReader.php b/src/Metadata/Driver/AttributeDriver/AttributeReader.php index 0b5156b22..ad8085d2b 100644 --- a/src/Metadata/Driver/AttributeDriver/AttributeReader.php +++ b/src/Metadata/Driver/AttributeDriver/AttributeReader.php @@ -46,7 +46,8 @@ public function getMethodAnnotation(ReflectionMethod $method, $annotationName): { $attributes = $method->getAttributes($annotationName); - return $this->reader->getClassAnnotation($method, $annotationName) ?? $this->buildAnnotation($attributes); + return $this->reader->getClassAnnotation(new ReflectionClass($method->class), $annotationName) + ?? $this->buildAnnotation($attributes); } public function getPropertyAnnotations(ReflectionProperty $property): array @@ -60,7 +61,8 @@ public function getPropertyAnnotation(ReflectionProperty $property, $annotationN { $attributes = $property->getAttributes($annotationName); - return $this->reader->getClassAnnotation($property, $annotationName) ?? $this->buildAnnotation($attributes); + return $this->reader->getClassAnnotation(new ReflectionClass($property->class), $annotationName) + ?? $this->buildAnnotation($attributes); } private function buildAnnotation(array $attributes): ?object