ParameterRule
in package
implements
RuleInterface
AbstractYes
A rule with a parameter: the rule reads and checks the parameter first, so a parameter outside the validation rules fails before the value is looked at, and then decides whether the value holds.
Tags
Table of Contents
Interfaces
- RuleInterface
- Interface for validation rules.
Methods
- validate() : bool
- Validate a value against the checked parameter of the rule.
- holds() : bool
- Whether the value holds under the checked parameter.
- parameter() : P
- The checked parameter of the rule.
Methods
validate()
Validate a value against the checked parameter of the rule.
public
final validate(mixed $value, mixed $param, array<string|int, mixed> $allData, FieldPath $path) : bool
Parameters
- $value : mixed
-
The value to validate
- $param : mixed
-
The rule parameter (e.g., min length, pattern, etc.)
- $allData : array<string|int, mixed>
-
All form data (for cross-field validation)
- $path : FieldPath
-
The data path of the value with the positions of its row keys
Tags
Return values
bool —True if valid, false otherwise
holds()
Whether the value holds under the checked parameter.
protected
abstract holds(mixed $value, P $parameter) : bool
Parameters
- $value : mixed
- $parameter : P
Return values
boolparameter()
The checked parameter of the rule.
protected
abstract parameter(mixed $param) : P
Parameters
- $param : mixed