Skip to content

Commit

Permalink
Seal the array inferred for hrtime
Browse files Browse the repository at this point in the history
  • Loading branch information
orklah committed Jan 8, 2022
1 parent abd499c commit afc3a76
Showing 1 changed file with 13 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -326,12 +326,12 @@ private static function getReturnTypeFromCallMapWithArgs(
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([
Expand Down Expand Up @@ -441,20 +441,18 @@ private static function getReturnTypeFromCallMapWithArgs(
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()
]);
}
Expand Down

0 comments on commit afc3a76

Please sign in to comment.