class StaticReflectionParser extends StaticReflectionParser (View source)

internal  This is a temporary solution to the fact that migration source plugins have more than one provider. This functionality will be moved to core in https://www.drupal.org/node/2786355.
 

Allows getting the reflection parser for the parent class.

Properties

protected string $className

The fully qualified class name.

from  StaticReflectionParser
protected string $shortClassName

The short class name.

from  StaticReflectionParser
protected bool $classAnnotationOptimize

Whether the caller only wants class annotations.

from  StaticReflectionParser
protected ClassFinderInterface $finder

A ClassFinder object which finds the class.

from  StaticReflectionParser
protected bool $parsed

Whether the parser has run.

from  StaticReflectionParser
protected string $namespace

The namespace of the class.

from  StaticReflectionParser
protected string[] $useStatements

The use statements of the class.

from  StaticReflectionParser
protected array $docComment

The docComment of the class.

from  StaticReflectionParser
protected string $parentClassName

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

from  StaticReflectionParser
protected StaticReflectionParser $parentStaticReflectionParser

The parent PSR-0 Parser.

from  StaticReflectionParser

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.

static StaticReflectionParser|null
getParentParser(StaticReflectionParser $parser, $finder)

If the current class extends another, get the parser for the latter.

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

static StaticReflectionParser|null getParentParser(StaticReflectionParser $parser, $finder)

If the current class extends another, get the parser for the latter.

Parameters

StaticReflectionParser $parser

The current static parser.

$finder

The class finder. Must implement \Drupal\Component\ClassFinder\ClassFinderInterface, but can do so implicitly (i.e., implements the interface's methods but not the actual interface).

Return Value

StaticReflectionParser|null

The static parser for the parent if there's a parent class or NULL.