diff --git a/stubs/CoreGenericClasses.phpstub b/stubs/CoreGenericClasses.phpstub index 8af9c4291..8a8b8d98f 100644 --- a/stubs/CoreGenericClasses.phpstub +++ b/stubs/CoreGenericClasses.phpstub @@ -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 { diff --git a/tests/ArrayAccessTest.php b/tests/ArrayAccessTest.php index e8314ff20..cf09a415d 100644 --- a/tests/ArrayAccessTest.php +++ b/tests/ArrayAccessTest.php @@ -835,6 +835,14 @@ class ArrayAccessTest extends TestCase return $s["a"]; }', ], + 'simpleXmlArrayFetchChildren' => [ + 'children() as $img) { + yield $img["src"] ?? ""; + } + }', + ], 'assertOnArrayAccess' => [ '