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

The work one analysis is allowed to do before it gives up and widens.

Following calls and re-walking loop bodies is what makes the analyzer precise, and is also what makes it possible for a pathological input to run forever. The budget bounds both, so an exhausted budget degrades the result into gaps rather than hanging the run.

Constants§

public const READING_ALLOWANCE = 4

How many times the search's budget reading what was found may take.

Properties§

public int $maxSteps = 20000
public int $maxDepth = 4
public int $maxLoopPasses = 2

Methods§

public function __construct(
    public int $maxSteps = 20000,
    public int $maxDepth = 4,
    public int $maxLoopPasses = 2,
)

Parameters

$maxStepsintHow many expressions may be evaluated while walking one body
$maxDepthintHow many nested calls may be followed
$maxLoopPassesintHow many times a loop body is re-walked
public function spend(): bool

Spends one step, reporting whether the budget still allows work.

Returns

bool
Test cases 19
Called from 2
public function isExhausted(): bool

Whether the step budget is used up.

Returns

bool
Test cases 4
Called from 10
public function isSpent(): bool

Whether even the work of reading what is already in hand has to stop.

Running out of budget stops the search from going anywhere new, but the statement it has found so far is still read, so a search cut short keeps the parts of the statement it did find. Reading has a limit of its own, several times the search's, so a pathological input still ends.

Returns

bool
Test cases 2
Called from 2
Calls 1

Private surface 1§

Implementation details, listed for orientation only.

private int $steps

Test cases 130§

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

Dedicated tests 8
Other tests reaching this symbol 122

Relations§

Instantiated in 3
Method calls 16
Type declarations 18