diff --git a/config/phpstan-baseline.neon b/config/phpstan-baseline.neon index 4150a6e8..3f311ad1 100644 --- a/config/phpstan-baseline.neon +++ b/config/phpstan-baseline.neon @@ -330,12 +330,6 @@ parameters: count: 1 path: ../src/RuleSet/DeclarationBlock.php - - - message: '#^Loose comparison via "\=\=" is not allowed\.$#' - identifier: equal.notAllowed - count: 1 - path: ../src/RuleSet/DeclarationBlock.php - - message: '#^Parameters should have "string" types as the only types passed to this method$#' identifier: typePerfect.narrowPublicClassMethodParamType diff --git a/src/RuleSet/DeclarationBlock.php b/src/RuleSet/DeclarationBlock.php index 5d025898..4dc0ce2d 100644 --- a/src/RuleSet/DeclarationBlock.php +++ b/src/RuleSet/DeclarationBlock.php @@ -45,18 +45,17 @@ public static function parse(ParserState $parserState, $list = null) $result = new DeclarationBlock($parserState->currentLine()); try { $aSelectorParts = []; - $stringWrapperCharacter = false; do { $aSelectorParts[] = $parserState->consume(1) . $parserState->consumeUntil(['{', '}', '\'', '"'], false, false, $comments); if (\in_array($parserState->peek(), ['\'', '"'], true) && \substr(\end($aSelectorParts), -1) != '\\') { - if ($stringWrapperCharacter === false) { + if (!isset($stringWrapperCharacter)) { $stringWrapperCharacter = $parserState->peek(); - } elseif ($stringWrapperCharacter == $parserState->peek()) { - $stringWrapperCharacter = false; + } elseif ($stringWrapperCharacter === $parserState->peek()) { + unset($stringWrapperCharacter); } } - } while (!\in_array($parserState->peek(), ['{', '}'], true) || $stringWrapperCharacter !== false); + } while (!\in_array($parserState->peek(), ['{', '}'], true) || isset($stringWrapperCharacter)); $result->setSelectors(\implode('', $aSelectorParts), $list); if ($parserState->comes('{')) { $parserState->consume(1);