Documentation

AnnotationReader
in package
implements Reader

A reader for docblock annotations.

Tags
author

Benjamin Eberlei kontakt@beberlei.de

author

Guilherme Blanco guilhermeblanco@hotmail.com

author

Jonathan Wage jonwage@gmail.com

author

Roman Borschel roman@code-factory.org

author

Johannes M. Schmitt schmittjoh@gmail.com

Interfaces, Classes and Traits

Reader
Interface for annotation readers.

Table of Contents

$globalIgnoredNames  : array<string|int, mixed>
A list with annotations that are not causing exceptions when not resolved to an annotation class.
$globalIgnoredNamespaces  : array<string|int, mixed>
A list with annotations that are not causing exceptions when not resolved to an annotation class.
$globalImports  : array<string|int, mixed>
Global map for imports.
$ignoredAnnotationNames  : array<string|int, mixed>
In-memory cache mechanism to store ignored annotations per class.
$imports  : array<string|int, 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
Constructor.
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()  : object|null
Gets a class annotation.
getClassAnnotations()  : array<string|int, mixed>
Gets the annotations applied to a class.
getMethodAnnotation()  : object|null
Gets a method annotation.
getMethodAnnotations()  : array<string|int, mixed>
Gets the annotations applied to a method.
getPropertyAnnotation()  : object|null
Gets a property annotation.
getPropertyAnnotations()  : array<string|int, mixed>
Gets the annotations applied to a property.
collectParsingMetadata()  : mixed
Collects parsing metadata for a given class.
getClassImports()  : array<string|int, mixed>
Retrieves imports.
getIgnoredAnnotationNames()  : array<string|int, mixed>
Returns the ignored annotations for the given class.
getMethodImports()  : array<string|int, mixed>
Retrieves imports for methods.
getPropertyImports()  : array<string|int, mixed>
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|int, mixed> $globalIgnoredNames = array( // Annotation tags 'Annotation' => true, 'Attribute' => true, 'Attributes' => true, /* Can we enable this? 'Enum' => true, */ 'Required' => true, 'Target' => true, // Widely used tags (but not existent in phpdoc) 'fix' => true, 'fixme' => true, 'override' => true, // PHPDocumentor 1 tags 'abstract' => true, 'access' => true, 'code' => true, 'deprec' => true, 'endcode' => true, 'exception' => true, 'final' => true, 'ingroup' => true, 'inheritdoc' => true, 'inheritDoc' => true, 'magic' => true, 'name' => true, 'toc' => true, 'tutorial' => true, 'private' => true, 'static' => true, 'staticvar' => true, 'staticVar' => true, 'throw' => true, // PHPDocumentor 2 tags. 'api' => true, 'author' => true, 'category' => true, 'copyright' => true, 'deprecated' => true, 'example' => true, 'filesource' => true, 'global' => true, 'ignore' => true, /* Can we enable this? 'index' => true, */ 'internal' => true, 'license' => true, 'link' => true, 'method' => true, 'package' => true, 'param' => true, 'property' => true, 'property-read' => true, 'property-write' => true, 'return' => true, 'see' => true, 'since' => true, 'source' => true, 'subpackage' => true, 'throws' => true, 'todo' => true, 'TODO' => true, 'usedby' => true, 'uses' => true, 'var' => true, 'version' => true, // PHPUnit tags 'codeCoverageIgnore' => true, 'codeCoverageIgnoreStart' => true, 'codeCoverageIgnoreEnd' => true, // PHPCheckStyle 'SuppressWarnings' => true, // PHPStorm 'noinspection' => true, // PEAR 'package_version' => true, // PlantUML 'startuml' => true, 'enduml' => true, )

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|int, mixed> $globalIgnoredNamespaces = array()

The names are case sensitive.

$globalImports

Global map for imports.

private static array<string|int, mixed> $globalImports = array('ignoreannotation' => 'Doctrine\Common\Annotations\Annotation\IgnoreAnnotation')

$ignoredAnnotationNames

In-memory cache mechanism to store ignored annotations per class.

private array<string|int, mixed> $ignoredAnnotationNames = array()

$imports

In-memory cache mechanism to store imported annotations per class.

private array<string|int, mixed> $imports = array()

Methods

__construct()

Constructor.

public __construct([DocParser $parser = null ]) : mixed

Initializes a new AnnotationReader.

Parameters
$parser : DocParser = null
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) : object|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
object|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, mixed>
Parameters
$class : ReflectionClass

The ReflectionClass of the class from which the class annotations should be read.

Return values
array<string|int, mixed>

An array of Annotations.

getMethodAnnotation()

Gets a method annotation.

public getMethodAnnotation(ReflectionMethod $method, mixed $annotationName) : object|null
Parameters
$method : ReflectionMethod

The ReflectionMethod to read the annotations from.

$annotationName : mixed

The name of the annotation.

Return values
object|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, mixed>
Parameters
$method : ReflectionMethod

The ReflectionMethod of the method from which the annotations should be read.

Return values
array<string|int, mixed>

An array of Annotations.

getPropertyAnnotation()

Gets a property annotation.

public getPropertyAnnotation(ReflectionProperty $property, mixed $annotationName) : object|null
Parameters
$property : ReflectionProperty

The ReflectionProperty to read the annotations from.

$annotationName : mixed

The name of the annotation.

Return values
object|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, mixed>
Parameters
$property : ReflectionProperty

The ReflectionProperty of the property from which the annotations should be read.

Return values
array<string|int, mixed>

An array of Annotations.

collectParsingMetadata()

Collects parsing metadata for a given class.

private collectParsingMetadata(ReflectionClass $class) : mixed
Parameters
$class : ReflectionClass
Return values
mixed

getClassImports()

Retrieves imports.

private getClassImports(ReflectionClass $class) : array<string|int, mixed>
Parameters
$class : ReflectionClass
Return values
array<string|int, mixed>

getIgnoredAnnotationNames()

Returns the ignored annotations for the given class.

private getIgnoredAnnotationNames(ReflectionClass $class) : array<string|int, mixed>
Parameters
$class : ReflectionClass
Return values
array<string|int, mixed>

getMethodImports()

Retrieves imports for methods.

private getMethodImports(ReflectionMethod $method) : array<string|int, mixed>
Parameters
$method : ReflectionMethod
Return values
array<string|int, mixed>

getPropertyImports()

Retrieves imports for properties.

private getPropertyImports(ReflectionProperty $property) : array<string|int, mixed>
Parameters
$property : ReflectionProperty
Return values
array<string|int, mixed>

Search results