1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Fix #733 - DomNodeList implements ArrayAccess

This commit is contained in:
Matthew Brown 2018-05-11 23:21:53 -04:00
parent b9b2a909a1
commit 071558ec83
2 changed files with 10 additions and 0 deletions

View File

@ -454,6 +454,10 @@ class ClassLikes
return true;
}
if ($interface_id === 'arrayaccess' && $fq_class_name === 'domnodelist') {
return true;
}
if (isset(ClassLikeChecker::$SPECIAL_TYPES[$interface_id])
|| isset(ClassLikeChecker::$SPECIAL_TYPES[$fq_class_name])
) {

View File

@ -135,6 +135,12 @@ class ArrayAccessTest extends TestCase
$x[] = 5;
takesInt($x[0]);',
],
'domNodeListAccessible' => [
'<?php
$doc = new DOMDocument();
$doc->loadXML("<node key=\"value\"/>");
$doc->getElementsByTagName("node")[0];'
],
];
}