final class AnyOf implements Schema

Schema that accepts any of a fixed set of values or sub-schemas (union type / enumeration).

Methods

__construct(mixed ...$set)

No description

firstIsDefault()

Sets the first variant as the default value (instead of null).

nullable()

Allows null as an accepted value in addition to the defined variants.

dynamic()

Allows the value to be a DynamicParameter as an accepted variant.

mixed
normalize(mixed $value, Context $context)

Applies pre-processing transformations to the raw input value (e.g., via before() hooks).

mixed
merge(mixed $value, mixed $base)

Merges two normalized values, with $value taking priority over $base.

mixed
complete(mixed $value, Context $context)

Validates the value and applies defaults, transforms, and assertions.

mixed
completeDefault(Context $context)

Returns the default value, or adds a missing-item error if the field is required.

Details

at line 28
__construct(mixed ...$set)

No description

Parameters

mixed ...$set

at line 41
AnyOf firstIsDefault()

Sets the first variant as the default value (instead of null).

Return Value

AnyOf

at line 51
AnyOf nullable()

Allows null as an accepted value in addition to the defined variants.

Return Value

AnyOf

at line 61
AnyOf dynamic()

Allows the value to be a DynamicParameter as an accepted variant.

Return Value

AnyOf

at line 71
mixed normalize(mixed $value, Context $context)

Applies pre-processing transformations to the raw input value (e.g., via before() hooks).

Parameters

mixed $value
Context $context

Return Value

mixed

at line 77
mixed merge(mixed $value, mixed $base)

Merges two normalized values, with $value taking priority over $base.

Parameters

mixed $value
mixed $base

Return Value

mixed

at line 83
mixed complete(mixed $value, Context $context)

Validates the value and applies defaults, transforms, and assertions.

Parameters

mixed $value
Context $context

Return Value

mixed

at line 138
mixed completeDefault(Context $context)

Returns the default value, or adds a missing-item error if the field is required.

Parameters

Context $context

Return Value

mixed

Traits