1
0
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:
orklah 2022-01-08 22:40:20 +01:00 committed by GitHub
commit a9bc132842
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -326,12 +326,12 @@ class FunctionCallReturnTypeFetcher
if (!$call_args) { if (!$call_args) {
switch ($call_map_key) { switch ($call_map_key) {
case 'hrtime': case 'hrtime':
return new Union([ $keyed_array = new TKeyedArray([
new TKeyedArray([ Type::getInt(),
Type::getInt(), Type::getInt()
Type::getInt()
])
]); ]);
$keyed_array->sealed = true;
return new Union([$keyed_array]);
case 'get_called_class': case 'get_called_class':
return new Union([ return new Union([
@ -441,20 +441,18 @@ class FunctionCallReturnTypeFetcher
return $int; return $int;
} }
$keyed_array = new TKeyedArray([
Type::getInt(),
Type::getInt()
]);
$keyed_array->sealed = true;
if ((string) $first_arg_type === 'false') { if ((string) $first_arg_type === 'false') {
return new Union([ return new Union([$keyed_array]);
new TKeyedArray([
Type::getInt(),
Type::getInt()
])
]);
} }
return new Union([ return new Union([
new TKeyedArray([ $keyed_array,
Type::getInt(),
Type::getInt()
]),
new TInt() new TInt()
]); ]);
} }