valueType = $valueType; $this->defaultKeyType = new Compound([new String_(), new Integer()]); $this->keyType = $keyType; } /** * Returns the type for the keys of this array. */ public function getKeyType() : Type { if ($this->keyType === null) { return $this->defaultKeyType; } return $this->keyType; } /** * Returns the value for the keys of this array. */ public function getValueType() : Type { return $this->valueType; } /** * Returns a rendered output of the Type as it would be used in a DocBlock. */ public function __toString() : string { if ($this->keyType) { return 'array<' . $this->keyType . ',' . $this->valueType . '>'; } if ($this->valueType instanceof Mixed_) { return 'array'; } if ($this->valueType instanceof Compound) { return '(' . $this->valueType . ')[]'; } return $this->valueType . '[]'; } }