[Console] Fix a bug when passing a letter that could be an alias
This commit is contained in:
parent
e77545ab8d
commit
a8871de263
|
@ -284,6 +284,8 @@ class ArgvInput extends Input
|
|||
}
|
||||
|
||||
if (0 === strpos($token, '-') && 0 !== strpos($token, '--')) {
|
||||
$noValue = explode('=', $token);
|
||||
$token = $noValue[0];
|
||||
$searchableToken = str_replace('-', '', $token);
|
||||
$searchableValue = str_replace('-', '', $value);
|
||||
if ('' !== $searchableToken && '' !== $searchableValue && false !== strpos($searchableToken, $searchableValue)) {
|
||||
|
|
|
@ -299,6 +299,9 @@ class ArgvInputTest extends TestCase
|
|||
$input = new ArgvInput(array('cli.php', '-fh'));
|
||||
$this->assertTrue($input->hasParameterOption('-fh'), '->hasParameterOption() returns true if the given short option is in the raw input');
|
||||
|
||||
$input = new ArgvInput(array('cli.php', '-e=test'));
|
||||
$this->assertFalse($input->hasParameterOption('-s'), '->hasParameterOption() returns true if the given short option is in the raw input');
|
||||
|
||||
$input = new ArgvInput(array('cli.php', '--foo', 'foo'));
|
||||
$this->assertTrue($input->hasParameterOption('--foo'), '->hasParameterOption() returns true if the given short option is in the raw input');
|
||||
|
||||
|
|
Reference in New Issue