From 0bdaa8e81ec8ced393eb6d22fae69e8ae290b362 Mon Sep 17 00:00:00 2001 From: SpacePossum Date: Tue, 19 Jul 2016 18:04:54 +0200 Subject: [PATCH 1/5] Update Application.php --- src/Symfony/Component/Console/Application.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index 11990242e85d1..01c31fa74626a 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -360,7 +360,7 @@ public function add(Command $command) if (!$command->isEnabled()) { $command->setApplication(null); - return; + return $command; } if (null === $command->getDefinition()) { From d8ff9ca46edd864b431ea658a3cca5a7de22947c Mon Sep 17 00:00:00 2001 From: SpacePossum Date: Wed, 20 Jul 2016 10:08:17 +0200 Subject: [PATCH 2/5] Update Application.php --- src/Symfony/Component/Console/Application.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index 01c31fa74626a..95af325e08164 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -351,7 +351,7 @@ public function addCommands(array $commands) * * @param Command $command A Command object * - * @return Command The registered command + * @return Command|null The registered command */ public function add(Command $command) { @@ -360,7 +360,7 @@ public function add(Command $command) if (!$command->isEnabled()) { $command->setApplication(null); - return $command; + return null; } if (null === $command->getDefinition()) { From 30cbb43c8fa026c8879d0bc1ea78e7de2af67dd6 Mon Sep 17 00:00:00 2001 From: SpacePossum Date: Fri, 22 Jul 2016 16:28:36 +0200 Subject: [PATCH 3/5] Update Application.php --- src/Symfony/Component/Console/Application.php | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index 95af325e08164..796f6d1086cda 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -213,7 +213,7 @@ public function getHelperSet() } /** - * Set an input definition set to be used with this application. + * Set an input definition to be used with this application. * * @param InputDefinition $definition The input definition */ @@ -335,6 +335,8 @@ public function register($name) /** * Adds an array of command objects. * + * If a Command is not enabled it will not be added. + * * @param Command[] $commands An array of commands */ public function addCommands(array $commands) @@ -348,10 +350,11 @@ public function addCommands(array $commands) * Adds a command object. * * If a command with the same name already exists, it will be overridden. + * If the command is not enabled it will not be added. * * @param Command $command A Command object * - * @return Command|null The registered command + * @return Command|null The registered command if enabled or null */ public function add(Command $command) { @@ -420,9 +423,9 @@ public function has($name) /** * Returns an array of all unique namespaces used by currently registered commands. * - * It does not returns the global namespace which always exists. + * It does not return the global namespace which always exists. * - * @return array An array of namespaces + * @return string[] An array of namespaces */ public function getNamespaces() { @@ -954,7 +957,7 @@ private function getSttyColumns() /** * Runs and parses mode CON if it's available, suppressing any error output. * - * @return string x or null if it could not be parsed + * @return string|null x or null if it could not be parsed */ private function getConsoleMode() { @@ -1013,7 +1016,7 @@ public function extractNamespace($name, $limit = null) * @param string $name The string * @param array|\Traversable $collection The collection * - * @return array A sorted array of similar string + * @return string[] A sorted array of similar string */ private function findAlternatives($name, $collection) { @@ -1067,6 +1070,11 @@ public function setDefaultCommand($commandName) $this->defaultCommand = $commandName; } + /** + * @param string $string + * + * @return int + */ private function stringWidth($string) { if (!function_exists('mb_strwidth')) { @@ -1080,6 +1088,12 @@ private function stringWidth($string) return mb_strwidth($string, $encoding); } + /** + * @param string $string + * @param int $width + * + * @return string[] + */ private function splitStringByWidth($string, $width) { // str_split is not suitable for multi-byte characters, we should use preg_split to get char array properly. @@ -1121,7 +1135,7 @@ private function splitStringByWidth($string, $width) * * @param string $name The full name of the command * - * @return array The namespaces of the command + * @return string[] The namespaces of the command */ private function extractAllNamespaces($name) { From fc706e9abe56ab0cbe21938a1a86e1f62fa691e4 Mon Sep 17 00:00:00 2001 From: SpacePossum Date: Sat, 23 Jul 2016 10:54:57 +0200 Subject: [PATCH 4/5] Update Application.php --- src/Symfony/Component/Console/Application.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index 796f6d1086cda..d6be9f4d2def3 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -335,7 +335,7 @@ public function register($name) /** * Adds an array of command objects. * - * If a Command is not enabled it will not be added. + * @see Application::add() * * @param Command[] $commands An array of commands */ From 95e3cd5b3592b2ea12c95f8d873ab60fc9bf8049 Mon Sep 17 00:00:00 2001 From: SpacePossum Date: Mon, 25 Jul 2016 19:55:59 +0200 Subject: [PATCH 5/5] Update Application.php --- src/Symfony/Component/Console/Application.php | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/Symfony/Component/Console/Application.php b/src/Symfony/Component/Console/Application.php index d6be9f4d2def3..590460ca0de99 100644 --- a/src/Symfony/Component/Console/Application.php +++ b/src/Symfony/Component/Console/Application.php @@ -335,7 +335,7 @@ public function register($name) /** * Adds an array of command objects. * - * @see Application::add() + * If a Command is not enabled it will not be added. * * @param Command[] $commands An array of commands */ @@ -363,7 +363,7 @@ public function add(Command $command) if (!$command->isEnabled()) { $command->setApplication(null); - return null; + return; } if (null === $command->getDefinition()) { @@ -1070,11 +1070,6 @@ public function setDefaultCommand($commandName) $this->defaultCommand = $commandName; } - /** - * @param string $string - * - * @return int - */ private function stringWidth($string) { if (!function_exists('mb_strwidth')) { @@ -1088,12 +1083,6 @@ private function stringWidth($string) return mb_strwidth($string, $encoding); } - /** - * @param string $string - * @param int $width - * - * @return string[] - */ private function splitStringByWidth($string, $width) { // str_split is not suitable for multi-byte characters, we should use preg_split to get char array properly.