Fixed warning when command alias is longer than command name

This commit is contained in:
Diego Saint Esteben 2015-08-11 14:10:03 -03:00
parent c0ff72802c
commit ecfe94465d

View File

@ -249,12 +249,16 @@ class TextDescriptor extends Descriptor
*/
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;
}
/**