[Console] Overcomplete argument exception message tweak.
This commit is contained in:
parent
35c70be59f
commit
7af59cdf86
@ -174,7 +174,12 @@ class ArgvInput extends Input
|
||||
|
||||
// unexpected argument
|
||||
} else {
|
||||
throw new \RuntimeException('Too many arguments.');
|
||||
$all = $this->definition->getArguments();
|
||||
if (count($all)) {
|
||||
throw new \RuntimeException(sprintf('Too many arguments, expected arguments "%s".', implode('" "', array_keys($all))));
|
||||
}
|
||||
|
||||
throw new \RuntimeException(sprintf('No arguments expected, got "%s".', $token));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -183,7 +183,17 @@ class ArgvInputTest extends \PHPUnit_Framework_TestCase
|
||||
array(
|
||||
array('cli.php', 'foo', 'bar'),
|
||||
new InputDefinition(),
|
||||
'Too many arguments.',
|
||||
'No arguments expected, got "foo".',
|
||||
),
|
||||
array(
|
||||
array('cli.php', 'foo', 'bar'),
|
||||
new InputDefinition(array(new InputArgument('number'))),
|
||||
'Too many arguments, expected arguments "number".',
|
||||
),
|
||||
array(
|
||||
array('cli.php', 'foo', 'bar', 'zzz'),
|
||||
new InputDefinition(array(new InputArgument('number'), new InputArgument('county'))),
|
||||
'Too many arguments, expected arguments "number" "county".',
|
||||
),
|
||||
array(
|
||||
array('cli.php', '--foo'),
|
||||
|
Reference in New Issue
Block a user