final class Structure implements Schema

Methods

__construct(array $shape)

No description

default(mixed $value)

Not supported for structures; always throws.

min(int|null $min)

No description

max(int|null $max)

No description

otherItems(Schema $type = 'mixed')

Allows extra keys not defined in the shape, validating their values against the given type.

skipDefaults(bool $state = true)

When enabled, properties whose value equals the default are omitted from the output.

extend(array|self $shape)

Creates a new structure by merging this shape with additional properties.

array
getShape()

No description

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 33
__construct(array $shape)

No description

Parameters

array $shape

at line 45
Structure default(mixed $value)

Not supported for structures; always throws.

Parameters

mixed $value

Return Value

Structure

at line 51
Structure min(int|null $min)

No description

Parameters

int|null $min

Return Value

Structure

at line 58
Structure max(int|null $max)

No description

Parameters

int|null $max

Return Value

Structure

at line 68
Structure otherItems(Schema $type = 'mixed')

Allows extra keys not defined in the shape, validating their values against the given type.

Parameters

Schema $type

Return Value

Structure

at line 78
Structure skipDefaults(bool $state = true)

When enabled, properties whose value equals the default are omitted from the output.

Parameters

bool $state

Return Value

Structure

at line 89
Structure extend(array|self $shape)

Creates a new structure by merging this shape with additional properties.

Parameters

array|self $shape

Return Value

Structure

at line 97
array getShape()

No description

Return Value

array

at line 106
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 128
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 155
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 208
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