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::combineTypes([ self::getAtomic('int'), self::getAtomic('string') ]) ); } public function testArrayOfIntOrString() { $this->assertEquals( 'array', (string) Type::combineTypes([ self::getAtomic('array'), self::getAtomic('array') ]) ); } public function testArrayOfIntOrAlsoString() { $this->assertEquals( 'array|string', (string) Type::combineTypes([ self::getAtomic('array'), self::getAtomic('string') ]) ); } public function testEmptyArrays() { $this->assertEquals( 'array', (string) Type::combineTypes([ self::getAtomic('array'), self::getAtomic('array') ]) ); } public function testArrayStringOrEmptyArray() { $this->assertEquals( 'array', (string) Type::combineTypes([ self::getAtomic('array'), self::getAtomic('array') ]) ); } public function testArrayMixedOrString() { $this->assertEquals( 'array', (string) Type::combineTypes([ self::getAtomic('array'), self::getAtomic('array') ]) ); } public function testArrayMixedOrStringKeys() { $this->assertEquals( 'array', (string) Type::combineTypes([ self::getAtomic('array'), self::getAtomic('array') ]) ); } public function testArrayMixedOrEmpty() { $this->assertEquals( 'array', (string) Type::combineTypes([ self::getAtomic('array'), self::getAtomic('array') ]) ); } public function testArrayBigCombination() { $this->assertEquals( 'array', (string) Type::combineTypes([ self::getAtomic('array'), self::getAtomic('array') ]) ); } public function testFalseDestruction() { $this->assertEquals( 'bool', (string) Type::combineTypes([ self::getAtomic('false'), self::getAtomic('bool') ]) ); } public function testOnlyFalse() { $this->assertEquals( 'bool', (string) Type::combineTypes([ self::getAtomic('false') ]) ); } public function testFalseFalseDestruction() { $this->assertEquals( 'bool', (string) Type::combineTypes([ self::getAtomic('false'), self::getAtomic('false') ]) ); } public function testAAndAOfB() { $this->assertEquals( 'A', (string) Type::combineTypes([ self::getAtomic('A'), self::getAtomic('A') ]) ); } public function testMultipleValuedArray() { $stmts = self::$_parser->parse('check(); } }