assertEquals('int|string', (string) Type::parseString('int|string')); } /** * @return void */ public function testArray() { $this->assertEquals('array', (string) Type::parseString('array')); $this->assertEquals('array', (string) Type::parseString('array')); $this->assertEquals('array', (string) Type::parseString('array')); $this->assertEquals('array', (string) Type::parseString('array')); } /** * @return void */ public function testGeneric() { $this->assertEquals('B', (string) Type::parseString('B')); } /** * @return void */ public function testPhpDocStyle() { $this->assertEquals('array', (string) Type::parseString('A[]')); $this->assertEquals('array', (string) Type::parseString('(A|B)[]')); $this->assertEquals('array>', (string) Type::parseString('A[][]')); $this->assertEquals('array>', (string) Type::parseString('(A|B)[][]')); $this->assertEquals('array', (string) Type::parseString('A[]|B[]')); $this->assertEquals('array|C', (string) Type::parseString('A[]|B[]|C')); } /** * @return void */ public function testObjectLike() { $this->assertEquals('array{a:int, b:string}', (string) Type::parseString('array{a:int, b:string}')); $this->assertEquals( 'array{a:int|string, b:string}', (string) Type::parseString('array{a:int|string, b:string}') ); $this->assertEquals( 'array{a:array, b:string}', (string) Type::parseString('array{a:array, b:string}') ); } }