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 @@ -327,7 +327,8 @@ static inline zend_bool can_elide_return_type_check(
327
327
return 0 ;
328
328
}
329
329
330
- if (ZEND_TYPE_CODE (info -> type ) == IS_CALLABLE ) {
330
+ /* These types are not represented exactly */
331
+ if (ZEND_TYPE_CODE (info -> type ) == IS_CALLABLE || ZEND_TYPE_CODE (info -> type ) == IS_ITERABLE ) {
331
332
return 0 ;
332
333
}
333
334
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