final class Helpers

internal  
 

Constants

PreventMerging

Methods

static mixed
merge(mixed $value, mixed $base)

Merges dataset. Left has higher priority than right one.

static string
formatValue(mixed $value)

Formats a value for use in error messages (e.g., 'hello', true, object stdClass).

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.

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.

static bool
isInRange(mixed $value, array $range)

Checks whether a value falls within the given [min, max] range (null means no bound).

static void
validatePattern(string $value, string $pattern, Context $context)

Adds a PatternMismatch error to the context if the value does not match the pattern.

static Closure
getCastStrategy(string $type)

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.

Parameters

mixed $value
mixed $base

Return Value

mixed

at line 59
static string formatValue(mixed $value)

Formats a value for use in error messages (e.g., 'hello', true, object stdClass).

Parameters

mixed $value

Return Value

string

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.

Parameters

mixed $value
string $expected
Context $context

Return Value

void

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.

Parameters

mixed $value
array $range
Context $context
string $types

Return Value

void

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).

Parameters

mixed $value
array $range

Return Value

bool

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.

Parameters

string $value
string $pattern
Context $context

Return Value

void

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).

Parameters

string $type

Return Value

Closure

Traits

StaticClass