PHP Class Phan\Language\Type

Inheritance: use trait Phan\Memoize
Afficher le fichier Open project: etsy/phan Class Usage Examples

Protected Properties

Свойство Type Description
$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.

Méthodes publiques

Méthode Description
__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 )

Méthodes protégées

Méthode Description
__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

Private Methods

Méthode Description
canonicalNameFromName ( string $name ) : string
isGenericArrayString ( string $type_name ) : boolean
isNativeTypeString ( string $type_name ) : boolean
typeStringComponents ( string $type_string ) : Tuple3

Method Details

__construct() protected méthode

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 méthode

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 méthode

public __toString ( ) : string
Résultat string A human readable representation of this type

asExpandedTypes() public méthode

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
Résultat UnionType Expands class types to all inherited classes returning a superset of this type.

asExpandedTypes() public méthode

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
Résultat UnionType Expands class types to all inherited classes returning a superset of this type.

asFQSEN() public méthode

public asFQSEN ( ) : Phan\Language\FQSEN
Résultat Phan\Language\FQSEN A fully-qualified structural element name derived from this type

asFQSENString() public méthode

public asFQSENString ( ) : string
Résultat string A string representation of this type in FQSEN form.

asGenericArrayType() public méthode

public asGenericArrayType ( ) : Type
Résultat Type Get a new type which is the generic array version of this type. For instance, 'int' will produce 'int[]'.

asUnionType() public méthode

public asUnionType ( ) : UnionType
Résultat UnionType A UnionType representing this and only this type

asUnionType() public méthode

public asUnionType ( ) : UnionType
Résultat UnionType A UnionType representing this and only this type

canCastToType() public méthode

public canCastToType ( Type $type ) : boolean
$type Type
Résultat boolean True if this Type can be cast to the given Type cleanly

fromFullyQualifiedString() public static méthode

public static fromFullyQualifiedString ( string $fully_qualified_string ) : Type
$fully_qualified_string string A fully qualified type name
Résultat Type

fromInternalTypeName() public static méthode

public static fromInternalTypeName ( string $type_name ) : Type
$type_name string The name of the internal type such as 'int'
Résultat Type Get a type for the given type name

fromNamespaceAndName() public static méthode

public static fromNamespaceAndName ( string $namespace, string $type_name ) : Type
$namespace string A fully qualified namespace
$type_name string The name of the type
Résultat Type A type representing the given namespace and type name.

fromObject() public static méthode

public static fromObject ( $object ) : Type
Résultat Type Get a type for the given object

fromStringInContext() public static méthode

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
Résultat Type Parse a type from the given string

fromType() public static méthode

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
Résultat Type

fromType() public static méthode

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
Résultat Type

genericArrayElementType() public méthode

public genericArrayElementType ( ) : Type
Résultat Type A variation of this type that is not generic. i.e. 'int[]' becomes 'int'.

getName() public méthode

public getName ( ) : string
Résultat string The name associated with this type

getNamespace() public méthode

public getNamespace ( ) : string
Résultat string The namespace associated with this type

getTemplateParameterTypeList() public méthode

public getTemplateParameterTypeList ( ) : UnionType[]
Résultat UnionType[] The set of types filling in template parameter types defined on the class specified by this type.

getTemplateParameterTypeList() public méthode

public getTemplateParameterTypeList ( ) : UnionType[]
Résultat UnionType[] The set of types filling in template parameter types defined on the class specified by this type.

getTemplateParameterTypeMap() public méthode

public getTemplateParameterTypeMap ( CodeBase $code_base ) : Type[]
$code_base Phan\CodeBase The code base to look up classes against
Résultat Type[] A map from template type identifier to a concrete type

hasNamespace() public méthode

public hasNamespace ( ) : boolean
Résultat boolean True if this namespace is defined

hasTemplateParameterTypes() public méthode

public hasTemplateParameterTypes ( ) : boolean
Résultat boolean True if this type has any template parameter types

isArrayLike() public méthode

public isArrayLike ( ) : boolean
Résultat boolean True if this type is array-like (is of type array, is a generic array, or implements ArrayAccess).

isGenericArray() public méthode

public isGenericArray ( ) : boolean
Résultat boolean True if this is a generic type such as 'int[]' or 'string[]'.

isNativeType() public méthode

public isNativeType ( ) : boolean
Résultat boolean True if this is a native type (like int, string, etc.)

isScalar() public méthode

See also: Phan\Deprecated\Util::type_scalar Formerly `function type_scalar`
public isScalar ( ) : boolean
Résultat boolean True if all types in this union are scalars

isSelfType() public méthode

public isSelfType ( ) : boolean
Résultat boolean True if this type is a type referencing the class context in which it exists such as 'static' or 'self'.

isSelfTypeString() public static méthode

public static isSelfTypeString ( string $type_string ) : boolean
$type_string string A string defining a type such as 'self' or 'int'.
Résultat boolean True if the given type references the class context in which it exists such as 'static' or 'self'.

isStaticType() public méthode

public isStaticType ( ) : boolean
Résultat boolean True if this type is a type referencing the class context 'static'.

isSubclassOf() public méthode

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

make() protected static méthode

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
Résultat Type A single canonical instance of the given type.

make() protected static méthode

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
Résultat Type A single canonical instance of the given type.

Property Details

$name protected_oe property

The name of this type such as 'int' or 'MyClass'
protected string $name
Résultat string

$namespace protected_oe property

The namespace of this type such as '\' or '\Phan\Language'
protected string $namespace
Résultat string

$template_parameter_type_list protected_oe property

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
Résultat UnionType[]

$template_parameter_type_list protected_oe property

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
Résultat UnionType[]