PHP_METHOD(RecursiveIteratorIterator, getSubIterator)
{
spl_recursive_it_object *object = Z_SPLRECURSIVE_IT_P(ZEND_THIS);
- zend_long level = object->level;
+ zend_long level;
+ zend_bool level_is_null = 1;
zval *value;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &level) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|l!", &level, &level_is_null) == FAILURE) {
RETURN_THROWS();
}
- if (level < 0 || level > object->level) {
+
+ if (level_is_null) {
+ level = object->level;
+ } else if (level < 0 || level > object->level) {
RETURN_NULL();
}
}
case DIT_IteratorIterator: {
zend_class_entry *ce_cast;
- zend_string *class_name;
+ zend_string *class_name = NULL;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "O|S", &zobject, ce_inner, &class_name) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "O|S!", &zobject, ce_inner, &class_name) == FAILURE) {
return NULL;
}
ce = Z_OBJCE_P(zobject);
if (!instanceof_function(ce, zend_ce_iterator)) {
- if (ZEND_NUM_ARGS() > 1) {
+ if (class_name) {
if (!(ce_cast = zend_lookup_class(class_name))
|| !instanceof_function(ce, ce_cast)
|| !ce_cast->get_iterator
public function getDepth() {}
/** @return RecursiveIterator|null */
- public function getSubIterator(int $level = UNKNOWN) {}
+ public function getSubIterator(?int $level = null) {}
/** @return RecursiveIterator */
public function getInnerIterator() {}
class IteratorIterator implements OuterIterator
{
- /** @param Traversable $iterator */
- public function __construct($iterator, string $class_name = UNKNOWN) {}
+ public function __construct(Traversable $iterator, ?string $class_name = null) {}
/** @return Iterator|null */
public function getInnerIterator() {}
/* This is a generated file, edit the .stub.php file instead.
- * Stub hash: 38fb46070ea48e774343e59de53797969acf4b06 */
+ * Stub hash: 65bcea1c2313ff50b3e15588e1cdba036995c131 */
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_EmptyIterator_current, 0, 0, 0)
ZEND_END_ARG_INFO()
#define arginfo_class_RecursiveIteratorIterator_getDepth arginfo_class_EmptyIterator_current
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_RecursiveIteratorIterator_getSubIterator, 0, 0, 0)
- ZEND_ARG_TYPE_INFO(0, level, IS_LONG, 0)
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, level, IS_LONG, 1, "null")
ZEND_END_ARG_INFO()
#define arginfo_class_RecursiveIteratorIterator_getInnerIterator arginfo_class_EmptyIterator_current
#define arginfo_class_OuterIterator_getInnerIterator arginfo_class_EmptyIterator_current
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_IteratorIterator___construct, 0, 0, 1)
- ZEND_ARG_INFO(0, iterator)
- ZEND_ARG_TYPE_INFO(0, class_name, IS_STRING, 0)
+ ZEND_ARG_OBJ_INFO(0, iterator, Traversable, 0)
+ ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, class_name, IS_STRING, 1, "null")
ZEND_END_ARG_INFO()
#define arginfo_class_IteratorIterator_getInnerIterator arginfo_class_EmptyIterator_current