bug #37700 [VarDumper] Improve previous fix on light array coloration (l-vo)
This PR was merged into the 3.4 branch.
Discussion
----------
[VarDumper] Improve previous fix on light array coloration
| Q | A
| ------------- | ---
| Branch? | 3.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix #37674
| License | MIT
| Doc PR |
Improve #36230 to fix #37674 (revert previous fix and use a solution that looks better).
Commits
-------
cef16f591f
[VarDumper] Improve previous fix on light array coloration
This commit is contained in:
commit
b940b5a4ca
@ -255,6 +255,10 @@ class CliDumper extends AbstractDumper
|
|||||||
*/
|
*/
|
||||||
public function enterHash(Cursor $cursor, $type, $class, $hasChild)
|
public function enterHash(Cursor $cursor, $type, $class, $hasChild)
|
||||||
{
|
{
|
||||||
|
if (null === $this->colors) {
|
||||||
|
$this->colors = $this->supportsColors();
|
||||||
|
}
|
||||||
|
|
||||||
$this->dumpKey($cursor);
|
$this->dumpKey($cursor);
|
||||||
|
|
||||||
if ($this->collapseNextHash) {
|
if ($this->collapseNextHash) {
|
||||||
@ -268,8 +272,7 @@ class CliDumper extends AbstractDumper
|
|||||||
} elseif (Cursor::HASH_RESOURCE === $type) {
|
} elseif (Cursor::HASH_RESOURCE === $type) {
|
||||||
$prefix = $this->style('note', $class.' resource').($hasChild ? ' {' : ' ');
|
$prefix = $this->style('note', $class.' resource').($hasChild ? ' {' : ' ');
|
||||||
} else {
|
} else {
|
||||||
$unstyledPrefix = $class && !(self::DUMP_LIGHT_ARRAY & $this->flags) ? 'array:'.$class : '';
|
$prefix = $class && !(self::DUMP_LIGHT_ARRAY & $this->flags) ? $this->style('note', 'array:'.$class).' [' : '[';
|
||||||
$prefix = $this->style('note', $unstyledPrefix).($unstyledPrefix ? ' [' : '[');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cursor->softRefCount || 0 < $cursor->softRefHandle) {
|
if ($cursor->softRefCount || 0 < $cursor->softRefHandle) {
|
||||||
|
@ -578,7 +578,7 @@ EOTXT
|
|||||||
yield [
|
yield [
|
||||||
['foo' => 'bar'],
|
['foo' => 'bar'],
|
||||||
0,
|
0,
|
||||||
<<<EOTXT
|
<<<EOTXT
|
||||||
\e[0;38;5;208m\e[38;5;38marray:1\e[0;38;5;208m [\e[m
|
\e[0;38;5;208m\e[38;5;38marray:1\e[0;38;5;208m [\e[m
|
||||||
\e[0;38;5;208m"\e[38;5;113mfoo\e[0;38;5;208m" => "\e[1;38;5;113mbar\e[0;38;5;208m"\e[m
|
\e[0;38;5;208m"\e[38;5;113mfoo\e[0;38;5;208m" => "\e[1;38;5;113mbar\e[0;38;5;208m"\e[m
|
||||||
\e[0;38;5;208m]\e[m
|
\e[0;38;5;208m]\e[m
|
||||||
@ -586,20 +586,20 @@ EOTXT
|
|||||||
EOTXT
|
EOTXT
|
||||||
];
|
];
|
||||||
|
|
||||||
yield [[], AbstractDumper::DUMP_LIGHT_ARRAY, "\e[0;38;5;208m\e[38;5;38m\e[0;38;5;208m[]\e[m\n"];
|
yield [[], AbstractDumper::DUMP_LIGHT_ARRAY, "\e[0;38;5;208m[]\e[m\n"];
|
||||||
|
|
||||||
yield [
|
yield [
|
||||||
['foo' => 'bar'],
|
['foo' => 'bar'],
|
||||||
AbstractDumper::DUMP_LIGHT_ARRAY,
|
AbstractDumper::DUMP_LIGHT_ARRAY,
|
||||||
<<<EOTXT
|
<<<EOTXT
|
||||||
\e[0;38;5;208m\e[38;5;38m\e[0;38;5;208m[\e[m
|
\e[0;38;5;208m[\e[m
|
||||||
\e[0;38;5;208m"\e[38;5;113mfoo\e[0;38;5;208m" => "\e[1;38;5;113mbar\e[0;38;5;208m"\e[m
|
\e[0;38;5;208m"\e[38;5;113mfoo\e[0;38;5;208m" => "\e[1;38;5;113mbar\e[0;38;5;208m"\e[m
|
||||||
\e[0;38;5;208m]\e[m
|
\e[0;38;5;208m]\e[m
|
||||||
|
|
||||||
EOTXT
|
EOTXT
|
||||||
];
|
];
|
||||||
|
|
||||||
yield [[], 0, "\e[0;38;5;208m\e[38;5;38m\e[0;38;5;208m[]\e[m\n"];
|
yield [[], 0, "\e[0;38;5;208m[]\e[m\n"];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user