Type Resolver

Array_ extends AbstractList
in package

Represents an array type as described in the PSR-5, the PHPDoc Standard.

An array can be represented in two forms:

  1. Untyped (array), where the key and value type is unknown and hence classified as 'Mixed_'.
  2. Types (string[]), where the value type is provided by preceding an opening and closing square bracket with a type name.
Tags
psalm-immutable

Table of Contents

Properties

$defaultKeyType  : Type
$keyType  : Type|null
$valueType  : Type

Methods

__construct()  : mixed
Initializes this representation of an array with the given Type.
__toString()  : string
Returns a rendered output of the Type as it would be used in a DocBlock.
getKeyType()  : Type
Returns the type for the keys of this array.
getValueType()  : Type
Returns the type for the values of this array.

Properties

Methods

__construct()

Initializes this representation of an array with the given Type.

public __construct([Type|null $valueType = null ][, Type|null $keyType = null ]) : mixed
Parameters
$valueType : Type|null = null
$keyType : Type|null = null

__toString()

Returns a rendered output of the Type as it would be used in a DocBlock.

public __toString() : string
Return values
string

getKeyType()

Returns the type for the keys of this array.

public getKeyType() : Type
Return values
Type

getValueType()

Returns the type for the values of this array.

public getValueType() : Type
Return values
Type

        
On this page

Search results