Skip to content

Commit 02aa357

Browse files
authored
fix(console): keep colors in key-value lines (#1068)
1 parent 412c2d0 commit 02aa357

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/Tempest/Console/src/Components/Renderers/KeyValueRenderer.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace Tempest\Console\Components\Renderers;
66

77
use Stringable;
8-
use Tempest\Support\Str\MutableString;
8+
use Tempest\Support\Str\ImmutableString;
99

1010
use function Tempest\root_path;
1111
use function Tempest\Support\str;
@@ -19,8 +19,8 @@
1919
public function render(Stringable|string $key, null|Stringable|string $value = null, int $maximumWidth = self::MAX_WIDTH): string
2020
{
2121
$key = $this->cleanText($key)->append(' ');
22-
$value = $this->cleanText($value)->unless(
23-
condition: fn ($s) => $s->stripTags()->length() === 0,
22+
$value = $this->cleanText($value)->when(
23+
condition: fn ($s) => $s->stripTags()->length() !== 0,
2424
callback: fn ($s) => $s->prepend(' '),
2525
);
2626

@@ -33,12 +33,12 @@ public function render(Stringable|string $key, null|Stringable|string $value = n
3333
->toString();
3434
}
3535

36-
private function cleanText(null|Stringable|string $text): MutableString
36+
private function cleanText(null|Stringable|string $text): ImmutableString
3737
{
38-
$text = new MutableString($text)->trim();
38+
$text = new ImmutableString($text)->trim();
3939

4040
if ($text->length() === 0) {
41-
return new MutableString();
41+
return new ImmutableString();
4242
}
4343

4444
return $text

0 commit comments

Comments
 (0)