minor #12546 [OptionsResolver] replaced some exception messages (issei-m)
This PR was submitted for the 2.6 branch but it was merged into the 2.7 branch instead (closes #12546).
Discussion
----------
[OptionsResolver] replaced some exception messages
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
In accordance with renaming of methods.
Commits
-------
5e5ba39
[OptionsResolver] replaced some exception messages
This commit is contained in:
commit
3be180dbb2
@ -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