@@ -139,8 +139,14 @@ public function dumpScalar(Cursor $cursor, string $type, string|int|float|bool|n
139139 $ attr = $ cursor ->attr ;
140140
141141 switch ($ type ) {
142- case 'label ' : $ style = 'label ' ; break ;
143- case 'default ' : $ style = 'default ' ; break ;
142+ case 'default ' :
143+ $ style = 'default ' ;
144+ break ;
145+
146+ case 'label ' :
147+ $ this ->styles += ['label ' => $ this ->styles ['default ' ]];
148+ $ style = 'label ' ;
149+ break ;
144150
145151 case 'integer ' :
146152 $ style = 'num ' ;
@@ -467,7 +473,7 @@ protected function style(string $style, string $value, array $attr = []): string
467473
468474 $ map = static ::$ controlCharsMap ;
469475 $ startCchr = $ this ->colors ? "\033[m \033[ {$ this ->styles ['default ' ]}m " : '' ;
470- $ endCchr = $ this ->colors ? "\033[m \033[ {$ this ->styles [' label ' === $ style ? ' default ' : $ style ]}m " : '' ;
476+ $ endCchr = $ this ->colors ? "\033[m \033[ {$ this ->styles [$ style ]}m " : '' ;
471477 $ value = preg_replace_callback (static ::$ controlCharsRx , function ($ c ) use ($ map , $ startCchr , $ endCchr ) {
472478 $ s = $ startCchr ;
473479 $ c = $ c [$ i = 0 ];
@@ -490,7 +496,7 @@ protected function style(string $style, string $value, array $attr = []): string
490496 if ($ cchrCount && "\033" === $ value [0 ]) {
491497 $ value = substr ($ value , \strlen ($ startCchr ));
492498 } else {
493- $ value = "\033[ {$ this ->styles [' label ' === $ style ? ' default ' : $ style ]}m " .$ value ;
499+ $ value = "\033[ {$ this ->styles [$ style ]}m " .$ value ;
494500 }
495501 if ($ cchrCount && str_ends_with ($ value , $ endCchr )) {
496502 $ value = substr ($ value , 0 , -\strlen ($ endCchr ));
0 commit comments