function SimpleAnnotationReader::getClassAnnotation
Gets a class annotation.
@template T
Parameters
ReflectionClass $class The ReflectionClass of the class from which: the class annotations should be read.
class-string<T> $annotationName The name of the annotation.:
Return value
T|null The Annotation or NULL, if the requested annotation does not exist.
File
-
core/
lib/ Drupal/ Component/ Annotation/ Doctrine/ SimpleAnnotationReader.php, line 144
Class
- SimpleAnnotationReader
- Simple Annotation Reader.
Namespace
Drupal\Component\Annotation\DoctrineCode
public function getClassAnnotation(\ReflectionClass $class, $annotationName) {
foreach ($this->getClassAnnotations($class) as $annotation) {
if ($annotation instanceof $annotationName) {
return $annotation;
}
}
return null;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.