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

Commitdc130be

Browse files
committed
[Console] Fix for block() padding formatting after#19189
Prevent future regression
1 parente0f1476 commitdc130be

File tree

3 files changed

+31
-6
lines changed

3 files changed

+31
-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 ($linesas$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
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
useSymfony\Component\Console\Input\InputInterface;
4+
useSymfony\Component\Console\Output\OutputInterface;
5+
useSymfony\Component\Console\Tests\Style\SymfonyStyleWithForcedLineLength;
6+
7+
// ensure that block() output is properly formatted (even padding lines)
8+
returnfunction (InputInterface$input,OutputInterface$output) {
9+
$output->setDecorated(true);
10+
$output =newSymfonyStyleWithForcedLineLength($input,$output);
11+
$output->success(
12+
'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum',
13+
'TEST'
14+
);
15+
};
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
 
3+
 [OK] Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore 
4+
 magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo 
5+
 consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. 
6+
 Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum 
7+
 
8+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp