final class ProgramIndex
Restricted visibility: declared "@visibility root". Code outside that scope must not name this declaration.

Every declaration the analyzed source tree contains, looked up by name.

Resolution follows parents, traits and interfaces, so a repository method inherited from an abstract base is found from the subclass the call names.

Properties§

public array<string, ClassShape> $classes = []
public array<string, FunctionShape> $functions = []
public array<string, Expr> $constants = []

Methods§

public function __construct(
    public array<string, ClassShape> $classes = [],
    public array<string, FunctionShape> $functions = [],
    public array<string, Expr> $constants = [],
)

Parameters

$classesarray<string, ClassShape>Class-likes, keyed by lower-case fully qualified name
$functionsarray<string, FunctionShape>Functions, keyed by lower-case fully qualified name
$constantsarray<string, Expr>Global constant expressions, keyed by fully qualified name
public function findConstant(string $name): ?Expr
public function findMethod(?string $className, string $method): ?MethodShape
public function findClassConstant(?string $className, string $constant): ?Expr

The class constant expression of that name on the class or anything it inherits from.

Parameters

$className?string
$constantstring

Returns

?Expr
Called from 2
Calls 1
public function findPropertyType(?string $className, string $property): ?TypeShape

The declared type of a property on the class or anything it inherits from.

Parameters

$className?string
$propertystring

Returns

Called from 1
Calls 1
public function isInstanceOf(?string $className, string $expected): bool

Whether the class is, or inherits from, the named one.

The walk follows written names rather than indexed declarations, so a class that extends one the analyzed source does not declare — a driver class, or a framework base class — is still recognised as inheriting it.

Parameters

$className?string
$expectedstring

Returns

bool
Called from 11
Calls 4
public function lineage(?string $className): list<ClassShape>
public function implementationsOf(
    ?string $className,
    string $method,
    int $limit = 8,
): list<MethodShape>

The concrete implementations of a method, for a call the declaration cannot answer.

A call on an abstract class or an interface names a method whose body is somewhere else. Collecting the bodies the source tree does declare is what lets a statement built by a subclass resolve instead of becoming a gap.

Parameters

$className?string
$methodstring
$limitintHow many implementations to return before giving up on enumerating them

Returns

Called from 1
Calls 3
public function merge(self $other): self

The index holding the declarations of both, with this one taking precedence.

Parameters

$otherself

Returns

self
Test cases 1
Calls 1

Test cases 250§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 4
Other tests reaching this symbol 246

Relations§

Instantiated in 1
Method calls 34
Type declarations 22