Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seal the array inferred for hrtime #7349

Merged
merged 1 commit into from Jan 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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