Skip to content

Commit 86386d4

Browse files
Merge branch '5.4' into 6.4
* 5.4: [Console] Allow false as a $shortcut in InputOption Fix plurial of word ending by pus
2 parents 2aaf83b + 37774e6 commit 86386d4

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

Input/InputOption.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function __construct(string $name, string|array|null $shortcut = null, ?i
7575
throw new InvalidArgumentException('An option name cannot be empty.');
7676
}
7777

78-
if ('' === $shortcut || [] === $shortcut) {
78+
if ('' === $shortcut || [] === $shortcut || false === $shortcut) {
7979
$shortcut = null;
8080
}
8181

Tests/Input/InputOptionTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ public function testShortcut()
7373
$this->assertEquals('0|z', $option->getShortcut(), '-0 is an acceptable shortcut value when embedded in an array');
7474
$option = new InputOption('foo', '0|z');
7575
$this->assertEquals('0|z', $option->getShortcut(), '-0 is an acceptable shortcut value when embedded in a string-list');
76+
$option = new InputOption('foo', false);
77+
$this->assertNull($option->getShortcut(), '__construct() makes the shortcut null when given a false as value');
7678
}
7779

7880
public function testModes()

0 commit comments

Comments
 (0)