classSqlKeywordSequence
final class SqlKeywordSequence
Finds where a run of keywords was written, at the level of the statement itself.
A clause is opened by words that only mean what they say when the statement itself says them: an ORDER BY inside a subquery orders the subquery, not the statement around it. Only a run written entirely outside parentheses counts.
Methods§
public function positionIn(
list<SqlToken> $tokens,
non-empty-list<string> $keywords,
int $from,
): int|nullAnswers where a run of keywords begins.
Parameters
$tokens | list<SqlToken> | Tokens to search, with nothing insignificant left in |
$keywords | non-empty-list<string> | Words the run is made of, in order |
$from | int | Position to start looking from |
Returns
int|null Position of the run's first word, or null when it is not written thereTest cases 5
SqlKeywordSequenceTest::testPositionInAnswersWhereTheRunOfKeywordsBeginscovers and callsSqlKeywordSequenceTest::testPositionInIgnoresTheSameWordsWrittenInsideParenthesescovers and callsSqlKeywordSequenceTest::testPositionInIsNothingWhereOnlyPartOfTheRunIsWrittencovers and callsSqlKeywordSequenceTest::testPositionInIsNothingWhereTheRunIsNotWrittenAtAllcovers and callsSqlKeywordSequenceTest::testPositionInLooksNoEarlierThanItWasToldTocovers and calls
Called from 5
- method-call ZtdQuery\Sql\SqlTokenStream::topLevelClause() packages/ztd-query-core/src/Sql/SqlTokenStream.php:189
- method-call ZtdQuery\Sql\SqlTokenStream::topLevelClause() packages/ztd-query-core/src/Sql/SqlTokenStream.php:197
- method-call ZtdQuery\Sql\SqlTokenStream::topLevelClauseAfter() packages/ztd-query-core/src/Sql/SqlTokenStream.php:217
- method-call ZtdQuery\Sql\SqlTokenStream::topLevelClauseAfter() packages/ztd-query-core/src/Sql/SqlTokenStream.php:221
- method-call ZtdQuery\Sql\SqlTokenStream::topLevelClauseAfter() packages/ztd-query-core/src/Sql/SqlTokenStream.php:229
Calls 1
- function-call
countline 27
Test cases 6§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 5
SqlKeywordSequenceTest::testPositionInAnswersWhereTheRunOfKeywordsBeginscovers and callsSqlKeywordSequenceTest::testPositionInIgnoresTheSameWordsWrittenInsideParenthesescovers and callsSqlKeywordSequenceTest::testPositionInIsNothingWhereOnlyPartOfTheRunIsWrittencovers and callsSqlKeywordSequenceTest::testPositionInIsNothingWhereTheRunIsNotWrittenAtAllcovers and callsSqlKeywordSequenceTest::testPositionInLooksNoEarlierThanItWasToldTocovers and calls
Other tests reaching this symbol 1
SqlTokenStreamTestcalls
Relations§
Instantiated in 1
Method calls 5
- method-call ZtdQuery\Sql\SqlTokenStream::topLevelClause() packages/ztd-query-core/src/Sql/SqlTokenStream.php:189
- method-call ZtdQuery\Sql\SqlTokenStream::topLevelClause() packages/ztd-query-core/src/Sql/SqlTokenStream.php:197
- method-call ZtdQuery\Sql\SqlTokenStream::topLevelClauseAfter() packages/ztd-query-core/src/Sql/SqlTokenStream.php:217
- method-call ZtdQuery\Sql\SqlTokenStream::topLevelClauseAfter() packages/ztd-query-core/src/Sql/SqlTokenStream.php:221
- method-call ZtdQuery\Sql\SqlTokenStream::topLevelClauseAfter() packages/ztd-query-core/src/Sql/SqlTokenStream.php:229