respect-validation/docs/AnyOf.md
Henrique Moody 9f15c6b6d8
Update documentation with code that works
Some codes in the documentation were not code that actually works which
can lead to some confusion of how to use Validation.

Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
2018-06-12 17:27:06 +02:00

558 B

AnyOf

  • AnyOf(Validatable ...$rule)

This is a group validator that acts as an OR operator.

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.

Changelog

Version Description
2.0.0 Renamed from OneOf to AnyOf
0.3.9 Created

See also: