class NamedType extends Type

Properties

bool $isCastable

Methods

bool
acceptsType(string $type)

Determine if this declaration accepts the given type name.

bool
acceptsValue(mixed $value)

Determine if this declaration accepts the given value.

bool
guaranteesType(string $type)

Determine if every value accepted by this declaration is an instance of the given type.

string|null
findAcceptedTypeForBaseType(string $class)

Find the declared type accepted by a base type.

array
getNamedTypes()

Get every named type in declaration order.

string|null
getSingleBuiltinType()

Get the one unambiguous built-in type in this declaration.

__construct(string $name, bool $builtIn, DataTypeKind $kind, string|null $dataClass = null, string|null $iterableClass = null, Type|null $iterableItemType = null)

Create a new named type.

static bool
typeExists(string $type)

Determine if a class or interface type exists.

Details

at line 36
bool acceptsType(string $type)

Determine if this declaration accepts the given type name.

Parameters

string $type

Return Value

bool

at line 56
bool acceptsValue(mixed $value)

Determine if this declaration accepts the given value.

Parameters

mixed $value

Return Value

bool

at line 79
bool guaranteesType(string $type)

Determine if every value accepted by this declaration is an instance of the given type.

Parameters

string $type

Return Value

bool

at line 87
string|null findAcceptedTypeForBaseType(string $class)

Find the declared type accepted by a base type.

Parameters

string $class

Return Value

string|null

at line 105
array getNamedTypes()

Get every named type in declaration order.

Return Value

array

at line 115
string|null getSingleBuiltinType()

Get the one unambiguous built-in type in this declaration.

Return Value

string|null

at line 22
__construct(string $name, bool $builtIn, DataTypeKind $kind, string|null $dataClass = null, string|null $iterableClass = null, Type|null $iterableItemType = null)

Create a new named type.

Parameters

string $name
bool $builtIn
DataTypeKind $kind
string|null $dataClass
string|null $iterableClass
Type|null $iterableItemType

at line 126
static protected bool typeExists(string $type)

Determine if a class or interface type exists.

Parameters

string $type

Return Value

bool