final class Deriver
Public API: explicitly declared with @visibility public.

Derives candidate values repeatedly from one captured set of PHP sources.

Preparing source once for independent queriesdoctest
$path = tempnam(sys_get_temp_dir(), 'deriver-example-');
    file_put_contents($path, '<?php function answer() { return 42; } function other() { return 7; }');
    $deriver = \Deriver\Deriver::prepare([$path]);
    unlink($path);
    $deriver->derive('answer#return')[0]->result // => 42
    $deriver->derive('other#return')[0]->result // => 7

Methods§

public static function prepare(
    list<string> $files,
    DeriverConfig|null $configuration = null,
): self

Captures and parses the selected files without executing application code. Builds reverse indexes for calls, property writes, closure owners and script globals. Function, method and closure bodies are compiled on demand and reused by later queries. The returned instance keeps these contents even if the files later change or disappear.

Parameters

$fileslist<string>Local paths, for example the result of Finder::files()
$configurationDeriverConfig|nullIndependent language and evaluation settings; null selects the defaults

Returns

self

Throws

CollectorException If a selected file cannot be collected
ParserException If a selected source cannot be parsed
ResolutionException If a selected source cannot be resolved
InvalidInputException If declarations are incomplete or declarations or evaluator registrations conflict
Test cases 56
Called from 1
Calls 25
public function derive(string $query): CandidateCollection

Answers a selector against the prepared sources with fresh evaluation state. Each result owns its evidence; the deriver does not retain query results.

Parameters

$querystringCallable or source-position selector

Returns

CandidateCollection Candidates and their self-contained evidence

Throws

InvalidInputException If the selector cannot identify a supported target
Test cases 8
Calls 3

Private surface 3§

Implementation details, listed for orientation only.

private SelectorResolution $selection
private CandidateQuery $evaluation
private function __construct(
    private SelectorResolution $selection,
    private CandidateQuery $evaluation,
)

Test cases 200§

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

Dedicated tests 19
Other tests reaching this symbol 181

Relations§

Static calls 1