diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallReturnTypeFetcher.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallReturnTypeFetcher.php index 7a61039cdc1..41dbfc51006 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallReturnTypeFetcher.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Call/FunctionCallReturnTypeFetcher.php @@ -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([ @@ -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() ]); }