Documentation

TypeFactoryTrait

Helper trait to create any type easily.

Tags
author

Mathias Arlaud mathias.arlaud@gmail.com

author

Baptiste Leduc baptiste.leduc@gmail.com

Table of Contents

Methods

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>
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>)
true()  : BuiltinType<string|int, TypeIdentifier::TRUE>
union()  : UnionType<string|int, T>|NullableType<string|int, T>
void()  : BuiltinType<string|int, TypeIdentifier::VOID>

Methods

arrayShape()

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
ArrayShapeType

builtin()

public static builtin(T|U $identifier) : BuiltinType<string|int, T>
Parameters
$identifier : T|U
Tags
template
template

value-of<T>

Return values
BuiltinType<string|int, T>

collection()

public static collection(T $type[, Type|null $value = null ][, Type|null $key = null ][, bool $asList = false ]) : CollectionType<string|int, T>
Parameters
$type : T
$value : Type|null = null
$key : Type|null = null
$asList : bool = false
Tags
template
Return values
CollectionType<string|int, T>

enum()

public static enum(T $className[, U|null $backingType = null ]) : EnumType
Parameters
$className : T
$backingType : U|null = null
Tags
template
template
@return

($className is class-string<\BackedEnum> ? ($backingType is U ? BackedEnumType<T, U> : BackedEnumType<T, BuiltinTypeTypeIdentifier::INT|BuiltinTypeTypeIdentifier::STRING>) : EnumType<T>))

Return values
EnumType

object()

public static object([T|null $className = null ]) : TypeIdentifier::OBJECT>)
Parameters
$className : T|null = null
Tags
template
Return values
TypeIdentifier::OBJECT>)

template()

public static template(string $name[, T|null $bound = null ]) : T>)
Parameters
$name : string
$bound : T|null = null
Tags
template
Return values
T>)

        
On this page

Search results