classDefinitionIntegrity
final class DefinitionIntegrity
Checks that the native parser retained every declared column.
Methods§
public function assertNothingWasLost(Parser $parser, CreateStatement $stmt, string $sql): voidStop 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
$parser | Parser | |
$stmt | CreateStatement | |
$sql | string |
Throws
Called from 1
Calls 4
- method-call DefinitionIntegrity::countDeclaredDefinitions() line 38
- function-call
is_arrayline 40 - function-call
countline 40 - new InvalidSqlException line 44
public function countDeclaredDefinitions(Parser $parser): ?intHow 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
$parser | Parser |
Returns
?intTest 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
PostgreSqlEndToEndTestcallsSqliteIntegrationTestcallsDatabaseFixtureProviderTestcallsFileFixtureProviderTestcallsRowMaterializerTestcallsPlanGeneratorTestcallsPlanSchemaValidatorTestcallsRowGenerationTestcallsFixtureGeneratorTestcallsFixtureProviderTestcallsConstructorHydrationTestcallsPropertyHydrationTestcallsMySqlSchemaFetcherTestcallsMySqlSchemaParserTestcallsPlatformFactoryTestcallsSqlSchemaProviderTestcallsMySqlSchemaParserTestcalls