minor #19094 [Console] Use InputInterface inherited doc as possible (chalasr)

This PR was merged into the 2.7 branch.

Discussion
----------

[Console] Use InputInterface inherited doc as possible

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | ~
| License       | MIT
| Doc PR        | ~

In classes implementing `InputInterface`, the methods doc blocks are duplicated from the interface.
Sometimes descriptions are different from the interface's ones and, sometimes, the class doc is clearer. So I tried to keep always the most adapted one.

Commits
-------

b604be7 [Console] Use InputInterface inherited doc as possible
This commit is contained in:
Fabien Potencier 2016-06-19 12:24:22 +02:00
commit 41fd5a1f7d
4 changed files with 37 additions and 111 deletions

View File

@ -44,8 +44,8 @@ class ArgvInput extends Input
/** /**
* Constructor. * Constructor.
* *
* @param array $argv An array of parameters from the CLI (in the argv format) * @param array|null $argv An array of parameters from the CLI (in the argv format)
* @param InputDefinition $definition A InputDefinition instance * @param InputDefinition|null $definition A InputDefinition instance
*/ */
public function __construct(array $argv = null, InputDefinition $definition = null) public function __construct(array $argv = null, InputDefinition $definition = null)
{ {
@ -67,7 +67,7 @@ class ArgvInput extends Input
} }
/** /**
* Processes command line arguments. * {@inheritdoc}
*/ */
protected function parse() protected function parse()
{ {
@ -251,9 +251,7 @@ class ArgvInput extends Input
} }
/** /**
* Returns the first argument from the raw parameters (not parsed). * {@inheritdoc}
*
* @return string The value of the first argument or null otherwise
*/ */
public function getFirstArgument() public function getFirstArgument()
{ {
@ -267,14 +265,7 @@ class ArgvInput extends Input
} }
/** /**
* Returns true if the raw parameters (not parsed) contain a value. * {@inheritdoc}
*
* This method is to be used to introspect the input parameters
* before they have been validated. It must be used carefully.
*
* @param string|array $values The value(s) to look for in the raw parameters (can be an array)
*
* @return bool true if the value is contained in the raw parameters
*/ */
public function hasParameterOption($values) public function hasParameterOption($values)
{ {
@ -292,15 +283,7 @@ class ArgvInput extends Input
} }
/** /**
* Returns the value of a raw option (not parsed). * {@inheritdoc}
*
* This method is to be used to introspect the input parameters
* before they have been validated. It must be used carefully.
*
* @param string|array $values The value(s) to look for in the raw parameters (can be an array)
* @param mixed $default The default value to return if no result is found
*
* @return mixed The option value
*/ */
public function getParameterOption($values, $default = false) public function getParameterOption($values, $default = false)
{ {

View File

@ -27,8 +27,8 @@ class ArrayInput extends Input
/** /**
* Constructor. * Constructor.
* *
* @param array $parameters An array of parameters * @param array $parameters An array of parameters
* @param InputDefinition $definition A InputDefinition instance * @param InputDefinition|null $definition A InputDefinition instance
*/ */
public function __construct(array $parameters, InputDefinition $definition = null) public function __construct(array $parameters, InputDefinition $definition = null)
{ {
@ -38,9 +38,7 @@ class ArrayInput extends Input
} }
/** /**
* Returns the first argument from the raw parameters (not parsed). * {@inheritdoc}
*
* @return string The value of the first argument or null otherwise
*/ */
public function getFirstArgument() public function getFirstArgument()
{ {
@ -54,14 +52,7 @@ class ArrayInput extends Input
} }
/** /**
* Returns true if the raw parameters (not parsed) contain a value. * {@inheritdoc}
*
* This method is to be used to introspect the input parameters
* before they have been validated. It must be used carefully.
*
* @param string|array $values The values to look for in the raw parameters (can be an array)
*
* @return bool true if the value is contained in the raw parameters
*/ */
public function hasParameterOption($values) public function hasParameterOption($values)
{ {
@ -81,15 +72,7 @@ class ArrayInput extends Input
} }
/** /**
* Returns the value of a raw option (not parsed). * {@inheritdoc}
*
* This method is to be used to introspect the input parameters
* before they have been validated. It must be used carefully.
*
* @param string|array $values The value(s) to look for in the raw parameters (can be an array)
* @param mixed $default The default value to return if no result is found
*
* @return mixed The option value
*/ */
public function getParameterOption($values, $default = false) public function getParameterOption($values, $default = false)
{ {
@ -128,7 +111,7 @@ class ArrayInput extends Input
} }
/** /**
* Processes command line arguments. * {@inheritdoc}
*/ */
protected function parse() protected function parse()
{ {

View File

@ -35,7 +35,7 @@ abstract class Input implements InputInterface
/** /**
* Constructor. * Constructor.
* *
* @param InputDefinition $definition A InputDefinition instance * @param InputDefinition|null $definition A InputDefinition instance
*/ */
public function __construct(InputDefinition $definition = null) public function __construct(InputDefinition $definition = null)
{ {
@ -48,9 +48,7 @@ abstract class Input implements InputInterface
} }
/** /**
* Binds the current Input instance with the given arguments and options. * {@inheritdoc}
*
* @param InputDefinition $definition A InputDefinition instance
*/ */
public function bind(InputDefinition $definition) public function bind(InputDefinition $definition)
{ {
@ -67,9 +65,7 @@ abstract class Input implements InputInterface
abstract protected function parse(); abstract protected function parse();
/** /**
* Validates the input. * {@inheritdoc}
*
* @throws \RuntimeException When not enough arguments are given
*/ */
public function validate() public function validate()
{ {
@ -86,9 +82,7 @@ abstract class Input implements InputInterface
} }
/** /**
* Checks if the input is interactive. * {@inheritdoc}
*
* @return bool Returns true if the input is interactive
*/ */
public function isInteractive() public function isInteractive()
{ {
@ -96,9 +90,7 @@ abstract class Input implements InputInterface
} }
/** /**
* Sets the input interactivity. * {@inheritdoc}
*
* @param bool $interactive If the input should be interactive
*/ */
public function setInteractive($interactive) public function setInteractive($interactive)
{ {
@ -106,9 +98,7 @@ abstract class Input implements InputInterface
} }
/** /**
* Returns the argument values. * {@inheritdoc}
*
* @return array An array of argument values
*/ */
public function getArguments() public function getArguments()
{ {
@ -116,13 +106,7 @@ abstract class Input implements InputInterface
} }
/** /**
* Returns the argument value for a given argument name. * {@inheritdoc}
*
* @param string $name The argument name
*
* @return mixed The argument value
*
* @throws \InvalidArgumentException When argument given doesn't exist
*/ */
public function getArgument($name) public function getArgument($name)
{ {
@ -134,12 +118,7 @@ abstract class Input implements InputInterface
} }
/** /**
* Sets an argument value by name. * {@inheritdoc}
*
* @param string $name The argument name
* @param string $value The argument value
*
* @throws \InvalidArgumentException When argument given doesn't exist
*/ */
public function setArgument($name, $value) public function setArgument($name, $value)
{ {
@ -151,11 +130,7 @@ abstract class Input implements InputInterface
} }
/** /**
* Returns true if an InputArgument object exists by name or position. * {@inheritdoc}
*
* @param string|int $name The InputArgument name or position
*
* @return bool true if the InputArgument object exists, false otherwise
*/ */
public function hasArgument($name) public function hasArgument($name)
{ {
@ -163,9 +138,7 @@ abstract class Input implements InputInterface
} }
/** /**
* Returns the options values. * {@inheritdoc}
*
* @return array An array of option values
*/ */
public function getOptions() public function getOptions()
{ {
@ -173,13 +146,7 @@ abstract class Input implements InputInterface
} }
/** /**
* Returns the option value for a given option name. * {@inheritdoc}
*
* @param string $name The option name
*
* @return mixed The option value
*
* @throws \InvalidArgumentException When option given doesn't exist
*/ */
public function getOption($name) public function getOption($name)
{ {
@ -191,12 +158,7 @@ abstract class Input implements InputInterface
} }
/** /**
* Sets an option value by name. * {@inheritdoc}
*
* @param string $name The option name
* @param string|bool $value The option value
*
* @throws \InvalidArgumentException When option given doesn't exist
*/ */
public function setOption($name, $value) public function setOption($name, $value)
{ {
@ -208,11 +170,7 @@ abstract class Input implements InputInterface
} }
/** /**
* Returns true if an InputOption object exists by name. * {@inheritdoc}
*
* @param string $name The InputOption name
*
* @return bool true if the InputOption object exists, false otherwise
*/ */
public function hasOption($name) public function hasOption($name)
{ {

View File

@ -58,11 +58,9 @@ interface InputInterface
public function bind(InputDefinition $definition); public function bind(InputDefinition $definition);
/** /**
* Validates if arguments given are correct. * Validates the input.
* *
* Throws an exception when not enough arguments are given. * @throws \RuntimeException When not enough arguments are given
*
* @throws \RuntimeException
*/ */
public function validate(); public function validate();
@ -74,11 +72,13 @@ interface InputInterface
public function getArguments(); public function getArguments();
/** /**
* Gets argument by name. * Returns the argument value for a given argument name.
* *
* @param string $name The name of the argument * @param string $name The argument name
* *
* @return mixed * @return mixed The argument value
*
* @throws \InvalidArgumentException When argument given doesn't exist
*/ */
public function getArgument($name); public function getArgument($name);
@ -109,11 +109,13 @@ interface InputInterface
public function getOptions(); public function getOptions();
/** /**
* Gets an option by name. * Returns the option value for a given option name.
* *
* @param string $name The name of the option * @param string $name The option name
* *
* @return mixed * @return mixed The option value
*
* @throws \InvalidArgumentException When option given doesn't exist
*/ */
public function getOption($name); public function getOption($name);