Documentation

ArrayShapeType extends CollectionType
in package

FinalYes

Represents the exact shape of an array.

Tags
author

Mathias Arlaud mathias.arlaud@gmail.com

extends

Table of Contents

Properties

$extraKeyType  : Type|null
$extraValueType  : Type|null
$shape  : array<string|int, Type, optional: bool}>

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>
getCollectionKeyType()  : Type
getCollectionValueType()  : Type
getExtraKeyType()  : Type|null
getExtraValueType()  : Type|null
getShape()  : array<string|int, Type, optional: bool}>
getWrappedType()  : 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.
isList()  : bool
isNullable()  : bool
isSatisfiedBy()  : bool
Tells if the type is satisfied by the $specification callable.
isSealed()  : bool
iterable()  : CollectionType<string|int, BuiltinType<string|int, TypeIdentifier::ITERABLE>>
list()  : CollectionType<string|int, BuiltinType<string|int, TypeIdentifier::ARRAY>>
mergeCollectionValueTypes()  : Type
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>
wrappedTypeIsSatisfiedBy()  : bool

Properties

$shape read-only

private array<string|int, Type, optional: bool}> $shape

Methods

__construct()

public __construct(array<string|int, Type, optional: bool}$shape[, Type|null $extraKeyType = null ][, Type|null $extraValueType = null ]) : mixed
Parameters
$shape : array<string|int, Type, optional: bool}>
$extraKeyType : Type|null = null
$extraValueType : Type|null = null

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

getShape()

public getShape() : array<string|int, Type, optional: bool}>
Return values
array<string|int, Type, optional: bool}>

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

mergeCollectionValueTypes()

public static mergeCollectionValueTypes(array<string|int, Type$types) : Type
Parameters
$types : array<string|int, Type>
Return values
Type

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>

wrappedTypeIsSatisfiedBy()

public wrappedTypeIsSatisfiedBy(callable $specification) : bool
Parameters
$specification : callable
Return values
bool

        
On this page

Search results