File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -302,7 +302,8 @@ static inline zend_bool can_elide_return_type_check(
302
302
return 0 ;
303
303
}
304
304
305
- if (ZEND_TYPE_CODE (info -> type ) == IS_CALLABLE ) {
305
+ /* These types are not represented exactly */
306
+ if (ZEND_TYPE_CODE (info -> type ) == IS_CALLABLE || ZEND_TYPE_CODE (info -> type ) == IS_ITERABLE ) {
306
307
return 0 ;
307
308
}
308
309
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Don't optimize object -> iterable
3
+ --FILE--
4
+ <?php
5
+
6
+ function test (object $ arg ): iterable {
7
+ return $ arg ;
8
+ }
9
+ test (new stdClass );
10
+
11
+ ?>
12
+ --EXPECTF--
13
+ Fatal error: Uncaught TypeError: Return value of test() must be iterable, object returned in %s:%d
14
+ Stack trace:
15
+ #0 %s(%d): test(Object(stdClass))
16
+ #1 {main}
17
+ thrown in %s on line %d
You can’t perform that action at this time.
0 commit comments