diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2020-02-26 16:42:49 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-06-24 15:31:41 +0200 |
commit | ff19ec2df3ef0dca8c29be83eddcde58234f4095 (patch) | |
tree | bc6477f4f4e696cf599ec82a0a6dbf221bc5bc10 /ext/dom/php_dom_arginfo.h | |
parent | 4730b06f1d026047c63980298d358e28e2183de6 (diff) | |
download | php-git-ff19ec2df3ef0dca8c29be83eddcde58234f4095.tar.gz |
Introduce InternalIterator
Userland classes that implement Traversable must do so either
through Iterator or IteratorAggregate. The same requirement does
not exist for internal classes: They can implement the internal
get_iterator mechanism, without exposing either the Iterator or
IteratorAggregate APIs. This makes them usable in get_iterator(),
but incompatible with any Iterator based APIs.
A lot of internal classes do this, because exposing the userland
APIs is simply a lot of work. This patch alleviates this issue by
providing a generic InternalIterator class, which acts as an
adapater between get_iterator and Iterator, and can be easily
used by many internal classes. At the same time, we extend the
requirement that Traversable implies Iterator or IteratorAggregate
to internal classes as well.
Closes GH-5216.
Diffstat (limited to 'ext/dom/php_dom_arginfo.h')
-rw-r--r-- | ext/dom/php_dom_arginfo.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/ext/dom/php_dom_arginfo.h b/ext/dom/php_dom_arginfo.h index 5e30511118..265782b50a 100644 --- a/ext/dom/php_dom_arginfo.h +++ b/ext/dom/php_dom_arginfo.h @@ -123,6 +123,9 @@ ZEND_END_ARG_INFO() #define arginfo_class_DOMNodeList_count arginfo_class_DOMNode_getLineNo +ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class_DOMNodeList_getIterator, 0, 0, Iterator, 0) +ZEND_END_ARG_INFO() + ZEND_BEGIN_ARG_INFO_EX(arginfo_class_DOMNodeList_item, 0, 0, 1) ZEND_ARG_TYPE_INFO(0, index, IS_LONG, 0) ZEND_END_ARG_INFO() @@ -404,6 +407,8 @@ ZEND_END_ARG_INFO() #define arginfo_class_DOMNamedNodeMap_count arginfo_class_DOMNode_getLineNo +#define arginfo_class_DOMNamedNodeMap_getIterator arginfo_class_DOMNodeList_getIterator + #define arginfo_class_DOMEntityReference___construct arginfo_class_DOMElement_getAttribute #define arginfo_class_DOMProcessingInstruction___construct arginfo_class_DOMAttr___construct @@ -470,6 +475,7 @@ ZEND_METHOD(DOMDocumentFragment, appendXML); ZEND_METHOD(DOMDocumentFragment, append); ZEND_METHOD(DOMDocumentFragment, prepend); ZEND_METHOD(DOMNodeList, count); +ZEND_METHOD(DOMNodeList, getIterator); ZEND_METHOD(DOMNodeList, item); ZEND_METHOD(DOMCharacterData, appendData); ZEND_METHOD(DOMCharacterData, substringData); @@ -564,6 +570,7 @@ ZEND_METHOD(DOMNamedNodeMap, getNamedItem); ZEND_METHOD(DOMNamedNodeMap, getNamedItemNS); ZEND_METHOD(DOMNamedNodeMap, item); ZEND_METHOD(DOMNamedNodeMap, count); +ZEND_METHOD(DOMNamedNodeMap, getIterator); ZEND_METHOD(DOMEntityReference, __construct); ZEND_METHOD(DOMProcessingInstruction, __construct); #if defined(LIBXML_XPATH_ENABLED) @@ -664,6 +671,7 @@ static const zend_function_entry class_DOMDocumentFragment_methods[] = { static const zend_function_entry class_DOMNodeList_methods[] = { ZEND_ME(DOMNodeList, count, arginfo_class_DOMNodeList_count, ZEND_ACC_PUBLIC) + ZEND_ME(DOMNodeList, getIterator, arginfo_class_DOMNodeList_getIterator, ZEND_ACC_PUBLIC) ZEND_ME(DOMNodeList, item, arginfo_class_DOMNodeList_item, ZEND_ACC_PUBLIC) ZEND_FE_END }; @@ -794,6 +802,7 @@ static const zend_function_entry class_DOMNamedNodeMap_methods[] = { ZEND_ME(DOMNamedNodeMap, getNamedItemNS, arginfo_class_DOMNamedNodeMap_getNamedItemNS, ZEND_ACC_PUBLIC) ZEND_ME(DOMNamedNodeMap, item, arginfo_class_DOMNamedNodeMap_item, ZEND_ACC_PUBLIC) ZEND_ME(DOMNamedNodeMap, count, arginfo_class_DOMNamedNodeMap_count, ZEND_ACC_PUBLIC) + ZEND_ME(DOMNamedNodeMap, getIterator, arginfo_class_DOMNamedNodeMap_getIterator, ZEND_ACC_PUBLIC) ZEND_FE_END }; |