Documentation

TClosure extends TNamedObject
in package
uses CallableTrait

FinalYes

Represents a closure where we know the return type and params

Tags
psalm-immutable

Table of Contents

Properties

$byref_uses  : array<string|int, mixed>
$checked  : bool
Whether or not the type has been checked yet
$definite_class  : bool
Whether or not this type can represent a child of the class named in $value
$extra_types  : array<string, TNamedObject|TTemplateParam|TIterable|TObjectWithProperties|TCallableObject>
$from_docblock  : bool
Whether or not the type comes from a docblock
$is_pure  : bool|null
$is_static  : bool
$is_static_resolved  : bool
$offset_end  : int|null
$offset_start  : int|null
$params  : array<int, FunctionLikeParameter>|null
$return_type  : Union|null
$text  : string|null
$value  : string

Methods

__construct()  : mixed
__toString()  : string
__unserialize()  : void
addIntersectionType()  : static
canBeFullyExpressedInPhp()  : bool
create()  : Atomic
createFromName()  : TNamedObject
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
getIntersectionTypes()  : array<string, TNamedObject|TTemplateParam|TIterable|TObjectWithProperties|TCallableObject>
getIterable()  : TIterable
getKey()  : string
getParamString()  : string
getReturnTypeString()  : string
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
replace()  : static
replaceClassLike()  : static
replaceTemplateTypesWithArgTypes()  : static
replaceTemplateTypesWithStandins()  : static
setFromDocblock()  : static
setIntersectionTypes()  : static
setIsPure()  : static
setIsStatic()  : static
setValue()  : static
setValueIsStatic()  : static
toNamespacedString()  : string
toPhpString()  : string
visit()  : bool
visitMutable()  : bool
__clone()  : mixed
getCallableChildNodeKeys()  : array<int, string>
getChildNodeKeys()  : array<int, string>
replaceCallableTemplateTypesWithArgTypes()  : Union|null}|null
replaceCallableTemplateTypesWithStandins()  : Union|null}|null
replaceIntersectionTemplateTypesWithArgTypes()  : array<string, TNamedObject|TTemplateParam|TIterable|TObjectWithProperties|TCallableObject>|null
replaceIntersectionTemplateTypesWithStandins()  : array<string, TNamedObject|TTemplateParam|TIterable|TObjectWithProperties|TCallableObject>|null
getNamespacedIntersectionTypes()  : string

Properties

$byref_uses

public array<string|int, mixed> $byref_uses = []

$checked

Whether or not the type has been checked yet

public bool $checked = false

$definite_class

Whether or not this type can represent a child of the class named in $value

public bool $definite_class = false

$from_docblock

Whether or not the type comes from a docblock

public bool $from_docblock = false

$is_static_resolved

public bool $is_static_resolved = 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 $value = 'callable' ][, array<int, FunctionLikeParameter$params = null ][, Union|null $return_type = null ][, bool|null $is_pure = null ][, array<string, bool> $byref_uses = [] ][, array<string, TNamedObject|TTemplateParam|TIterable|TObjectWithProperties|TCallableObject$extra_types = [] ][, bool $from_docblock = false ]) : mixed
Parameters
$value : string = 'callable'

the name of the object

$params : array<int, FunctionLikeParameter> = null
$return_type : Union|null = null
$is_pure : bool|null = null
$byref_uses : array<string, bool> = []
$extra_types : array<string, TNamedObject|TTemplateParam|TIterable|TObjectWithProperties|TCallableObject> = []
$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

createFromName()

public static createFromName(string $value[, bool $is_static = false ][, bool $definite_class = false ][, array<string, TNamedObject|TTemplateParam|TIterable|TObjectWithProperties$extra_types = [] ][, bool $from_docblock = false ]) : TNamedObject
Parameters
$value : string
$is_static : bool = false
$definite_class : bool = false
$extra_types : array<string, TNamedObject|TTemplateParam|TIterable|TObjectWithProperties> = []
$from_docblock : bool = false
Return values
TNamedObject

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()

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

getKey()

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

getParamString()

public getParamString() : string
Return values
string

getReturnTypeString()

public getReturnTypeString() : string
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

setIsPure()

public setIsPure(bool $is_pure) : static
Parameters
$is_pure : bool
Return values
static

setIsStatic()

public setIsStatic(bool $is_static[, bool|null $is_static_resolved = null ]) : static
Parameters
$is_static : bool
$is_static_resolved : bool|null = null
Return values
static

setValue()

public setValue(string $value) : static
Parameters
$value : string
Return values
static

setValueIsStatic()

public setValueIsStatic(string $value, bool $is_static[, bool|null $is_static_resolved = null ]) : static
Parameters
$value : string
$is_static : bool
$is_static_resolved : bool|null = null
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
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
Parameters
$namespace : string|null
$aliased_classes : array<lowercase-string, string>
$this_class : string|null
$analysis_php_version_id : int
Return values
string

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

getCallableChildNodeKeys()

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

getChildNodeKeys()

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

replaceCallableTemplateTypesWithArgTypes()

protected replaceCallableTemplateTypesWithArgTypes(TemplateResult $template_result, Codebase|null $codebase) : Union|null}|null
Parameters
$template_result : TemplateResult
$codebase : Codebase|null
Return values
Union|null}|null

replaceCallableTemplateTypesWithStandins()

protected replaceCallableTemplateTypesWithStandins(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 ]) : Union|null}|null
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
Union|null}|null

replaceIntersectionTemplateTypesWithStandins()

protected replaceIntersectionTemplateTypesWithStandins(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 ]) : array<string, TNamedObject|TTemplateParam|TIterable|TObjectWithProperties|TCallableObject>|null
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
array<string, TNamedObject|TTemplateParam|TIterable|TObjectWithProperties|TCallableObject>|null

getNamespacedIntersectionTypes()

private getNamespacedIntersectionTypes(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

        
On this page

Search results