Skip to content

Commit 09635e6

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. This is the v8.x backport of #740.
1 parent 404aff3 commit 09635e6

File tree

4 files changed

+4
-8
lines changed

4 files changed

+4
-8
lines changed

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ This project adheres to [Semantic Versioning](https://semver.org/).
2424
### Fixed
2525

2626
- Fix type errors in PHP strict mode (#695)
27-
- Fix comment parsing to support multiple comments (#671)
2827

2928
## 8.6.0
3029

src/Rule/Rule.php

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

111-
// NOTE: This is a backport to fix comment parsing to support multiple
112-
// comments. This will be rectified in version 9.0.0.
113-
while (preg_match('/\\s/isSu', $oParserState->peek()) === 1) {
114-
$oParserState->consume(1);
115-
}
111+
$oParserState->consumeWhiteSpace();
116112

117113
return $oRule;
118114
}

tests/ParserTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,11 +1172,14 @@ public function flatCommentExtractingOneComment()
11721172
self::assertCount(1, $comments);
11731173
self::assertSame("Find Me!", $comments[0]->getComment());
11741174
}
1175+
11751176
/**
11761177
* @test
11771178
*/
11781179
public function flatCommentExtractingTwoComments()
11791180
{
1181+
self::markTestSkipped('This is currently broken.');
1182+
11801183
$parser = new Parser('div {/*Find Me!*/left:10px; /*Find Me Too!*/text-align:left;}');
11811184
$doc = $parser->parse();
11821185
$contents = $doc->getContents();

tests/RuleSet/DeclarationBlockTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,8 +497,6 @@ public function canRemoveCommentsFromRulesUsingStrictParsing(
497497
$cssWithComments,
498498
$cssWithoutComments
499499
) {
500-
self::markTestSkipped('This currently crashes, and we need to fix it.');
501-
502500
$parserSettings = ParserSettings::create()->withLenientParsing(false);
503501
$document = (new Parser($cssWithComments, $parserSettings))->parse();
504502

0 commit comments

Comments
 (0)