UnionTrait
Tags
Table of Contents
Methods
- __construct() : mixed
- Constructs a Union instance
- __toString() : string
- allFloatLiterals() : bool
- allIntLiterals() : bool
- allLiterals() : bool
- allSpecificLiterals() : bool
- allStringLiterals() : bool
- canBeFullyExpressedInPhp() : bool
- canContainObjectType() : bool
- check() : bool
- containsAnyLiteral() : bool
- containsClassLike() : bool
- equals() : bool
- getArray() : TArray|TKeyedArray|TClassStringMap
- getAtomicTypes() : array<string|int, mixed>
- getCallableTypes() : array<string, TCallable>
- getClosureTypes() : array<string, TClosure>
- getId() : string
- getKey() : string
- getLiteralFloats() : array<string, TLiteralFloat>
- getLiteralInts() : array<string, TLiteralInt>
- getLiteralStrings() : array<string, TLiteralString>
- getRangeInts() : array<string, TIntRange>
- getSingleAtomic() : Atomic
- getSingleFloatLiteral() : TLiteralFloat
- getSingleIntLiteral() : TLiteralInt
- getSingleLiteral() : TLiteralInt|TLiteralString|TLiteralFloat
- getSingleStringLiteral() : TLiteralString
- getTemplateTypes() : array<int, TTemplateParam>
- hasArray() : bool
- hasArrayAccessInterface() : bool
- hasArrayKey() : bool
- hasBool() : bool
- hasCallableType() : bool
- hasClassStringMap() : bool
- hasConditional() : bool
- hasFloat() : bool
- hasInt() : bool
- hasIterable() : bool
- hasList() : bool
- hasLiteralClassString() : bool
- hasLiteralFloat() : bool
- hasLiteralInt() : bool
- hasLiteralString() : bool
- hasLiteralValue() : bool
- hasLowercaseString() : bool
- hasMixed() : bool
- hasNamedObjectType() : bool
- hasNull() : bool
- hasNumeric() : bool
- hasObject() : bool
- hasObjectType() : bool
- hasScalar() : bool
- hasScalarType() : bool
- hasStaticObject() : bool
- hasString() : bool
- hasTemplate() : bool
- hasTemplateOrStatic() : bool
- hasType() : bool
- isAlwaysFalsy() : bool
- isAlwaysTruthy() : bool
- isArray() : bool
- isArrayKey() : bool
- isBool() : bool
- isEmptyArray() : bool
- isEmptyMixed() : bool
- isFalsable() : bool
- isFalse() : bool
- isFloat() : bool
- isGenerator() : bool
- isInt() : bool
- isMixed() : bool
- isNever() : bool
- isNonEmptyString() : bool
- isNull() : bool
- isNullable() : bool
- isObjectType() : bool
- isSingle() : bool
- isSingleAndMaybeNullable() : bool
- isSingleFloatLiteral() : bool
- isSingleIntLiteral() : bool
- isSingleLiteral() : bool
- isSingleStringLiteral() : bool
- isStaticObject() : bool
- isString() : bool
- isTemplatedClassString() : bool
- isTrue() : bool
- isUnionEmpty() : bool
- isVanillaMixed() : bool
- isVoid() : bool
- queueClassLikesForScanning() : void
- replaceClassLike() : static
- toNamespacedString() : string
- toPhpString() : string|null
- visit() : bool
Methods
__construct()
Constructs a Union instance
public
__construct(array<string|int, mixed> $types[, TProperties $properties = [] ]) : mixed
Parameters
- $types : array<string|int, mixed>
- $properties : TProperties = []
Tags
__toString()
public
__toString() : string
Tags
Return values
stringallFloatLiterals()
public
allFloatLiterals() : bool
Tags
Return values
boolallIntLiterals()
public
allIntLiterals() : bool
Tags
Return values
boolallLiterals()
public
allLiterals() : bool
Tags
Return values
boolallSpecificLiterals()
public
allSpecificLiterals() : bool
Tags
Return values
boolallStringLiterals()
public
allStringLiterals() : bool
Tags
Return values
boolcanBeFullyExpressedInPhp()
public
canBeFullyExpressedInPhp(int $analysis_php_version_id) : bool
Parameters
- $analysis_php_version_id : int
Tags
Return values
boolcanContainObjectType()
public
canContainObjectType(Codebase $codebase) : bool
Parameters
- $codebase : Codebase
Tags
Return values
boolcheck()
public
check(StatementsSource $source, CodeLocation $code_location, array<string|int, string> $suppressed_issues[, array<string, bool> $phantom_classes = [] ][, bool $inferred = true ][, bool $inherited = false ][, bool $prevent_template_covariance = false ][, string|null $calling_method_id = null ]) : bool
Parameters
- $source : StatementsSource
- $code_location : CodeLocation
- $suppressed_issues : array<string|int, string>
- $phantom_classes : array<string, bool> = []
- $inferred : bool = true
- $inherited : bool = false
- $prevent_template_covariance : bool = false
- $calling_method_id : string|null = null
Return values
boolcontainsAnyLiteral()
public
containsAnyLiteral() : bool
Tags
Return values
boolcontainsClassLike()
public
containsClassLike(lowercase-string $fq_class_like_name) : bool
Parameters
- $fq_class_like_name : lowercase-string
Tags
Return values
boolequals()
public
equals(self $other_type[, bool $ensure_source_equality = true ][, bool $ensure_parent_node_equality = true ][, bool $ensure_possibly_undefined_equality = true ]) : bool
Parameters
- $other_type : self
- $ensure_source_equality : bool = true
- $ensure_parent_node_equality : bool = true
- $ensure_possibly_undefined_equality : bool = true
Tags
Return values
boolgetArray()
public
getArray() : TArray|TKeyedArray|TClassStringMap
Return values
TArray|TKeyedArray|TClassStringMapgetAtomicTypes()
public
getAtomicTypes() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>getCallableTypes()
public
getCallableTypes() : array<string, TCallable>
Tags
Return values
array<string, TCallable>getClosureTypes()
public
getClosureTypes() : array<string, TClosure>
Tags
Return values
array<string, TClosure>getId()
public
getId([bool $exact = true ]) : string
Parameters
- $exact : bool = true
Tags
Return values
stringgetKey()
public
getKey() : string
Tags
Return values
stringgetLiteralFloats()
public
getLiteralFloats() : array<string, TLiteralFloat>
Tags
Return values
array<string, TLiteralFloat>getLiteralInts()
public
getLiteralInts() : array<string, TLiteralInt>
Tags
Return values
array<string, TLiteralInt>getLiteralStrings()
public
getLiteralStrings() : array<string, TLiteralString>
Tags
Return values
array<string, TLiteralString>getRangeInts()
public
getRangeInts() : array<string, TIntRange>
Tags
Return values
array<string, TIntRange>getSingleAtomic()
public
getSingleAtomic() : Atomic
Tags
Return values
AtomicgetSingleFloatLiteral()
public
getSingleFloatLiteral() : TLiteralFloat
Tags
Return values
TLiteralFloat —the only float literal represented by this union type
getSingleIntLiteral()
public
getSingleIntLiteral() : TLiteralInt
Tags
Return values
TLiteralInt —the only int literal represented by this union type
getSingleLiteral()
public
getSingleLiteral() : TLiteralInt|TLiteralString|TLiteralFloat
Tags
Return values
TLiteralInt|TLiteralString|TLiteralFloatgetSingleStringLiteral()
public
getSingleStringLiteral() : TLiteralString
Tags
Return values
TLiteralString —the only string literal represented by this union type
getTemplateTypes()
public
getTemplateTypes() : array<int, TTemplateParam>
Tags
Return values
array<int, TTemplateParam>hasArray()
public
hasArray() : bool
Tags
Return values
boolhasArrayAccessInterface()
public
hasArrayAccessInterface(Codebase $codebase) : bool
Parameters
- $codebase : Codebase
Tags
Return values
boolhasArrayKey()
public
hasArrayKey() : bool
Tags
Return values
boolhasBool()
public
hasBool() : bool
Tags
Return values
boolhasCallableType()
public
hasCallableType() : bool
Tags
Return values
boolhasClassStringMap()
public
hasClassStringMap() : bool
Tags
Return values
boolhasConditional()
public
hasConditional() : bool
Tags
Return values
boolhasFloat()
public
hasFloat() : bool
Tags
Return values
boolhasInt()
public
hasInt() : bool
Tags
Return values
boolhasIterable()
public
hasIterable() : bool
Tags
Return values
boolhasList()
public
hasList() : bool
Tags
Return values
boolhasLiteralClassString()
public
hasLiteralClassString() : bool
Tags
Return values
boolhasLiteralFloat()
public
hasLiteralFloat() : bool
Tags
Return values
boolhasLiteralInt()
public
hasLiteralInt() : bool
Tags
Return values
boolhasLiteralString()
public
hasLiteralString() : bool
Tags
Return values
boolhasLiteralValue()
public
hasLiteralValue() : bool
Tags
Return values
boolhasLowercaseString()
public
hasLowercaseString() : bool
Tags
Return values
boolhasMixed()
public
hasMixed() : bool
Tags
Return values
boolhasNamedObjectType()
public
hasNamedObjectType() : bool
Tags
Return values
boolhasNull()
public
hasNull() : bool
Tags
Return values
boolhasNumeric()
public
hasNumeric() : bool
Tags
Return values
boolhasObject()
public
hasObject() : bool
Tags
Return values
boolhasObjectType()
public
hasObjectType() : bool
Tags
Return values
boolhasScalar()
public
hasScalar() : bool
Tags
Return values
boolhasScalarType()
public
hasScalarType() : bool
Tags
Return values
boolhasStaticObject()
public
hasStaticObject() : bool
Tags
Return values
boolhasString()
public
hasString() : bool
Tags
Return values
boolhasTemplate()
public
hasTemplate() : bool
Tags
Return values
boolhasTemplateOrStatic()
public
hasTemplateOrStatic() : bool
Tags
Return values
boolhasType()
public
hasType(string $type_string) : bool
Parameters
- $type_string : string
Tags
Return values
boolisAlwaysFalsy()
public
isAlwaysFalsy() : bool
Tags
Return values
boolisAlwaysTruthy()
public
isAlwaysTruthy() : bool
Tags
Return values
boolisArray()
public
isArray() : bool
Tags
Return values
bool —true if this is an array
isArrayKey()
public
isArrayKey() : bool
Tags
Return values
boolisBool()
public
isBool() : bool
Tags
Return values
bool —true if this is a boolean
isEmptyArray()
public
isEmptyArray() : bool
Tags
Return values
boolisEmptyMixed()
public
isEmptyMixed() : bool
Tags
Return values
boolisFalsable()
public
isFalsable() : bool
Tags
Return values
boolisFalse()
public
isFalse() : bool
Tags
Return values
boolisFloat()
public
isFloat() : bool
Tags
Return values
bool —true if this is a float
isGenerator()
public
isGenerator() : bool
Tags
Return values
boolisInt()
public
isInt([bool $check_templates = false ]) : bool
Parameters
- $check_templates : bool = false
Tags
Return values
bool —true if this is an int
isMixed()
public
isMixed([bool $check_templates = false ]) : bool
Parameters
- $check_templates : bool = false
Tags
Return values
boolisNever()
public
isNever() : bool
Tags
Return values
boolisNonEmptyString()
public
isNonEmptyString([bool $check_templates = false ]) : bool
Parameters
- $check_templates : bool = false
Tags
Return values
bool —true if this is a string
isNull()
public
isNull() : bool
Tags
Return values
boolisNullable()
public
isNullable() : bool
Tags
Return values
boolisObjectType()
public
isObjectType() : bool
Tags
Return values
boolisSingle()
public
isSingle() : bool
Tags
Return values
boolisSingleAndMaybeNullable()
public
isSingleAndMaybeNullable() : bool
Tags
Return values
boolisSingleFloatLiteral()
public
isSingleFloatLiteral() : bool
Tags
Return values
bool —true if this is a float literal with only one possible value
isSingleIntLiteral()
public
isSingleIntLiteral() : bool
Tags
Return values
bool —true if this is an int literal with only one possible value
isSingleLiteral()
public
isSingleLiteral() : bool
Tags
Return values
boolisSingleStringLiteral()
public
isSingleStringLiteral() : bool
Tags
Return values
bool —true if this is a string literal with only one possible value
isStaticObject()
public
isStaticObject() : bool
Tags
Return values
boolisString()
public
isString([bool $check_templates = false ]) : bool
Parameters
- $check_templates : bool = false
Tags
Return values
bool —true if this is a string
isTemplatedClassString()
public
isTemplatedClassString() : bool
Tags
Return values
boolisTrue()
public
isTrue() : bool
Tags
Return values
boolisUnionEmpty()
public
isUnionEmpty() : bool
Tags
Return values
boolisVanillaMixed()
public
isVanillaMixed() : bool
Tags
Return values
boolisVoid()
public
isVoid() : bool
Tags
Return values
boolqueueClassLikesForScanning()
public
queueClassLikesForScanning(Codebase $codebase[, FileStorage|null $file_storage = null ][, array<string, mixed> $phantom_classes = [] ]) : void
Parameters
- $codebase : Codebase
- $file_storage : FileStorage|null = null
- $phantom_classes : array<string, mixed> = []
replaceClassLike()
public
replaceClassLike(string $old, string $new) : static
Parameters
- $old : string
- $new : string
Return values
statictoNamespacedString()
public
toNamespacedString(string|null $namespace, array<lowercase-string, string> $aliased_classes, string|null $this_class, bool $use_phpdoc_format) : string
Parameters
- $namespace : string|null
- $aliased_classes : array<lowercase-string, string>
- $this_class : string|null
- $use_phpdoc_format : bool
Tags
Return values
stringtoPhpString()
public
toPhpString(string|null $namespace, array<lowercase-string, string> $aliased_classes, string|null $this_class, int $analysis_php_version_id) : string|null
Parameters
- $namespace : string|null
- $aliased_classes : array<lowercase-string, string>
- $this_class : string|null
- $analysis_php_version_id : int
Tags
Return values
string|nullvisit()
public
visit(TypeVisitor $visitor) : bool
Parameters
- $visitor : TypeVisitor