From ecfe94465d834af1317dd19bba3b24cec124e991 Mon Sep 17 00:00:00 2001 From: Diego Saint Esteben Date: Tue, 11 Aug 2015 14:10:03 -0300 Subject: [PATCH] Fixed warning when command alias is longer than command name --- .../Component/Console/Descriptor/TextDescriptor.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Console/Descriptor/TextDescriptor.php b/src/Symfony/Component/Console/Descriptor/TextDescriptor.php index 5c3fea9a2c..212796a3ed 100644 --- a/src/Symfony/Component/Console/Descriptor/TextDescriptor.php +++ b/src/Symfony/Component/Console/Descriptor/TextDescriptor.php @@ -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; } /**