diff --git a/src/Psalm/Internal/Analyzer/Statements/Block/ForeachAnalyzer.php b/src/Psalm/Internal/Analyzer/Statements/Block/ForeachAnalyzer.php index 7f68a5c0d..b0b68879f 100644 --- a/src/Psalm/Internal/Analyzer/Statements/Block/ForeachAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/Statements/Block/ForeachAnalyzer.php @@ -742,10 +742,6 @@ class ForeachAnalyzer return; } - if ($generic_storage->stubbed && !$iterator_atomic_type instanceof Type\Atomic\TGenericObject) { - return; - } - if ($generic_storage->template_types || $iterator_atomic_type instanceof Type\Atomic\TGenericObject ) { diff --git a/tests/Loop/ForeachTest.php b/tests/Loop/ForeachTest.php index 9a2946e67..112a79069 100644 --- a/tests/Loop/ForeachTest.php +++ b/tests/Loop/ForeachTest.php @@ -825,6 +825,12 @@ class ForeachTest extends \Psalm\Tests\TestCase if ($a) {}', ], + 'domNodeListIterator' => [ + '