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

Works out what a call produces.

A database call produces what the driver hands back: a statement handle from a preparing call, the statement text itself from a call that composes one. A call into the analyzed source produces what the callee returns for these arguments. Recording statements is not done here; it is done at each database call, from the call itself.

Methods§

public function __construct(
    ProgramIndex $index,
    SinkMatcher $sinks,
    Registry $functions,
    ExternalInput $external,
    NodeText $text,
    ?CalleeReturns $returns = null,
)

Wires the evaluator to everything a call may need.

Parameters

$indexProgramIndex
$sinksSinkMatcher
$functionsRegistry
$externalExternalInput
$textNodeText
$returns?CalleeReturns
public function applyEffects(CallLike $node, Environment $environment): void

Opens arguments whose callees may write through references.

Parameters

$nodeCallLike
$environmentEnvironment
Test cases 1
Called from 7
Calls 15
public function evaluateInstantiation(New_ $node, FunctionScope $scope): Domain

The object an instantiation produces, which is how a driver gets its type.

Parameters

$nodeNew_
$scopeFunctionScope

Returns

Test cases 1
Called from 1
Calls 7
public function arguments(
    CallLike $node,
    Environment $environment,
    FunctionScope $scope,
    ExpressionEvaluator $expressions,
): list<Domain>

The evaluated arguments of a call, in the order they are written.

Parameters

$nodeCallLike
$environmentEnvironment
$scopeFunctionScope
$expressionsExpressionEvaluator

Returns

list<Domain>
Test cases 1
Called from 1
Calls 2
public function evaluateMethod(
    MethodCall|NullsafeMethodCall $node,
    list<Domain> $arguments,
    Environment $environment,
    FunctionScope $scope,
    ExpressionEvaluator $expressions,
    ?Domain $receiver = null,
): Domain
public function isOwnReceiver(MethodCall|NullsafeMethodCall $node): bool

Whether the call is written on the object the body it is written in belongs to.

A class an extension models is not followed into from outside, but its own source is still read the way any other source is, so a call it makes on itself is followed like any other.

Parameters

$nodeMethodCall|NullsafeMethodCall

Returns

bool
Test cases 1
Called from 1
public function dispatch(
    ?string $className,
    string $method,
    list<Domain> $arguments,
    FunctionScope $scope,
    ExpressionEvaluator $expressions,
): ?Domain

The value a call resolves to across the implementations the source declares.

Parameters

$className?string
$methodstring
$argumentslist<Domain>
$scopeFunctionScope
$expressionsExpressionEvaluator

Returns

Test cases 1
Called from 1
Calls 2
public function evaluateFunction(
    FuncCall $node,
    list<Domain> $arguments,
    FunctionScope $scope,
    ExpressionEvaluator $expressions,
    ?Environment $environment = null,
): Domain
public function functionName(Name $name): string
public function applySink(
    SinkSpec $sink,
    CallLike $node,
    list<Domain> $arguments,
    FunctionScope $scope,
): Domain
public function siteKeyOf(CallLike $node, FunctionScope $scope, string $sinkId): string

What tells one call apart from every other, including one written on the same line.

The reported site names a line, because that is what a reader jumps to. Grouping the readings of a call needs more than that, since two queries on one line are two calls and must not be folded into each other.

Parameters

$nodeCallLike
$scopeFunctionScope
$sinkIdstring

Returns

string
Test cases 2
Called from 1
Calls 1
public function callKeyOf(CallLike $node, FunctionScope $scope): string

What tells one call apart from every other, by where it is written.

Parameters

$nodeCallLike
$scopeFunctionScope

Returns

string
Test cases 1
Called from 1
Calls 1
  • method-call CallLike::getStartFilePos() line 434

Private surface 7§

Implementation details, listed for orientation only.

private ProgramIndex $index
private SinkMatcher $sinks
private Registry $functions
private ExternalInput $external
private NodeText $text
private ?CalleeReturns $returns
private ?ReferenceEffects $references = null

Test cases 49§

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

Dedicated tests 26
Other tests reaching this symbol 23

Relations§

Instantiated in 1
Method calls 1
Type declarations 2