com php-src: Limit covariance to array and Traversable: Zend/tests/type_declarations/iterable_004.phpt Ze nd/tests/type_declarations/iterable_005.phpt
Zend /zend_inheritance.c
| From: | Aaron Piotrowski | Date: | Mon, 06 Jun 2016 03:06:17 +0000 |
| Subject: | com php-src: Limit covariance to array and Traversable: Zend/tests/type_declarations/iterable_004.phpt Ze nd/tests/type_declarations/iterable_005.phpt Zend /zend_inheritance.c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-92749@lists.php.net to get a copy of this message | ||
Commit: 277d89cde8ed19c0e1f9f51e14bcb993f80e1d22
Author: Aaron Piotrowski <aaron@trowski.com> Sun, 5 Jun 2016 09:49:29 -0500
Parents: cf0290c27380e17d2407828c974882d39ed976f4
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=277d89cde8ed19c0e1f9f51e14bcb993f80e1d22
Log:
Limit covariance to array and Traversable
Changed paths:
M Zend/tests/type_declarations/iterable_004..phpt
M Zend/tests/type_declarations/iterable_005.phpt
M Zend/zend_inheritance.c
Diff:
diff --git a/Zend/tests/type_declarations/iterable_004.phpt
b/Zend/tests/type_declarations/iterable_004.phpt
index 8215dd6..47e79fa 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 cfb5551..9c0584b 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 1785f45..6c3dc74 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;
}