class Type

Type value object (immutable).

Constants

BUILTIN_TYPE_INT

BUILTIN_TYPE_FLOAT

BUILTIN_TYPE_STRING

BUILTIN_TYPE_BOOL

BUILTIN_TYPE_RESOURCE

BUILTIN_TYPE_OBJECT

BUILTIN_TYPE_ARRAY

BUILTIN_TYPE_NULL

BUILTIN_TYPE_CALLABLE

BUILTIN_TYPE_ITERABLE

Properties

static string[] $builtinTypes List of PHP builtin types.

Methods

__construct(string $builtinType, bool $nullable = false, string $class = null, bool $collection = false, Type $collectionKeyType = null, Type $collectionValueType = null)

No description

string
getBuiltinType()

Gets built-in type.

bool
isNullable()

No description

string|null
getClassName()

Gets the class name.

bool
isCollection()

No description

Type|null
getCollectionKeyType()

Gets collection key type.

Type|null
getCollectionValueType()

Gets collection value type.

Details

at line 62
__construct(string $builtinType, bool $nullable = false, string $class = null, bool $collection = false, Type $collectionKeyType = null, Type $collectionValueType = null)

Parameters

string $builtinType
bool $nullable
string $class
bool $collection
Type $collectionKeyType
Type $collectionValueType

Exceptions

InvalidArgumentException

at line 81
string getBuiltinType()

Gets built-in type.

Can be bool, int, float, string, array, object, resource, null, callback or iterable.

Return Value

string

at line 86
bool isNullable()

Return Value

bool

at line 96
string|null getClassName()

Gets the class name.

Only applicable if the built-in type is object.

Return Value

string|null

at line 101
bool isCollection()

Return Value

bool

at line 111
Type|null getCollectionKeyType()

Gets collection key type.

Only applicable for a collection type.

Return Value

Type|null

at line 121
Type|null getCollectionValueType()

Gets collection value type.

Only applicable for a collection type.

Return Value

Type|null