1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00

Fix false-positive

This commit is contained in:
Brown 2020-05-02 21:56:28 -04:00
parent 3e0c4cfb75
commit d3fba74f75

View File

@ -509,6 +509,7 @@ class AssignmentAnalyzer
); );
$new_assign_type = null; $new_assign_type = null;
$assigned = false;
foreach ($assign_value_type->getAtomicTypes() as $assign_value_atomic_type) { foreach ($assign_value_type->getAtomicTypes() as $assign_value_atomic_type) {
if ($assign_value_atomic_type instanceof Type\Atomic\ObjectLike if ($assign_value_atomic_type instanceof Type\Atomic\ObjectLike
@ -541,6 +542,8 @@ class AssignmentAnalyzer
$doc_comment $doc_comment
); );
$assigned = true;
continue; continue;
} }
@ -713,6 +716,7 @@ class AssignmentAnalyzer
} }
} }
if (!$assigned) {
foreach ($var_comments as $var_comment) { foreach ($var_comments as $var_comment) {
if (!$var_comment->type) { if (!$var_comment->type) {
continue; continue;
@ -753,6 +757,7 @@ class AssignmentAnalyzer
} }
} }
} }
}
} elseif ($assign_var instanceof PhpParser\Node\Expr\ArrayDimFetch) { } elseif ($assign_var instanceof PhpParser\Node\Expr\ArrayDimFetch) {
ArrayAssignmentAnalyzer::analyze( ArrayAssignmentAnalyzer::analyze(
$statements_analyzer, $statements_analyzer,