Skip to content

Commit ba4a7cf

Browse files
Add test
1 parent 493e2de commit ba4a7cf

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
namespace Bug9575;
4+
5+
use SimpleXMLElement;
6+
use function PHPStan\Testing\assertType;
7+
8+
$string = <<<XML
9+
<a>
10+
<foo name="one" game="lonely">1</foo>
11+
</a>
12+
XML;
13+
14+
$xml = new SimpleXMLElement($string);
15+
foreach($xml->foo[0]->attributes() as $a => $b) {
16+
echo $a,'="',$b,"\"\n";
17+
}
18+
19+
assertType('(SimpleXMLElement|null)', $xml->foo);
20+
assertType('(SimpleXMLElement|null)', $xml->foo[0]);
21+
assertType('(SimpleXMLElement|null)', $xml->foobar);
22+
assertType('(SimpleXMLElement|null)', $xml->foo->attributes());

0 commit comments

Comments
 (0)