Skip to content

Commit 41fd5a1

Browse files
committed
minor symfony#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
2 parents 7eab67f + b604be7 commit 41fd5a1

File tree

4 files changed

+37
-111
lines changed

4 files changed

+37
-111
lines changed

src/Symfony/Component/Console/Input/ArgvInput.php

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ class ArgvInput extends Input
4444
/**
4545
* Constructor.
4646
*
47-
* @param array $argv An array of parameters from the CLI (in the argv format)
48-
* @param InputDefinition $definition A InputDefinition instance
47+
* @param array|null $argv An array of parameters from the CLI (in the argv format)
48+
* @param InputDefinition|null $definition A InputDefinition instance
4949
*/
5050
public function __construct(array $argv = null, InputDefinition $definition = null)
5151
{
@@ -67,7 +67,7 @@ protected function setTokens(array $tokens)
6767
}
6868

6969
/**
70-
* Processes command line arguments.
70+
* {@inheritdoc}
7171
*/
7272
protected function parse()
7373
{
@@ -251,9 +251,7 @@ private function addLongOption($name, $value)
251251
}
252252

253253
/**
254-
* Returns the first argument from the raw parameters (not parsed).
255-
*
256-
* @return string The value of the first argument or null otherwise
254+
* {@inheritdoc}
257255
*/
258256
public function getFirstArgument()
259257
{
@@ -267,14 +265,7 @@ public function getFirstArgument()
267265
}
268266

269267
/**
270-
* Returns true if the raw parameters (not parsed) contain a value.
271-
*
272-
* This method is to be used to introspect the input parameters
273-
* before they have been validated. It must be used carefully.
274-
*
275-
* @param string|array $values The value(s) to look for in the raw parameters (can be an array)
276-
*
277-
* @return bool true if the value is contained in the raw parameters
268+
* {@inheritdoc}
278269
*/
279270
public function hasParameterOption($values)
280271
{
@@ -292,15 +283,7 @@ public function hasParameterOption($values)
292283
}
293284

294285
/**
295-
* Returns the value of a raw option (not parsed).
296-
*
297-
* This method is to be used to introspect the input parameters
298-
* before they have been validated. It must be used carefully.
299-
*
300-
* @param string|array $values The value(s) to look for in the raw parameters (can be an array)
301-
* @param mixed $default The default value to return if no result is found
302-
*
303-
* @return mixed The option value
286+
* {@inheritdoc}
304287
*/
305288
public function getParameterOption($values, $default = false)
306289
{

src/Symfony/Component/Console/Input/ArrayInput.php

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ class ArrayInput extends Input
2727
/**
2828
* Constructor.
2929
*
30-
* @param array $parameters An array of parameters
31-
* @param InputDefinition $definition A InputDefinition instance
30+
* @param array $parameters An array of parameters
31+
* @param InputDefinition|null $definition A InputDefinition instance
3232
*/
3333
public function __construct(array $parameters, InputDefinition $definition = null)
3434
{
@@ -38,9 +38,7 @@ public function __construct(array $parameters, InputDefinition $definition = nul
3838
}
3939

4040
/**
41-
* Returns the first argument from the raw parameters (not parsed).
42-
*
43-
* @return string The value of the first argument or null otherwise
41+
* {@inheritdoc}
4442
*/
4543
public function getFirstArgument()
4644
{
@@ -54,14 +52,7 @@ public function getFirstArgument()
5452
}
5553

5654
/**
57-
* Returns true if the raw parameters (not parsed) contain a value.
58-
*
59-
* This method is to be used to introspect the input parameters
60-
* before they have been validated. It must be used carefully.
61-
*
62-
* @param string|array $values The values to look for in the raw parameters (can be an array)
63-
*
64-
* @return bool true if the value is contained in the raw parameters
55+
* {@inheritdoc}
6556
*/
6657
public function hasParameterOption($values)
6758
{
@@ -81,15 +72,7 @@ public function hasParameterOption($values)
8172
}
8273

8374
/**
84-
* Returns the value of a raw option (not parsed).
85-
*
86-
* This method is to be used to introspect the input parameters
87-
* before they have been validated. It must be used carefully.
88-
*
89-
* @param string|array $values The value(s) to look for in the raw parameters (can be an array)
90-
* @param mixed $default The default value to return if no result is found
91-
*
92-
* @return mixed The option value
75+
* {@inheritdoc}
9376
*/
9477
public function getParameterOption($values, $default = false)
9578
{
@@ -128,7 +111,7 @@ public function __toString()
128111
}
129112

130113
/**
131-
* Processes command line arguments.
114+
* {@inheritdoc}
132115
*/
133116
protected function parse()
134117
{

src/Symfony/Component/Console/Input/Input.php

Lines changed: 13 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ abstract class Input implements InputInterface
3535
/**
3636
* Constructor.
3737
*
38-
* @param InputDefinition $definition A InputDefinition instance
38+
* @param InputDefinition|null $definition A InputDefinition instance
3939
*/
4040
public function __construct(InputDefinition $definition = null)
4141
{
@@ -48,9 +48,7 @@ public function __construct(InputDefinition $definition = null)
4848
}
4949

5050
/**
51-
* Binds the current Input instance with the given arguments and options.
52-
*
53-
* @param InputDefinition $definition A InputDefinition instance
51+
* {@inheritdoc}
5452
*/
5553
public function bind(InputDefinition $definition)
5654
{
@@ -67,9 +65,7 @@ public function bind(InputDefinition $definition)
6765
abstract protected function parse();
6866

6967
/**
70-
* Validates the input.
71-
*
72-
* @throws \RuntimeException When not enough arguments are given
68+
* {@inheritdoc}
7369
*/
7470
public function validate()
7571
{
@@ -86,43 +82,31 @@ public function validate()
8682
}
8783

8884
/**
89-
* Checks if the input is interactive.
90-
*
91-
* @return bool Returns true if the input is interactive
85+
* {@inheritdoc}
9286
*/
9387
public function isInteractive()
9488
{
9589
return $this->interactive;
9690
}
9791

9892
/**
99-
* Sets the input interactivity.
100-
*
101-
* @param bool $interactive If the input should be interactive
93+
* {@inheritdoc}
10294
*/
10395
public function setInteractive($interactive)
10496
{
10597
$this->interactive = (bool) $interactive;
10698
}
10799

108100
/**
109-
* Returns the argument values.
110-
*
111-
* @return array An array of argument values
101+
* {@inheritdoc}
112102
*/
113103
public function getArguments()
114104
{
115105
return array_merge($this->definition->getArgumentDefaults(), $this->arguments);
116106
}
117107

118108
/**
119-
* Returns the argument value for a given argument name.
120-
*
121-
* @param string $name The argument name
122-
*
123-
* @return mixed The argument value
124-
*
125-
* @throws \InvalidArgumentException When argument given doesn't exist
109+
* {@inheritdoc}
126110
*/
127111
public function getArgument($name)
128112
{
@@ -134,12 +118,7 @@ public function getArgument($name)
134118
}
135119

136120
/**
137-
* Sets an argument value by name.
138-
*
139-
* @param string $name The argument name
140-
* @param string $value The argument value
141-
*
142-
* @throws \InvalidArgumentException When argument given doesn't exist
121+
* {@inheritdoc}
143122
*/
144123
public function setArgument($name, $value)
145124
{
@@ -151,35 +130,23 @@ public function setArgument($name, $value)
151130
}
152131

153132
/**
154-
* Returns true if an InputArgument object exists by name or position.
155-
*
156-
* @param string|int $name The InputArgument name or position
157-
*
158-
* @return bool true if the InputArgument object exists, false otherwise
133+
* {@inheritdoc}
159134
*/
160135
public function hasArgument($name)
161136
{
162137
return $this->definition->hasArgument($name);
163138
}
164139

165140
/**
166-
* Returns the options values.
167-
*
168-
* @return array An array of option values
141+
* {@inheritdoc}
169142
*/
170143
public function getOptions()
171144
{
172145
return array_merge($this->definition->getOptionDefaults(), $this->options);
173146
}
174147

175148
/**
176-
* Returns the option value for a given option name.
177-
*
178-
* @param string $name The option name
179-
*
180-
* @return mixed The option value
181-
*
182-
* @throws \InvalidArgumentException When option given doesn't exist
149+
* {@inheritdoc}
183150
*/
184151
public function getOption($name)
185152
{
@@ -191,12 +158,7 @@ public function getOption($name)
191158
}
192159

193160
/**
194-
* Sets an option value by name.
195-
*
196-
* @param string $name The option name
197-
* @param string|bool $value The option value
198-
*
199-
* @throws \InvalidArgumentException When option given doesn't exist
161+
* {@inheritdoc}
200162
*/
201163
public function setOption($name, $value)
202164
{
@@ -208,11 +170,7 @@ public function setOption($name, $value)
208170
}
209171

210172
/**
211-
* Returns true if an InputOption object exists by name.
212-
*
213-
* @param string $name The InputOption name
214-
*
215-
* @return bool true if the InputOption object exists, false otherwise
173+
* {@inheritdoc}
216174
*/
217175
public function hasOption($name)
218176
{

src/Symfony/Component/Console/Input/InputInterface.php

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,9 @@ public function getParameterOption($values, $default = false);
5858
public function bind(InputDefinition $definition);
5959

6060
/**
61-
* Validates if arguments given are correct.
61+
* Validates the input.
6262
*
63-
* Throws an exception when not enough arguments are given.
64-
*
65-
* @throws \RuntimeException
63+
* @throws \RuntimeException When not enough arguments are given
6664
*/
6765
public function validate();
6866

@@ -74,11 +72,13 @@ public function validate();
7472
public function getArguments();
7573

7674
/**
77-
* Gets argument by name.
75+
* Returns the argument value for a given argument name.
76+
*
77+
* @param string $name The argument name
7878
*
79-
* @param string $name The name of the argument
79+
* @return mixed The argument value
8080
*
81-
* @return mixed
81+
* @throws \InvalidArgumentException When argument given doesn't exist
8282
*/
8383
public function getArgument($name);
8484

@@ -109,11 +109,13 @@ public function hasArgument($name);
109109
public function getOptions();
110110

111111
/**
112-
* Gets an option by name.
112+
* Returns the option value for a given option name.
113113
*
114-
* @param string $name The name of the option
114+
* @param string $name The option name
115115
*
116-
* @return mixed
116+
* @return mixed The option value
117+
*
118+
* @throws \InvalidArgumentException When option given doesn't exist
117119
*/
118120
public function getOption($name);
119121

0 commit comments

Comments
 (0)