php-src/ext/simplexml/simplexml.stub.php
Nikita Popov 4730b06f1d Make SimpleXMLElement a RecursiveIterator
Context: https://externals.io/message/108789

This essentially moves the functionality of SimpleXMLIterator into
SimpleXMLElement, and makes SimpleXMLIterator a no-op extension.

Ideally SimpleXMLElement would be an IteratorAggregate, whose
getIterator() method returns SimpleXMLIterator. However, because
SimpleXMLIterator extends SimpleXMLElement (and code depends on
this in non-trivial ways), this is not possible.

The only way to not keep SimpleXMLElement as a magic Traversable
(that implements neither Iterator nor IteratorAggregate) is to
move the SimpleXMLIterator functionality into it.

Closes GH-5234.
2020-06-24 15:09:21 +02:00

80 lines
2.4 KiB
PHP

<?php
/** @generate-function-entries */
function simplexml_load_file(string $filename, ?string $class_name = SimpleXMLElement::class, int $options = 0, string $ns = '', bool $is_prefix = false): SimpleXMLElement|false {}
function simplexml_load_string(string $data, ?string $class_name = SimpleXMLElement::class, int $options = 0, string $ns = '', bool $is_prefix = false): SimpleXMLElement|false {}
function simplexml_import_dom(DOMNode $node, ?string $class_name = SimpleXMLElement::class): ?SimpleXMLElement {}
class SimpleXMLElement implements Stringable, Countable, RecursiveIterator
{
/** @return array|false */
public function xpath(string $path) {}
/** @return bool */
public function registerXPathNamespace(string $prefix, string $ns) {}
/** @return string|bool */
public function asXML(string $filename = UNKNOWN) {}
/**
* @return string|bool
* @alias SimpleXMLElement::asXML
*/
public function saveXML(string $filename = UNKNOWN) {}
/** @return array */
public function getNamespaces(bool $recursive = false) {}
/** @return array|false */
public function getDocNamespaces(bool $recursive = false, bool $from_root = true) {}
/** @return SimpleXMLIterator */
public function children(?string $ns = null, bool $is_prefix = false) {}
/** @return SimpleXMLIterator */
public function attributes(?string $ns = null, bool $is_prefix = false) {}
public function __construct(string $data, int $options = 0, bool $data_is_url = false, string $ns = '', bool $is_prefix = false) {}
/** @return SimpleXMLElement */
public function addChild(string $name, ?string $value = null, ?string $ns = null) {}
/** @return SimpleXMLElement */
public function addAttribute(string $name, ?string $value = null, ?string $ns = null) {}
/** @return string */
public function getName() {}
public function __toString(): string {}
/** @return int */
public function count() {}
/** @return void */
public function rewind() {}
/** @return bool */
public function valid() {}
/** @return ?SimpleXMLElement */
public function current() {}
/** @return string|false */
public function key() {}
/** @return void */
public function next() {}
/** @return bool */
public function hasChildren() {}
/** @return ?SimpleXMLElement */
public function getChildren() {}
}
class SimpleXMLIterator extends SimpleXMLElement
{
}