Skip to content
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
30 changes: 0 additions & 30 deletions config/phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -156,36 +156,6 @@ parameters:
count: 1
path: ../src/RuleSet/DeclarationBlock.php

-
message: '#^Call to an undefined method Sabberworm\\CSS\\OutputFormat\:\:removeLastSemicolon\(\)\.$#'
identifier: method.notFound
count: 1
path: ../src/RuleSet/RuleSet.php

-
message: '#^Call to an undefined method Sabberworm\\CSS\\OutputFormat\:\:safely\(\)\.$#'
identifier: method.notFound
count: 1
path: ../src/RuleSet/RuleSet.php

-
message: '#^Call to an undefined method Sabberworm\\CSS\\OutputFormat\:\:spaceAfterRules\(\)\.$#'
identifier: method.notFound
count: 1
path: ../src/RuleSet/RuleSet.php

-
message: '#^Call to an undefined method Sabberworm\\CSS\\OutputFormat\:\:spaceBeforeRules\(\)\.$#'
identifier: method.notFound
count: 1
path: ../src/RuleSet/RuleSet.php

-
message: '#^Call to an undefined method Sabberworm\\CSS\\OutputFormat\:\:spaceBetweenRules\(\)\.$#'
identifier: method.notFound
count: 1
path: ../src/RuleSet/RuleSet.php

-
message: '#^Only booleans are allowed in a negated boolean, string\|null given\.$#'
identifier: booleanNot.exprNotBoolean
Expand Down
12 changes: 7 additions & 5 deletions src/RuleSet/RuleSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -278,27 +278,29 @@ protected function renderRules(OutputFormat $outputFormat)
$isFirst = true;
$nextLevelFormat = $outputFormat->nextLevel();
foreach ($this->getRules() as $rule) {
$renderedRule = $nextLevelFormat->safely(static function () use ($rule, $nextLevelFormat): string {
$nextLevelFormatter = $nextLevelFormat->getFormatter();
$renderedRule = $nextLevelFormatter->safely(static function () use ($rule, $nextLevelFormat): string {
return $rule->render($nextLevelFormat);
});
if ($renderedRule === null) {
continue;
}
if ($isFirst) {
$isFirst = false;
$result .= $nextLevelFormat->spaceBeforeRules();
$result .= $nextLevelFormatter->spaceBeforeRules();
} else {
$result .= $nextLevelFormat->spaceBetweenRules();
$result .= $nextLevelFormatter->spaceBetweenRules();
}
$result .= $renderedRule;
}

$formatter = $outputFormat->getFormatter();
if (!$isFirst) {
// Had some output
$result .= $outputFormat->spaceAfterRules();
$result .= $formatter->spaceAfterRules();
}

return $outputFormat->removeLastSemicolon($result);
return $formatter->removeLastSemicolon($result);
}

/**
Expand Down