From 08b7a1a10f538f461219019ce1c094c4740d1ae7 Mon Sep 17 00:00:00 2001 From: Oliver Klee Date: Wed, 12 Mar 2025 09:14:37 +0100 Subject: [PATCH] [CLEANUP] Avoid magic method forwarding in `AtRuleBlockList` Part of #1147 --- config/phpstan-baseline.neon | 12 ------------ src/CSSList/AtRuleBlockList.php | 5 +++-- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/config/phpstan-baseline.neon b/config/phpstan-baseline.neon index 6c0a6d88..7535b3d8 100644 --- a/config/phpstan-baseline.neon +++ b/config/phpstan-baseline.neon @@ -1,17 +1,5 @@ parameters: ignoreErrors: - - - message: '#^Call to an undefined method Sabberworm\\CSS\\OutputFormat\:\:comments\(\)\.$#' - identifier: method.notFound - count: 1 - path: ../src/CSSList/AtRuleBlockList.php - - - - message: '#^Call to an undefined method Sabberworm\\CSS\\OutputFormat\:\:spaceBeforeOpeningBrace\(\)\.$#' - identifier: method.notFound - count: 1 - path: ../src/CSSList/AtRuleBlockList.php - - message: '#^Only booleans are allowed in an if condition, string given\.$#' identifier: if.condNotBoolean diff --git a/src/CSSList/AtRuleBlockList.php b/src/CSSList/AtRuleBlockList.php index 2fbe755c..6c7cc800 100644 --- a/src/CSSList/AtRuleBlockList.php +++ b/src/CSSList/AtRuleBlockList.php @@ -52,13 +52,14 @@ public function __toString(): string public function render(OutputFormat $outputFormat): string { - $result = $outputFormat->comments($this); + $formatter = $outputFormat->getFormatter(); + $result = $formatter->comments($this); $result .= $outputFormat->getContentBeforeAtRuleBlock(); $arguments = $this->arguments; if ($arguments) { $arguments = ' ' . $arguments; } - $result .= "@{$this->type}$arguments{$outputFormat->spaceBeforeOpeningBrace()}{"; + $result .= "@{$this->type}$arguments{$formatter->spaceBeforeOpeningBrace()}{"; $result .= $this->renderListContents($outputFormat); $result .= '}'; $result .= $outputFormat->getContentAfterAtRuleBlock();