Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ec3e26f

Browse files
committed
[OptionsResolver] Merged Options class into OptionsResolver
1 parent 453882c commit ec3e26f

14 files changed

+2736
-1026
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
CHANGELOG
2+
=========
3+
4+
2.6.0
5+
-----
6+
7+
* added Options::resolve()
8+
* added Options::setDefault()
9+
* added Options::setDefaults()
10+
* added Options::hasDefault()
11+
* added Options::setNormalizer()
12+
* added Options::hasNormalizer()
13+
* added Options::getNormalizedOptions()
14+
* added Options::setRequired()
15+
* added Options::isRequired()
16+
* added Options::getRequiredOptions()
17+
* added Options::isMissing()
18+
* added Options::getMissingOptions()
19+
* added Options::setDefined()
20+
* added Options::isDefined()
21+
* added Options::getDefinedOptions()
22+
* added Options::setAllowedValues()
23+
* added Options::addAllowedValues()
24+
* added Options::setAllowedTypes()
25+
* added Options::addAllowedTypes()
26+
* deprecated Options::overload()
27+
* deprecated Options::set()
28+
* deprecated Options::get()
29+
* deprecated Options::has()
30+
* deprecated Options::replace()
31+
* deprecated OptionsResolver
32+
* add OptionsResolver::getOptions() to access the inner Options instance and
33+
use the new API
34+
* deprecated OptionsResolverInterface
35+
* [BC BREAK] Options::get() can only be used within lazy option/normalizer
36+
closures now
37+
* [BC BREAK] removed Traversable interface from Options since using within
38+
lazy option/normalizer closures resulted in exceptions
39+
* [BC BREAK] removed Options::all() since using within lazy option/normalizer
40+
closures resulted in exceptions
41+
* [BC BREAK] OptionDefinitionException now extends LogicException instead of
42+
RuntimeException
43+
* [BC BREAK] the modifying methods in Options (set(), setNormalizer(), ...) now
44+
throw an AccessException if they may not be accessed anymore because resolving
45+
has started. Previously, they threw an OptionDefinitionException
46+
* [BC BREAK] normalizers are not executed anymore for unset options
47+
* normalizers are executed after validating the options now
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\OptionsResolver\Exception;
13+
14+
/**
15+
* Thrown when trying to read an option outside of or write it inside of
16+
* {@link Options::resolve()}.
17+
*
18+
* @author Bernhard Schussek <[email protected]>
19+
*/
20+
class AccessException extends \LogicException implements ExceptionInterface
21+
{
22+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\OptionsResolver\Exception;
13+
14+
/**
15+
* Thrown when an argument is invalid.
16+
*
17+
* @author Bernhard Schussek <[email protected]>
18+
*/
19+
class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
20+
{
21+
}

src/Symfony/Component/OptionsResolver/Exception/InvalidOptionsException.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@
1212
namespace Symfony\Component\OptionsResolver\Exception;
1313

1414
/**
15-
* Exception thrown when an invalid option is passed.
15+
* Thrown when the value of an option does not match its validation rules.
16+
*
17+
* You should make sure a valid value is passed to the option.
1618
*
1719
* @author Bernhard Schussek <[email protected]>
1820
*/
19-
class InvalidOptionsException extends \InvalidArgumentException implements ExceptionInterface
21+
class InvalidOptionsException extends InvalidArgumentException
2022
{
2123
}

src/Symfony/Component/OptionsResolver/Exception/MissingOptionsException.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414
/**
1515
* Exception thrown when a required option is missing.
1616
*
17+
* Add the option to the passed options array.
18+
*
1719
* @author Bernhard Schussek <[email protected]>
1820
*/
19-
class MissingOptionsException extends \InvalidArgumentException implements ExceptionInterface
21+
class MissingOptionsException extends InvalidArgumentException
2022
{
2123
}

src/Symfony/Component/OptionsResolver/Exception/OptionDefinitionException.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
namespace Symfony\Component\OptionsResolver\Exception;
1313

1414
/**
15-
* Thrown when an option definition is invalid.
15+
* Thrown when two lazy options have a cyclic dependency.
1616
*
1717
* @author Bernhard Schussek <[email protected]>
1818
*/
19-
class OptionDefinitionException extends \RuntimeException implements ExceptionInterface
19+
class OptionDefinitionException extends \LogicException implements ExceptionInterface
2020
{
2121
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\OptionsResolver\Exception;
13+
14+
/**
15+
* Exception thrown when an undefined option is passed.
16+
*
17+
* You should remove the options in question from your code or define them
18+
* beforehand.
19+
*
20+
* @author Bernhard Schussek <[email protected]>
21+
*/
22+
class UndefinedOptionsException extends InvalidArgumentException
23+
{
24+
}

0 commit comments

Comments
 (0)