Skip to content

Commit b464c81

Browse files
committed
Warn also if return type is iterable
1 parent ba5d33d commit b464c81

File tree

64 files changed

+128
-3
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+128
-3
lines changed

Zend/zend_API.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2793,8 +2793,6 @@ ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend
27932793
ZEND_ASSERT(arg_info->name && "Parameter must have a name");
27942794
if (ZEND_TYPE_IS_SET(arg_info->type)) {
27952795
if (ZEND_TYPE_IS_ITERABLE_FALLBACK(arg_info->type)) {
2796-
zend_error(E_CORE_WARNING, "iterable type is now a compile time alias for array|Traversable,"
2797-
" regenerate the argument info via the php-src gen_stub build script");
27982796
rebuild_arginfo = true;
27992797
}
28002798
reg_function->common.fn_flags |= ZEND_ACC_HAS_TYPE_HINTS;
@@ -2867,10 +2865,11 @@ ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend
28672865
}
28682866
}
28692867
if (ZEND_TYPE_IS_ITERABLE_FALLBACK(new_arg_info[i].type)) {
2868+
zend_error(E_CORE_WARNING, "iterable type is now a compile time alias for array|Traversable,"
2869+
" regenerate the argument info via the php-src gen_stub build script");
28702870
zend_type legacy_iterable = ZEND_TYPE_INIT_CLASS_CONST_MASK(ZSTR_KNOWN(ZEND_STR_TRAVERSABLE),
28712871
(new_arg_info[i].type.type_mask|_ZEND_TYPE_UNION_BIT|MAY_BE_ARRAY));
28722872
memcpy(&new_arg_info[i].type, &legacy_iterable, sizeof(zend_type));
2873-
//return FAILURE;
28742873
}
28752874
}
28762875
}

ext/zend_test/tests/attribute_arguments.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ var_dump($attribute->newInstance());
8888
--EXPECTF--
8989
Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0
9090

91+
Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0
92+
9193
Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0
9294
array(1) {
9395
[0]=>

ext/zend_test/tests/attribute_hash_table_leak.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ var_dump($o->override("foo"));
5757
--EXPECT--
5858
Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0
5959

60+
Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0
61+
6062
Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0
6163
int(1)
6264
int(2)

ext/zend_test/tests/fiber_test_01.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ var_dump($fiber->getReturn()); // int(1)
2323
--EXPECT--
2424
Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0
2525

26+
Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0
27+
2628
Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0
2729
int(123)
2830
int(246)

ext/zend_test/tests/fiber_test_02.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ var_dump($test->resume(2)); // NULL
1919
--EXPECT--
2020
Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0
2121

22+
Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0
23+
2224
Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0
2325
int(1)
2426
int(2)

ext/zend_test/tests/fiber_test_03.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ $value = $fiber->throw(new Exception('test'));
2424
--EXPECTF--
2525
Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0
2626

27+
Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0
28+
2729
Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0
2830
int(1)
2931
int(2)

ext/zend_test/tests/fiber_test_04.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ var_dump($fiber->getReturn()); // int(-1)
3232
--EXPECT--
3333
Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0
3434

35+
Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0
36+
3537
Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0
3638
int(1)
3739
int(2)

ext/zend_test/tests/fiber_test_05.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ $value = $test->resume(2 * $value);
3030
--EXPECT--
3131
Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0
3232

33+
Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0
34+
3335
Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0
3436
int(1)
3537
int(2)

ext/zend_test/tests/fiber_test_06.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ var_dump($fiber->resume('2')); // NULL
3131
--EXPECT--
3232
Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0
3333

34+
Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0
35+
3436
Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0
3537
int(10)
3638
int(1)

ext/zend_test/tests/fiber_test_07.phpt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ var_dump($fiber->start());
1919
--EXPECT--
2020
Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0
2121

22+
Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0
23+
2224
Warning: iterable type is now a compile time alias for array|Traversable, regenerate the argument info via the php-src gen_stub build script in Unknown on line 0
2325
int(1)
2426
NULL

0 commit comments

Comments
 (0)