diff --git a/src/Psalm/Checker/Statements/Expression/Call/NewChecker.php b/src/Psalm/Checker/Statements/Expression/Call/NewChecker.php index b9169cc6d..675c67741 100644 --- a/src/Psalm/Checker/Statements/Expression/Call/NewChecker.php +++ b/src/Psalm/Checker/Statements/Expression/Call/NewChecker.php @@ -144,6 +144,12 @@ class NewChecker extends \Psalm\Checker\Statements\Expression\CallChecker continue; } + if ($lhs_type_part instanceof Type\Atomic\TNull + && $stmt->class->inferredType->ignore_nullable_issues + ) { + continue; + } + if (IssueBuffer::accepts( new UndefinedClass( 'Type ' . $lhs_type_part . ' cannot be called as a class', diff --git a/src/Psalm/Checker/Statements/Expression/Call/StaticCallChecker.php b/src/Psalm/Checker/Statements/Expression/Call/StaticCallChecker.php index ada9485d9..d5a5b6d49 100644 --- a/src/Psalm/Checker/Statements/Expression/Call/StaticCallChecker.php +++ b/src/Psalm/Checker/Statements/Expression/Call/StaticCallChecker.php @@ -224,6 +224,12 @@ class StaticCallChecker extends \Psalm\Checker\Statements\Expression\CallChecker continue; } + if ($lhs_type_part instanceof Type\Atomic\TNull + && $lhs_type->ignore_nullable_issues + ) { + continue; + } + if (IssueBuffer::accepts( new UndefinedClass( 'Type ' . $lhs_type_part . ' cannot be called as a class',