Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f0a9916

Browse filesBrowse 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
Copy full SHA for f0a9916

File tree

Expand file treeCollapse file tree

2 files changed

+3
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+3
-1
lines changed

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Input/InputOption.php
+1-1Lines changed: 1 addition & 1 deletion
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

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Tests/Input/InputOptionTest.php
+2Lines changed: 2 additions & 0 deletions
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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.