[OptionsResolver] replaced some exception messages
This commit is contained in:
parent
db4eb0f509
commit
5e5ba393f1
@ -409,7 +409,7 @@ class OptionsResolver implements Options, OptionsResolverInterface
|
|||||||
|
|
||||||
if (!isset($this->defined[$option])) {
|
if (!isset($this->defined[$option])) {
|
||||||
throw new UndefinedOptionsException(sprintf(
|
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,
|
$option,
|
||||||
implode('", "', array_keys($this->defined))
|
implode('", "', array_keys($this->defined))
|
||||||
));
|
));
|
||||||
@ -473,7 +473,7 @@ class OptionsResolver implements Options, OptionsResolverInterface
|
|||||||
|
|
||||||
if (!isset($this->defined[$option])) {
|
if (!isset($this->defined[$option])) {
|
||||||
throw new UndefinedOptionsException(sprintf(
|
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,
|
$option,
|
||||||
implode('", "', array_keys($this->defined))
|
implode('", "', array_keys($this->defined))
|
||||||
));
|
));
|
||||||
@ -527,7 +527,7 @@ class OptionsResolver implements Options, OptionsResolverInterface
|
|||||||
|
|
||||||
if (!isset($this->defined[$option])) {
|
if (!isset($this->defined[$option])) {
|
||||||
throw new UndefinedOptionsException(sprintf(
|
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,
|
$option,
|
||||||
implode('", "', array_keys($this->defined))
|
implode('", "', array_keys($this->defined))
|
||||||
));
|
));
|
||||||
@ -579,7 +579,7 @@ class OptionsResolver implements Options, OptionsResolverInterface
|
|||||||
|
|
||||||
if (!isset($this->defined[$option])) {
|
if (!isset($this->defined[$option])) {
|
||||||
throw new UndefinedOptionsException(sprintf(
|
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,
|
$option,
|
||||||
implode('", "', array_keys($this->defined))
|
implode('", "', array_keys($this->defined))
|
||||||
));
|
));
|
||||||
@ -627,7 +627,7 @@ class OptionsResolver implements Options, OptionsResolverInterface
|
|||||||
|
|
||||||
if (!isset($this->defined[$option])) {
|
if (!isset($this->defined[$option])) {
|
||||||
throw new UndefinedOptionsException(sprintf(
|
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,
|
$option,
|
||||||
implode('", "', array_keys($this->defined))
|
implode('", "', array_keys($this->defined))
|
||||||
));
|
));
|
||||||
@ -742,7 +742,7 @@ class OptionsResolver implements Options, OptionsResolverInterface
|
|||||||
ksort($diff);
|
ksort($diff);
|
||||||
|
|
||||||
throw new UndefinedOptionsException(sprintf(
|
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($diff)),
|
||||||
implode('", "', array_keys($clone->defined))
|
implode('", "', array_keys($clone->defined))
|
||||||
));
|
));
|
||||||
@ -808,7 +808,7 @@ class OptionsResolver implements Options, OptionsResolverInterface
|
|||||||
if (!array_key_exists($option, $this->defaults)) {
|
if (!array_key_exists($option, $this->defaults)) {
|
||||||
if (!isset($this->defined[$option])) {
|
if (!isset($this->defined[$option])) {
|
||||||
throw new NoSuchOptionException(sprintf(
|
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,
|
$option,
|
||||||
implode('", "', array_keys($this->defined))
|
implode('", "', array_keys($this->defined))
|
||||||
));
|
));
|
||||||
|
@ -207,6 +207,7 @@ 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()
|
public function testResolveFailsIfNonExistingOption()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user