[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
|
// unexpected argument
|
||||||
} else {
|
} 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(
|
||||||
array('cli.php', 'foo', 'bar'),
|
array('cli.php', 'foo', 'bar'),
|
||||||
new InputDefinition(),
|
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(
|
||||||
array('cli.php', '--foo'),
|
array('cli.php', '--foo'),
|
||||||
|
Reference in New Issue
Block a user