summaryrefslogtreecommitdiff
path: root/Zend/zend_weakrefs.stub.php
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-02-26 16:42:49 +0100
committerNikita Popov <nikita.ppv@gmail.com>2020-06-24 15:31:41 +0200
commitff19ec2df3ef0dca8c29be83eddcde58234f4095 (patch)
treebc6477f4f4e696cf599ec82a0a6dbf221bc5bc10 /Zend/zend_weakrefs.stub.php
parent4730b06f1d026047c63980298d358e28e2183de6 (diff)
downloadphp-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 'Zend/zend_weakrefs.stub.php')
-rw-r--r--Zend/zend_weakrefs.stub.php4
1 files changed, 3 insertions, 1 deletions
diff --git a/Zend/zend_weakrefs.stub.php b/Zend/zend_weakrefs.stub.php
index 4cf189b064..8cf0df5cf6 100644
--- a/Zend/zend_weakrefs.stub.php
+++ b/Zend/zend_weakrefs.stub.php
@@ -11,7 +11,7 @@ final class WeakReference
public function get(): ?object {}
}
-final class WeakMap implements ArrayAccess, Countable, Traversable
+final class WeakMap implements ArrayAccess, Countable, IteratorAggregate
{
/**
* @param object $object
@@ -32,4 +32,6 @@ final class WeakMap implements ArrayAccess, Countable, Traversable
public function offsetUnset($object): void {}
public function count(): int {}
+
+ public function getIterator(): Iterator {}
}