PHP 클래스 Phan\Language\UnionType

상속: implements Serializable, use trait Phan\Memoize
파일 보기 프로젝트 열기: etsy/phan 1 사용 예제들

공개 메소드들

메소드 설명
__clone ( ) : null After a clone is called on this object, clone our deep objects.
__construct ( Type[] | Iterator $type_list = null )
__construct ( Type[] | Iterator $type_list = null )
__toString ( ) : string
addType ( Type $type ) : void Add a type name to the list of types
addType ( Type $type ) : void Add a type name to the list of types
addUnionType ( UnionType $union_type ) : null Add the given types to this type
asClassList ( CodeBase $code_base, Context $context ) : Generator | Clazz[]
asExpandedTypes ( CodeBase $code_base, integer $recursion_depth ) : UnionType
asGenericArrayTypes ( ) : UnionType
canCastToExpandedUnionType ( UnionType $target, CodeBase $code_base ) : boolean
canCastToUnionType ( UnionType $target ) : boolean
fromFullyQualifiedString ( string $fully_qualified_string ) : UnionType
fromNode ( Context $context, CodeBase $code_base, ast\Node | string | null $node, boolean $should_catch_issue_exception = true ) : UnionType
fromStringInContext ( string $type_string, Context $context ) : UnionType
genericArrayElementTypes ( ) : UnionType Takes "a|b[]|c|d[]|e" and returns "b|d"
getTemplateParameterTypeList ( ) : array
getTemplateParameterTypeMap ( CodeBase $code_base ) : array
getTypeSet ( ) : Phan\Library\Set
hasAnyType ( array $type_list ) : boolean
hasArrayLike ( ) : boolean
hasGenericArray ( ) : boolean
hasSelfType ( ) : boolean
hasStaticType ( ) : boolean
hasTemplateType ( ) : boolean
hasType ( Type $type ) : boolean
hasType ( Type $type ) : boolean
internalFunctionSignatureMap ( ) : array
internalFunctionSignatureMapForFQSEN ( FullyQualifiedMethodName | FullyQualifiedFunctionName $function_fqsen ) : array A list of types for parameters associated with the given builtin function with the given name
internalPropertyMapForClassName ( string $class_name ) : array
isEmpty ( ) : boolean
isEqualTo ( UnionType $union_type ) : boolean
isGenericArray ( ) : boolean
isNativeType ( ) : boolean
isScalar ( ) : boolean
isType ( Type $type ) : boolean
isType ( Type $type ) : boolean
nonArrayTypes ( ) : UnionType Takes "a|b[]|c|d[]|e|array|ArrayAccess" and returns "a|c|e|ArrayAccess"
nonGenericArrayTypes ( ) : UnionType Takes "a|b[]|c|d[]|e" and returns "a|c|e"
nonNativeTypes ( ) : UnionType
removeType ( Type $type ) : void Remove a type name to the list of types
removeType ( Type $type ) : void Remove a type name to the list of types
serialize ( ) : string As per the Serializable interface
typeCount ( ) : integer
unserialize ( string $serialized ) : void As per the Serializable interface
withStaticResolvedInContext ( Context $context ) : UnionType
withTemplateParameterTypeMap ( array $template_parameter_type_map ) : UnionType

비공개 메소드들

메소드 설명
hasGenericType ( ) : boolean
internalPropertyMap ( ) : array

메소드 상세

__clone() 공개 메소드

After a clone is called on this object, clone our deep objects.
public __clone ( ) : null
리턴 null

__construct() 공개 메소드

public __construct ( Type[] | Iterator $type_list = null )
$type_list Type[] | Iterator An optional list of types represented by this union

__construct() 공개 메소드

public __construct ( Type[] | Iterator $type_list = null )
$type_list Type[] | Iterator An optional list of types represented by this union

__toString() 공개 메소드

public __toString ( ) : string
리턴 string A human-readable string representation of this union type

addType() 공개 메소드

Add a type name to the list of types
public addType ( Type $type ) : void
$type Type
리턴 void

addType() 공개 메소드

Add a type name to the list of types
public addType ( Type $type ) : void
$type Type
리턴 void

addUnionType() 공개 메소드

Add the given types to this type
public addUnionType ( UnionType $union_type ) : null
$union_type UnionType
리턴 null

asClassList() 공개 메소드

public asClassList ( CodeBase $code_base, Context $context ) : Generator | Clazz[]
$code_base Phan\CodeBase The code base in which to find classes
$context Context The context in which we're resolving this union type.
리턴 Generator | Phan\Language\Element\Clazz[] A list of classes representing the non-native types associated with this UnionType

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

asGenericArrayTypes() 공개 메소드

public asGenericArrayTypes ( ) : UnionType
리턴 UnionType Get a new type for each type in this union which is the generic array version of this type. For instance, 'int|float' will produce 'int[]|float[]'.

canCastToExpandedUnionType() 공개 메소드

public canCastToExpandedUnionType ( UnionType $target, CodeBase $code_base ) : boolean
$target UnionType The type we'd like to see if this type can cast to
$code_base Phan\CodeBase The code base used to expand types
리턴 boolean Test to see if this type can be cast to the given type after expanding both union types to include all ancestor types

canCastToUnionType() 공개 메소드

또한 보기: Phan\Deprecated\Pass2::type_check Formerly 'function type_check'
public canCastToUnionType ( UnionType $target ) : boolean
$target UnionType A type to check to see if this can cast to it
리턴 boolean True if this type is allowed to cast to the given type i.e. int->float is allowed while float->int is not.

fromFullyQualifiedString() 공개 정적인 메소드

public static fromFullyQualifiedString ( string $fully_qualified_string ) : UnionType
$fully_qualified_string string A '|' delimited string representing a type in the form 'int|string|null|ClassName'.
리턴 UnionType

fromNode() 공개 정적인 메소드

public static fromNode ( Context $context, CodeBase $code_base, ast\Node | string | null $node, boolean $should_catch_issue_exception = true ) : UnionType
$context Context The context of the parser at the node for which we'd like to determine a type
$code_base Phan\CodeBase The code base within which we're operating
$node ast\Node | string | null The node for which we'd like to determine its type
$should_catch_issue_exception boolean Set to true to cause loggable issues to be thrown instead of emitted as issues to the log.
리턴 UnionType

fromStringInContext() 공개 정적인 메소드

public static fromStringInContext ( string $type_string, Context $context ) : UnionType
$type_string string A '|' delimited string representing a type in the form 'int|string|null|ClassName'.
$context Context The context in which the type string was found
리턴 UnionType

genericArrayElementTypes() 공개 메소드

Takes "a|b[]|c|d[]|e" and returns "b|d"
public genericArrayElementTypes ( ) : UnionType
리턴 UnionType The subset of types in this

getTemplateParameterTypeList() 공개 메소드

public getTemplateParameterTypeList ( ) : array
리턴 array A map from template type identifiers to the UnionType to replace it with

getTemplateParameterTypeMap() 공개 메소드

public getTemplateParameterTypeMap ( CodeBase $code_base ) : array
$code_base Phan\CodeBase The code base to look up classes against
리턴 array A map from template type identifiers to the UnionType to replace it with

getTypeSet() 공개 메소드

public getTypeSet ( ) : Phan\Library\Set
리턴 Phan\Library\Set The set of simple types associated with this union type.

hasAnyType() 공개 메소드

public hasAnyType ( array $type_list ) : boolean
$type_list array A list of types
리턴 boolean True if this union type contains any of the given named types

hasArrayLike() 공개 메소드

public hasArrayLike ( ) : boolean
리턴 boolean True if this union has array-like types (is of type array, is a generic array, or implements ArrayAccess).

hasGenericArray() 공개 메소드

public hasGenericArray ( ) : boolean
리턴 boolean True if this type has any generic types

hasSelfType() 공개 메소드

public hasSelfType ( ) : boolean
리턴 boolean True if this type has a type referencing the class context in which it exists such as 'self' or '$this'

hasStaticType() 공개 메소드

public hasStaticType ( ) : boolean
리턴 boolean True if this type has a type referencing the class context 'static'.

hasTemplateType() 공개 메소드

public hasTemplateType ( ) : boolean
리턴 boolean True if this union type has any types that are generic types

hasType() 공개 메소드

public hasType ( Type $type ) : boolean
$type Type
리턴 boolean True if this union type contains the given named type.

hasType() 공개 메소드

public hasType ( Type $type ) : boolean
$type Type
리턴 boolean True if this union type contains the given named type.

internalFunctionSignatureMap() 공개 정적인 메소드

또한 보기: Phan\Language\Internal\FunctionSignatureMap
public static internalFunctionSignatureMap ( ) : array
리턴 array A map from builtin function name to type information

internalFunctionSignatureMapForFQSEN() 공개 정적인 메소드

A list of types for parameters associated with the given builtin function with the given name
또한 보기: internal_varargs_check Formerly `function internal_varargs_check`
public static internalFunctionSignatureMapForFQSEN ( FullyQualifiedMethodName | FullyQualifiedFunctionName $function_fqsen ) : array
$function_fqsen Phan\Language\FQSEN\FullyQualifiedMethodName | Phan\Language\FQSEN\FullyQualifiedFunctionName
리턴 array

internalPropertyMapForClassName() 공개 정적인 메소드

public static internalPropertyMapForClassName ( string $class_name ) : array
$class_name string
리턴 array Get a map from property name to its type for the given class name.

isEmpty() 공개 메소드

public isEmpty ( ) : boolean
리턴 boolean True if this Union has no types

isEqualTo() 공개 메소드

public isEqualTo ( UnionType $union_type ) : boolean
$union_type UnionType
리턴 boolean True iff this union contains the exact set of types represented in the given union type.

isGenericArray() 공개 메소드

public isGenericArray ( ) : boolean
리턴 boolean True if this is exclusively generic types

isNativeType() 공개 메소드

public isNativeType ( ) : boolean
리턴 boolean True if this UnionType is exclusively native types

isScalar() 공개 메소드

또한 보기: Phan\Deprecated\Util::type_scalar Formerly `function type_scalar`
public isScalar ( ) : boolean
리턴 boolean True if all types in this union are scalars

isType() 공개 메소드

public isType ( Type $type ) : boolean
$type Type
리턴 boolean True if and only if this UnionType contains the given type and no others.

isType() 공개 메소드

public isType ( Type $type ) : boolean
$type Type
리턴 boolean True if and only if this UnionType contains the given type and no others.

nonArrayTypes() 공개 메소드

Takes "a|b[]|c|d[]|e|array|ArrayAccess" and returns "a|c|e|ArrayAccess"
또한 보기: nonGenericArrayTypes
public nonArrayTypes ( ) : UnionType
리턴 UnionType A UnionType with generic types(as well as the non-generic type "array") filtered out.

nonGenericArrayTypes() 공개 메소드

Takes "a|b[]|c|d[]|e" and returns "a|c|e"
또한 보기: Phan\Deprecated\Pass2::nongenerics Formerly `function nongenerics`
public nonGenericArrayTypes ( ) : UnionType
리턴 UnionType A UnionType with generic types filtered out

nonNativeTypes() 공개 메소드

public nonNativeTypes ( ) : UnionType
리턴 UnionType Get the subset of types which are not native

removeType() 공개 메소드

Remove a type name to the list of types
public removeType ( Type $type ) : void
$type Type
리턴 void

removeType() 공개 메소드

Remove a type name to the list of types
public removeType ( Type $type ) : void
$type Type
리턴 void

serialize() 공개 메소드

As per the Serializable interface
또한 보기: Serializable
public serialize ( ) : string
리턴 string A serialized representation of this type

typeCount() 공개 메소드

public typeCount ( ) : integer
리턴 integer The number of types in this union type

unserialize() 공개 메소드

As per the Serializable interface
또한 보기: Serializable
public unserialize ( string $serialized ) : void
$serialized string A serialized UnionType
리턴 void

withStaticResolvedInContext() 공개 메소드

public withStaticResolvedInContext ( Context $context ) : UnionType
$context Context
리턴 UnionType A new UnionType with any references to 'static' resolved in the given context.

withTemplateParameterTypeMap() 공개 메소드

public withTemplateParameterTypeMap ( array $template_parameter_type_map ) : UnionType
$template_parameter_type_map array A map from template type identifiers to concrete types
리턴 UnionType This UnionType with any template types contained herein mapped to concrete types defined in the given map.