mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
add ArrayAccess to SimpleXmlElement (#4934)
* add ArrayAccess to SimpleXmlElement * add test
This commit is contained in:
parent
d8fea8aabb
commit
c2c25ada84
@ -2215,7 +2215,7 @@ final class WeakReference
|
||||
public function get(): ?object;
|
||||
}
|
||||
|
||||
class SimpleXMLElement implements \Stringable, \Countable, \RecursiveIterator
|
||||
class SimpleXMLElement implements \Stringable, \Countable, \RecursiveIterator, \ArrayAccess
|
||||
{
|
||||
/** @return array */
|
||||
public function getNamespaces(bool $recursive = false)
|
||||
@ -2284,6 +2284,22 @@ class SimpleXMLElement implements \Stringable, \Countable, \RecursiveIterator
|
||||
public function getChildren()
|
||||
{
|
||||
}
|
||||
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
}
|
||||
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
}
|
||||
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
}
|
||||
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
interface Serializable {
|
||||
|
@ -835,6 +835,14 @@ class ArrayAccessTest extends TestCase
|
||||
return $s["a"];
|
||||
}',
|
||||
],
|
||||
'simpleXmlArrayFetchChildren' => [
|
||||
'<?php
|
||||
function iterator(SimpleXMLElement $xml): iterable {
|
||||
foreach ($xml->children() as $img) {
|
||||
yield $img["src"] ?? "";
|
||||
}
|
||||
}',
|
||||
],
|
||||
'assertOnArrayAccess' => [
|
||||
'<?php
|
||||
class A {
|
||||
|
Loading…
Reference in New Issue
Block a user