Skip to content

Commit

Permalink
Merge branch '6.4' into 7.0
Browse files Browse the repository at this point in the history
* 6.4:
  [Console] Allow false as a $shortcut in InputOption
  [MonologBridge] Support symfony/security-core 5.4 again
  Fix plurial of word ending by pus
  • Loading branch information
nicolas-grekas committed Feb 1, 2024
2 parents c5010d5 + 86386d4 commit 019186b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Input/InputOption.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function __construct(string $name, string|array|null $shortcut = null, ?i
throw new InvalidArgumentException('An option name cannot be empty.');
}

if ('' === $shortcut || [] === $shortcut) {
if ('' === $shortcut || [] === $shortcut || false === $shortcut) {
$shortcut = null;
}

Expand Down
2 changes: 2 additions & 0 deletions Tests/Input/InputOptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ public function testShortcut()
$this->assertEquals('0|z', $option->getShortcut(), '-0 is an acceptable shortcut value when embedded in an array');
$option = new InputOption('foo', '0|z');
$this->assertEquals('0|z', $option->getShortcut(), '-0 is an acceptable shortcut value when embedded in a string-list');
$option = new InputOption('foo', false);
$this->assertNull($option->getShortcut(), '__construct() makes the shortcut null when given a false as value');
}

public function testModes()
Expand Down

0 comments on commit 019186b

Please sign in to comment.