Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/Metadata/Driver/AttributeDriver/AttributeReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Comment on lines +49 to +50
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return $this->reader->getClassAnnotation(new ReflectionClass($method->class), $annotationName)
?? $this->buildAnnotation($attributes);
return $this->reader->getMethodAnnotation($method, $annotationName) ?? $this->buildAnnotation($attributes);

}

public function getPropertyAnnotations(ReflectionProperty $property): array
Expand All @@ -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);
Comment on lines +64 to +65
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return $this->reader->getClassAnnotation(new ReflectionClass($property->class), $annotationName)
?? $this->buildAnnotation($attributes);
return $this->reader->getPropertyAnnotation($property, $annotationName) ?? $this->buildAnnotation($attributes);

}

private function buildAnnotation(array $attributes): ?object
Expand Down