diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/PropertyAssignmentAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/PropertyAssignmentAnalyzer.php index 2601f98e4..68ffa35b1 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/PropertyAssignmentAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Assignment/PropertyAssignmentAnalyzer.php @@ -364,11 +364,21 @@ class PropertyAssignmentAnalyzer ] ); + $suppressed_issues = $statements_analyzer->getSuppressedIssues(); + + if (!in_array('PossiblyNullReference', $suppressed_issues, true)) { + $statements_analyzer->addSuppressedIssues(['PossiblyNullReference']); + } + \Psalm\Internal\Analyzer\Statements\Expression\Call\MethodCallAnalyzer::analyze( $statements_analyzer, $fake_method_call, $context ); + + if (!in_array('PossiblyNullReference', $suppressed_issues, true)) { + $statements_analyzer->removeSuppressedIssues(['PossiblyNullReference']); + } } /* diff --git a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/PropertyFetchAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/PropertyFetchAnalyzer.php index b8423c6de..bbe252c4f 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/PropertyFetchAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Expression/Fetch/PropertyFetchAnalyzer.php @@ -492,12 +492,22 @@ class PropertyFetchAnalyzer ] ); + $suppressed_issues = $statements_analyzer->getSuppressedIssues(); + + if (!in_array('PossiblyNullReference', $suppressed_issues, true)) { + $statements_analyzer->addSuppressedIssues(['PossiblyNullReference']); + } + \Psalm\Internal\Analyzer\Statements\Expression\Call\MethodCallAnalyzer::analyze( $statements_analyzer, $fake_method_call, $context ); + if (!in_array('PossiblyNullReference', $suppressed_issues, true)) { + $statements_analyzer->removeSuppressedIssues(['PossiblyNullReference']); + } + $stmt->inferredType = $fake_method_call->inferredType ?? Type::getMixed(); /*