mirror of
https://github.com/Respect/Validation.git
synced 2026-03-14 22:35:45 +01:00
1.1 KiB
1.1 KiB
All
All(Validator $validator)
Validates all items of the input against a given validator.
v::all(v::intType())->isValid([1, 2, 3]); // true
v::all(v::intType())->isValid([1, 2, '3']); // false
This validator is similar to Each, but as opposed to the former, it displays a single message when asserting an input.
Note
This validator uses Length with [GreaterThan][GreaterThan.md] internally. If an input has no items, the validation will fail.
Templates
All::TEMPLATE_STANDARD
| Mode | Template |
|---|---|
default |
Every item in |
inverted |
Every item in |
This template serve as message prefixes.:
v::all(v::floatType())->assert([1.5, 2]);
// Message: Every item in `[1.5, 2]` must be float
v::not(v::all(v::intType()))->assert([1, 2, -3]);
// Message: Every item in `[1, 2, -3]` must not be an integer
Categorization
- Comparisons
- Transformations
Changelog
| Version | Description |
|---|---|
| 3.0.0 | Created |
See also: