mirror of
https://github.com/danog/psalm.git
synced 2025-01-21 21:31:13 +01:00
Add support for if replacement
This commit is contained in:
parent
8154a9ef16
commit
a5c3304853
@ -1053,6 +1053,28 @@ class StatementsAnalyzer extends SourceAnalyzer implements StatementsSource
|
||||
if ($search_result[0] && $search_result[1]) {
|
||||
return $search_result;
|
||||
}
|
||||
} elseif ($stmt instanceof PhpParser\Node\Stmt\If_) {
|
||||
$search_result = $this->findAssignStmt($stmt->stmts, $var_id, $original_location);
|
||||
|
||||
if ($search_result[0] && $search_result[1]) {
|
||||
return $search_result;
|
||||
}
|
||||
|
||||
foreach ($stmt->elseifs as $elseif_stmt) {
|
||||
$search_result = $this->findAssignStmt($elseif_stmt->stmts, $var_id, $original_location);
|
||||
|
||||
if ($search_result[0] && $search_result[1]) {
|
||||
return $search_result;
|
||||
}
|
||||
}
|
||||
|
||||
if ($stmt->else) {
|
||||
$search_result = $this->findAssignStmt($stmt->else->stmts, $var_id, $original_location);
|
||||
|
||||
if ($search_result[0] && $search_result[1]) {
|
||||
return $search_result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$i++;
|
||||
|
Loading…
x
Reference in New Issue
Block a user