diff --git a/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeNodeScanner.php b/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeNodeScanner.php index f04a90072d0..f0a8f34cc63 100644 --- a/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeNodeScanner.php +++ b/src/Psalm/Internal/PhpVisitor/Reflector/FunctionLikeNodeScanner.php @@ -825,7 +825,9 @@ private function getTranslatedFunctionParam( $this->codebase->analysis_php_version_id, ); - if ($is_nullable) { + if ($param_type->isMixed()) { + $is_nullable = false; + } elseif ($is_nullable) { $param_type = $param_type->getBuilder()->addType(new TNull)->freeze(); } else { $is_nullable = $param_type->isNullable(); diff --git a/tests/ArgTest.php b/tests/ArgTest.php index 5fefdbef086..36efb359362 100644 --- a/tests/ArgTest.php +++ b/tests/ArgTest.php @@ -355,6 +355,20 @@ function foo($a, ...$b) {} var_caller("foo");', ], + 'mixedNullable' => [ + 'code' => 'default;', + 'assertions' => [ + '$_v===' => 'mixed', + ], + 'ignored_issues' => [], + 'php_version' => '8.0', + ], ]; }