d8338dc358
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
-------
|
||
---|---|---|
.. | ||
Debug | ||
Exception | ||
Tests | ||
.gitattributes | ||
.gitignore | ||
CHANGELOG.md | ||
composer.json | ||
LICENSE | ||
OptionConfigurator.php | ||
Options.php | ||
OptionsResolver.php | ||
phpunit.xml.dist | ||
README.md |
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.