mirror of
https://github.com/Respect/Validation.git
synced 2024-06-03 06:12:17 +02:00
2610a380dc
With this and the Lazy rule, the LazyConsecutive lost its purpose. While working on it, I did refactor the Domain rule a bit, but mainly to check how this rule could behave. Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
810 B
810 B
OneOf
OneOf(Validatable $rule1, Validatable $rule2, Validatable ...$rule)
Will validate if exactly one inner validator passes.
v::oneOf(v::digit(), v::alpha())->validate('AB'); // true
v::oneOf(v::digit(), v::alpha())->validate('12'); // true
v::oneOf(v::digit(), v::alpha())->validate('AB12'); // false
v::oneOf(v::digit(), v::alpha())->validate('*'); // false
The chains above validate if the input is either a digit or an alphabetic character, one or the other, but not neither nor both.
Categorization
- Composite
- Nesting
Changelog
Version | Description |
---|---|
3.0.0 | Require at least two rules to be passed |
0.3.9 | Created |
See also: