Skip to content

Commit 8a9b80c

Browse files
committed
Add test case
1 parent 717335e commit 8a9b80c

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

ext/zend_test/test.c

+13
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,19 @@ static ZEND_METHOD(_ZendTestClass, returnsThrowable)
412412
zend_throw_error(NULL, "Dummy");
413413
}
414414

415+
static ZEND_METHOD(_ZendTestClass, variadicTest) {
416+
int argc;
417+
zval *args = NULL;
418+
419+
ZEND_PARSE_PARAMETERS_START(0, -1)
420+
Z_PARAM_VARIADIC('*', args, argc)
421+
ZEND_PARSE_PARAMETERS_END();
422+
423+
(void) (args + argc);
424+
425+
object_init_ex(return_value, zend_get_called_scope(execute_data));
426+
}
427+
415428
static ZEND_METHOD(_ZendTestChildClass, returnsThrowable)
416429
{
417430
ZEND_PARSE_PARAMETERS_NONE();

ext/zend_test/test.stub.php

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ public function __toString() {}
3030
public function returnsStatic(): static {}
3131

3232
public function returnsThrowable(): Throwable {}
33+
34+
static public function variadicTest(string|Iterator ...$elements) : static {}
3335
}
3436

3537
class _ZendTestChildClass extends _ZendTestClass

ext/zend_test/test_arginfo.h

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 1eca5b01969498e67501a59dc69ba4c01263c4d9 */
2+
* Stub hash: 614310958c6e2acde46c9b7932ba894caf72d6df */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_zend_test_array_return, 0, 0, IS_ARRAY, 0)
55
ZEND_END_ARG_INFO()
@@ -96,6 +96,10 @@ ZEND_END_ARG_INFO()
9696
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class__ZendTestClass_returnsThrowable, 0, 0, Throwable, 0)
9797
ZEND_END_ARG_INFO()
9898

99+
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_class__ZendTestClass_variadicTest, 0, 0, IS_STATIC, 0)
100+
ZEND_ARG_VARIADIC_OBJ_TYPE_MASK(0, elements, Iterator, MAY_BE_STRING)
101+
ZEND_END_ARG_INFO()
102+
99103
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_class__ZendTestChildClass_returnsThrowable, 0, 0, Exception, 0)
100104
ZEND_END_ARG_INFO()
101105

@@ -144,6 +148,7 @@ static ZEND_METHOD(_ZendTestClass, is_object);
144148
static ZEND_METHOD(_ZendTestClass, __toString);
145149
static ZEND_METHOD(_ZendTestClass, returnsStatic);
146150
static ZEND_METHOD(_ZendTestClass, returnsThrowable);
151+
static ZEND_METHOD(_ZendTestClass, variadicTest);
147152
static ZEND_METHOD(_ZendTestChildClass, returnsThrowable);
148153
static ZEND_METHOD(_ZendTestTrait, testMethod);
149154
static ZEND_METHOD(ZendTestParameterAttribute, __construct);
@@ -192,6 +197,7 @@ static const zend_function_entry class__ZendTestClass_methods[] = {
192197
ZEND_ME(_ZendTestClass, __toString, arginfo_class__ZendTestClass___toString, ZEND_ACC_PUBLIC|ZEND_ACC_DEPRECATED)
193198
ZEND_ME(_ZendTestClass, returnsStatic, arginfo_class__ZendTestClass_returnsStatic, ZEND_ACC_PUBLIC)
194199
ZEND_ME(_ZendTestClass, returnsThrowable, arginfo_class__ZendTestClass_returnsThrowable, ZEND_ACC_PUBLIC)
200+
ZEND_ME(_ZendTestClass, variadicTest, arginfo_class__ZendTestClass_variadicTest, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)
195201
ZEND_FE_END
196202
};
197203

0 commit comments

Comments
 (0)