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

Formats report SQL with sql-formatter's expanded layout.

Catalog entries do not carry a dialect, so each supported grammar is tried. Gaps are temporarily represented by identifiers and restored with their provenance after formatting. Text no grammar accepts is kept as written.

Methods§

public function __construct(private list<SqlFormatter> $formatters = [])

Parameters

$formatterslist<SqlFormatter>Ordered application policies
public function format(list<StatementPart> $parts): list<StatementPart>

The statement laid out for reading, with gap metadata preserved.

Parameters

$partslist<StatementPart>

Returns

Test cases 1
Calls 3
public function mask(list<StatementPart> $parts): array{string, array<string, StatementPart>}

Replaces gaps with identifiers that cannot collide with known SQL text.

Parameters

$partslist<StatementPart>

Returns

array{string, array<string, StatementPart>}
Called from 1
Calls 5
public function maskParameters(
    string $sql,
    array<string, StatementPart> $gaps,
    string $prefix,
): array{string, array<string, StatementPart>}

Protects client placeholders that are not part of the server grammar.

Parameters

$sqlstring
$gapsarray<string, StatementPart>
$prefixstring

Returns

array{string, array<string, StatementPart>}
Called from 1
Calls 7
public function restore(string $sql, array<string, StatementPart> $gaps): list<StatementPart>

Restores gaps and client placeholders without interpreting literal gap-like text.

Parameters

$sqlstring
$gapsarray<string, StatementPart>

Returns

Throws

FormattingException When a marker cannot be restored
Called from 1
Calls 8

Private surface 1§

Implementation details, listed for orientation only.

private list<SqlFormatter> $formatters = []

Test cases 18§

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

Dedicated tests 2
Other tests reaching this symbol 16

Relations§

Instantiated in 5
Type declarations 9