TArrayKey
extends Scalar
in package
Denotes the `array-key` type, used for something that could be the offset of an `array`.
Tags
Table of Contents
Properties
- $checked : bool
- Whether or not the type has been checked yet
- $from_docblock : bool
- Whether or not the type comes from a docblock
- $offset_end : int|null
- $offset_start : int|null
- $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([bool $from_docblock = false ]) : mixed
Parameters
- $from_docblock : bool = false
__toString()
public
final __toString() : string
Return values
string__unserialize()
public
__unserialize(array<string|int, mixed> $properties) : void
Parameters
- $properties : array<string|int, mixed>
canBeFullyExpressedInPhp()
public
canBeFullyExpressedInPhp(int $analysis_php_version_id) : bool
Parameters
- $analysis_php_version_id : int
Return values
boolcreate()
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
Return values
Atomicequals()
public
equals(Atomic $other_type, bool $ensure_source_equality) : bool
Parameters
- $other_type : Atomic
- $ensure_source_equality : bool
Return values
boolgetAssertionString()
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
stringgetId()
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
stringgetIterable()
public
getIterable(Codebase $codebase) : TIterable
Parameters
- $codebase : Codebase
Tags
Return values
TIterablegetKey()
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
stringhasArrayAccessInterface()
public
hasArrayAccessInterface(Codebase $codebase) : bool
Parameters
- $codebase : Codebase
Return values
boolhasCountableInterface()
public
hasCountableInterface(Codebase $codebase) : bool
Parameters
- $codebase : Codebase
Return values
boolhasTraversableInterface()
public
hasTraversableInterface(Codebase $codebase) : bool
Parameters
- $codebase : Codebase
Tags
Return values
boolisArrayAccessibleWithIntOrStringKey()
public
isArrayAccessibleWithIntOrStringKey(Codebase $codebase) : bool
Parameters
- $codebase : Codebase
Return values
boolisArrayAccessibleWithStringKey()
public
isArrayAccessibleWithStringKey(Codebase $codebase) : bool
Parameters
- $codebase : Codebase
Return values
boolisCallableType()
public
isCallableType() : bool
Return values
boolisCountable()
public
isCountable(Codebase $codebase) : bool
Parameters
- $codebase : Codebase
Return values
boolisFalsy()
public
isFalsy() : bool
Return values
boolisIterable()
public
isIterable(Codebase $codebase) : bool
Parameters
- $codebase : Codebase
Return values
boolisNamedObjectType()
public
isNamedObjectType() : bool
Return values
boolisNumericType()
public
isNumericType() : bool
Return values
boolisObjectType()
public
isObjectType() : bool
Return values
boolisTruthy()
public
isTruthy() : bool
Return values
boolreplaceClassLike()
public
replaceClassLike(string $old, string $new) : static
Parameters
- $old : string
- $new : string
Return values
staticreplaceTemplateTypesWithArgTypes()
public
replaceTemplateTypesWithArgTypes(TemplateResult $template_result, Codebase|null $codebase) : static
Parameters
- $template_result : TemplateResult
- $codebase : Codebase|null
Return values
staticreplaceTemplateTypesWithStandins()
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
staticsetFromDocblock()
public
setFromDocblock(bool $from_docblock) : static
Parameters
- $from_docblock : bool
Return values
statictoNamespacedString()
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
stringtoPhpString()
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|nullvisit()
public
visit(TypeVisitor $visitor) : bool
Parameters
- $visitor : TypeVisitor
Return values
boolvisitMutable()
public
static visitMutable(MutableTypeVisitor $visitor, mixed &$node, bool $cloned) : bool
Parameters
- $visitor : MutableTypeVisitor
- $node : mixed
- $cloned : bool
Tags
Return values
bool__clone()
protected
__clone() : mixed
getChildNodeKeys()
protected
getChildNodeKeys() : array<int, string>