Skip to content

Commit

Permalink
Use generics on Reader
Browse files Browse the repository at this point in the history
Allowing for static analysis tools to more easily understand things.
  • Loading branch information
lcobucci committed Oct 25, 2020
1 parent 8fe07a5 commit e41281d
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions lib/Doctrine/Common/Annotations/Reader.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ public function getClassAnnotations(ReflectionClass $class);
*
* @param ReflectionClass $class The ReflectionClass of the class from which
* the class annotations should be read.
* @param string $annotationName The name of the annotation.
* @param class-string<T> $annotationName The name of the annotation.
*
* @return object|null The Annotation or NULL, if the requested annotation does not exist.
* @return T|null The Annotation or NULL, if the requested annotation does not exist.
*
* @template T
*/
public function getClassAnnotation(ReflectionClass $class, $annotationName);

Expand All @@ -46,9 +48,11 @@ public function getMethodAnnotations(ReflectionMethod $method);
* Gets a method annotation.
*
* @param ReflectionMethod $method The ReflectionMethod to read the annotations from.
* @param string $annotationName The name of the annotation.
* @param class-string<T> $annotationName The name of the annotation.
*
* @return T|null The Annotation or NULL, if the requested annotation does not exist.
*
* @return object|null The Annotation or NULL, if the requested annotation does not exist.
* @template T
*/
public function getMethodAnnotation(ReflectionMethod $method, $annotationName);

Expand All @@ -66,9 +70,11 @@ public function getPropertyAnnotations(ReflectionProperty $property);
* Gets a property annotation.
*
* @param ReflectionProperty $property The ReflectionProperty to read the annotations from.
* @param string $annotationName The name of the annotation.
* @param class-string<T> $annotationName The name of the annotation.
*
* @return T|null The Annotation or NULL, if the requested annotation does not exist.
*
* @return object|null The Annotation or NULL, if the requested annotation does not exist.
* @template T
*/
public function getPropertyAnnotation(ReflectionProperty $property, $annotationName);
}

0 comments on commit e41281d

Please sign in to comment.