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
[CLEANUP] Avoid magic method forwarding in Color
Part of #1147
  • Loading branch information
oliverklee committed Mar 12, 2025
commit 60957b57376f5f4b74c45d5da56fe81c5d051542
18 changes: 0 additions & 18 deletions config/phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -294,24 +294,6 @@ parameters:
count: 1
path: ../src/Value/CalcRuleValueList.php

-
message: '#^Call to an undefined method Sabberworm\\CSS\\OutputFormat\:\:implode\(\)\.$#'
identifier: method.notFound
count: 2
path: ../src/Value/Color.php

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

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

-
message: '#^Call to method Sabberworm\\CSS\\Value\\Color\:\:hasNoneAsComponentValue\(\) with incorrect case\: HasNoneAsComponentValue$#'
identifier: method.nameCase
Expand Down
9 changes: 5 additions & 4 deletions src/Value/Color.php
Original file line number Diff line number Diff line change
Expand Up @@ -383,11 +383,12 @@ private function renderInModernSyntax(OutputFormat $outputFormat): string
unset($componentsWithoutAlpha['a']);
}

$arguments = $outputFormat->implode(' ', $componentsWithoutAlpha);
$formatter = $outputFormat->getFormatter();
$arguments = $formatter->implode(' ', $componentsWithoutAlpha);
if (isset($alpha)) {
$separator = $outputFormat->spaceBeforeListArgumentSeparator('/')
. '/' . $outputFormat->spaceAfterListArgumentSeparator('/');
$arguments = $outputFormat->implode($separator, [$arguments, $alpha]);
$separator = $formatter->spaceBeforeListArgumentSeparator('/')
. '/' . $formatter->spaceAfterListArgumentSeparator('/');
$arguments = $formatter->implode($separator, [$arguments, $alpha]);
}

return $this->getName() . '(' . $arguments . ')';
Expand Down