Skip to content
docsv0.44.3

SyntaxFinding

A native parser finding, without executing the proposal or interpreting process stderr.

SyntaxFinding::inspect()

public static function inspect(string $content): ?array

Location attributes the finding; only the parser and message identify its information. Null is not a compilation verdict: php -l still judges bodies without a ParseError.

Parameters

Parameters of inspect()
NameTypeDescription
$contentstring

SyntaxFinding::shown()

public static function shown(string $content, array $finding): string

The builder's own lines where the parser stopped, to close the refusal with (greenhouse evidence/1162). A line number alone sends a builder back to a text it no longer has in front of it — and the house, beside the refusal, tells it to repair that text with exact find and replace pairs. The line the parser names is where it gave up, which is rarely the line of the mistake: a missing semicolon is reported two lines down. So the lines before it travel too, and so does the line a bracket was opened on when the parser names one. After the gutter each line is the proposal's, byte for byte: it is what a `find` is copied from.

Parameters

Parameters of shown()
NameTypeDescription
$contentstring
$findingarray{message: string, line: int}

SyntaxFinding::shownAt()

public static function shownAt(string $content, int $line): string

The same lines for the check that runs after the parser, to close its refusal with. A body the parser reads can still fail to compile — a method declared twice, a void function that returns a value — and that check answered with what it printed: a line number inside a sentence, and no text. The line it names is the line of the mistake itself.

Parameters

Parameters of shownAt()
NameTypeDescription
$contentstring
$lineint

SyntaxFinding::lineNamedIn()

public static function lineNamedIn(string $printed): ?int

The line a compile check names in what it printed — it closes its sentence with `on line N` — or null.

Parameters

Parameters of lineNamedIn()
NameTypeDescription
$printedstring