summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Zend/tests/type_declarations/iterable_004.phpt4
-rw-r--r--Zend/tests/type_declarations/iterable_005.phpt12
-rw-r--r--Zend/zend_inheritance.c15
3 files changed, 3 insertions, 28 deletions
diff --git a/Zend/tests/type_declarations/iterable_004.phpt b/Zend/tests/type_declarations/iterable_004.phpt
index 8215dd686b..47e79fa6b3 100644
--- a/Zend/tests/type_declarations/iterable_004.phpt
+++ b/Zend/tests/type_declarations/iterable_004.phpt
@@ -8,8 +8,6 @@ class Foo {
function testTraversable(Traversable $traversable) {}
- function testGenerator(Generator $generator) {}
-
function testScalar(int $int) {}
}
@@ -18,8 +16,6 @@ class Bar extends Foo {
function testTraversable(iterable $iterable) {}
- function testGenerator(iterable $iterable) {}
-
function testScalar(iterable $iterable) {}
}
diff --git a/Zend/tests/type_declarations/iterable_005.phpt b/Zend/tests/type_declarations/iterable_005.phpt
index cfb55517e0..9c0584b51a 100644
--- a/Zend/tests/type_declarations/iterable_005.phpt
+++ b/Zend/tests/type_declarations/iterable_005.phpt
@@ -21,18 +21,6 @@ class TestTraversable extends Test {
}
}
-class TestIterator extends Test {
- function method(): Iterator {
- return new ArrayIterator([]);
- }
-}
-
-class TestGenerator extends Test {
- function method(): Generator {
- return (function () { yield; })();
- }
-}
-
class TestScalar extends Test {
function method(): int {
return 1;
diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c
index 1785f45372..6c3dc743fb 100644
--- a/Zend/zend_inheritance.c
+++ b/Zend/zend_inheritance.c
@@ -22,7 +22,6 @@
#include "zend_compile.h"
#include "zend_execute.h"
#include "zend_inheritance.h"
-#include "zend_interfaces.h"
#include "zend_smart_str.h"
#include "zend_inheritance.h"
@@ -170,19 +169,11 @@ char *zend_visibility_string(uint32_t fn_flags) /* {{{ */
static zend_bool zend_iterable_type_check(zend_arg_info *arg_info) /* {{{ */
{
- if (arg_info->class_name) {
- zend_class_entry *ce;
-
- ce = zend_lookup_class(arg_info->class_name);
-
- if (ce && instanceof_function(ce, zend_ce_traversable)) {
- return 1;
- }
-
- return 0;
+ if (arg_info->type_hint == IS_ITERABLE || arg_info->type_hint == IS_ARRAY) {
+ return 1;
}
- if (arg_info->type_hint == IS_ITERABLE || arg_info->type_hint == IS_ARRAY) {
+ if (arg_info->class_name && zend_string_equals_literal_ci(arg_info->class_name, "Traversable")) {
return 1;
}