Documentation

UnionTrait

Tags
psalm-immutable
psalm-import-type

TProperties from Union

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
psalm-external-mutation-free

__toString()

public __toString() : string
Tags
psalm-mutation-free
Return values
string

allFloatLiterals()

public allFloatLiterals() : bool
Tags
psalm-mutation-free
Return values
bool

allIntLiterals()

public allIntLiterals() : bool
Tags
psalm-mutation-free
Return values
bool

allLiterals()

public allLiterals() : bool
Tags
psalm-mutation-free
psalm-assert-if-true

array< array-key, TLiteralString|TLiteralInt|TLiteralFloat|TNonspecificLiteralString|TNonSpecificLiteralInt|TFalse|TTrue

$this->getAtomicTypes()

Return values
bool

allSpecificLiterals()

public allSpecificLiterals() : bool
Tags
psalm-mutation-free
psalm-assert-if-true

array< array-key, TLiteralString|TLiteralInt|TLiteralFloat|TFalse|TTrue

$this->getAtomicTypes()

Return values
bool

allStringLiterals()

public allStringLiterals() : bool
Tags
psalm-mutation-free
Return values
bool

canBeFullyExpressedInPhp()

public canBeFullyExpressedInPhp(int $analysis_php_version_id) : bool
Parameters
$analysis_php_version_id : int
Tags
psalm-mutation-free
Return values
bool

canContainObjectType()

public canContainObjectType(Codebase $codebase) : bool
Parameters
$codebase : Codebase
Tags
psalm-mutation-free
Return values
bool

check()

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
bool

containsAnyLiteral()

public containsAnyLiteral() : bool
Tags
psalm-mutation-free
Return values
bool

containsClassLike()

public containsClassLike(lowercase-string $fq_class_like_name) : bool
Parameters
$fq_class_like_name : lowercase-string
Tags
psalm-mutation-free
Return values
bool

equals()

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
psalm-mutation-free
Return values
bool

getAtomicTypes()

public getAtomicTypes() : array<string|int, mixed>
Tags
psalm-mutation-free
Return values
array<string|int, mixed>

getClosureTypes()

public getClosureTypes() : array<string, TClosure>
Tags
psalm-mutation-free
Return values
array<string, TClosure>

getId()

public getId([bool $exact = true ]) : string
Parameters
$exact : bool = true
Tags
psalm-mutation-free
Return values
string

getKey()

public getKey() : string
Tags
psalm-mutation-free
Return values
string

getSingleFloatLiteral()

public getSingleFloatLiteral() : TLiteralFloat
Tags
psalm-mutation-free
throws
InvalidArgumentException

if isSingleFloatLiteral is false

Return values
TLiteralFloat

the only float literal represented by this union type

getSingleIntLiteral()

public getSingleIntLiteral() : TLiteralInt
Tags
throws
InvalidArgumentException

if isSingleIntLiteral is false

psalm-mutation-free
Return values
TLiteralInt

the only int literal represented by this union type

getSingleStringLiteral()

public getSingleStringLiteral() : TLiteralString
Tags
throws
InvalidArgumentException

if isSingleStringLiteral is false

psalm-mutation-free
Return values
TLiteralString

the only string literal represented by this union type

hasArray()

public hasArray() : bool
Tags
psalm-mutation-free
Return values
bool

hasArrayAccessInterface()

public hasArrayAccessInterface(Codebase $codebase) : bool
Parameters
$codebase : Codebase
Tags
psalm-mutation-free
Return values
bool

hasArrayKey()

public hasArrayKey() : bool
Tags
psalm-mutation-free
Return values
bool

hasBool()

public hasBool() : bool
Tags
psalm-mutation-free
Return values
bool

hasCallableType()

public hasCallableType() : bool
Tags
psalm-mutation-free
Return values
bool

hasClassStringMap()

public hasClassStringMap() : bool
Tags
psalm-mutation-free
Return values
bool

hasConditional()

public hasConditional() : bool
Tags
psalm-mutation-free
Return values
bool

hasFloat()

public hasFloat() : bool
Tags
psalm-mutation-free
Return values
bool

hasInt()

public hasInt() : bool
Tags
psalm-mutation-free
Return values
bool

hasIterable()

public hasIterable() : bool
Tags
psalm-mutation-free
Return values
bool

hasList()

public hasList() : bool
Tags
psalm-mutation-free
Return values
bool

hasLiteralClassString()

public hasLiteralClassString() : bool
Tags
psalm-mutation-free
Return values
bool

hasLiteralFloat()

public hasLiteralFloat() : bool
Tags
psalm-mutation-free
Return values
bool

hasLiteralInt()

public hasLiteralInt() : bool
Tags
psalm-mutation-free
Return values
bool

hasLiteralString()

public hasLiteralString() : bool
Tags
psalm-mutation-free
Return values
bool

hasLiteralValue()

public hasLiteralValue() : bool
Tags
psalm-mutation-free
Return values
bool

hasLowercaseString()

public hasLowercaseString() : bool
Tags
psalm-mutation-free
Return values
bool

hasMixed()

public hasMixed() : bool
Tags
psalm-mutation-free
Return values
bool

hasNamedObjectType()

public hasNamedObjectType() : bool
Tags
psalm-mutation-free
Return values
bool

hasNull()

public hasNull() : bool
Tags
psalm-mutation-free
Return values
bool

hasNumeric()

public hasNumeric() : bool
Tags
psalm-mutation-free
Return values
bool

hasObject()

public hasObject() : bool
Tags
psalm-mutation-free
Return values
bool

hasObjectType()

public hasObjectType() : bool
Tags
psalm-mutation-free
Return values
bool

hasScalar()

public hasScalar() : bool
Tags
psalm-mutation-free
Return values
bool

hasScalarType()

public hasScalarType() : bool
Tags
psalm-mutation-free
Return values
bool

hasStaticObject()

public hasStaticObject() : bool
Tags
psalm-mutation-free
Return values
bool

hasString()

public hasString() : bool
Tags
psalm-mutation-free
Return values
bool

hasTemplate()

public hasTemplate() : bool
Tags
psalm-mutation-free
Return values
bool

hasTemplateOrStatic()

public hasTemplateOrStatic() : bool
Tags
psalm-mutation-free
Return values
bool

hasType()

public hasType(string $type_string) : bool
Parameters
$type_string : string
Tags
psalm-mutation-free
Return values
bool

isAlwaysFalsy()

public isAlwaysFalsy() : bool
Tags
psalm-mutation-free
Return values
bool

isAlwaysTruthy()

public isAlwaysTruthy() : bool
Tags
psalm-mutation-free
Return values
bool

isArray()

public isArray() : bool
Tags
psalm-mutation-free
Return values
bool

true if this is an array

isArrayKey()

public isArrayKey() : bool
Tags
psalm-mutation-free
Return values
bool

isBool()

public isBool() : bool
Tags
psalm-mutation-free
Return values
bool

true if this is a boolean

isEmptyArray()

public isEmptyArray() : bool
Tags
psalm-mutation-free
Return values
bool

isEmptyMixed()

public isEmptyMixed() : bool
Tags
psalm-mutation-free
Return values
bool

isFalsable()

public isFalsable() : bool
Tags
psalm-mutation-free
Return values
bool

isFalse()

public isFalse() : bool
Tags
psalm-mutation-free
Return values
bool

isFloat()

public isFloat() : bool
Tags
psalm-mutation-free
Return values
bool

true if this is a float

isGenerator()

public isGenerator() : bool
Tags
psalm-mutation-free
Return values
bool

isInt()

public isInt([bool $check_templates = false ]) : bool
Parameters
$check_templates : bool = false
Tags
psalm-mutation-free
Return values
bool

true if this is an int

isMixed()

public isMixed([bool $check_templates = false ]) : bool
Parameters
$check_templates : bool = false
Tags
psalm-mutation-free
Return values
bool

isNever()

public isNever() : bool
Tags
psalm-mutation-free
Return values
bool

isNonEmptyString()

public isNonEmptyString([bool $check_templates = false ]) : bool
Parameters
$check_templates : bool = false
Tags
psalm-mutation-free
Return values
bool

true if this is a string

isNull()

public isNull() : bool
Tags
psalm-mutation-free
Return values
bool

isNullable()

public isNullable() : bool
Tags
psalm-mutation-free
Return values
bool

isObjectType()

public isObjectType() : bool
Tags
psalm-mutation-free
Return values
bool

isSingle()

public isSingle() : bool
Tags
psalm-mutation-free
Return values
bool

isSingleAndMaybeNullable()

public isSingleAndMaybeNullable() : bool
Tags
psalm-mutation-free
Return values
bool

isSingleFloatLiteral()

public isSingleFloatLiteral() : bool
Tags
psalm-mutation-free
Return values
bool

true if this is a float literal with only one possible value

isSingleIntLiteral()

public isSingleIntLiteral() : bool
Tags
psalm-mutation-free
Return values
bool

true if this is an int literal with only one possible value

isSingleLiteral()

public isSingleLiteral() : bool
Tags
psalm-mutation-free
Return values
bool

isSingleStringLiteral()

public isSingleStringLiteral() : bool
Tags
psalm-mutation-free
Return values
bool

true if this is a string literal with only one possible value

isStaticObject()

public isStaticObject() : bool
Tags
psalm-mutation-free
Return values
bool

isString()

public isString([bool $check_templates = false ]) : bool
Parameters
$check_templates : bool = false
Tags
psalm-mutation-free
Return values
bool

true if this is a string

isTemplatedClassString()

public isTemplatedClassString() : bool
Tags
psalm-mutation-free
Return values
bool

isTrue()

public isTrue() : bool
Tags
psalm-mutation-free
Return values
bool

isUnionEmpty()

public isUnionEmpty() : bool
Tags
psalm-mutation-free
Return values
bool

isVanillaMixed()

public isVanillaMixed() : bool
Tags
psalm-mutation-free
Return values
bool

isVoid()

public isVoid() : bool
Tags
psalm-mutation-free
Return values
bool

queueClassLikesForScanning()

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
static

toNamespacedString()

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
psalm-mutation-free
Return values
string

toPhpString()

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
psalm-mutation-free
Return values
string|null

        
On this page

Search results