Skip to content

Commit

Permalink
Merge pull request #7350 from orklah/hrtime3
Browse files Browse the repository at this point in the history
set the is_list flag for the array inferred for hrtime
  • Loading branch information
orklah committed Jan 8, 2022
2 parents a9bc132 + 48ebbe8 commit 771fbfa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Expand Up @@ -331,6 +331,7 @@ private static function getReturnTypeFromCallMapWithArgs(
Type::getInt()
]);
$keyed_array->sealed = true;
$keyed_array->is_list = true;
return new Union([$keyed_array]);

case 'get_called_class':
Expand Down Expand Up @@ -446,6 +447,7 @@ private static function getReturnTypeFromCallMapWithArgs(
Type::getInt()
]);
$keyed_array->sealed = true;
$keyed_array->is_list = true;

if ((string) $first_arg_type === 'false') {
return new Union([$keyed_array]);
Expand Down
6 changes: 3 additions & 3 deletions tests/FunctionCallTest.php
Expand Up @@ -1054,9 +1054,9 @@ class Props {
$d = hrtime(false);',
'assertions' => [
'$a' => 'int',
'$b' => 'array{0: int, 1: int}',
'$c' => 'array{0: int, 1: int}|int',
'$d' => 'array{0: int, 1: int}',
'$b' => 'array{int, int}',
'$c' => 'array{int, int}|int',
'$d' => 'array{int, int}',
],
],
'PHP73-hrtimeCanBeFloat' => [
Expand Down

0 comments on commit 771fbfa

Please sign in to comment.