summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Reay <stephen.reay@me.com>2019-09-18 08:33:51 +0200
committerChristoph M. Becker <cmbecker69@gmx.de>2019-09-25 10:34:21 +0200
commitb0d80e16e355d328cdab2053a974e8d681674851 (patch)
tree43b77a17bddc0501b8f835a4062929cff3bc0b9d
parent2e6c91e3ab5e2affa77b10e9e9cb27f22ff39e32 (diff)
downloadphp-git-b0d80e16e355d328cdab2053a974e8d681674851.tar.gz
Add SimpleXML arginfo stubs
-rw-r--r--ext/simplexml/simplexml.c96
-rw-r--r--ext/simplexml/simplexml.stub.php53
-rw-r--r--ext/simplexml/simplexml_arginfo.h76
-rw-r--r--ext/simplexml/sxe.c20
-rw-r--r--ext/simplexml/sxe.stub.php25
-rw-r--r--ext/simplexml/sxe_arginfo.h16
6 files changed, 193 insertions, 93 deletions
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index 58d2cca910..bcf2c2ed0e 100644
--- a/ext/simplexml/simplexml.c
+++ b/ext/simplexml/simplexml.c
@@ -30,6 +30,7 @@
#include "ext/standard/php_string.h"
#include "php_simplexml.h"
#include "php_simplexml_exports.h"
+#include "simplexml_arginfo.h"
#include "zend_exceptions.h"
#include "zend_interfaces.h"
#include "sxe.h"
@@ -2559,73 +2560,6 @@ PHP_FUNCTION(simplexml_import_dom)
}
/* }}} */
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexml_load_file, 0, 0, 1)
- ZEND_ARG_INFO(0, filename)
- ZEND_ARG_INFO(0, class_name)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, ns)
- ZEND_ARG_INFO(0, is_prefix)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexml_load_string, 0, 0, 1)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, class_name)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, ns)
- ZEND_ARG_INFO(0, is_prefix)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexml_import_dom, 0, 0, 1)
- ZEND_ARG_INFO(0, node)
- ZEND_ARG_INFO(0, class_name)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexmlelement_xpath, 0, 0, 1)
- ZEND_ARG_INFO(0, path)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexmlelement_registerxpathnamespace, 0, 0, 2)
- ZEND_ARG_INFO(0, prefix)
- ZEND_ARG_INFO(0, ns)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexmlelement_asxml, 0, 0, 0)
- ZEND_ARG_INFO(0, filename)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexmlelement_getnamespaces, 0, 0, 0)
- ZEND_ARG_INFO(0, recursve)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexmlelement_getdocnamespaces, 0, 0, 0)
- ZEND_ARG_INFO(0, recursve)
- ZEND_ARG_INFO(0, from_root)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexmlelement_children, 0, 0, 0)
- ZEND_ARG_INFO(0, ns)
- ZEND_ARG_INFO(0, is_prefix)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexmlelement__construct, 0, 0, 1)
- ZEND_ARG_INFO(0, data)
- ZEND_ARG_INFO(0, options)
- ZEND_ARG_INFO(0, data_is_url)
- ZEND_ARG_INFO(0, ns)
- ZEND_ARG_INFO(0, is_prefix)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO(arginfo_simplexmlelement__void, 0)
-ZEND_END_ARG_INFO()
-
-ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexmlelement_addchild, 0, 0, 1)
- ZEND_ARG_INFO(0, name)
- ZEND_ARG_INFO(0, value)
- ZEND_ARG_INFO(0, ns)
-ZEND_END_ARG_INFO()
-/* }}} */
-
static const zend_function_entry simplexml_functions[] = { /* {{{ */
PHP_FE(simplexml_load_file, arginfo_simplexml_load_file)
PHP_FE(simplexml_load_string, arginfo_simplexml_load_string)
@@ -2663,20 +2597,20 @@ ZEND_GET_MODULE(simplexml)
/* the method table */
/* each method can have its own parameters and visibility */
static const zend_function_entry sxe_functions[] = { /* {{{ */
- SXE_ME(__construct, arginfo_simplexmlelement__construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) /* must be called */
- SXE_ME(asXML, arginfo_simplexmlelement_asxml, ZEND_ACC_PUBLIC)
- SXE_MALIAS(saveXML, asXML, arginfo_simplexmlelement_asxml, ZEND_ACC_PUBLIC)
- SXE_ME(xpath, arginfo_simplexmlelement_xpath, ZEND_ACC_PUBLIC)
- SXE_ME(registerXPathNamespace, arginfo_simplexmlelement_registerxpathnamespace, ZEND_ACC_PUBLIC)
- SXE_ME(attributes, arginfo_simplexmlelement_children, ZEND_ACC_PUBLIC)
- SXE_ME(children, arginfo_simplexmlelement_children, ZEND_ACC_PUBLIC)
- SXE_ME(getNamespaces, arginfo_simplexmlelement_getnamespaces, ZEND_ACC_PUBLIC)
- SXE_ME(getDocNamespaces, arginfo_simplexmlelement_getdocnamespaces, ZEND_ACC_PUBLIC)
- SXE_ME(getName, arginfo_simplexmlelement__void, ZEND_ACC_PUBLIC)
- SXE_ME(addChild, arginfo_simplexmlelement_addchild, ZEND_ACC_PUBLIC)
- SXE_ME(addAttribute, arginfo_simplexmlelement_addchild, ZEND_ACC_PUBLIC)
- SXE_ME(__toString, arginfo_simplexmlelement__void, ZEND_ACC_PUBLIC)
- SXE_ME(count, arginfo_simplexmlelement__void, ZEND_ACC_PUBLIC)
+ SXE_ME(__construct, arginfo_class_SimpleXMLElement___construct, ZEND_ACC_PUBLIC|ZEND_ACC_FINAL) /* must be called */
+ SXE_ME(asXML, arginfo_class_SimpleXMLElement_asXML, ZEND_ACC_PUBLIC)
+ SXE_MALIAS(saveXML, asXML, arginfo_class_SimpleXMLElement_saveXML, ZEND_ACC_PUBLIC)
+ SXE_ME(xpath, arginfo_class_SimpleXMLElement_xpath, ZEND_ACC_PUBLIC)
+ SXE_ME(registerXPathNamespace, arginfo_class_SimpleXMLElement_registerXPathNamespace, ZEND_ACC_PUBLIC)
+ SXE_ME(attributes, arginfo_class_SimpleXMLElement_attributes, ZEND_ACC_PUBLIC)
+ SXE_ME(children, arginfo_class_SimpleXMLElement_children, ZEND_ACC_PUBLIC)
+ SXE_ME(getNamespaces, arginfo_class_SimpleXMLElement_getNamespaces, ZEND_ACC_PUBLIC)
+ SXE_ME(getDocNamespaces, arginfo_class_SimpleXMLElement_getDocNamespaces, ZEND_ACC_PUBLIC)
+ SXE_ME(getName, arginfo_class_SimpleXMLElement_getName, ZEND_ACC_PUBLIC)
+ SXE_ME(addChild, arginfo_class_SimpleXMLElement_addChild, ZEND_ACC_PUBLIC)
+ SXE_ME(addAttribute, arginfo_class_SimpleXMLElement_addAttribute, ZEND_ACC_PUBLIC)
+ SXE_ME(__toString, arginfo_class_SimpleXMLElement___toString, ZEND_ACC_PUBLIC)
+ SXE_ME(count, arginfo_class_SimpleXMLElement_count, ZEND_ACC_PUBLIC)
PHP_FE_END
};
/* }}} */
diff --git a/ext/simplexml/simplexml.stub.php b/ext/simplexml/simplexml.stub.php
new file mode 100644
index 0000000000..dbbbfcba92
--- /dev/null
+++ b/ext/simplexml/simplexml.stub.php
@@ -0,0 +1,53 @@
+<?php
+
+/** @return SimpleXMLElement|false */
+function simplexml_load_file(string $filename, ?string $class_name = SimpleXMLElement::class, int $options = 0, string $ns = '', bool $is_prefix = false) {}
+
+/** @return SimpleXMLElement|false */
+function simplexml_load_string(string $data, ?string $class_name = SimpleXMLElement::class, int $options = 0, string $ns = '', bool $is_prefix = false) {}
+
+function simplexml_import_dom(DOMNode $node, ?string $class_name = SimpleXMLElement::class): ?SimpleXMLElement {}
+
+class SimpleXMLElement
+{
+ /** @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 */
+ 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() {}
+
+ /** @return string */
+ public function __toString() {}
+
+ /** @return int */
+ public function count() {}
+}
diff --git a/ext/simplexml/simplexml_arginfo.h b/ext/simplexml/simplexml_arginfo.h
new file mode 100644
index 0000000000..ccbbb47d00
--- /dev/null
+++ b/ext/simplexml/simplexml_arginfo.h
@@ -0,0 +1,76 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexml_load_file, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, class_name, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, ns, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, is_prefix, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_simplexml_load_string, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, class_name, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, ns, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, is_prefix, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_simplexml_import_dom, 0, 1, SimpleXMLElement, 1)
+ ZEND_ARG_OBJ_INFO(0, node, DOMNode, 0)
+ ZEND_ARG_TYPE_INFO(0, class_name, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SimpleXMLElement_xpath, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, path, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SimpleXMLElement_registerXPathNamespace, 0, 0, 2)
+ ZEND_ARG_TYPE_INFO(0, prefix, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, ns, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SimpleXMLElement_asXML, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SimpleXMLElement_saveXML arginfo_class_SimpleXMLElement_asXML
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SimpleXMLElement_getNamespaces, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, recursive, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SimpleXMLElement_getDocNamespaces, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, recursive, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, from_root, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SimpleXMLElement_children, 0, 0, 0)
+ ZEND_ARG_TYPE_INFO(0, ns, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, is_prefix, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SimpleXMLElement_attributes arginfo_class_SimpleXMLElement_children
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SimpleXMLElement___construct, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, options, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO(0, data_is_url, _IS_BOOL, 0)
+ ZEND_ARG_TYPE_INFO(0, ns, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, is_prefix, _IS_BOOL, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SimpleXMLElement_addChild, 0, 0, 1)
+ ZEND_ARG_TYPE_INFO(0, name, IS_STRING, 0)
+ ZEND_ARG_TYPE_INFO(0, value, IS_STRING, 1)
+ ZEND_ARG_TYPE_INFO(0, ns, IS_STRING, 1)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SimpleXMLElement_addAttribute arginfo_class_SimpleXMLElement_addChild
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SimpleXMLElement_getName, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SimpleXMLElement___toString arginfo_class_SimpleXMLElement_getName
+
+#define arginfo_class_SimpleXMLElement_count arginfo_class_SimpleXMLElement_getName
diff --git a/ext/simplexml/sxe.c b/ext/simplexml/sxe.c
index c60e37e264..115671534e 100644
--- a/ext/simplexml/sxe.c
+++ b/ext/simplexml/sxe.c
@@ -29,6 +29,7 @@
#include "ext/spl/php_spl.h"
#include "ext/spl/spl_iterators.h"
#include "sxe.h"
+#include "sxe_arginfo.h"
PHP_SXE_API zend_class_entry *ce_SimpleXMLIterator = NULL;
PHP_SXE_API zend_class_entry *ce_SimpleXMLElement;
@@ -166,19 +167,14 @@ PHP_METHOD(ce_SimpleXMLIterator, getChildren)
ZVAL_COPY_DEREF(return_value, data);
}
-/* {{{ arginfo */
-ZEND_BEGIN_ARG_INFO(arginfo_simplexmliterator__void, 0)
-ZEND_END_ARG_INFO()
-/* }}} */
-
static const zend_function_entry funcs_SimpleXMLIterator[] = {
- PHP_ME(ce_SimpleXMLIterator, rewind, arginfo_simplexmliterator__void, ZEND_ACC_PUBLIC)
- PHP_ME(ce_SimpleXMLIterator, valid, arginfo_simplexmliterator__void, ZEND_ACC_PUBLIC)
- PHP_ME(ce_SimpleXMLIterator, current, arginfo_simplexmliterator__void, ZEND_ACC_PUBLIC)
- PHP_ME(ce_SimpleXMLIterator, key, arginfo_simplexmliterator__void, ZEND_ACC_PUBLIC)
- PHP_ME(ce_SimpleXMLIterator, next, arginfo_simplexmliterator__void, ZEND_ACC_PUBLIC)
- PHP_ME(ce_SimpleXMLIterator, hasChildren, arginfo_simplexmliterator__void, ZEND_ACC_PUBLIC)
- PHP_ME(ce_SimpleXMLIterator, getChildren, arginfo_simplexmliterator__void, ZEND_ACC_PUBLIC)
+ PHP_ME(ce_SimpleXMLIterator, rewind, arginfo_class_SimpleXMLIterator_rewind, ZEND_ACC_PUBLIC)
+ PHP_ME(ce_SimpleXMLIterator, valid, arginfo_class_SimpleXMLIterator_valid, ZEND_ACC_PUBLIC)
+ PHP_ME(ce_SimpleXMLIterator, current, arginfo_class_SimpleXMLIterator_current, ZEND_ACC_PUBLIC)
+ PHP_ME(ce_SimpleXMLIterator, key, arginfo_class_SimpleXMLIterator_key, ZEND_ACC_PUBLIC)
+ PHP_ME(ce_SimpleXMLIterator, next, arginfo_class_SimpleXMLIterator_next, ZEND_ACC_PUBLIC)
+ PHP_ME(ce_SimpleXMLIterator, hasChildren, arginfo_class_SimpleXMLIterator_hasChildren, ZEND_ACC_PUBLIC)
+ PHP_ME(ce_SimpleXMLIterator, getChildren, arginfo_class_SimpleXMLIterator_getChildren, ZEND_ACC_PUBLIC)
PHP_FE_END
};
/* }}} */
diff --git a/ext/simplexml/sxe.stub.php b/ext/simplexml/sxe.stub.php
new file mode 100644
index 0000000000..98ea3327ba
--- /dev/null
+++ b/ext/simplexml/sxe.stub.php
@@ -0,0 +1,25 @@
+<?php
+
+class SimpleXMLIterator
+{
+ /** @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 ?SimpleXMLIterator */
+ public function getChildren() {}
+}
diff --git a/ext/simplexml/sxe_arginfo.h b/ext/simplexml/sxe_arginfo.h
new file mode 100644
index 0000000000..d3b0c6c479
--- /dev/null
+++ b/ext/simplexml/sxe_arginfo.h
@@ -0,0 +1,16 @@
+/* This is a generated file, edit the .stub.php file instead. */
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_class_SimpleXMLIterator_rewind, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+#define arginfo_class_SimpleXMLIterator_valid arginfo_class_SimpleXMLIterator_rewind
+
+#define arginfo_class_SimpleXMLIterator_current arginfo_class_SimpleXMLIterator_rewind
+
+#define arginfo_class_SimpleXMLIterator_key arginfo_class_SimpleXMLIterator_rewind
+
+#define arginfo_class_SimpleXMLIterator_next arginfo_class_SimpleXMLIterator_rewind
+
+#define arginfo_class_SimpleXMLIterator_hasChildren arginfo_class_SimpleXMLIterator_rewind
+
+#define arginfo_class_SimpleXMLIterator_getChildren arginfo_class_SimpleXMLIterator_rewind