File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -227,7 +227,7 @@ public function render(OutputFormat $outputFormat): string
227227 // Shorthand RGB color values
228228 if (
229229 $ outputFormat ->getRGBHashNotation ()
230- && \implode ( '' , \array_keys ( $ this ->aComponents ) ) === 'rgb '
230+ && $ this ->getRealName ( ) === 'rgb '
231231 && $ this ->allComponentsAreNumbers ()
232232 ) {
233233 $ result = \sprintf (
@@ -242,6 +242,16 @@ public function render(OutputFormat $outputFormat): string
242242 return parent ::render ($ outputFormat );
243243 }
244244
245+ /**
246+ * The function name is a concatenation of the array keys of the components, which is passed to the constructor.
247+ * However, this can be changed by calling {@see CSSFunction::setName},
248+ * so is not reliable in situations where it's necessary to determine the function name based on the components.
249+ */
250+ private function getRealName (): string
251+ {
252+ return \implode ('' , \array_keys ($ this ->aComponents ));
253+ }
254+
245255 /**
246256 * Test whether all color components are absolute numbers (CSS type `number`), not percentages or anything else.
247257 * If any component is not an instance of `Size`, the method will also return `false`.
You can’t perform that action at this time.
0 commit comments