Type
in package
implements
Stringable
uses
TypeFactoryTrait
AbstractYes
Tags
Table of Contents
Interfaces
Methods
- accepts() : bool
- Tells if the type (or one of its wrapped/composed parts) accepts the given $value.
- array() : CollectionType<string|int, BuiltinType<string|int, TypeIdentifier::ARRAY>>
- arrayKey() : UnionType
- arrayShape() : ArrayShapeType
- bool() : BuiltinType<string|int, TypeIdentifier::BOOL>
- builtin() : BuiltinType<string|int, T>
- callable() : BuiltinType<string|int, TypeIdentifier::CALLABLE>
- collection() : CollectionType<string|int, T>
- dict() : CollectionType<string|int, BuiltinType<string|int, TypeIdentifier::ARRAY>>
- enum() : EnumType
- false() : BuiltinType<string|int, TypeIdentifier::FALSE>
- float() : BuiltinType<string|int, TypeIdentifier::FLOAT>
- fromValue() : Type
- generic() : GenericType<string|int, T>
- int() : BuiltinType<string|int, TypeIdentifier::INT>
- intersection() : IntersectionType<string|int, T>
- isIdentifiedBy() : bool
- Tells if the type (or one of its wrapped/composed parts) is identified by one of the $identifiers.
- isNullable() : bool
- isSatisfiedBy() : bool
- Tells if the type is satisfied by the $specification callable.
- iterable() : CollectionType<string|int, BuiltinType<string|int, TypeIdentifier::ITERABLE>>
- list() : CollectionType<string|int, BuiltinType<string|int, TypeIdentifier::ARRAY>>
- mixed() : BuiltinType<string|int, TypeIdentifier::MIXED>
- never() : BuiltinType<string|int, TypeIdentifier::NEVER>
- null() : BuiltinType<string|int, TypeIdentifier::NULL>
- nullable() : T|NullableType<string|int, T>
- object() : TypeIdentifier::OBJECT>)
- resource() : BuiltinType<string|int, TypeIdentifier::RESOURCE>
- string() : BuiltinType<string|int, TypeIdentifier::STRING>
- template() : T>)
- traverse() : iterable<string|int, self>
- Traverses the whole type tree.
- true() : BuiltinType<string|int, TypeIdentifier::TRUE>
- union() : UnionType<string|int, T>|NullableType<string|int, T>
- void() : BuiltinType<string|int, TypeIdentifier::VOID>
Methods
accepts()
Tells if the type (or one of its wrapped/composed parts) accepts the given $value.
public
accepts(mixed $value) : bool
Parameters
- $value : mixed
Return values
boolarray()
public
static array([Type|null $value = null ][, Type|null $key = null ][, bool $asList = false ]) : CollectionType<string|int, BuiltinType<string|int, TypeIdentifier::ARRAY>>
Parameters
Return values
CollectionType<string|int, BuiltinType<string|int, TypeIdentifier::ARRAY>>arrayKey()
public
static arrayKey() : UnionType
Return values
UnionTypearrayShape()
public
static arrayShape(array<string|int, Type, optional?: bool}|Type> $shape[, bool $sealed = true ][, Type|null $extraKeyType = null ][, Type|null $extraValueType = null ]) : ArrayShapeType
Parameters
- $shape : array<string|int, Type, optional?: bool}|Type>
- $sealed : bool = true
- $extraKeyType : Type|null = null
- $extraValueType : Type|null = null
Return values
ArrayShapeTypebool()
public
static bool() : BuiltinType<string|int, TypeIdentifier::BOOL>
Return values
BuiltinType<string|int, TypeIdentifier::BOOL>builtin()
public
static builtin(T|U $identifier) : BuiltinType<string|int, T>
Parameters
- $identifier : T|U
Tags
Return values
BuiltinType<string|int, T>callable()
public
static callable() : BuiltinType<string|int, TypeIdentifier::CALLABLE>
Return values
BuiltinType<string|int, TypeIdentifier::CALLABLE>collection()
public
static collection(T $type[, Type|null $value = null ][, Type|null $key = null ][, bool $asList = false ]) : CollectionType<string|int, T>
Parameters
Tags
Return values
CollectionType<string|int, T>dict()
public
static dict([Type|null $value = null ]) : CollectionType<string|int, BuiltinType<string|int, TypeIdentifier::ARRAY>>
Parameters
- $value : Type|null = null
Return values
CollectionType<string|int, BuiltinType<string|int, TypeIdentifier::ARRAY>>enum()
public
static enum(T $className[, U|null $backingType = null ]) : EnumType
Parameters
- $className : T
- $backingType : U|null = null
Tags
Return values
EnumTypefalse()
public
static false() : BuiltinType<string|int, TypeIdentifier::FALSE>
Return values
BuiltinType<string|int, TypeIdentifier::FALSE>float()
public
static float() : BuiltinType<string|int, TypeIdentifier::FLOAT>
Return values
BuiltinType<string|int, TypeIdentifier::FLOAT>fromValue()
public
static fromValue(mixed $value) : Type
Parameters
- $value : mixed
Return values
Typegeneric()
public
static generic(T $mainType, Type ...$variableTypes) : GenericType<string|int, T>
Parameters
- $mainType : T
- $variableTypes : Type
Tags
Return values
GenericType<string|int, T>int()
public
static int() : BuiltinType<string|int, TypeIdentifier::INT>
Return values
BuiltinType<string|int, TypeIdentifier::INT>intersection()
public
static intersection(array<int, T|IntersectionType<string|int, T>> ...$types) : IntersectionType<string|int, T>
Parameters
- $types : array<int, T|IntersectionType<string|int, T>>
Tags
Return values
IntersectionType<string|int, T>isIdentifiedBy()
Tells if the type (or one of its wrapped/composed parts) is identified by one of the $identifiers.
public
isIdentifiedBy(TypeIdentifier|string ...$identifiers) : bool
Parameters
- $identifiers : TypeIdentifier|string
Return values
boolisNullable()
public
isNullable() : bool
Return values
boolisSatisfiedBy()
Tells if the type is satisfied by the $specification callable.
public
isSatisfiedBy(callable(self): bool $specification) : bool
Parameters
- $specification : callable(self): bool
Return values
booliterable()
public
static iterable([Type|null $value = null ][, Type|null $key = null ][, bool $asList = false ]) : CollectionType<string|int, BuiltinType<string|int, TypeIdentifier::ITERABLE>>
Parameters
Return values
CollectionType<string|int, BuiltinType<string|int, TypeIdentifier::ITERABLE>>list()
public
static list([Type|null $value = null ]) : CollectionType<string|int, BuiltinType<string|int, TypeIdentifier::ARRAY>>
Parameters
- $value : Type|null = null
Return values
CollectionType<string|int, BuiltinType<string|int, TypeIdentifier::ARRAY>>mixed()
public
static mixed() : BuiltinType<string|int, TypeIdentifier::MIXED>
Return values
BuiltinType<string|int, TypeIdentifier::MIXED>never()
public
static never() : BuiltinType<string|int, TypeIdentifier::NEVER>
Return values
BuiltinType<string|int, TypeIdentifier::NEVER>null()
public
static null() : BuiltinType<string|int, TypeIdentifier::NULL>
Return values
BuiltinType<string|int, TypeIdentifier::NULL>nullable()
public
static nullable(T $type) : T|NullableType<string|int, T>
Parameters
- $type : T
Tags
Return values
T|NullableType<string|int, T>object()
public
static object([T|null $className = null ]) : TypeIdentifier::OBJECT>)
Parameters
- $className : T|null = null
Tags
Return values
TypeIdentifier::OBJECT>)resource()
public
static resource() : BuiltinType<string|int, TypeIdentifier::RESOURCE>
Return values
BuiltinType<string|int, TypeIdentifier::RESOURCE>string()
public
static string() : BuiltinType<string|int, TypeIdentifier::STRING>
Return values
BuiltinType<string|int, TypeIdentifier::STRING>template()
public
static template(string $name[, T|null $bound = null ]) : T>)
Parameters
- $name : string
- $bound : T|null = null
Tags
Return values
T>)traverse()
Traverses the whole type tree.
public
traverse([bool $traverseComposite = true ][, bool $traverseWrapped = true ]) : iterable<string|int, self>
Parameters
- $traverseComposite : bool = true
- $traverseWrapped : bool = true
Return values
iterable<string|int, self>true()
public
static true() : BuiltinType<string|int, TypeIdentifier::TRUE>
Return values
BuiltinType<string|int, TypeIdentifier::TRUE>union()
public
static union(array<int, T> ...$types) : UnionType<string|int, T>|NullableType<string|int, T>
Parameters
- $types : array<int, T>
Tags
Return values
UnionType<string|int, T>|NullableType<string|int, T>void()
public
static void() : BuiltinType<string|int, TypeIdentifier::VOID>