class StaticReflectionParser (View source)

Parses a file for namespaces/use/class declarations.

Properties

protected string $className

The fully qualified class name.

protected string $shortClassName

The short class name.

protected bool $classAnnotationOptimize

Whether the caller only wants class annotations.

protected ClassFinderInterface $finder

A ClassFinder object which finds the class.

protected bool $parsed

Whether the parser has run.

protected string $namespace

The namespace of the class.

protected string[] $useStatements

The use statements of the class.

protected array $docComment

The docComment of the class.

protected string $parentClassName

The name of the class this class extends, if any.

protected StaticReflectionParser $parentStaticReflectionParser

The parent PSR-0 Parser.

Methods

__construct(string $className, ClassFinderInterface $finder, bool $classAnnotationOptimize = false)

Parses a class residing in a PSR-0 hierarchy.

void
parse()

No description

string
getClassName()

No description

string
getNamespaceName()

No description

ReflectionClass
getReflectionClass()

Gets the ReflectionClass equivalent for this class.

string[]
getUseStatements()

Gets the use statements from this file.

string
getDocComment(string $type = 'class', string $name = '')

Gets the doc comment.

getStaticReflectionParserForDeclaringClass(string $type, string $name)

Gets the PSR-0 parser for the declaring class.

Details

__construct(string $className, ClassFinderInterface $finder, bool $classAnnotationOptimize = false)

Parses a class residing in a PSR-0 hierarchy.

Parameters

string $className

The full, namespaced class name.

ClassFinderInterface $finder

A ClassFinder object which finds the class.

bool $classAnnotationOptimize

Only retrieve the class docComment. Presumes there is only one statement per line.

protected void parse()

No description

Return Value

void

protected StaticReflectionParser getParentStaticReflectionParser()

No description

Return Value

StaticReflectionParser

string getClassName()

No description

Return Value

string

string getNamespaceName()

No description

Return Value

string

ReflectionClass getReflectionClass()

Gets the ReflectionClass equivalent for this class.

Return Value

ReflectionClass

string[] getUseStatements()

Gets the use statements from this file.

Return Value

string[]

string getDocComment(string $type = 'class', string $name = '')

Gets the doc comment.

Parameters

string $type

The type: 'class', 'property' or 'method'.

string $name

The name of the property or method, not needed for 'class'.

Return Value

string

The doc comment, empty string if none.

StaticReflectionParser getStaticReflectionParserForDeclaringClass(string $type, string $name)

Gets the PSR-0 parser for the declaring class.

Parameters

string $type

The type: 'property' or 'method'.

string $name

The name of the property or method.

Return Value

StaticReflectionParser

A static reflection parser for the declaring class.

Exceptions

ReflectionException