Expect
final class Expect
Schema generator.
Methods
No description
Creates a schema for a custom type expression (e.g., 'int|string', 'null|float').
Creates a union schema that accepts any of the given values or sub-schemas.
Creates a structure schema with defined properties; output is stdClass.
Generates a structure schema from a class by reflecting its properties or constructor parameters.
Creates an array schema. When passed Schema elements, behaves like structure() but outputs an array.
Creates an associative or indexed array schema where every value matches the given type.
Details
at line 34
static Type
__callStatic(string $name, array $args)
No description
at line 48
static Type
type(string $type)
Creates a schema for a custom type expression (e.g., 'int|string', 'null|float').
at line 57
static AnyOf
anyOf(mixed ...$set)
Creates a union schema that accepts any of the given values or sub-schemas.
at line 67
static Structure
structure(array $shape)
Creates a structure schema with defined properties; output is stdClass.
at line 78
static Structure
from(object|string $object, array $items = [])
Generates a structure schema from a class by reflecting its properties or constructor parameters.
at line 125
static Type
array(array|null $shape = [])
Creates an array schema. When passed Schema elements, behaves like structure() but outputs an array.
Without Schema elements, creates a plain array type with the given default value.
at line 137
static Type
arrayOf(Schema $valueType, Schema|null $keyType = null)
Creates an associative or indexed array schema where every value matches the given type.
at line 146
static Type
listOf(Schema $type)
Creates a list schema (sequentially indexed from 0) where every element matches the given type.
at line 31
static Type
scalar(mixed $default)
No description
at line 31
static Type
string(mixed $default)
No description
at line 31
static Type
int(mixed $default)
No description
at line 31
static Type
float(mixed $default)
No description
at line 31
static Type
bool(mixed $default)
No description
at line 31
static Type
null()
No description
at line 31
static Type
list(mixed $default)
No description
at line 31
static Type
mixed(mixed $default)
No description
at line 31
static Type
email(mixed $default)
No description
at line 31
static Type
unicode(mixed $default)
No description