Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 63d9a53

Browse files
committed
bug #53521 [VarDumper] Fixes Typed property Symfony\Component\VarDumper\Dumper\CliDumper::$colors must not be accessed before initialization (crynobone)
This PR was squashed before being merged into the 7.0 branch. Discussion ---------- [VarDumper] Fixes `Typed property Symfony\Component\VarDumper\Dumper\CliDumper::$colors must not be accessed before initialization` | Q | A | ------------- | --- | Branch? | 7.0 | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Issues | N/A | License | MIT Fixes the following error: ![CleanShot 2024-01-12 at 16 27 25](https://github.com/symfony/symfony/assets/172966/dfb482ff-4754-41cd-bc06-36143afad5cb) Other methods in the class start with `$this->colors ??= $this->supportsColors();`. I believe this should have the same code. Commits ------- b163c7a [VarDumper] Fixes `Typed property Symfony\Component\VarDumper\Dumper\CliDumper::$colors must not be accessed before initialization`
2 parents e597a35 + b163c7a commit 63d9a53

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/VarDumper/Dumper/CliDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ protected function supportsColors(): bool
550550

551551
protected function dumpLine(int $depth, bool $endOfValue = false): void
552552
{
553-
if ($this->colors) {
553+
if ($this->colors ??= $this->supportsColors()) {
554554
$this->line = sprintf("\033[%sm%s\033[m", $this->styles['default'], $this->line);
555555
}
556556
parent::dumpLine($depth);

0 commit comments

Comments
 (0)