8000 bug #53711 [Console] Allow false as a $shortcut in InputOption (jaymi… · symfony/symfony@f0a9916 · GitHub
[go: up one dir, main page]

Skip to content

Commit f0a9916

Browse files
bug #53711 [Console] Allow false as a $shortcut in InputOption (jayminsilicon)
This PR was squashed before being merged into the 5.4 branch. Discussion ---------- [Console] Allow false as a $shortcut in InputOption | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #53702 | License | MIT This change is needed for laravel 8.x installation to allow running kernel and module based architecture. Right now our deployments are suddenly stopped since morning all saying "An option shortcut cannot be empty" and root cause for this is $shortcut is coming as false from laravel modules feature library. Commits ------- 2025baa [Console] Allow false as a $shortcut in InputOption
2 parents d5c72ae + 2025baa commit f0a9916

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function __construct(string $name, $shortcut = null, ?int $mode = null, s
6969
throw new InvalidArgumentException('An option name cannot be empty.');
7070
}
7171

72-
if ('' === $shortcut || [] === $shortcut) {
72+
if ('' === $shortcut || [] === $shortcut || false === $shortcut) {
7373
$shortcut = null;
7474
}
7575

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

+2
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ public function testShortcut()
6969
$this->assertEquals('0|z', $option->getShortcut(), '-0 is an acceptable shortcut value when embedded in an array');
7070
$option = new InputOption('foo', '0|z');
7171
$this->assertEquals('0|z', $option->getShortcut(), '-0 is an acceptable shortcut value when embedded in a string-list');
72+
$option = new InputOption('foo', false);
73+
$this->assertNull($option->getShortcut(), '__construct() makes the shortcut null when given a false as value');
7274
}
7375

7476
public function testModes()

0 commit comments

Comments
 (0)
0