Helpers
final class Helpers
| internal |
Constants
| PreventMerging |
|
Methods
Merges dataset. Left has higher priority than right one.
Formats a value for use in error messages (e.g., 'hello', true, object stdClass).
Adds a TypeMismatch error to the context if the value does not match the expected type.
Adds a range error to the context if the value (or its length for strings/arrays) is outside the given range.
Checks whether a value falls within the given [min, max] range (null means no bound).
Adds a PatternMismatch error to the context if the value does not match the pattern.
Returns a closure that casts a value to the given type (built-in, class with constructor, or plain class).
Details
at line 27
static mixed
merge(mixed $value, mixed $base)
Merges dataset. Left has higher priority than right one.
at line 59
static string
formatValue(mixed $value)
Formats a value for use in error messages (e.g., 'hello', true, object stdClass).
at line 78
static void
validateType(mixed $value, string $expected, Context $context)
Adds a TypeMismatch error to the context if the value does not match the expected type.
at line 96
static void
validateRange(mixed $value, array $range, Context $context, string $types = '')
Adds a range error to the context if the value (or its length for strings/arrays) is outside the given range.
at line 126
static bool
isInRange(mixed $value, array $range)
Checks whether a value falls within the given [min, max] range (null means no bound).
at line 136
static void
validatePattern(string $value, string $pattern, Context $context)
Adds a PatternMismatch error to the context if the value does not match the pattern.
at line 152
static Closure
getCastStrategy(string $type)
Returns a closure that casts a value to the given type (built-in, class with constructor, or plain class).