respect-validation/docs/validators/All.md
Alexandre Gomes Gaigalas d9cdc118b2 Introduce REUSE compliance
This commit introduces REUSE compliance by annotating all files
with SPDX information and placing the reused licences in the
LICENSES folder.

We additionally removed the docheader tool which is made obsolete
by this change.

The main LICENSE and copyright text of the project is now not under
my personal name anymore, and it belongs to "The Respect Project
Contributors" instead.

This change restores author names to several files, giving the
appropriate attribution for contributions.
2026-01-21 06:28:11 +00:00

1.3 KiB

All

  • All(Validator $validator)

Validates all items of the input against a given validator.

v::all(v::intType())->assert([1, 2, 3]);
// Validation passes successfully

v::all(v::intType())->assert([1, 2, '3']);
// → Every item in `[1, 2, "3"]` must be an integer

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

Template as prefix

The template serves as a prefix to the template of the inner validator.

v::all(v::floatType())->assert([1.5, 2]);
// → Every item in `[1.5, 2]` must be float

v::not(v::all(v::intType()))->assert([1, 2, -3]);
// → Every item in `[1, 2, -3]` must not be an integer

Categorization

  • Comparisons
  • Transformations

Changelog

Version Description
3.0.0 Created

See also: