mirror of
https://github.com/Respect/Validation.git
synced 2026-03-17 15:50:03 +01:00
520 B
520 B
OneOf
v::oneOf(v $v1, v $v2, v $v3...)
This is a group validator that acts as an OR operator.
v::oneOf(
v::int(),
v::floatVal()
)->validate(15.5); //true
In the sample above, v::int() doesn't validates, but
v::floatVal() validates, so oneOf returns true.
v::oneOf returns true if at least one inner validator
passes.
Using a shortcut
v::int()->addOr(v::floatVal())->validate(15.5); //true
See also: