mirror of
https://github.com/Respect/Validation.git
synced 2026-03-17 07:45:45 +01:00
The `{{name}}` placeholder could represent different things depending on
the state of the Result, and referring to it as `{{name}}` seems
arbitrary. This commit changes it to `{{subject}}`, which is much more
generic and it describes well what that placeholder can mean.
1.3 KiB
1.3 KiB
AnyOf
AnyOf(Rule $rule1, Rule $rule2, Rule ...$rule)
This is a group validator that acts as an OR operator.
v::anyOf(v::intVal(), v::floatVal())->isValid(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.
Templates
AnyOf::TEMPLATE_STANDARD
| Mode | Template |
|---|---|
default |
{{subject}} must pass at least one of the rules |
inverted |
{{subject}} must pass at least one of the rules |
Template placeholders
| Placeholder | Description |
|---|---|
subject |
The validated input or the custom validator name (if specified). |
Categorization
- Composite
- Nesting
Changelog
| Version | Description |
|---|---|
| 3.0.0 | Require at least two rules to be passed |
| 2.0.0 | Created |
See also: