Skip to content

Commit 47340f4

Browse files
issei-mfabpot
authored andcommitted
[OptionsResolver] replaced some exception messages
1 parent e326531 commit 47340f4

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

OptionsResolver.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ public function setNormalizer($option, \Closure $normalizer)
409409

410410
if (!isset($this->defined[$option])) {
411411
throw new UndefinedOptionsException(sprintf(
412-
'The option "%s" does not exist. Known options are: "%s".',
412+
'The option "%s" does not exist. Defined options are: "%s".',
413413
$option,
414414
implode('", "', array_keys($this->defined))
415415
));
@@ -473,7 +473,7 @@ public function setAllowedValues($option, $allowedValues = null)
473473

474474
if (!isset($this->defined[$option])) {
475475
throw new UndefinedOptionsException(sprintf(
476-
'The option "%s" does not exist. Known options are: "%s".',
476+
'The option "%s" does not exist. Defined options are: "%s".',
477477
$option,
478478
implode('", "', array_keys($this->defined))
479479
));
@@ -527,7 +527,7 @@ public function addAllowedValues($option, $allowedValues = null)
527527

528528
if (!isset($this->defined[$option])) {
529529
throw new UndefinedOptionsException(sprintf(
530-
'The option "%s" does not exist. Known options are: "%s".',
530+
'The option "%s" does not exist. Defined options are: "%s".',
531531
$option,
532532
implode('", "', array_keys($this->defined))
533533
));
@@ -579,7 +579,7 @@ public function setAllowedTypes($option, $allowedTypes = null)
579579

580580
if (!isset($this->defined[$option])) {
581581
throw new UndefinedOptionsException(sprintf(
582-
'The option "%s" does not exist. Known options are: "%s".',
582+
'The option "%s" does not exist. Defined options are: "%s".',
583583
$option,
584584
implode('", "', array_keys($this->defined))
585585
));
@@ -627,7 +627,7 @@ public function addAllowedTypes($option, $allowedTypes = null)
627627

628628
if (!isset($this->defined[$option])) {
629629
throw new UndefinedOptionsException(sprintf(
630-
'The option "%s" does not exist. Known options are: "%s".',
630+
'The option "%s" does not exist. Defined options are: "%s".',
631631
$option,
632632
implode('", "', array_keys($this->defined))
633633
));
@@ -742,7 +742,7 @@ public function resolve(array $options = array())
742742
ksort($diff);
743743

744744
throw new UndefinedOptionsException(sprintf(
745-
(count($diff) > 1 ? 'The options "%s" do not exist.' : 'The option "%s" does not exist.').' Known options are: "%s".',
745+
(count($diff) > 1 ? 'The options "%s" do not exist.' : 'The option "%s" does not exist.').' Defined options are: "%s".',
746746
implode('", "', array_keys($diff)),
747747
implode('", "', array_keys($clone->defined))
748748
));
@@ -808,7 +808,7 @@ public function offsetGet($option)
808808
if (!array_key_exists($option, $this->defaults)) {
809809
if (!isset($this->defined[$option])) {
810810
throw new NoSuchOptionException(sprintf(
811-
'The option "%s" does not exist. Known options are: "%s".',
811+
'The option "%s" does not exist. Defined options are: "%s".',
812812
$option,
813813
implode('", "', array_keys($this->defined))
814814
));

Tests/LegacyOptionsResolverTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,8 @@ public function testResolveLazyReplaceDefaults()
206206
}
207207

208208
/**
209-
* @expectedException \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
209+
* @expectedException \Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException
210+
* @expectedExceptionMessage The option "foo" does not exist. Defined options are: "one", "three", "two".
210211
*/
211212
public function testResolveFailsIfNonExistingOption()
212213
{

0 commit comments

Comments
 (0)