classSqlIdentifierComponent
final class SqlIdentifierComponent
Reads one part of a name out of the tokens a statement was written as.
A name may be written bare or in whatever the dialect quotes identifiers with, and a quoted one carries escapes that are not part of the name. Both spellings answer the same name, and anything that is not a name at all answers nothing.
Methods§
public function at(
list<SqlToken> $tokens,
int $index,
SqlLexerProfile $profile,
): array{string, int}|nullReads the name written at a position, and says where reading it left off.
Parameters
$tokens | list<SqlToken> | Tokens to read, with nothing insignificant left in |
$index | int | Position to read at |
$profile | SqlLexerProfile | What the dialect quotes identifiers with |
Returns
array{string, int}|null The name and the position after it, or null where no name is writtenTest cases 4
SqlIdentifierComponentTest::testAtIsNothingPastTheEndOfWhatWasWrittencovers and callsSqlIdentifierComponentTest::testAtIsNothingWhereNoNameIsWrittencovers and callsSqlIdentifierComponentTest::testAtReadsABareNameAndSaysWhereItLeftOffcovers and callsSqlIdentifierComponentTest::testAtReadsAQuotedNameWithoutTheQuotesAroundItcovers and calls
Called from 1
Calls 3
- class-const SqlTokenKind::Word() line 32
- class-const SqlTokenKind::QuotedIdentifier() line 35
- method-call SqlLexerProfile::quotedIdentifierValue() line 36
Test cases 5§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 4
SqlIdentifierComponentTest::testAtIsNothingPastTheEndOfWhatWasWrittencovers and callsSqlIdentifierComponentTest::testAtIsNothingWhereNoNameIsWrittencovers and callsSqlIdentifierComponentTest::testAtReadsABareNameAndSaysWhereItLeftOffcovers and callsSqlIdentifierComponentTest::testAtReadsAQuotedNameWithoutTheQuotesAroundItcovers and calls
Other tests reaching this symbol 1
SqlTokenStreamTestcalls