1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 12:24:49 +01:00

Fix #5028 - avoid false-positive on dynamic property fetch after ternary

This commit is contained in:
Matt Brown 2021-01-17 11:59:59 -05:00 committed by Daniil Gentili
parent eb3c014106
commit 245b944c85
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7

View File

@ -176,7 +176,8 @@ class InstancePropertyFetchAnalyzer
}
if ($stmt_var_type->isNullable() && !$stmt_var_type->ignore_nullable_issues) {
if (!$context->inside_isset) {
// we can only be sure that the variable is possibly null if we know the var_id
if (!$context->inside_isset && $var_id) {
if (IssueBuffer::accepts(
new PossiblyNullPropertyFetch(
'Cannot get property on possibly null variable ' . $stmt_var_id . ' of type ' . $stmt_var_type,