8000 bug #15515 [Console] Fixed warning when command alias is longer than … · symfony/symfony@f1d5885 · GitHub
[go: up one dir, main page]

Skip to content

Commit f1d5885

Browse files
committed
bug #15515 [Console] Fixed warning when command alias is longer than command name (dosten)
This PR was merged into the 2.7 branch. Discussion ---------- [Console] Fixed warning when command alias is longer than command name | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #15511 | License | MIT Commits ------- ecfe944 Fixed warning when command alias is longer than command name
2 parents d3a1cb1 + ecfe944 commit f1d5885

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/Symfony/Component/Console/Descriptor/TextDescriptor.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,12 +249,16 @@ private function formatDefaultValue($default)
249249
*/
250250
private function getColumnWidth(array $commands)
251251
{
252-
$width = 0;
252+
$widths = array();
253+
253254
foreach ($commands as $command) {
254-
$width = strlen($command->getName()) > $width ? strlen($command->getName()) : $width;
255+
$widths[] = strlen($command->getName());
256+
foreach ($command->getAliases() as $alias) {
257+
$widths[] = strlen($alias);
258+
}
255259
}
256260

257-
return $width + 2;
261+
return max($widths) + 2;
258262
}
259263

260264
/**

0 commit comments

Comments
 (0)
0