Skip to content

Commit

Permalink
Fixed warning when command alias is longer than command name
Browse files Browse the repository at this point in the history
  • Loading branch information
dosten committed Aug 11, 2015
1 parent c0ff728 commit ecfe944
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Symfony/Component/Console/Descriptor/TextDescriptor.php
Expand Up @@ -249,12 +249,16 @@ private function formatDefaultValue($default)
*/
private function getColumnWidth(array $commands)
{
$width = 0;
$widths = array();

foreach ($commands as $command) {
$width = strlen($command->getName()) > $width ? strlen($command->getName()) : $width;
$widths[] = strlen($command->getName());
foreach ($command->getAliases() as $alias) {
$widths[] = strlen($alias);
}
}

return $width + 2;
return max($widths) + 2;
}

/**
Expand Down

0 comments on commit ecfe944

Please sign in to comment.