From e41281dbaf014b10093e46bc80a53794a4001e6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Cobucci?= Date: Sun, 25 Oct 2020 23:29:22 +0100 Subject: [PATCH] Use generics on Reader Allowing for static analysis tools to more easily understand things. --- lib/Doctrine/Common/Annotations/Reader.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/Doctrine/Common/Annotations/Reader.php b/lib/Doctrine/Common/Annotations/Reader.php index c306574f1..0663ffda0 100644 --- a/lib/Doctrine/Common/Annotations/Reader.php +++ b/lib/Doctrine/Common/Annotations/Reader.php @@ -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 $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); @@ -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 $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); @@ -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 $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); }