Skip to content
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions src/RuleSet/DeclarationBlock.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php

declare(strict_types=1);
Expand Down Expand Up @@ -44,14 +44,21 @@
do {
$selectorParts[] = $parserState->consume(1)
. $parserState->consumeUntil(['{', '}', '\'', '"'], false, false, $comments);
if (\in_array($parserState->peek(), ['\'', '"'], true) && \substr(\end($selectorParts), -1) != '\\') {
if (!isset($stringWrapperCharacter)) {
$stringWrapperCharacter = $parserState->peek();
} elseif ($stringWrapperCharacter === $parserState->peek()) {
unset($stringWrapperCharacter);
}
$nextCharacter = $parserState->peek();
switch ($nextCharacter) {
case '\'':
// The fallthrough is intentional.
case '"':
if (!\is_string($stringWrapperCharacter)) {

Check failure on line 52 in src/RuleSet/DeclarationBlock.php

View workflow job for this annotation

GitHub Actions / Static Analysis (php:stan, 8.3)

Variable $stringWrapperCharacter might not be defined.
$stringWrapperCharacter = $nextCharacter;
} elseif ($stringWrapperCharacter === $nextCharacter) {
if (\substr(\end($selectorParts), -1) !== '\\') {
$stringWrapperCharacter = null;
}
}
break;
}
} while (!\in_array($parserState->peek(), ['{', '}'], true) || isset($stringWrapperCharacter));
} while (!\in_array($nextCharacter, ['{', '}'], true) || \is_string($stringWrapperCharacter));

Check failure on line 61 in src/RuleSet/DeclarationBlock.php

View workflow job for this annotation

GitHub Actions / Static Analysis (php:stan, 8.3)

Variable $stringWrapperCharacter might not be defined.
$result->setSelectors(\implode('', $selectorParts), $list);
if ($parserState->comes('{')) {
$parserState->consume(1);
Expand Down
Loading