mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
Change return type of range() from array<int, ...> to list<...>
This commit is contained in:
parent
e0d555e203
commit
038e7c9ff8
@ -58,27 +58,25 @@ class RangeReturnTypeProvider implements \Psalm\Plugin\Hook\FunctionReturnTypePr
|
||||
}
|
||||
|
||||
if ($all_ints) {
|
||||
return new Type\Union([new Type\Atomic\TArray([Type::getInt(), Type::getInt()])]);
|
||||
return new Type\Union([new Type\Atomic\TList(new Type\Union([new Type\Atomic\TInt]))]);
|
||||
}
|
||||
|
||||
if ($all_strings) {
|
||||
return new Type\Union([new Type\Atomic\TArray([Type::getInt(), Type::getString()])]);
|
||||
return new Type\Union([new Type\Atomic\TList(new Type\Union([new Type\Atomic\TString]))]);
|
||||
}
|
||||
|
||||
if ($all_floats) {
|
||||
return new Type\Union([new Type\Atomic\TArray([Type::getInt(), Type::getFloat()])]);
|
||||
return new Type\Union([new Type\Atomic\TList(new Type\Union([new Type\Atomic\TFloat]))]);
|
||||
}
|
||||
|
||||
if ($all_numbers) {
|
||||
return new Type\Union([new Type\Atomic\TArray([
|
||||
Type::getInt(),
|
||||
new Type\Union([new Type\Atomic\TInt, new Type\Atomic\TFloat]),
|
||||
])]);
|
||||
return new Type\Union([new Type\Atomic\TList(
|
||||
new Type\Union([new Type\Atomic\TInt, new Type\Atomic\TFloat])
|
||||
)]);
|
||||
}
|
||||
|
||||
return new Type\Union([new Type\Atomic\TArray([
|
||||
Type::getInt(),
|
||||
new Type\Union([new Type\Atomic\TInt, new Type\Atomic\TFloat, new Type\Atomic\TString]),
|
||||
])]);
|
||||
return new Type\Union([new Type\Atomic\TList(
|
||||
new Type\Union([new Type\Atomic\TInt, new Type\Atomic\TFloat, new Type\Atomic\TString])
|
||||
)]);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user