Skip to content
docsv0.17.0

InvalidSchemaException

A supported-but-malformed schema (a developer error), detected at parse time by SchemaFormParser. Distinct from a FieldError (user input) and a RegexExecutionException (engine failure). Surfaces switch on the stable `schemaCode`; the message is human text and is never parsed.

InvalidSchemaException::enumMemberInvalid()

public static function enumMemberInvalid(string $field, ?mixed $member, Milpa\Live\Schema\FieldType $type): self

Builds the error for an enum member that cannot be coerced to the field's base type.

Parameters

Parameters of enumMemberInvalid()
NameTypeDescription
$fieldstring
$member?mixed
$typeMilpa\Live\Schema\FieldType

InvalidSchemaException::enumEmpty()

public static function enumEmpty(string $field): self

Builds the error for an `enum` key present but with no valid members.

Parameters

Parameters of enumEmpty()
NameTypeDescription
$fieldstring

InvalidSchemaException::patternInvalid()

public static function patternInvalid(string $field): self

Builds the error for a `pattern` that is not a valid regular expression.

Parameters

Parameters of patternInvalid()
NameTypeDescription
$fieldstring

InvalidSchemaException::constraintInvalid()

public static function constraintInvalid(string $field, string $constraint): self

Builds the error for a malformed numeric or length constraint.

Parameters

Parameters of constraintInvalid()
NameTypeDescription
$fieldstring
$constraintstring

InvalidSchemaException::defaultInvalid()

public static function defaultInvalid(string $field, string $reason): self

Builds the error for a `default` not coercible to the type or outside the enum.

Parameters

Parameters of defaultInvalid()
NameTypeDescription
$fieldstring
$reasonstring