Skip to content

Latest commit

 

History

History
55 lines (36 loc) · 1.13 KB

File metadata and controls

55 lines (36 loc) · 1.13 KB

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: