Skip to content

[BUGFIX] Revert broken support for multiple comments #740

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ Please also have a look at our
### Fixed

- Fix type errors in PHP strict mode (#664)
- Fix comment parsing to support multiple comments (#672)
- Fix undefined local variable in `CalcFunction::parse()` (#593)
- Fix PHP notice caused by parsing invalid color values having less than 6
characters (#485)
Expand Down
4 changes: 1 addition & 3 deletions src/Rule/Rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,7 @@ public static function parse(ParserState $oParserState): Rule
$oParserState->consume(';');
}

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

return $oRule;
}
Expand Down
3 changes: 3 additions & 0 deletions tests/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1171,11 +1171,14 @@ public function flatCommentExtractingOneComment(): void
self::assertCount(1, $comments);
self::assertSame('Find Me!', $comments[0]->getComment());
}

/**
* @test
*/
public function flatCommentExtractingTwoComments(): void
{
self::markTestSkipped('This is currently broken.');

$parser = new Parser('div {/*Find Me!*/left:10px; /*Find Me Too!*/text-align:left;}');
$document = $parser->parse();
$contents = $document->getContents();
Expand Down
2 changes: 0 additions & 2 deletions tests/RuleSet/DeclarationBlockTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,6 @@ public function canRemoveCommentsFromRulesUsingStrictParsing(
string $cssWithComments,
string $cssWithoutComments
): void {
self::markTestSkipped('This currently crashes, and we need to fix it.');

$parserSettings = ParserSettings::create()->withLenientParsing(false);
$document = (new Parser($cssWithComments, $parserSettings))->parse();

Expand Down