AnnotationReader
in package
implements
Reader
A reader for docblock annotations.
Interfaces, Classes and Traits
- Reader
- Interface for annotation readers.
Table of Contents
- $globalIgnoredNames : array<string, true>
- A list with annotations that are not causing exceptions when not resolved to an annotation class.
- $globalIgnoredNamespaces : array<string, true>
- A list with annotations that are not causing exceptions when not resolved to an annotation class.
- $globalImports : array<string, class-string>
- Global map for imports.
- $ignoredAnnotationNames : mixed
- In-memory cache mechanism to store ignored annotations per class.
- $imports : mixed
- In-memory cache mechanism to store imported annotations per class.
- $parser : DocParser
- Annotations parser.
- $phpParser : PhpParser
- PHP parser used to collect imports.
- $preParser : DocParser
- Annotations parser used to collect parsing metadata.
- __construct() : mixed
- Initializes a new AnnotationReader.
- addGlobalIgnoredName() : mixed
- Add a new annotation to the globally ignored annotation names with regard to exception handling.
- addGlobalIgnoredNamespace() : mixed
- Add a new annotation to the globally ignored annotation namespaces with regard to exception handling.
- getClassAnnotation() : T|null
- Gets a class annotation.
- getClassAnnotations() : array<string|int, object>
- Gets the annotations applied to a class.
- getFunctionAnnotation() : object|null
- Gets a function annotation.
- getFunctionAnnotations() : array<string|int, mixed>
- Gets the annotations applied to a function.
- getMethodAnnotation() : T|null
- Gets a method annotation.
- getMethodAnnotations() : array<string|int, object>
- Gets the annotations applied to a method.
- getPropertyAnnotation() : T|null
- Gets a property annotation.
- getPropertyAnnotations() : array<string|int, object>
- Gets the annotations applied to a property.
- collectParsingMetadata() : void
- Collects parsing metadata for a given class or function.
- getIgnoredAnnotationNames() : array<string, true>
- Returns the ignored annotations for the given class or function.
- getImports() : array<string, class-string>
- Retrieves imports for a class or a function.
- getMethodImports() : array<string, class-string>
- Retrieves imports for methods.
- getPropertyImports() : array<string, class-string>
- Retrieves imports for properties.
Properties
$globalIgnoredNames
A list with annotations that are not causing exceptions when not resolved to an annotation class.
private
static array<string, true>
$globalIgnoredNames
= DoctrineCommonAnnotationsImplicitlyIgnoredAnnotationNames::LIST
The names are case sensitive.
$globalIgnoredNamespaces
A list with annotations that are not causing exceptions when not resolved to an annotation class.
private
static array<string, true>
$globalIgnoredNamespaces
= []
The names are case sensitive.
$globalImports
Global map for imports.
private
static array<string, class-string>
$globalImports
= ['ignoreannotation' => DoctrineCommonAnnotationsAnnotationIgnoreAnnotation::class]
$ignoredAnnotationNames
In-memory cache mechanism to store ignored annotations per class.
private
mixed
$ignoredAnnotationNames
= []
Tags
$imports
In-memory cache mechanism to store imported annotations per class.
private
mixed
$imports
= []
Tags
$parser
Annotations parser.
private
DocParser
$parser
$phpParser
PHP parser used to collect imports.
private
PhpParser
$phpParser
$preParser
Annotations parser used to collect parsing metadata.
private
DocParser
$preParser
Methods
__construct()
Initializes a new AnnotationReader.
public
__construct([DocParser|null $parser = null ]) : mixed
Parameters
- $parser : DocParser|null = null
Tags
Return values
mixed —addGlobalIgnoredName()
Add a new annotation to the globally ignored annotation names with regard to exception handling.
public
static addGlobalIgnoredName(string $name) : mixed
Parameters
- $name : string
Return values
mixed —addGlobalIgnoredNamespace()
Add a new annotation to the globally ignored annotation namespaces with regard to exception handling.
public
static addGlobalIgnoredNamespace(string $namespace) : mixed
Parameters
- $namespace : string
Return values
mixed —getClassAnnotation()
Gets a class annotation.
public
getClassAnnotation(ReflectionClass $class, mixed $annotationName) : T|null
Parameters
- $class : ReflectionClass
-
The ReflectionClass of the class from which the class annotations should be read.
- $annotationName : mixed
-
The name of the annotation.
Return values
T|null —The Annotation or NULL, if the requested annotation does not exist.
getClassAnnotations()
Gets the annotations applied to a class.
public
getClassAnnotations(ReflectionClass $class) : array<string|int, object>
Parameters
- $class : ReflectionClass
-
The ReflectionClass of the class from which the class annotations should be read.
Return values
array<string|int, object> —An array of Annotations.
getFunctionAnnotation()
Gets a function annotation.
public
getFunctionAnnotation(ReflectionFunction $function, string $annotationName) : object|null
Parameters
- $function : ReflectionFunction
- $annotationName : string
Return values
object|null —The Annotation or NULL, if the requested annotation does not exist.
getFunctionAnnotations()
Gets the annotations applied to a function.
public
getFunctionAnnotations(ReflectionFunction $function) : array<string|int, mixed>
Parameters
- $function : ReflectionFunction
Tags
Return values
array<string|int, mixed> —getMethodAnnotation()
Gets a method annotation.
public
getMethodAnnotation(ReflectionMethod $method, mixed $annotationName) : T|null
Parameters
- $method : ReflectionMethod
-
The ReflectionMethod to read the annotations from.
- $annotationName : mixed
-
The name of the annotation.
Return values
T|null —The Annotation or NULL, if the requested annotation does not exist.
getMethodAnnotations()
Gets the annotations applied to a method.
public
getMethodAnnotations(ReflectionMethod $method) : array<string|int, object>
Parameters
- $method : ReflectionMethod
-
The ReflectionMethod of the method from which the annotations should be read.
Return values
array<string|int, object> —An array of Annotations.
getPropertyAnnotation()
Gets a property annotation.
public
getPropertyAnnotation(ReflectionProperty $property, mixed $annotationName) : T|null
Parameters
- $property : ReflectionProperty
-
The ReflectionProperty to read the annotations from.
- $annotationName : mixed
-
The name of the annotation.
Return values
T|null —The Annotation or NULL, if the requested annotation does not exist.
getPropertyAnnotations()
Gets the annotations applied to a property.
public
getPropertyAnnotations(ReflectionProperty $property) : array<string|int, object>
Parameters
- $property : ReflectionProperty
-
The ReflectionProperty of the property from which the annotations should be read.
Return values
array<string|int, object> —An array of Annotations.
collectParsingMetadata()
Collects parsing metadata for a given class or function.
private
collectParsingMetadata(ReflectionClass|ReflectionFunction $reflection) : void
Parameters
- $reflection : ReflectionClass|ReflectionFunction
Return values
void —getIgnoredAnnotationNames()
Returns the ignored annotations for the given class or function.
private
getIgnoredAnnotationNames(ReflectionClass|ReflectionFunction $reflection) : array<string, true>
Parameters
- $reflection : ReflectionClass|ReflectionFunction
Return values
array<string, true> —getImports()
Retrieves imports for a class or a function.
private
getImports(ReflectionClass|ReflectionFunction $reflection) : array<string, class-string>
Parameters
- $reflection : ReflectionClass|ReflectionFunction
Return values
array<string, class-string> —getMethodImports()
Retrieves imports for methods.
private
getMethodImports(ReflectionMethod $method) : array<string, class-string>
Parameters
- $method : ReflectionMethod
Return values
array<string, class-string> —getPropertyImports()
Retrieves imports for properties.
private
getPropertyImports(ReflectionProperty $property) : array<string, class-string>
Parameters
- $property : ReflectionProperty