Skip to content

Commit bbf786c

Browse files
committed
minor #40428 [Console] Fix type of InputOption::$default (oliverklee)
This PR was merged into the 4.4 branch. Discussion ---------- [Console] Fix type of InputOption::$default Options can also be `int`s. So add this type to the PHPDoc parameter type annotation of `InputInterface::setOption` and the return type annotation of `InputInterface::getOption`. | Q | A | ------------- | --- | Branch? | 4.4 or 5.2 for bug fixes | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #40427 | License | MIT Commits ------- 3a2d1b4 bug #40427 [Console] Stop accepting ints as InputOption defaults
2 parents 9f3c30a + 3a2d1b4 commit bbf786c

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/Symfony/Component/Console/Command/Command.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -394,11 +394,11 @@ public function addArgument($name, $mode = null, $description = '', $default = n
394394
/**
395395
* Adds an option.
396396
*
397-
* @param string $name The option name
398-
* @param string|array|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts
399-
* @param int|null $mode The option mode: One of the InputOption::VALUE_* constants
400-
* @param string $description A description text
401-
* @param string|string[]|int|bool|null $default The default value (must be null for InputOption::VALUE_NONE)
397+
* @param string $name The option name
398+
* @param string|array|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts
399+
* @param int|null $mode The option mode: One of the InputOption::VALUE_* constants
400+
* @param string $description A description text
401+
* @param string|string[]|bool|null $default The default value (must be null for InputOption::VALUE_NONE)
402402
*
403403
* @throws InvalidArgumentException If option mode is invalid or incompatible
404404
*

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ class InputOption
3333
private $description;
3434

3535
/**
36-
* @param string $name The option name
37-
* @param string|array|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts
38-
* @param int|null $mode The option mode: One of the VALUE_* constants
39-
* @param string $description A description text
40-
* @param string|string[]|int|bool|null $default The default value (must be null for self::VALUE_NONE)
36+
* @param string $name The option name
37+
* @param string|array|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts
38+
* @param int|null $mode The option mode: One of the VALUE_* constants
39+
* @param string $description A description text
40+
* @param string|string[]|bool|null $default The default value (must be null for self::VALUE_NONE)
4141
*
4242
* @throws InvalidArgumentException If option mode is invalid or incompatible
4343
*/
@@ -149,7 +149,7 @@ public function isArray()
149149
/**
150150
* Sets the default value.
151151
*
152-
* @param string|string[]|int|bool|null $default The default value
152+
* @param string|string[]|bool|null $default The default value
153153
*
154154
* @throws LogicException When incorrect default value is given
155155
*/
@@ -173,7 +173,7 @@ public function setDefault($default = null)
173173
/**
174174
* Returns the default value.
175175
*
176-
* @return string|string[]|int|bool|null The default value
176+
* @return string|string[]|bool|null The default value
177177
*/
178178
public function getDefault()
179179
{

0 commit comments

Comments
 (0)