[OptionsResolver] replaced some exception messages

This commit is contained in:
Issei.M 2014-11-23 03:21:28 +09:00 committed by Fabien Potencier
parent db4eb0f509
commit 5e5ba393f1
2 changed files with 9 additions and 8 deletions

View File

@ -409,7 +409,7 @@ class OptionsResolver implements Options, OptionsResolverInterface
if (!isset($this->defined[$option])) {
throw new UndefinedOptionsException(sprintf(
'The option "%s" does not exist. Known options are: "%s".',
'The option "%s" does not exist. Defined options are: "%s".',
$option,
implode('", "', array_keys($this->defined))
));
@ -473,7 +473,7 @@ class OptionsResolver implements Options, OptionsResolverInterface
if (!isset($this->defined[$option])) {
throw new UndefinedOptionsException(sprintf(
'The option "%s" does not exist. Known options are: "%s".',
'The option "%s" does not exist. Defined options are: "%s".',
$option,
implode('", "', array_keys($this->defined))
));
@ -527,7 +527,7 @@ class OptionsResolver implements Options, OptionsResolverInterface
if (!isset($this->defined[$option])) {
throw new UndefinedOptionsException(sprintf(
'The option "%s" does not exist. Known options are: "%s".',
'The option "%s" does not exist. Defined options are: "%s".',
$option,
implode('", "', array_keys($this->defined))
));
@ -579,7 +579,7 @@ class OptionsResolver implements Options, OptionsResolverInterface
if (!isset($this->defined[$option])) {
throw new UndefinedOptionsException(sprintf(
'The option "%s" does not exist. Known options are: "%s".',
'The option "%s" does not exist. Defined options are: "%s".',
$option,
implode('", "', array_keys($this->defined))
));
@ -627,7 +627,7 @@ class OptionsResolver implements Options, OptionsResolverInterface
if (!isset($this->defined[$option])) {
throw new UndefinedOptionsException(sprintf(
'The option "%s" does not exist. Known options are: "%s".',
'The option "%s" does not exist. Defined options are: "%s".',
$option,
implode('", "', array_keys($this->defined))
));
@ -742,7 +742,7 @@ class OptionsResolver implements Options, OptionsResolverInterface
ksort($diff);
throw new UndefinedOptionsException(sprintf(
(count($diff) > 1 ? 'The options "%s" do not exist.' : 'The option "%s" does not exist.').' Known options are: "%s".',
(count($diff) > 1 ? 'The options "%s" do not exist.' : 'The option "%s" does not exist.').' Defined options are: "%s".',
implode('", "', array_keys($diff)),
implode('", "', array_keys($clone->defined))
));
@ -808,7 +808,7 @@ class OptionsResolver implements Options, OptionsResolverInterface
if (!array_key_exists($option, $this->defaults)) {
if (!isset($this->defined[$option])) {
throw new NoSuchOptionException(sprintf(
'The option "%s" does not exist. Known options are: "%s".',
'The option "%s" does not exist. Defined options are: "%s".',
$option,
implode('", "', array_keys($this->defined))
));

View File

@ -206,7 +206,8 @@ class LegacyOptionsResolverTest extends \PHPUnit_Framework_TestCase
}
/**
* @expectedException \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
* @expectedException \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
* @expectedExceptionMessage The option "foo" does not exist. Defined options are: "one", "three", "two".
*/
public function testResolveFailsIfNonExistingOption()
{