Documentation

EnumType extends ObjectType
in package

Tags
author

Mathias Arlaud mathias.arlaud@gmail.com

author

Baptiste Leduc baptiste.leduc@gmail.com

template
extends

Table of Contents

Methods

__construct()  : mixed
__toString()  : string
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>
getClassName()  : T
getTypeIdentifier()  : TypeIdentifier
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

__construct()

public __construct(T $className) : mixed
Parameters
$className : T

__toString()

public __toString() : string
Return values
string

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
bool

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

getClassName()

public getClassName() : T
Return values
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
bool

isNullable()

public isNullable() : bool
Return values
bool

isSatisfiedBy()

Tells if the type is satisfied by the $specification callable.

public isSatisfiedBy(callable(self): bool $specification) : bool
Parameters
$specification : callable(self): bool
Return values
bool

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>)

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>

        
On this page

Search results