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
This commit is contained in:
Nicolas Grekas 2016-07-26 06:44:12 +02:00
commit eeaa0c7fd1

View File

@ -213,7 +213,7 @@ class Application
}
/**
* 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 @@ class Application
/**
* 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 @@ class Application
* 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 The registered command
* @return Command|null The registered command if enabled or null
*/
public function add(Command $command)
{
@ -420,9 +423,9 @@ class Application
/**
* 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 @@ class Application
/**
* Runs and parses mode CON if it's available, suppressing any error output.
*
* @return string <width>x<height> or null if it could not be parsed
* @return string|null <width>x<height> or null if it could not be parsed
*/
private function getConsoleMode()
{
@ -1013,7 +1016,7 @@ class Application
* @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)
{
@ -1121,7 +1124,7 @@ class Application
*
* @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)
{