respect-validation/docs/rules/Max.md
Henrique Moody 061a3c9c09
Rename method "validate()" to "isValid()"
The method has been renamed some time ago, but I haven't updated the
documentation to cause less confusion. Now that I want to start updating
the documentation, I switched the default branch on GitHub to the latest
stable version, so I assume there will be less confusion in the
documentation, and I can start updating the docs for the next version.
2024-12-02 22:11:57 +01:00

1.2 KiB

Max

  • Max(Validatable $rule)

Validates the maximum value of the input against a given rule.

v::max(v::equals(30))->isValid([10, 20, 30]); // true

v::max(v::between('e', 'g'))->isValid(['b', 'd', 'f']); // true

v::max(v::greaterThan(new DateTime('today')))
        ->isValid([new DateTime('yesterday'), new DateTime('tomorrow')]); // true

v::max(v::greaterThan(15))->isValid([4, 8, 12]); // false

Note

This rule uses IterableType and NotEmpty internally. If an input is non-iterable or empty, the validation will fail.

Categorization

  • Comparisons
  • Transformations

Changelog

Version Description
3.0.0 Became a transformation
2.0.0 Became always inclusive
1.0.0 Became inclusive by default
0.3.9 Created

See also: