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

Reads the statements a source tree can issue, starting from every call that issues one.

Every call written the way a database call is written is a starting point. What it is called on is worked out first, which decides whether it is a database call at all; then what its arguments can be is worked out from the call backwards. Each way the arguments can be is one statement at the call, and a value bound later, by an execute() or a bindValue(), is attached to the statement the handle it is called on came from.

Methods§

public function __construct(
    ProgramIndex $index,
    list<SinkSpec> $sinks,
    EvaluationBudget|null $budget = null,
    DeclaredGlobals|null $globals = null,
    Registry|null $functions = null,
    private ?string $dialect = null,
    private list<ModelProviderInterface> $modelProviders = [],
)

Parameters

$indexProgramIndexThe declarations of the whole analyzed source tree
$sinkslist<SinkSpec>The database calls the enabled extensions recognise
$budgetEvaluationBudget|nullHow much work one call may cost
$globalsDeclaredGlobals|nullWhat the global variables the source declares are known to hold
$functionsRegistry|nullThe function interpretations shared by the derivation
$dialect?string
$modelProviderslist<ModelProviderInterface>Enabled extension providers, instantiated for each derivation engine
Calls 5
public function analyze(list<ParsedFile> $files): list<QueryRecord>

Every statement the files can issue.

Parameters

$fileslist<ParsedFile>

Returns

Test cases 28
Called from 1
Calls 13
public function evaluatorFor(list<ParsedFile> $files = []): ExpressionEvaluator

The expression evaluator the deriver for the given files reads values with.

Parameters

$fileslist<ParsedFile>
Test cases 159
Calls 1
public function deriverFor(list<ParsedFile> $files): Deriver

The deriver wired over the given files.

Parameters

$fileslist<ParsedFile>

Returns

Test cases 114
Called from 2
Calls 20
public function visit(
    CallLike $call,
    Deriver $deriver,
    SinkMatcher $matcher,
    StatementRecorder $recorder,
    ValueBinder $binder,
): list<array{SinkSpec, Solution}>
public function sinkOf(
    CallLike $call,
    Deriver $deriver,
    SinkMatcher $matcher,
    FunctionScope $scope,
): ?SinkSpec
public function receiverOf(MethodCall|NullsafeMethodCall $call, Deriver $deriver): Domain
public function unidentified(CallLike $call, Deriver $deriver, SinkMatcher $matcher): bool

Whether a call that carries statement text could not be told apart from a database call.

A call on something whose class is known, and is not a database class, is simply not a database call. A call on something whose class could not be worked out might be one, and that is a gap worth reporting.

Parameters

$callCallLike
$deriverDeriver
$matcherSinkMatcher

Returns

bool
Test cases 2
Called from 1
Calls 7
public function argumentsOf(CallLike $call): list<Expr>

The expressions a call passes, in the order they are written.

Parameters

$callCallLike

Returns

list<Expr>
Test cases 1
Called from 1
Calls 4
  • method-call CallLike::isFirstClassCallable() line 311
  • function-call array_values line 315
  • function-call array_map line 315
  • method-call CallLike::getArgs() line 315
public function recordUnmatched(
    CallLike $call,
    FunctionScope $scope,
    StatementRecorder $recorder,
): void

Records a call written as a database call on something that could not be identified.

Parameters

$callCallLike
$scopeFunctionScope
$recorderStatementRecorder
Test cases 2
Called from 1
Calls 6

Private surface 10§

Implementation details, listed for orientation only.

private Registry $functions
private ProgramIndex $index
private list<SinkSpec> $sinks
private EvaluationBudget $budget
private DeclaredGlobals $globals
private NodeText $text
private SinkFinder $finder
private ?ModelSet $models = null
private ?string $dialect = null
private list<ModelProviderInterface> $modelProviders = []

Test cases 314§

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

Dedicated tests 31
Other tests reaching this symbol 283

Relations§

Instantiated in 1
Method calls 1