respect-validation/docs/rules/NoneOf.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.5 KiB

NoneOf

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

Validates if NONE of the given validators validate:

v::noneOf(
    v::intVal(),
    v::floatVal()
)->isValid('foo'); // true

In the sample above, 'foo' isn't a integer nor a float, so noneOf returns true.

Templates

NoneOf::TEMPLATE_SOME

Used when some rules have passed.

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

NoneOf::TEMPLATE_ALL

Used when all rules have passed.

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: