mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 12:55:26 +01:00
Don’t stop scanning loop contents due to possibly-null iterator
This commit is contained in:
parent
8c137527d4
commit
d18a4f4ccc
@ -366,8 +366,9 @@ class ForeachAnalyzer
|
||||
),
|
||||
$statements_analyzer->getSuppressedIssues()
|
||||
)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
} elseif ($iterator_type->isNullable() && !$iterator_type->ignore_nullable_issues) {
|
||||
if (IssueBuffer::accepts(
|
||||
new PossiblyNullIterator(
|
||||
@ -376,9 +377,13 @@ class ForeachAnalyzer
|
||||
),
|
||||
$statements_analyzer->getSuppressedIssues()
|
||||
)) {
|
||||
return false;
|
||||
// fall through
|
||||
}
|
||||
} elseif ($iterator_type->isFalsable() && !$iterator_type->ignore_falsable_issues) {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($iterator_type->isFalsable() && !$iterator_type->ignore_falsable_issues) {
|
||||
if (IssueBuffer::accepts(
|
||||
new PossiblyFalseIterator(
|
||||
'Cannot iterate over falsable var ' . $iterator_type,
|
||||
@ -386,8 +391,10 @@ class ForeachAnalyzer
|
||||
),
|
||||
$statements_analyzer->getSuppressedIssues()
|
||||
)) {
|
||||
return false;
|
||||
// fall through
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
$has_valid_iterator = false;
|
||||
|
Loading…
Reference in New Issue
Block a user