]> granicus.if.org Git - php/commit
Introduce InternalIterator
authorNikita Popov <nikita.ppv@gmail.com>
Wed, 26 Feb 2020 15:42:49 +0000 (16:42 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Wed, 24 Jun 2020 13:31:41 +0000 (15:31 +0200)
commitff19ec2df3ef0dca8c29be83eddcde58234f4095
treebc6477f4f4e696cf599ec82a0a6dbf221bc5bc10
parent4730b06f1d026047c63980298d358e28e2183de6
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.
33 files changed:
UPGRADING
UPGRADING.INTERNALS
Zend/zend_interfaces.c
Zend/zend_interfaces.h
Zend/zend_interfaces.stub.php
Zend/zend_interfaces_arginfo.h
Zend/zend_weakrefs.c
Zend/zend_weakrefs.stub.php
Zend/zend_weakrefs_arginfo.h
ext/date/php_date.c
ext/date/php_date.stub.php
ext/date/php_date_arginfo.h
ext/date/tests/DatePeriod_IteratorAggregate.phpt [new file with mode: 0644]
ext/dom/namednodemap.c
ext/dom/nodelist.c
ext/dom/php_dom.c
ext/dom/php_dom.stub.php
ext/dom/php_dom_arginfo.h
ext/intl/breakiterator/breakiterator.stub.php
ext/intl/breakiterator/breakiterator_arginfo.h
ext/intl/breakiterator/breakiterator_class.cpp
ext/intl/breakiterator/breakiterator_methods.cpp
ext/intl/resourcebundle/resourcebundle.stub.php
ext/intl/resourcebundle/resourcebundle_arginfo.h
ext/intl/resourcebundle/resourcebundle_class.c
ext/mysqli/mysqli.c
ext/mysqli/mysqli.stub.php
ext/mysqli/mysqli_arginfo.h
ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt
ext/pdo/pdo_stmt.c
ext/pdo/pdo_stmt.stub.php
ext/pdo/pdo_stmt_arginfo.h
ext/pdo/tests/pdo_014.phpt