create(ParserFactory::PREFER_PHP7); } private static function getAtomic($string) { return array_values(Type::parseString($string)->types)[0]; } public function testIntOrString() { $this->assertEquals('int|string', (string) Type::parseString('int|string')); } 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')); } public function testGeneric() { $this->assertEquals('B', (string) Type::parseString('B')); } public function testObjectLike() { $this->assertEquals('object-like{a:int,b:string}', (string) Type::parseString('object-like{a:int,b:string}')); $this->assertEquals('object-like{a:int|string,b:string}', (string) Type::parseString('object-like{a:int|string,b:string}')); $this->assertEquals('object-like{a:array,b:string}', (string) Type::parseString('object-like{a:array,b:string}')); } }