mediawiki-extensions-Echo/includes/iterator/NotRecursiveIterator.php
Aryeh Gregor 3af6a04c69 Use IteratorDecorator from core
As far as I can tell, EchoIteratorDecorator is functionally identical to
IteratorDecorator from includes/libs/iterators/ in core, so why have a
separate copy? (EchoIteratorDecorator does pass through the return value
of next() or rewind(), if any, but there shouldn't be any per the
Iterator interface.)

Change-Id: Ic763ec19c15f67d9c9b42ebffb88c52b9056ed22
2022-05-02 13:44:41 +03:00

20 lines
476 B
PHP

<?php
/**
* Wraps a non-recursive iterator with methods to be recursive
* without children.
*
* Alternatively wraps a recursive iterator to prevent recursing deeper
* than the wrapped iterator.
*/
class EchoNotRecursiveIterator extends IteratorDecorator implements RecursiveIterator {
public function hasChildren() {
return false;
}
public function getChildren() {
// @phan-suppress-next-line PhanTypeMismatchReturnProbablyReal Never called
return null;
}
}