This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Component/OptionsResolver
Nicolas Grekas d8338dc358 minor #36799 Remove some magic from TypeValidator logic and OptionsResolver type verify logic (drealecs)
This PR was squashed before being merged into the 5.2-dev branch.

Discussion
----------

Remove some magic from TypeValidator logic and OptionsResolver type verify logic

| Q             | A
| ------------- | ---
| Branch?       | 5.0
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| License       | MIT

Following discussion on https://twitter.com/Ocramius/status/1260236117129015297
The changes in this PR could ensure that types that can be verified by the TypeValidator is limited and there is no way to magically use it.
For example you can break it by defining you own function like:
```php
function is_usercollection {
    return true;
}
```
that will validate any value that have the validator type as 'UserCollection'.

Another example would be defining `is_lower` or `ctype_int` that would also break the implementation.

Commits
-------

e8c9049a5a Remove some magic from TypeValidator logic and OptionsResolver type verify logic
2020-07-13 11:15:52 +02:00
..
Debug [OptionsResolver] Improve the deprecation feature by handling package + version 2020-04-06 19:48:46 +02:00
Exception Mark ExceptionInterfaces throwable 2018-08-29 17:58:00 +02:00
Tests Merge branch '5.0' into 5.1 2020-07-12 14:58:00 +02:00
.gitattributes add missing gitattributes for phpunit-bridge 2020-03-27 17:54:36 +01:00
.gitignore Added missing files .gitignore 2013-07-21 14:12:18 +02:00
CHANGELOG.md [OptionsResolver] Improve the deprecation feature by handling package + version 2020-04-06 19:48:46 +02:00
composer.json minor #36799 Remove some magic from TypeValidator logic and OptionsResolver type verify logic (drealecs) 2020-07-13 11:15:52 +02:00
LICENSE Update year in license files 2020-01-01 12:03:25 +01:00
OptionConfigurator.php remove not needed BC layer 2020-04-21 09:24:21 +02:00
Options.php [OptionsResolver] fix adding $triggerDeprecation to Options::offsetGet() 2019-06-09 18:15:03 +02:00
OptionsResolver.php minor #36799 Remove some magic from TypeValidator logic and OptionsResolver type verify logic (drealecs) 2020-07-13 11:15:52 +02:00
phpunit.xml.dist Bump phpunit XSD version to 5.2 2018-11-11 12:18:13 +01:00
README.md Fixed readme of OptionsResolver 2016-05-06 22:13:08 +02:00

OptionsResolver Component

The OptionsResolver component is array_replace on steroids. It allows you to create an options system with required options, defaults, validation (type, value), normalization and more.

Resources