From c83afc1af21f0d434d066e80779d8ef5f0f049ca Mon Sep 17 00:00:00 2001 From: Matthew Brown Date: Tue, 5 Feb 2019 13:34:59 -0500 Subject: [PATCH] Fix element type inference for DOMNodeList --- .../Internal/Analyzer/Statements/Block/ForeachAnalyzer.php | 4 ---- tests/Loop/ForeachTest.php | 6 ++++++ 2 files changed, 6 insertions(+), 4 deletions(-) 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' => [ + '