respect-validation/docs/rules/AnyOf.md

35 lines
590 B
Markdown
Raw Normal View History

2017-02-05 12:23:22 +01:00
# AnyOf
2015-01-30 09:40:06 +01:00
- `AnyOf(Validatable ...$rule)`
2015-01-30 09:40:06 +01:00
This is a group validator that acts as an OR operator.
```php
v::anyOf(v::intVal(), v::floatVal())->validate(15.5); // true
2015-01-30 09:40:06 +01:00
```
In the sample above, `IntVal()` doesn't validates, but `FloatVal()` validates,
so `AnyOf()` returns true.
2015-01-30 09:40:06 +01:00
`AnyOf()` returns true if at least one inner validator passes.
2015-01-30 09:40:06 +01:00
## Categorization
- Composite
- Nesting
## Changelog
Version | Description
--------|-------------
2.0.0 | Created
***
2015-01-30 09:40:06 +01:00
See also:
- [AllOf](AllOf.md)
- [ContainsAny](ContainsAny.md)
- [NoneOf](NoneOf.md)
- [OneOf](OneOf.md)
- [When](When.md)