Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions src/Type/Symfony/InputBagDynamicReturnTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,11 @@ private function getAllTypeFromMethodCall(
MethodCall $methodCall
): Type
{
$types = [
new BooleanType(),
new FloatType(),
new IntegerType(),
new StringType(),
];
$oneParameterType = new UnionType($types);
if (isset($methodCall->getArgs()[0])) {
return new ArrayType(new MixedType(), $oneParameterType);
return new ArrayType(new MixedType(), new MixedType(true));
}

return new ArrayType(new StringType(), new UnionType([new ArrayType(new MixedType(), $oneParameterType), new BooleanType(), new FloatType(), new IntegerType(), new StringType()]));
return new ArrayType(new StringType(), new UnionType([new ArrayType(new MixedType(), new MixedType(true)), new BooleanType(), new FloatType(), new IntegerType(), new StringType()]));
}

}
4 changes: 2 additions & 2 deletions tests/Type/Symfony/data/input_bag.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
assertType('bool|float|int|string|null', $bag->get('foo', null));
assertType('bool|float|int|string', $bag->get('foo', ''));
assertType('bool|float|int|string', $bag->get('foo', 'baz'));
assertType('array<string, array<bool|float|int|string>|bool|float|int|string>', $bag->all());
assertType('array<bool|float|int|string>', $bag->all('bar'));
assertType('array<string, array|bool|float|int|string>', $bag->all());
assertType('array', $bag->all('bar'));