class ConstructorParser

Reads a class's methods from its source, such as the constructor its instances run.

Methods

__construct(Parser $parser)

Create a new constructor parser instance.

array|null
findConstructor(ClassReflection $classReflection)

Find the constructor the class's instances run (its own, an inherited one or a trait's), with the class declaring it, which parent:: is relative to. A trait's constructor is declared by the class using it.

array|null
findMethod(ClassReflection $classReflection, string $name)

Find the declaration of the method the class runs under the name (its own, an inherited one or a trait's), with the file declaring it. Null when the class has no such method in source.

bool
writesProperty(ClassReflection $classReflection, string $property, array $setters = [])

Determine whether the constructor the class's instances run may change the property, following parent::__construct(): an assignment to it or through an array dimension of it, a promoted parameter, or a call on the instance to one of the given setters.

Details

at line 51
__construct(Parser $parser)

Create a new constructor parser instance.

Parameters

Parser $parser

at line 64
array|null findConstructor(ClassReflection $classReflection)

Find the constructor the class's instances run (its own, an inherited one or a trait's), with the class declaring it, which parent:: is relative to. A trait's constructor is declared by the class using it.

Null when there is no constructor in source.

Parameters

ClassReflection $classReflection

Return Value

array|null

at line 87
array|null findMethod(ClassReflection $classReflection, string $name)

Find the declaration of the method the class runs under the name (its own, an inherited one or a trait's), with the file declaring it. Null when the class has no such method in source.

Parameters

ClassReflection $classReflection
string $name

Return Value

array|null

at line 128
bool writesProperty(ClassReflection $classReflection, string $property, array $setters = [])

Determine whether the constructor the class's instances run may change the property, following parent::__construct(): an assignment to it or through an array dimension of it, a promoted parameter, or a call on the instance to one of the given setters.

The bodies of the other methods it calls are not read.

Parameters

ClassReflection $classReflection
string $property
array $setters

Return Value

bool