/** * @return Type * Get a new type which is the generic array version of * this type. For instance, 'int' will produce 'int[]'. */ public function asGenericArrayType() : Type { if ($this->name == 'array' || $this->name == 'mixed' || strpos($this->name, '[]') !== false) { return ArrayType::instance(); } return GenericArrayType::fromElementType($this); }
public function testGenericArrayType() { $type = GenericArrayType::fromElementType(GenericArrayType::fromElementType(IntType::instance())); $this->assertEquals($type->genericArrayElementType()->__toString(), "int[]"); }