respect-validation/docs/rules/AnyOf.md
Henrique Moody 0417fea213
Fix confusion with some changelogs
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>
2019-05-11 21:44:44 +02:00

590 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.

Categorization

  • Composite
  • Nesting

Changelog

Version Description
2.0.0 Created

See also: