$types * * @return void */ public function testValidTypeCombination($expected, $types) { foreach ($types as $k => $type) { $types[$k] = self::getAtomic($type); } $this->assertSame( $expected, (string) Type::combineTypes($types) ); } /** * @return array */ public function providerFileCheckerValidCodeParse() { return [ 'multipleValuedArray' => [ ' [ 'int|string', [ 'int', 'string', ], ], 'arrayOfIntOrString' => [ 'array', [ 'array', 'array', ], ], 'arrayOfIntOrAlsoString' => [ 'array|string', [ 'array', 'string', ], ], 'emptyArrays' => [ 'array', [ 'array', 'array', ], ], 'arrayStringOrEmptyArray' => [ 'array', [ 'array', 'array', ], ], 'arrayMixedOrString' => [ 'array', [ 'array', 'array', ], ], 'arrayMixedOrStringKeys' => [ 'array', [ 'array', 'array', ], ], 'arrayMixedOrEmpty' => [ 'array', [ 'array', 'array', ], ], 'arrayBigCombination' => [ 'array', [ 'array', 'array', ], ], 'falseDestruction' => [ 'bool', [ 'false', 'bool', ], ], 'onlyFalse' => [ 'bool', [ 'false', ], ], 'falseFalseDestruction' => [ 'bool', [ 'false', 'false', ], ], 'aAndAOfB' => [ 'A', [ 'A', 'A', ], ], 'combineObjectType1' => [ 'array{a:int, b:string}', [ 'array{a:int}', 'array{b:string}', ], ], 'combineObjectType2' => [ 'array{a:int|string, b:string}', [ 'array{a:int}', 'array{a:string,b:string}', ], ], ]; } /** * @param string $string * * @return Type\Atomic */ private static function getAtomic($string) { return array_values(Type::parseString($string)->types)[0]; } }