Simple Annotation Reader.
This annotation reader is intended to be used in projects where you have full-control over all annotations that are available.
- Full name:
\Doctrine\Common\Annotations\SimpleAnnotationReader
- Warning: this class is deprecated. This means that this class will likely be removed in a future version.
- This class implements:
\Doctrine\Common\Annotations\Reader
private \Doctrine\Common\Annotations\DocParser $parser
Initializes a new SimpleAnnotationReader.
public __construct(): mixed
Adds a namespace in which we will look for annotations.
public addNamespace(string $namespace): void
Parameters:
Parameter | Type | Description |
---|---|---|
$namespace |
string |
Gets the annotations applied to a class.
public getClassAnnotations(\ReflectionClass $class): object[]
Parameters:
Parameter | Type | Description |
---|---|---|
$class |
\ReflectionClass | The ReflectionClass of the class from which the class annotations should be read. |
Return Value:
An array of Annotations.
Gets the annotations applied to a method.
public getMethodAnnotations(\ReflectionMethod $method): object[]
Parameters:
Parameter | Type | Description |
---|---|---|
$method |
\ReflectionMethod | The ReflectionMethod of the method from which the annotations should be read. |
Return Value:
An array of Annotations.
Gets the annotations applied to a property.
public getPropertyAnnotations(\ReflectionProperty $property): object[]
Parameters:
Parameter | Type | Description |
---|---|---|
$property |
\ReflectionProperty | The ReflectionProperty of the property from which the annotations should be read. |
Return Value:
An array of Annotations.
Gets a class annotation.
public getClassAnnotation(\ReflectionClass $class, mixed $annotationName): \Doctrine\Common\Annotations\T|null
Parameters:
Parameter | Type | Description |
---|---|---|
$class |
\ReflectionClass | The ReflectionClass of the class from which the class annotations should be read. |
$annotationName |
mixed | The name of the annotation. |
Return Value:
The Annotation or NULL, if the requested annotation does not exist.
Gets a method annotation.
public getMethodAnnotation(\ReflectionMethod $method, mixed $annotationName): \Doctrine\Common\Annotations\T|null
Parameters:
Parameter | Type | Description |
---|---|---|
$method |
\ReflectionMethod | The ReflectionMethod to read the annotations from. |
$annotationName |
mixed | The name of the annotation. |
Return Value:
The Annotation or NULL, if the requested annotation does not exist.
Gets a property annotation.
public getPropertyAnnotation(\ReflectionProperty $property, mixed $annotationName): \Doctrine\Common\Annotations\T|null
Parameters:
Parameter | Type | Description |
---|---|---|
$property |
\ReflectionProperty | The ReflectionProperty to read the annotations from. |
$annotationName |
mixed | The name of the annotation. |
Return Value:
The Annotation or NULL, if the requested annotation does not exist.