10000 bug #40427 [Console] Stop accepting ints as InputOption defaults · symfony/symfony@3a2d1b4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3a2d1b4

Browse files
committed
bug #40427 [Console] Stop accepting ints as InputOption defaults
The types accepted and provided by `InputInterface::getOption` and `setOption` do not include `int` (and passing something like `--option=123` will set the option to the string `"123"`, not to the integer `123`). The `InputOption` default types should match this.
1 parent 756522e commit 3a2d1b4

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)
0