mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
Merge pull request #7349 from orklah/hrtime2
Seal the array inferred for hrtime
This commit is contained in:
commit
a9bc132842
@ -326,12 +326,12 @@ class FunctionCallReturnTypeFetcher
|
||||
if (!$call_args) {
|
||||
switch ($call_map_key) {
|
||||
case 'hrtime':
|
||||
return new Union([
|
||||
new TKeyedArray([
|
||||
Type::getInt(),
|
||||
Type::getInt()
|
||||
])
|
||||
$keyed_array = new TKeyedArray([
|
||||
Type::getInt(),
|
||||
Type::getInt()
|
||||
]);
|
||||
$keyed_array->sealed = true;
|
||||
return new Union([$keyed_array]);
|
||||
|
||||
case 'get_called_class':
|
||||
return new Union([
|
||||
@ -441,20 +441,18 @@ class FunctionCallReturnTypeFetcher
|
||||
return $int;
|
||||
}
|
||||
|
||||
$keyed_array = new TKeyedArray([
|
||||
Type::getInt(),
|
||||
Type::getInt()
|
||||
]);
|
||||
$keyed_array->sealed = true;
|
||||
|
||||
if ((string) $first_arg_type === 'false') {
|
||||
return new Union([
|
||||
new TKeyedArray([
|
||||
Type::getInt(),
|
||||
Type::getInt()
|
||||
])
|
||||
]);
|
||||
return new Union([$keyed_array]);
|
||||
}
|
||||
|
||||
return new Union([
|
||||
new TKeyedArray([
|
||||
Type::getInt(),
|
||||
Type::getInt()
|
||||
]),
|
||||
$keyed_array,
|
||||
new TInt()
|
||||
]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user