8000 merged branch Nanocom/master (PR #4346) · symfony/symfony@c1e868f · GitHub
[go: up one dir, main page]

Skip to content

Commit c1e868f

Browse files
committed
merged branch Nanocom/master (PR #4346)
Commits ------- 2c19b3c Empty shortcut check in the constructor cf9039e Added a unit test for the shortcut name of the InputOption class Discussion ---------- [Console] Single dash for option shortcuts See #4062 --------------------------------------------------------------------------- by travisbot at 2012-05-20T13:09:18Z This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1380389) (merged 02290da4 into f433f6b). --------------------------------------------------------------------------- by stof at 2012-05-20T13:16:34Z please rebase your branch to get rid of these merge commits btw, you should use feature branches to send your next pull requests instead of using your master branch each time, which limits you to a single PR. --------------------------------------------------------------------------- by Nanocom at 2012-05-20T13:39:32Z Sorry for the mess, cleaning it --------------------------------------------------------------------------- by travisbot at 2012-05-20T13:41:46Z This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1380549) (merged 63129657 into f433f6b). --------------------------------------------------------------------------- by travisbot at 2012-05-20T13:43:07Z This pull request [passes](http://travis-ci.org/symfony/symfony/builds/1380553) (merged 2c19b3c into f433f6b).
2 parents a6b3902 + 2c19b3c commit c1e868f

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ public function __construct($name, $shortcut = null, $mode = null, $description
5858
if ('-' === $shortcut[0]) {
5959
$shortcut = substr($shortcut, 1);
6060
}
61+
62+
if (empty($shortcut)) {
63+
$shortcut = null;
64+
}
6165
}
6266

6367
if (null === $mode) {

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ public function testConstructor()
3535
$this->assertEquals('f', $option->getShortcut(), '__construct() can take a shortcut as its second argument');
3636
$option = new InputOption('foo', '-f');
3737
$this->assertEquals('f', $option->getShortcut(), '__construct() removes the leading - of the shortcut');
38+
$option = new InputOption('foo');
39+
$this->assertNull($option->getShortcut(), '__construct() makes the shortcut null by default');
40+
$option = new InputOption('foo', '-');
41+
$this->assertNull($option->getShortcut(), '__construct() makes the shortcut null if a single dash is specified as its name');
3842

3943
// mode argument
4044
$option = new InputOption('foo', 'f');

0 commit comments

Comments
 (0)
0