respect-validation/docs/rules/AllOf.md
Henrique Moody a0d6355980
Update some templates and improve tests
Some templates were a bit confusing, and I would like to favour adding
the `{{name}}` at the beginning of the templates as it helps when
reading nested messages.

I also deleted the regression tests for issue #1348, because it's a
non-issue, actually. The best approach to that problem is indeed using
`When` insteaf of `OneOf`.
2024-12-27 15:55:55 +01:00

1.3 KiB

AllOf

  • AllOf(Rule $rule1, Rule $rule2, Rule ...$rule)

Will validate if all inner validators validates.

v::allOf(v::intVal(), v::positive())->isValid(15); // true

Templates

AllOf::TEMPLATE_SOME

Used when some rules must be failed.

Mode Template
default {{name}} must pass the rules
inverted {{name}} must pass the rules

AllOf::TEMPLATE_ALL

Used when all rules have failed.

Mode Template
default {{name}} must pass all the rules
inverted {{name}} must pass all the rules

Template placeholders

Placeholder Description
name The validated input or the custom validator name (if specified).

Categorization

  • Composite
  • Nesting

Changelog

Version Description
3.0.0 Require at least two rules to be passed
0.3.9 Created

See also: