From 129d793ac468e2660a8d03ab545c05f2e127790c Mon Sep 17 00:00:00 2001 From: Oliver Klee Date: Wed, 12 Mar 2025 11:15:20 +0100 Subject: [PATCH] [CLEANUP] Avoid magic method forwarding in `ValueList` Part of #1147 --- config/phpstan-baseline.neon | 18 ------------------ src/Value/ValueList.php | 8 +++++--- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/config/phpstan-baseline.neon b/config/phpstan-baseline.neon index 6c0a6d88..4d9c844b 100644 --- a/config/phpstan-baseline.neon +++ b/config/phpstan-baseline.neon @@ -383,21 +383,3 @@ parameters: identifier: typePerfect.narrowPublicClassMethodParamType count: 1 path: ../src/Value/Size.php - - - - message: '#^Call to an undefined method Sabberworm\\CSS\\OutputFormat\:\:implode\(\)\.$#' - identifier: method.notFound - count: 1 - path: ../src/Value/ValueList.php - - - - message: '#^Call to an undefined method Sabberworm\\CSS\\OutputFormat\:\:spaceAfterListArgumentSeparator\(\)\.$#' - identifier: method.notFound - count: 1 - path: ../src/Value/ValueList.php - - - - message: '#^Call to an undefined method Sabberworm\\CSS\\OutputFormat\:\:spaceBeforeListArgumentSeparator\(\)\.$#' - identifier: method.notFound - count: 1 - path: ../src/Value/ValueList.php diff --git a/src/Value/ValueList.php b/src/Value/ValueList.php index b58af646..8a50809d 100644 --- a/src/Value/ValueList.php +++ b/src/Value/ValueList.php @@ -93,9 +93,11 @@ public function __toString(): string public function render(OutputFormat $outputFormat): string { - return $outputFormat->implode( - $outputFormat->spaceBeforeListArgumentSeparator($this->separator) . $this->separator - . $outputFormat->spaceAfterListArgumentSeparator($this->separator), + $formatter = $outputFormat->getFormatter(); + + return $formatter->implode( + $formatter->spaceBeforeListArgumentSeparator($this->separator) . $this->separator + . $formatter->spaceAfterListArgumentSeparator($this->separator), $this->components ); }