1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00

Fix element type inference for DOMNodeList

This commit is contained in:
Matthew Brown 2019-02-05 13:34:59 -05:00
parent 6d5c995458
commit c83afc1af2
2 changed files with 6 additions and 4 deletions

View File

@ -742,10 +742,6 @@ class ForeachAnalyzer
return; return;
} }
if ($generic_storage->stubbed && !$iterator_atomic_type instanceof Type\Atomic\TGenericObject) {
return;
}
if ($generic_storage->template_types if ($generic_storage->template_types
|| $iterator_atomic_type instanceof Type\Atomic\TGenericObject || $iterator_atomic_type instanceof Type\Atomic\TGenericObject
) { ) {

View File

@ -825,6 +825,12 @@ class ForeachTest extends \Psalm\Tests\TestCase
if ($a) {}', if ($a) {}',
], ],
'domNodeListIterator' => [
'<?php
function foo(DOMNodeList $list) : void {
foreach ($list as $item) {}
}'
],
]; ];
} }