class DocParser (View source)

A parser for docblock annotations.

It is strongly discouraged to change the default annotation parsing process.

Methods

__construct()

Constructs a new DocParser.

setIgnoredAnnotationNames(array $names)

Sets the annotation names that are ignored during the parsing process.

setAnnotationCreationFunction(Closure $func) deprecated

No description

setImports(array $imports)

No description

setIgnoreNotImportedAnnotations($bool)

No description

setAnnotationNamespaceAlias($namespace, $alias)

No description

array
parse(string $input, string $context = '')

Parses the given docblock string for annotations.

Details

__construct()

Constructs a new DocParser.

setIgnoredAnnotationNames(array $names)

Sets the annotation names that are ignored during the parsing process.

The names are supposed to be the raw names as used in the class, not the fully qualified class names.

Parameters

array $names

setAnnotationCreationFunction(Closure $func) deprecated

deprecated Will be removed in 3.0

Parameters

Closure $func

setImports(array $imports)

Parameters

array $imports

setIgnoreNotImportedAnnotations($bool)

Parameters

$bool

setAnnotationNamespaceAlias($namespace, $alias)

Parameters

$namespace
$alias

array parse(string $input, string $context = '')

Parses the given docblock string for annotations.

Parameters

string $input The docblock string to parse.
string $context The parsing context.

Return Value

array Array of annotations. If no annotations are found, an empty array is returned.