PHP Класс Phan\Language\Type

Наследование: use trait Phan\Memoize
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$name string The name of this type such as 'int' or 'MyClass'
$namespace string The namespace of this type such as '\' or '\Phan\Language'
$template_parameter_type_list UnionType[] A possibly empty list of concrete types that act as parameters to this type if it is a templated type.
$template_parameter_type_list UnionType[] A possibly empty list of concrete types that act as parameters to this type if it is a templated type.

Открытые методы

Метод Описание
__toString ( ) : string
asExpandedTypes ( CodeBase $code_base, integer $recursion_depth ) : UnionType
asExpandedTypes ( CodeBase $code_base, integer $recursion_depth ) : UnionType
asFQSEN ( ) : Phan\Language\FQSEN
asFQSENString ( ) : string
asGenericArrayType ( ) : Type
asUnionType ( ) : UnionType
asUnionType ( ) : UnionType
canCastToType ( Type $type ) : boolean
fromFullyQualifiedString ( string $fully_qualified_string ) : Type
fromInternalTypeName ( string $type_name ) : Type
fromNamespaceAndName ( string $namespace, string $type_name ) : Type
fromObject ( $object ) : Type
fromStringInContext ( string $string, Context $context ) : Type
fromType ( Type $type, UnionType[] $template_parameter_type_list ) : Type
fromType ( Type $type, UnionType[] $template_parameter_type_list ) : Type
genericArrayElementType ( ) : Type
getName ( ) : string
getNamespace ( ) : string
getTemplateParameterTypeList ( ) : UnionType[]
getTemplateParameterTypeList ( ) : UnionType[]
getTemplateParameterTypeMap ( CodeBase $code_base ) : Type[]
hasNamespace ( ) : boolean
hasTemplateParameterTypes ( ) : boolean
isArrayLike ( ) : boolean
isGenericArray ( ) : boolean
isNativeType ( ) : boolean
isScalar ( ) : boolean
isSelfType ( ) : boolean
isSelfTypeString ( string $type_string ) : boolean
isStaticType ( ) : boolean
isSubclassOf ( CodeBase $code_base, Type $parent )

Защищенные методы

Метод Описание
__construct ( string $namespace, string $name, UnionType[] $template_parameter_type_list )
__construct ( string $namespace, string $name, UnionType[] $template_parameter_type_list )
make ( string $namespace, string $type_name, UnionType[] $template_parameter_type_list ) : Type
make ( string $namespace, string $type_name, UnionType[] $template_parameter_type_list ) : Type

Приватные методы

Метод Описание
canonicalNameFromName ( string $name ) : string
isGenericArrayString ( string $type_name ) : boolean
isNativeTypeString ( string $type_name ) : boolean
typeStringComponents ( string $type_string ) : Tuple3

Описание методов

__construct() защищенный Метод

protected __construct ( string $namespace, string $name, UnionType[] $template_parameter_type_list )
$namespace string The (optional) namespace of the type such as '\' or '\Phan\Language'.
$name string The name of the type such as 'int' or 'MyClass'
$template_parameter_type_list UnionType[] A (possibly empty) list of template parameter types

__construct() защищенный Метод

protected __construct ( string $namespace, string $name, UnionType[] $template_parameter_type_list )
$namespace string The (optional) namespace of the type such as '\' or '\Phan\Language'.
$name string The name of the type such as 'int' or 'MyClass'
$template_parameter_type_list UnionType[] A (possibly empty) list of template parameter types

__toString() публичный Метод

public __toString ( ) : string
Результат string A human readable representation of this type

asExpandedTypes() публичный Метод

public asExpandedTypes ( CodeBase $code_base, integer $recursion_depth ) : UnionType
$code_base Phan\CodeBase
$recursion_depth integer This thing has a tendency to run-away on me. This tracks how bad I messed up by seeing how far the expanded types go
Результат UnionType Expands class types to all inherited classes returning a superset of this type.

asExpandedTypes() публичный Метод

public asExpandedTypes ( CodeBase $code_base, integer $recursion_depth ) : UnionType
$code_base Phan\CodeBase
$recursion_depth integer This thing has a tendency to run-away on me. This tracks how bad I messed up by seeing how far the expanded types go
Результат UnionType Expands class types to all inherited classes returning a superset of this type.

asFQSEN() публичный Метод

public asFQSEN ( ) : Phan\Language\FQSEN
Результат Phan\Language\FQSEN A fully-qualified structural element name derived from this type

asFQSENString() публичный Метод

public asFQSENString ( ) : string
Результат string A string representation of this type in FQSEN form.

asGenericArrayType() публичный Метод

public asGenericArrayType ( ) : Type
Результат Type Get a new type which is the generic array version of this type. For instance, 'int' will produce 'int[]'.

asUnionType() публичный Метод

public asUnionType ( ) : UnionType
Результат UnionType A UnionType representing this and only this type

asUnionType() публичный Метод

public asUnionType ( ) : UnionType
Результат UnionType A UnionType representing this and only this type

canCastToType() публичный Метод

public canCastToType ( Type $type ) : boolean
$type Type
Результат boolean True if this Type can be cast to the given Type cleanly

fromFullyQualifiedString() публичный статический Метод

public static fromFullyQualifiedString ( string $fully_qualified_string ) : Type
$fully_qualified_string string A fully qualified type name
Результат Type

fromInternalTypeName() публичный статический Метод

public static fromInternalTypeName ( string $type_name ) : Type
$type_name string The name of the internal type such as 'int'
Результат Type Get a type for the given type name

fromNamespaceAndName() публичный статический Метод

public static fromNamespaceAndName ( string $namespace, string $type_name ) : Type
$namespace string A fully qualified namespace
$type_name string The name of the type
Результат Type A type representing the given namespace and type name.

fromObject() публичный статический Метод

public static fromObject ( $object ) : Type
Результат Type Get a type for the given object

fromStringInContext() публичный статический Метод

public static fromStringInContext ( string $string, Context $context ) : Type
$string string A string representing a type
$context Context The context in which the type string was found
Результат Type Parse a type from the given string

fromType() публичный статический Метод

public static fromType ( Type $type, UnionType[] $template_parameter_type_list ) : Type
$type Type The base type of this generic type referencing a generic class
$template_parameter_type_list UnionType[] A map from a template type identifier to a concrete union type
Результат Type

fromType() публичный статический Метод

public static fromType ( Type $type, UnionType[] $template_parameter_type_list ) : Type
$type Type The base type of this generic type referencing a generic class
$template_parameter_type_list UnionType[] A map from a template type identifier to a concrete union type
Результат Type

genericArrayElementType() публичный Метод

public genericArrayElementType ( ) : Type
Результат Type A variation of this type that is not generic. i.e. 'int[]' becomes 'int'.

getName() публичный Метод

public getName ( ) : string
Результат string The name associated with this type

getNamespace() публичный Метод

public getNamespace ( ) : string
Результат string The namespace associated with this type

getTemplateParameterTypeList() публичный Метод

public getTemplateParameterTypeList ( ) : UnionType[]
Результат UnionType[] The set of types filling in template parameter types defined on the class specified by this type.

getTemplateParameterTypeList() публичный Метод

public getTemplateParameterTypeList ( ) : UnionType[]
Результат UnionType[] The set of types filling in template parameter types defined on the class specified by this type.

getTemplateParameterTypeMap() публичный Метод

public getTemplateParameterTypeMap ( CodeBase $code_base ) : Type[]
$code_base Phan\CodeBase The code base to look up classes against
Результат Type[] A map from template type identifier to a concrete type

hasNamespace() публичный Метод

public hasNamespace ( ) : boolean
Результат boolean True if this namespace is defined

hasTemplateParameterTypes() публичный Метод

public hasTemplateParameterTypes ( ) : boolean
Результат boolean True if this type has any template parameter types

isArrayLike() публичный Метод

public isArrayLike ( ) : boolean
Результат boolean True if this type is array-like (is of type array, is a generic array, or implements ArrayAccess).

isGenericArray() публичный Метод

public isGenericArray ( ) : boolean
Результат boolean True if this is a generic type such as 'int[]' or 'string[]'.

isNativeType() публичный Метод

public isNativeType ( ) : boolean
Результат boolean True if this is a native type (like int, string, etc.)

isScalar() публичный Метод

См. также: Phan\Deprecated\Util::type_scalar Formerly `function type_scalar`
public isScalar ( ) : boolean
Результат boolean True if all types in this union are scalars

isSelfType() публичный Метод

public isSelfType ( ) : boolean
Результат boolean True if this type is a type referencing the class context in which it exists such as 'static' or 'self'.

isSelfTypeString() публичный статический Метод

public static isSelfTypeString ( string $type_string ) : boolean
$type_string string A string defining a type such as 'self' or 'int'.
Результат boolean True if the given type references the class context in which it exists such as 'static' or 'self'.

isStaticType() публичный Метод

public isStaticType ( ) : boolean
Результат boolean True if this type is a type referencing the class context 'static'.

isSubclassOf() публичный Метод

public isSubclassOf ( CodeBase $code_base, Type $parent )
$code_base Phan\CodeBase
$parent Type

make() защищенный статический Метод

protected static make ( string $namespace, string $type_name, UnionType[] $template_parameter_type_list ) : Type
$namespace string The (optional) namespace of the type such as '\' or '\Phan\Language'.
$type_name string
$template_parameter_type_list UnionType[] A (possibly empty) list of template parameter types
Результат Type A single canonical instance of the given type.

make() защищенный статический Метод

protected static make ( string $namespace, string $type_name, UnionType[] $template_parameter_type_list ) : Type
$namespace string The (optional) namespace of the type such as '\' or '\Phan\Language'.
$type_name string
$template_parameter_type_list UnionType[] A (possibly empty) list of template parameter types
Результат Type A single canonical instance of the given type.

Описание свойств

$name защищенное свойство

The name of this type such as 'int' or 'MyClass'
protected string $name
Результат string

$namespace защищенное свойство

The namespace of this type such as '\' or '\Phan\Language'
protected string $namespace
Результат string

$template_parameter_type_list защищенное свойство

A possibly empty list of concrete types that act as parameters to this type if it is a templated type.
protected UnionType[] $template_parameter_type_list
Результат UnionType[]

$template_parameter_type_list защищенное свойство

A possibly empty list of concrete types that act as parameters to this type if it is a templated type.
protected UnionType[],Phan\Language $template_parameter_type_list
Результат UnionType[]