Skip to content

Commit 08612de

Browse files
authored
[CLEANUP] Avoid magic method forwarding in Color (#1152)
Part of #1147
1 parent 92927fe commit 08612de

File tree

2 files changed

+5
-22
lines changed

2 files changed

+5
-22
lines changed

config/phpstan-baseline.neon

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -270,24 +270,6 @@ parameters:
270270
count: 1
271271
path: ../src/Value/CalcRuleValueList.php
272272

273-
-
274-
message: '#^Call to an undefined method Sabberworm\\CSS\\OutputFormat\:\:implode\(\)\.$#'
275-
identifier: method.notFound
276-
count: 2
277-
path: ../src/Value/Color.php
278-
279-
-
280-
message: '#^Call to an undefined method Sabberworm\\CSS\\OutputFormat\:\:spaceAfterListArgumentSeparator\(\)\.$#'
281-
identifier: method.notFound
282-
count: 1
283-
path: ../src/Value/Color.php
284-
285-
-
286-
message: '#^Call to an undefined method Sabberworm\\CSS\\OutputFormat\:\:spaceBeforeListArgumentSeparator\(\)\.$#'
287-
identifier: method.notFound
288-
count: 1
289-
path: ../src/Value/Color.php
290-
291273
-
292274
message: '#^Call to method Sabberworm\\CSS\\Value\\Color\:\:hasNoneAsComponentValue\(\) with incorrect case\: HasNoneAsComponentValue$#'
293275
identifier: method.nameCase

src/Value/Color.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -383,11 +383,12 @@ private function renderInModernSyntax(OutputFormat $outputFormat): string
383383
unset($componentsWithoutAlpha['a']);
384384
}
385385

386-
$arguments = $outputFormat->implode(' ', $componentsWithoutAlpha);
386+
$formatter = $outputFormat->getFormatter();
387+
$arguments = $formatter->implode(' ', $componentsWithoutAlpha);
387388
if (isset($alpha)) {
388-
$separator = $outputFormat->spaceBeforeListArgumentSeparator('/')
389-
. '/' . $outputFormat->spaceAfterListArgumentSeparator('/');
390-
$arguments = $outputFormat->implode($separator, [$arguments, $alpha]);
389+
$separator = $formatter->spaceBeforeListArgumentSeparator('/')
390+
. '/' . $formatter->spaceAfterListArgumentSeparator('/');
391+
$arguments = $formatter->implode($separator, [$arguments, $alpha]);
391392
}
392393

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

0 commit comments

Comments
 (0)