Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcef16f5

Browse files
committed
[VarDumper] Improve previous fix on light array coloration
1 parentcc82746 commitcef16f5

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,10 @@ public function dumpString(Cursor $cursor, $str, $bin, $cut)
255255
*/
256256
publicfunctionenterHash(Cursor$cursor,$type,$class,$hasChild)
257257
{
258+
if (null ===$this->colors) {
259+
$this->colors =$this->supportsColors();
260+
}
261+
258262
$this->dumpKey($cursor);
259263

260264
if ($this->collapseNextHash) {
@@ -268,8 +272,7 @@ public function enterHash(Cursor $cursor, $type, $class, $hasChild)
268272
}elseif (Cursor::HASH_RESOURCE ===$type) {
269273
$prefix =$this->style('note',$class.' resource').($hasChild ?' {' :'');
270274
}else {
271-
$unstyledPrefix =$class && !(self::DUMP_LIGHT_ARRAY &$this->flags) ?'array:'.$class :'';
272-
$prefix =$this->style('note',$unstyledPrefix).($unstyledPrefix ?' [' :'[');
275+
$prefix =$class && !(self::DUMP_LIGHT_ARRAY &$this->flags) ?$this->style('note','array:'.$class).' [' :'[';
273276
}
274277

275278
if ($cursor->softRefCount ||0 <$cursor->softRefHandle) {

‎src/Symfony/Component/VarDumper/Tests/Dumper/CliDumperTest.php‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -578,28 +578,28 @@ public function provideDumpArrayWithColor()
578578
yield [
579579
['foo' =>'bar'],
580580
0,
581-
<<<EOTXT
581+
<<<EOTXT
582582
\e[0;38;5;208m\e[38;5;38marray:1\e[0;38;5;208m [\e[m
583583
\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
584584
\e[0;38;5;208m]\e[m
585585
586586
EOTXT
587587
];
588588

589-
yield [[], AbstractDumper::DUMP_LIGHT_ARRAY,"\e[0;38;5;208m\e[38;5;38m\e[0;38;5;208m[]\e[m\n"];
589+
yield [[], AbstractDumper::DUMP_LIGHT_ARRAY,"\e[0;38;5;208m[]\e[m\n"];
590590

591591
yield [
592592
['foo' =>'bar'],
593593
AbstractDumper::DUMP_LIGHT_ARRAY,
594594
<<<EOTXT
595-
\e[0;38;5;208m\e[38;5;38m\e[0;38;5;208m[\e[m
595+
\e[0;38;5;208m[\e[m
596596
\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
597597
\e[0;38;5;208m]\e[m
598598
599599
EOTXT
600600
];
601601

602-
yield [[],0,"\e[0;38;5;208m\e[38;5;38m\e[0;38;5;208m[]\e[m\n"];
602+
yield [[],0,"\e[0;38;5;208m[]\e[m\n"];
603603
}
604604

605605
/**

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp