diff --git a/src/Symfony/Component/VarDumper/Dumper/CliDumper.php b/src/Symfony/Component/VarDumper/Dumper/CliDumper.php index c66cdcd412e9d..5aa28a7b56df4 100644 --- a/src/Symfony/Component/VarDumper/Dumper/CliDumper.php +++ b/src/Symfony/Component/VarDumper/Dumper/CliDumper.php @@ -550,7 +550,7 @@ protected function supportsColors(): bool protected function dumpLine(int $depth, bool $endOfValue = false): void { - if ($this->colors) { + if ($this->colors ??= $this->supportsColors()) { $this->line = sprintf("\033[%sm%s\033[m", $this->styles['default'], $this->line); } parent::dumpLine($depth);