8000 [Console] Fix for block() padding formatting after #19189 · symfony/symfony@d9fae25 · GitHub
[go: up one dir, main page]

Skip to content

Commit d9fae25

Browse files
committed
[Console] Fix for block() padding formatting after #19189
1 parent e0f1476 commit d9fae25

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/Symfony/Component/Console/Style/SymfonyStyle.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -410,9 +410,16 @@ private function createBlock($messages, $type = null, $style = null, $prefix = '
410410
}
411411
}
412412

413+
$firstLineIndex = 0;
414+
if ($padding && $this->isDecorated()) {
415+
$firstLineIndex = 1;
416+
array_unshift($lines, '');
417+
$lines[] = '';
418+
}
419+
413420
foreach ($lines as $i => &$line) {
414421
if (null !== $type) {
415-
$line = 0 === $i ? $type.$line : $lineIndentation.$line;
422+
$line = $firstLineIndex === $i ? $type.$line : $lineIndentation.$line;
416423
}
417424

418425
$line = $prefix.$line;
@@ -423,11 +430,6 @@ private function createBlock($messages, $type = null, $style = null, $prefix = '
423430
}
424431
}
425432

426-
if ($padding && $this->isDecorated()) {
427-
array_unshift($lines, '');
428-
$lines[] = '';
429-
}
430-
431433
return $lines;
432434
}
433435
}

0 commit comments

Comments
 (0)
0