Skip to content

Commit a1a9a61

Browse files
committed
[BUGFIX] Revert broken support for multiple comments
This reverts e4c66f6 (#672), which broke comment parsing in strict mode. We'll need to re-implement support for multiple comments later in a way that does not break the existing comment parsing.
1 parent e2bb6b7 commit a1a9a61

File tree

4 files changed

+2
-22
lines changed

4 files changed

+2
-22
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ Please also have a look at our
4242

4343
### Fixed
4444

45+
- Revert broken support for multiple comments (#740)
4546
- Fix type errors in PHP strict mode (#664)
46-
- Fix comment parsing to support multiple comments (#672)
4747
- Fix undefined local variable in `CalcFunction::parse()` (#593)
4848
- Fix PHP notice caused by parsing invalid color values having less than 6
4949
characters (#485)

src/Rule/Rule.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,7 @@ public static function parse(ParserState $oParserState): Rule
108108
$oParserState->consume(';');
109109
}
110110

111-
while (\preg_match('/\\s/isSu', $oParserState->peek()) === 1) {
112-
$oParserState->consume(1);
113-
}
111+
$oParserState->consumeWhiteSpace();
114112

115113
return $oRule;
116114
}

tests/ParserTest.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,22 +1171,6 @@ public function flatCommentExtractingOneComment(): void
11711171
self::assertCount(1, $comments);
11721172
self::assertSame('Find Me!', $comments[0]->getComment());
11731173
}
1174-
/**
1175-
* @test
1176-
*/
1177-
public function flatCommentExtractingTwoComments(): void
1178-
{
1179-
$parser = new Parser('div {/*Find Me!*/left:10px; /*Find Me Too!*/text-align:left;}');
1180-
$document = $parser->parse();
1181-
$contents = $document->getContents();
1182-
$divRules = $contents[0]->getRules();
1183-
$rule1Comments = $divRules[0]->getComments();
1184-
$rule2Comments = $divRules[1]->getComments();
1185-
self::assertCount(1, $rule1Comments);
1186-
self::assertCount(1, $rule2Comments);
1187-
self::assertEquals('Find Me!', $rule1Comments[0]->getComment());
1188-
self::assertEquals('Find Me Too!', $rule2Comments[0]->getComment());
1189-
}
11901174

11911175
/**
11921176
* @test

tests/RuleSet/DeclarationBlockTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,6 @@ public function canRemoveCommentsFromRulesUsingStrictParsing(
467467
string $cssWithComments,
468468
string $cssWithoutComments
469469
): void {
470-
self::markTestSkipped('This currently crashes, and we need to fix it.');
471-
472470
$parserSettings = ParserSettings::create()->withLenientParsing(false);
473471
$document = (new Parser($cssWithComments, $parserSettings))->parse();
474472

0 commit comments

Comments
 (0)