TypeFrom
extends ReferenceRule
in package
Type From validation rule (CUVR-077).
Validates that a value has the type that the value of another field names: bool a boolean, int a finite number without a fractional part, enum a string; a missing or other type fails.
Table of Contents
Methods
- validate() : bool
- Validate that a value agrees with the value of the field that the parameter names.
- agrees() : bool
- Whether the value agrees with the value of the other field.
Methods
validate()
Validate that a value agrees with the value of the field that the parameter names.
public
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
Return values
bool —True if valid, false otherwise
agrees()
Whether the value agrees with the value of the other field.
protected
agrees(mixed $value, mixed $reference) : bool
Parameters
- $value : mixed
- $reference : mixed