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

Checks that the native parser retained every declared column.

Methods§

public function assertNothingWasLost(Parser $parser, CreateStatement $stmt, string $sql): void

Stop if the parser abandoned part of the definition list.

On a syntax error the parser gives up on the rest of the definitions, so a stray keyword takes every column after it. The result is a schema that looks complete and is not, and the damage only shows up much later as a column that generates no value.

Not every error loses something. DEC and FIXED are valid synonyms the parser reports as unrecognised while still reading the column, so the test is what came out rather than whether anything was said.

Parameters

$parserParser
$stmtCreateStatement
$sqlstring
Test cases 1
Called from 1
Calls 4
public function countDeclaredDefinitions(Parser $parser): ?int

How many definitions the parenthesised body separates, or null when it is never closed.

Counting uses the parser's own tokens, which already know that a comma inside a string or an ENUM is not a separator.

Parameters

$parserParser

Returns

?int
Test cases 2
Called from 1
Calls 1
  • class-const Token::TYPE_OPERATOR() line 65

Test cases 19§

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 17

Relations§

Instantiated in 1
Method calls 1