mirror of
https://github.com/Respect/Validation.git
synced 2024-06-01 13:22:24 +02:00
0417fea213
The changelogs that this commit will change are confusing. From a code perspective, the rule Date was renamed to DateTime, and OneOf was renamed to AnyOf, but because we also created a Date and OneOf rule with different behaviours, it makes more sense to say that their behaviour changed, rather than saying that they were created in version 2.0.0. Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
35 lines
590 B
Markdown
35 lines
590 B
Markdown
# AnyOf
|
|
|
|
- `AnyOf(Validatable ...$rule)`
|
|
|
|
This is a group validator that acts as an OR operator.
|
|
|
|
```php
|
|
v::anyOf(v::intVal(), v::floatVal())->validate(15.5); // true
|
|
```
|
|
|
|
In the sample above, `IntVal()` doesn't validates, but `FloatVal()` validates,
|
|
so `AnyOf()` returns true.
|
|
|
|
`AnyOf()` returns true if at least one inner validator passes.
|
|
|
|
## Categorization
|
|
|
|
- Composite
|
|
- Nesting
|
|
|
|
## Changelog
|
|
|
|
Version | Description
|
|
--------|-------------
|
|
2.0.0 | Created
|
|
|
|
***
|
|
See also:
|
|
|
|
- [AllOf](AllOf.md)
|
|
- [ContainsAny](ContainsAny.md)
|
|
- [NoneOf](NoneOf.md)
|
|
- [OneOf](OneOf.md)
|
|
- [When](When.md)
|