classSqlBlockCommentReader
final class SqlBlockCommentReader
Reads a block comment, opening to closing.
Which pair of delimiters writes a block comment, and whether one comment may hold another, are both the dialect's business, so they are asked of the profile. A comment left unclosed runs to the end of the statement, because there is nothing further to close it with.
Methods§
public function endAt(string $sql, int $offset, SqlLexerProfile $profile): int|nullAnswers where the block comment starting at an offset ends.
Parameters
$sql | string | The statement, as written |
$offset | int | Where to look |
$profile | SqlLexerProfile | What the dialect spells things with |
Returns
int|null The offset just past the closing delimiter, or null when no comment starts thereTest cases 5
SqlBlockCommentReaderTest::testEndAtAnswersJustPastTheClosingDelimitercovers and callsSqlBlockCommentReaderTest::testEndAtAnswersNothingWhereNoCommentBeginscovers and callsSqlBlockCommentReaderTest::testEndAtClosesAtTheFirstDelimiterWhereACommentHoldsNoOthercovers and callsSqlBlockCommentReaderTest::testEndAtReadsTheWholeOfANestedCommentWhereOneMayHoldAnothercovers and callsSqlBlockCommentReaderTest::testEndAtStopsAtTheEndOfAStatementThatNeverClosedTheCommentcovers and calls
Called from 1
Calls 4
- method-call SqlLexerProfile::blockCommentAt() line 30
- function-call
strlenline 36 - method-call SqlLexerProfile::supportsNestedBlockComments() line 39
- function-call
substr_compareline 40
Test cases 10§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 5
SqlBlockCommentReaderTest::testEndAtAnswersJustPastTheClosingDelimitercovers and callsSqlBlockCommentReaderTest::testEndAtAnswersNothingWhereNoCommentBeginscovers and callsSqlBlockCommentReaderTest::testEndAtClosesAtTheFirstDelimiterWhereACommentHoldsNoOthercovers and callsSqlBlockCommentReaderTest::testEndAtReadsTheWholeOfANestedCommentWhereOneMayHoldAnothercovers and callsSqlBlockCommentReaderTest::testEndAtStopsAtTheEndOfAStatementThatNeverClosedTheCommentcovers and calls
Other tests reaching this symbol 5
SqlTriviaReaderTestcallsSqlIdentifierComponentTestcallsSqlKeywordSequenceTestcallsSqlTokenScannerTestcallsSqlTokenStreamTestcalls