mirror of
https://github.com/Respect/Validation.git
synced 2024-06-26 17:20:16 +02:00
0417fea213
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>
749 B
749 B
OneOf
OneOf(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 |
---|---|
2.0.0 | Changed to pass if only one inner validator passes |
0.3.9 | Created |
See also: