Documentation

TTemplateValueOf extends Atomic
in package
uses UnserializeMemoryUsageSuppressionTrait

FinalYes

Represents the type used when using TValueOf when the type of the array or enum is a template

Tags
psalm-immutable

Table of Contents

Properties

$as  : Union
$checked  : bool
Whether or not the type has been checked yet
$defining_class  : string
$from_docblock  : bool
Whether or not the type comes from a docblock
$offset_end  : int|null
$offset_start  : int|null
$param_name  : string
$text  : string|null

Methods

__construct()  : mixed
__toString()  : string
__unserialize()  : void
canBeFullyExpressedInPhp()  : bool
create()  : Atomic
equals()  : bool
getAssertionString()  : string
This string is used in order to transform a type into an string assertion for the assertion module Default to self::getId()
getId()  : string
This is the true identifier for the type. It defaults to self::getKey() but can be overridden to be more precise
getIterable()  : TIterable
getKey()  : string
This is the string that will be used to represent the type in Union::$types. This means that two types sharing the same getKey value will override themselves in a Union
hasArrayAccessInterface()  : bool
hasCountableInterface()  : bool
hasTraversableInterface()  : bool
isArrayAccessibleWithIntOrStringKey()  : bool
isArrayAccessibleWithStringKey()  : bool
isCallableType()  : bool
isCountable()  : bool
isFalsy()  : bool
isIterable()  : bool
isNamedObjectType()  : bool
isNumericType()  : bool
isObjectType()  : bool
isTruthy()  : bool
replaceClassLike()  : static
replaceTemplateTypesWithArgTypes()  : static
replaceTemplateTypesWithStandins()  : static
setFromDocblock()  : static
toNamespacedString()  : string
Returns the detailed description of the type, either in phpdoc standard format or Psalm format depending on flag Default to self::getKey()
toPhpString()  : string|null
Returns a string representation of the type compatible with php signature or null if the type can't be expressed with the given php version
visit()  : bool
visitMutable()  : bool
__clone()  : mixed
getChildNodeKeys()  : array<int, string>

Properties

$checked

Whether or not the type has been checked yet

public bool $checked = false

$from_docblock

Whether or not the type comes from a docblock

public bool $from_docblock = false

$offset_end

public int|null $offset_end = null

$offset_start

public int|null $offset_start = null

$text

public string|null $text = null

Methods

__construct()

public __construct(string $param_name, string $defining_class, Union $as[, bool $from_docblock = false ]) : mixed
Parameters
$param_name : string
$defining_class : string
$as : Union
$from_docblock : bool = false

__toString()

public final __toString() : string
Return values
string

canBeFullyExpressedInPhp()

public canBeFullyExpressedInPhp(int $analysis_php_version_id) : bool
Parameters
$analysis_php_version_id : int
Return values
bool

create()

public static create(string $value[, int $analysis_php_version_id = null ][, array<string, array<string, Union>> $template_type_map = [] ][, array<string, TypeAlias$type_aliases = [] ][, int|null $offset_start = null ][, int|null $offset_end = null ][, string|null $text = null ][, bool $from_docblock = false ]) : Atomic
Parameters
$value : string
$analysis_php_version_id : int = null

contains php version when the type comes from signature

$template_type_map : array<string, array<string, Union>> = []
$type_aliases : array<string, TypeAlias> = []
$offset_start : int|null = null
$offset_end : int|null = null
$text : string|null = null
$from_docblock : bool = false
Tags
psalm-suppress

InaccessibleProperty Allowed during construction

Return values
Atomic

equals()

public equals(Atomic $other_type, bool $ensure_source_equality) : bool
Parameters
$other_type : Atomic
$ensure_source_equality : bool
Return values
bool

getAssertionString()

This string is used in order to transform a type into an string assertion for the assertion module Default to self::getId()

public getAssertionString() : string
Return values
string

getId()

This is the true identifier for the type. It defaults to self::getKey() but can be overridden to be more precise

public getId([bool $exact = true ][, bool $nested = false ]) : string
Parameters
$exact : bool = true
$nested : bool = false
Return values
string

getKey()

This is the string that will be used to represent the type in Union::$types. This means that two types sharing the same getKey value will override themselves in a Union

public getKey([bool $include_extra = true ]) : string
Parameters
$include_extra : bool = true
Return values
string

hasArrayAccessInterface()

public hasArrayAccessInterface(Codebase $codebase) : bool
Parameters
$codebase : Codebase
Return values
bool

hasCountableInterface()

public hasCountableInterface(Codebase $codebase) : bool
Parameters
$codebase : Codebase
Return values
bool

hasTraversableInterface()

public hasTraversableInterface(Codebase $codebase) : bool
Parameters
$codebase : Codebase
Tags
psalm-assert-if-true

TNamedObject $this

Return values
bool

isArrayAccessibleWithIntOrStringKey()

public isArrayAccessibleWithIntOrStringKey(Codebase $codebase) : bool
Parameters
$codebase : Codebase
Return values
bool

isArrayAccessibleWithStringKey()

public isArrayAccessibleWithStringKey(Codebase $codebase) : bool
Parameters
$codebase : Codebase
Return values
bool

isCallableType()

public isCallableType() : bool
Return values
bool

isCountable()

public isCountable(Codebase $codebase) : bool
Parameters
$codebase : Codebase
Return values
bool

isFalsy()

public isFalsy() : bool
Return values
bool

isNamedObjectType()

public isNamedObjectType() : bool
Return values
bool

isNumericType()

public isNumericType() : bool
Return values
bool

isObjectType()

public isObjectType() : bool
Return values
bool

isTruthy()

public isTruthy() : bool
Return values
bool

replaceClassLike()

public replaceClassLike(string $old, string $new) : static
Parameters
$old : string
$new : string
Return values
static

replaceTemplateTypesWithArgTypes()

public replaceTemplateTypesWithArgTypes(TemplateResult $template_result, Codebase|null $codebase) : static
Parameters
$template_result : TemplateResult
$codebase : Codebase|null
Return values
static

replaceTemplateTypesWithStandins()

public replaceTemplateTypesWithStandins(TemplateResult $template_result, Codebase $codebase[, StatementsAnalyzer|null $statements_analyzer = null ][, Atomic|null $input_type = null ][, int|null $input_arg_offset = null ][, string|null $calling_class = null ][, string|null $calling_function = null ][, bool $replace = true ][, bool $add_lower_bound = false ][, int $depth = 0 ]) : static
Parameters
$template_result : TemplateResult
$codebase : Codebase
$statements_analyzer : StatementsAnalyzer|null = null
$input_type : Atomic|null = null
$input_arg_offset : int|null = null
$calling_class : string|null = null
$calling_function : string|null = null
$replace : bool = true
$add_lower_bound : bool = false
$depth : int = 0
Return values
static

setFromDocblock()

public setFromDocblock(bool $from_docblock) : static
Parameters
$from_docblock : bool
Return values
static

toNamespacedString()

Returns the detailed description of the type, either in phpdoc standard format or Psalm format depending on flag Default to self::getKey()

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
Return values
string

toPhpString()

Returns a string representation of the type compatible with php signature or null if the type can't be expressed with the given php version

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

visitMutable()

public static visitMutable(MutableTypeVisitor $visitor, mixed &$node, bool $cloned) : bool
Parameters
$visitor : MutableTypeVisitor
$node : mixed
$cloned : bool
Tags
phpcsSuppress

SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingAnyTypeHint

Return values
bool

__clone()

protected __clone() : mixed

getChildNodeKeys()

protected getChildNodeKeys() : array<int, string>
Return values
array<int, string>

        
On this page

Search results