summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-08-15 22:07:49 +0200
committerNikita Popov <nikita.ppv@gmail.com>2019-08-15 22:07:49 +0200
commit37a8408e83057c13cc14b29018f698f4244d151e (patch)
tree7cdf100a10995ab48109679ebabebfe9be2b2b28 /scripts
parentd04c85fcb5977e56615e021327782720d997c3c6 (diff)
downloadphp-git-37a8408e83057c13cc14b29018f698f4244d151e.tar.gz
Support typed variadic args in gen_stubs
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/dev/gen_stub.php22
1 files changed, 8 insertions, 14 deletions
diff --git a/scripts/dev/gen_stub.php b/scripts/dev/gen_stub.php
index 9d7d81dac4..6146009df3 100755
--- a/scripts/dev/gen_stub.php
+++ b/scripts/dev/gen_stub.php
@@ -316,30 +316,24 @@ function funcInfoToCode(FuncInfo $funcInfo): string {
}
foreach ($funcInfo->args as $argInfo) {
- if ($argInfo->isVariadic) {
- if ($argInfo->type) {
- throw new Exception("Not implemented");
- }
- $code .= sprintf(
- "\tZEND_ARG_VARIADIC_INFO(%d, %s)\n",
- $argInfo->byRef, $argInfo->name
- );
- } else if ($argInfo->type) {
+ $argKind = $argInfo->isVariadic ? "ARG_VARIADIC" : "ARG";
+ if ($argInfo->type) {
if ($argInfo->type->isBuiltin) {
$code .= sprintf(
- "\tZEND_ARG_TYPE_INFO(%d, %s, %s, %d)\n",
- $argInfo->byRef, $argInfo->name,
+ "\tZEND_%s_TYPE_INFO(%d, %s, %s, %d)\n",
+ $argKind, $argInfo->byRef, $argInfo->name,
$argInfo->type->toTypeCode(), $argInfo->type->isNullable
);
} else {
$code .= sprintf(
- "\tZEND_ARG_OBJ_INFO(%d, %s, %s, %d)\n",
- $argInfo->byRef, $argInfo->name,
+ "\tZEND_%s_OBJ_INFO(%d, %s, %s, %d)\n",
+ $argKind, $argInfo->byRef, $argInfo->name,
$argInfo->type->name, $argInfo->type->isNullable
);
}
} else {
- $code .= sprintf("\tZEND_ARG_INFO(%d, %s)\n", $argInfo->byRef, $argInfo->name);
+ $code .= sprintf(
+ "\tZEND_%s_INFO(%d, %s)\n", $argKind, $argInfo->byRef, $argInfo->name);
}
}