diff --git a/config/phpstan-baseline.neon b/config/phpstan-baseline.neon index b527ad4b5..920f31e74 100644 --- a/config/phpstan-baseline.neon +++ b/config/phpstan-baseline.neon @@ -108,36 +108,6 @@ parameters: count: 1 path: ../src/RuleSet/AtRuleSet.php - - - message: '#^Call to an undefined method Sabberworm\\CSS\\OutputFormat\:\:comments\(\)\.$#' - identifier: method.notFound - count: 1 - path: ../src/RuleSet/DeclarationBlock.php - - - - message: '#^Call to an undefined method Sabberworm\\CSS\\OutputFormat\:\:implode\(\)\.$#' - identifier: method.notFound - count: 1 - path: ../src/RuleSet/DeclarationBlock.php - - - - message: '#^Call to an undefined method Sabberworm\\CSS\\OutputFormat\:\:spaceAfterSelectorSeparator\(\)\.$#' - identifier: method.notFound - count: 1 - path: ../src/RuleSet/DeclarationBlock.php - - - - message: '#^Call to an undefined method Sabberworm\\CSS\\OutputFormat\:\:spaceBeforeOpeningBrace\(\)\.$#' - identifier: method.notFound - count: 1 - path: ../src/RuleSet/DeclarationBlock.php - - - - message: '#^Call to an undefined method Sabberworm\\CSS\\OutputFormat\:\:spaceBeforeSelectorSeparator\(\)\.$#' - identifier: method.notFound - count: 1 - path: ../src/RuleSet/DeclarationBlock.php - - message: '#^Loose comparison via "\!\=" is not allowed\.$#' identifier: notEqual.notAllowed diff --git a/src/RuleSet/DeclarationBlock.php b/src/RuleSet/DeclarationBlock.php index 4bd45d686..295167648 100644 --- a/src/RuleSet/DeclarationBlock.php +++ b/src/RuleSet/DeclarationBlock.php @@ -155,21 +155,23 @@ public function __toString(): string */ public function render(OutputFormat $outputFormat): string { - $result = $outputFormat->comments($this); + $formatter = $outputFormat->getFormatter(); + $result = $formatter->comments($this); if (\count($this->selectors) === 0) { // If all the selectors have been removed, this declaration block becomes invalid throw new OutputException('Attempt to print declaration block with missing selector', $this->lineNumber); } $result .= $outputFormat->getContentBeforeDeclarationBlock(); - $result .= $outputFormat->implode( - $outputFormat->spaceBeforeSelectorSeparator() . ',' . $outputFormat->spaceAfterSelectorSeparator(), + $result .= $formatter->implode( + $formatter->spaceBeforeSelectorSeparator() . ',' . $formatter->spaceAfterSelectorSeparator(), $this->selectors ); $result .= $outputFormat->getContentAfterDeclarationBlockSelectors(); - $result .= $outputFormat->spaceBeforeOpeningBrace() . '{'; + $result .= $formatter->spaceBeforeOpeningBrace() . '{'; $result .= $this->renderRules($outputFormat); $result .= '}'; $result .= $outputFormat->getContentAfterDeclarationBlock(); + return $result; } }