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.

setIgnoreNotImportedAnnotations($bool)

No description

addNamespace($namespace)

Sets the default namespaces.

setImports(array $imports)

No description

setTarget(integer $target)

Sets current target context as bitmask.

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

setIgnoreNotImportedAnnotations($bool)

Parameters

$bool

addNamespace($namespace)

Sets the default namespaces.

Parameters

$namespace

setImports(array $imports)

Parameters

array $imports

setTarget(integer $target)

Sets current target context as bitmask.

Parameters

integer $target

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.