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

The calls in the source that reach a given function or method.

A function is reached by the calls written with its name. A method is reached by the calls written with its name on something that can be an instance of its class; what they are written on is worked out the same way any other value is, so $repository->find(…) is a caller of Repository::find when $repository can be a Repository. A call on something whose class could not be worked out is not taken as a caller, since a method of the same name on a built-in class or on a class outside the analyzed files may be the one it reaches; the callers found are then marked as partial instead.

A call written on a class name reaches the method that class has, declared or inherited: parent:: looks from the parent of the class it is written in and self:: from that class itself. Only static:: and a call on an instance can also land in a subclass that overrides the method.

A method of a class an extension models has no callers here. The extension already says what calling it does, and every call of it is read where it is written; reading it again from inside the class, once per caller, would list each of those statements a second time under the class's own line.

Methods§

public function __construct(CallerIndex $calls, ProgramIndex $index, ?SinkMatcher $sinks = null)

Wires the lookup to the calls and the declarations it filters them with.

Parameters

public function ofFunction(Function_ $function): list<CallLike>
public function instantiations(string $className, Deriver $deriver): list<CallLike>

The instantiations that run a class's constructor.

Parameters

$classNamestring
$deriverDeriver

Returns

list<CallLike>
Test cases 3
Called from 1
Calls 7
public function inheritorsOf(string $className): list<string>

The classes whose instantiation runs a class's constructor: the class, and every subclass that inherits the constructor rather than declaring its own.

Parameters

$classNamestring

Returns

list<string>
Test cases 1
Called from 1
Calls 3
public function reaches(CallLike $call, string $className, int $depth, Deriver $deriver): ?bool

Whether a call written with the method's name can reach the method of that class, or null when that cannot be told.

Parameters

$callCallLike
$classNamestring
$depthint
$deriverDeriver

Returns

?bool
Test cases 3
Called from 1
Calls 8
public function staticTarget(StaticCall $call, Deriver $deriver): ?string

The class a call written on a class name looks its method up from, or null when it cannot be named.

Parameters

$callStaticCall
$deriverDeriver

Returns

?string
Test cases 1
Called from 1
Calls 3
public function related(string $receiver, string $declaring, string $method): bool

Whether a call of the method on an instance of one class can land in the method as the other class declares it.

The method is looked up from the class of the instance upwards, and the first class that declares it is the one that runs. So a call on an instance of a subclass lands in the declaring class's method only when nothing between them overrides it, and a call on an instance of a parent class can land in the declaring class's method when the instance is of that subclass.

Parameters

$receiverstring
$declaringstring
$methodstring

Returns

bool
Test cases 2
Called from 3
Calls 4

Private surface 3§

Implementation details, listed for orientation only.

private CallerIndex $calls
private ProgramIndex $index
private ?SinkMatcher $sinks

Test cases 50§

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

Dedicated tests 23
Other tests reaching this symbol 27

Relations§

Instantiated in 1
Method calls 1
Type declarations 2