Skip to content

Commit

Permalink
Merge pull request #7349 from orklah/hrtime2
Browse files Browse the repository at this point in the history
Seal the array inferred for hrtime
  • Loading branch information
orklah committed Jan 8, 2022
2 parents 3502f04 + afc3a76 commit a9bc132
Showing 1 changed file with 13 additions and 15 deletions.
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 a9bc132

Please sign in to comment.