Skip to content

Commit eeaa0c7

Browse files
minor #19389 [Console] Application update PHPDoc of add and register methods (SpacePossum)
This PR was squashed before being merged into the 2.7 branch (closes #19389). Discussion ---------- [Console] Application update PHPDoc of add and register methods | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | License | MIT The [PHPDoc](https://github.com/symfony/symfony/blob/2.7/src/Symfony/Component/Console/Application.php#L354) states the method will always return a command, but it doesn't. Since [Application::register](https://github.com/symfony/symfony/blob/2.7/src/Symfony/Component/Console/Application.php#L328) returns the result of `add` directly is also doesn't always return the command (as its PHPDoc states). Commits ------- 6f0474f [Console] Application update PHPDoc of add and register methods
2 parents 4af4878 + 6f0474f commit eeaa0c7

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/Symfony/Component/Console/Application.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ public function getHelperSet()
213213
}
214214

215215
/**
216-
* Set an input definition set to be used with this application.
216+
* Set an input definition to be used with this application.
217217
*
218218
* @param InputDefinition $definition The input definition
219219
*/
@@ -335,6 +335,8 @@ public function register($name)
335335
/**
336336
* Adds an array of command objects.
337337
*
338+
* If a Command is not enabled it will not be added.
339+
*
338340
* @param Command[] $commands An array of commands
339341
*/
340342
public function addCommands(array $commands)
@@ -348,10 +350,11 @@ public function addCommands(array $commands)
348350
* Adds a command object.
349351
*
350352
* If a command with the same name already exists, it will be overridden.
353+
* If the command is not enabled it will not be added.
351354
*
352355
* @param Command $command A Command object
353356
*
354-
* @return Command The registered command
357+
* @return Command|null The registered command if enabled or null
355358
*/
356359
public function add(Command $command)
357360
{
@@ -420,9 +423,9 @@ public function has($name)
420423
/**
421424
* Returns an array of all unique namespaces used by currently registered commands.
422425
*
423-
* It does not returns the global namespace which always exists.
426+
* It does not return the global namespace which always exists.
424427
*
425-
* @return array An array of namespaces
428+
* @return string[] An array of namespaces
426429
*/
427430
public function getNamespaces()
428431
{
@@ -954,7 +957,7 @@ private function getSttyColumns()
954957
/**
955958
* Runs and parses mode CON if it's available, suppressing any error output.
956959
*
957-
* @return string <width>x<height> or null if it could not be parsed
960+
* @return string|null <width>x<height> or null if it could not be parsed
958961
*/
959962
private function getConsoleMode()
960963
{
@@ -1013,7 +1016,7 @@ public function extractNamespace($name, $limit = null)
10131016
* @param string $name The string
10141017
* @param array|\Traversable $collection The collection
10151018
*
1016-
* @return array A sorted array of similar string
1019+
* @return string[] A sorted array of similar string
10171020
*/
10181021
private function findAlternatives($name, $collection)
10191022
{
@@ -1121,7 +1124,7 @@ private function splitStringByWidth($string, $width)
11211124
*
11221125
* @param string $name The full name of the command
11231126
*
1124-
* @return array The namespaces of the command
1127+
* @return string[] The namespaces of the command
11251128
*/
11261129
private function extractAllNamespaces($name)
11271130
{

0 commit comments

Comments
 (0)