Documentation

TCallableKeyedArray extends TKeyedArray
in package
implements TCallableInterface

FinalYes

Denotes an object-like array that is _also_ `callable`.

Tags
psalm-immutable

Table of Contents

Interfaces

TCallableInterface

Constants

NAME_ARRAY  = 'callable-array'
NAME_LIST  = 'callable-array'

Properties

$checked  : bool
Whether or not the type has been checked yet
$class_strings  : array<string|int, mixed>|null
$fallback_params  : Union}|null
If the shape has fallback params then they are here
$from_docblock  : bool
Whether or not the type comes from a docblock
$is_list  : bool
$offset_end  : int|null
$offset_start  : int|null
$properties  : array<string|int, mixed>
$text  : string|null

Methods

__construct()  : mixed
Constructs a new instance of a generic type
__toString()  : string
__unserialize()  : void
allShapeKeysAlwaysDefined()  : bool
Whether all keys are always defined (ignores unsealedness).
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()
getGenericArrayType()  : TArray|TNonEmptyArray
getGenericKeyType()  : Union
getGenericValueType()  : Union
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
getMaxCount()  : int<1, max>|null
Returns null if there is no upper limit.
getMinCount()  : int<0, max>
hasArrayAccessInterface()  : bool
hasCountableInterface()  : bool
hasTraversableInterface()  : bool
isArrayAccessibleWithIntOrStringKey()  : bool
isArrayAccessibleWithStringKey()  : bool
isCallableType()  : bool
isCountable()  : bool
isFalsy()  : bool
isGenericList()  : bool
isIterable()  : bool
isNamedObjectType()  : bool
isNonEmpty()  : bool
isNumericType()  : bool
isObjectType()  : bool
isSealed()  : bool
isTruthy()  : bool
makeSealed()  : static
replaceClassLike()  : static
replaceTemplateTypesWithArgTypes()  : static
replaceTemplateTypesWithStandins()  : static
setFromDocblock()  : static
setProperties()  : 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
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>

Constants

Properties

$checked

Whether or not the type has been checked yet

public bool $checked = false

$class_strings

public array<string|int, mixed>|null $class_strings = null

$fallback_params

If the shape has fallback params then they are here

public Union}|null $fallback_params = null

$from_docblock

Whether or not the type comes from a docblock

public bool $from_docblock = false

$is_list

public bool $is_list = false
  • if this is a list of sequential elements

$offset_end

public int|null $offset_end = null

$offset_start

public int|null $offset_start = null

$properties

public array<string|int, mixed> $properties

$text

public string|null $text = null

Methods

__construct()

Constructs a new instance of a generic type

public __construct(array<string|int, mixed> $properties[, array<string, bool> $class_strings = null ][, Union}|null $fallback_params = null ][, bool $from_docblock = false ]) : mixed
Parameters
$properties : array<string|int, mixed>
$class_strings : array<string, bool> = null
$fallback_params : Union}|null = null
$from_docblock : bool = false

__toString()

public final __toString() : string
Return values
string

allShapeKeysAlwaysDefined()

Whether all keys are always defined (ignores unsealedness).

public allShapeKeysAlwaysDefined() : bool
Return values
bool

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

getGenericKeyType()

public getGenericKeyType([bool $possibly_undefined = false ]) : Union
Parameters
$possibly_undefined : bool = false
Return values
Union

getGenericValueType()

public getGenericValueType([bool $possibly_undefined = false ]) : Union
Parameters
$possibly_undefined : bool = false
Return values
Union

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

getMaxCount()

Returns null if there is no upper limit.

public getMaxCount() : int<1, max>|null
Return values
int<1, max>|null

getMinCount()

public getMinCount() : int<0, max>
Return values
int<0, max>

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

isGenericList()

public isGenericList() : bool
Tags
psalm-assert-if-true

list{Union} $this->properties

psalm-assert-if-true

list{Union, Union} $this->fallback_params

Return values
bool

isNamedObjectType()

public isNamedObjectType() : bool
Return values
bool

isNonEmpty()

public isNonEmpty() : bool
Return values
bool

isNumericType()

public isNumericType() : bool
Return values
bool

isObjectType()

public isObjectType() : bool
Return values
bool

isSealed()

public isSealed() : bool
Return values
bool

isTruthy()

public isTruthy() : bool
Return values
bool

makeSealed()

public makeSealed() : static
Return values
static

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

setProperties()

public setProperties(array<string|int, mixed> $properties) : static
Parameters
$properties : array<string|int, mixed>
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
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

getChildNodeKeys()

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

        
On this page

Search results