Doctrine\Common\Annotations\DocParser
A parser for docblock annotations.
It is strongly discouraged to change the default annotation parsing process.
- Author: Benjamin Eberlei <kontakt@beberlei.de>
Synopsis
class DocParser
{
- // members
- private array $classIdentifiers;
- private DocLexer $lexer;
- private string $target;
- private DocParser $metadataParser;
- private boolean $isNestedAnnotation;
- private array $imports;
- private array $classExists;
- private boolean $ignoreNotImportedAnnotations;
- private array $namespaces;
- private array $ignoredAnnotationNames;
- private string $context;
- private array $annotationMetadata;
- private array $typeMap;
- // methods
- public void __construct()
- public void setIgnoredAnnotationNames()
- public void setIgnoreNotImportedAnnotations()
- public void addNamespace()
- public void setImports()
- public void setTarget()
- public array parse()
- private bool match()
- private bool matchAny()
- private void syntaxError()
- private boolean classExists()
- private void collectAnnotationMetadata()
- private array Annotations()
- private mixed Annotation()
- private array Values()
- private mixed Constant()
- private string Identifier()
- private mixed Value()
- private mixed PlainValue()
- private array FieldAssignment()
- private array Arrayx()
- private array ArrayEntry()
Members
private
- $annotationMetadata
—
array
Hash-map for caching annotation metadata - $classExists
—
array
This hashmap is used internally to cache results of class_exists() look-ups. - $classIdentifiers
—
array
An array of all valid tokens for a class name. - $context — string
- $ignoreNotImportedAnnotations
—
boolean
Whether annotations that have not been imported should be ignored. - $ignoredAnnotationNames
—
array
A list with annotations that are not causing exceptions when not resolved to an annotation class. - $imports
—
array
Hashmap containing all use-statements that are to be used when parsing the given doc block. - $isNestedAnnotation
—
boolean
Flag to control if the current annotation is nested or not. - $lexer
—
\Doctrine\Common\Annotations\DocLexer
The lexer. - $metadataParser
—
\Doctrine\Common\Annotations\DocParser
Doc Parser used to collect annotation target - $namespaces
—
array
An array of default namespaces if operating in simple mode. - $target
—
string
Current target context - $typeMap
—
array
Hash-map for handle types declaration
Methods
private
- Annotation() — Annotation ::= "@" AnnotationName ["(" [Values] ")"] AnnotationName ::= QualifiedName | SimpleName QualifiedName ::= NameSpacePart "\" {NameSpacePart "\"}* SimpleName NameSpacePart ::= identifier | null | false | true SimpleName ::= identifier | null | false | true
- Annotations() — Annotations ::= Annotation {[ "*" ]* [Annotation]}
- ArrayEntry() — ArrayEntry ::= Value | KeyValuePair KeyValuePair ::= Key ("=" | ":") PlainValue | Constant Key ::= string | integer | Constant
- Arrayx() — Array ::= "{" ArrayEntry {"," ArrayEntry}* [","] "}"
- Constant() — Constant ::= integer | string | float | boolean
- FieldAssignment() — FieldAssignment ::= FieldName "=" PlainValue FieldName ::= identifier
- Identifier() — Identifier ::= string
- PlainValue() — PlainValue ::= integer | string | float | boolean | Array | Annotation
- Value() — Value ::= PlainValue | FieldAssignment
- Values() — Values ::= Array | Value {"," Value}
- classExists() — Attempt to check if a class exists or not. This never goes through the PHP autoloading mechanism but uses the {@link AnnotationRegistry} to load classes.
- collectAnnotationMetadata() — Collects parsing metadata for a given annotation class
- match() — Attempts to match the given token with the current lookahead token.
- matchAny() — Attempts to match the current lookahead token with any of the given tokens.
- syntaxError() — Generates a new syntax error.
public
- __construct() — Constructs a new DocParser.
- addNamespace() — Sets the default namespaces.
- parse() — Parses the given docblock string for annotations.
- setIgnoreNotImportedAnnotations() — Sets ignore on not-imported annotations
- setIgnoredAnnotationNames() — Sets the annotation names that are ignored during the parsing process.
- setImports() — Sets the imports
- setTarget() — Sets current target context as bitmask.