mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Support union types for args in gen stubs
Using this requires care! The zpp implementation for this union must be consistent with the arginfo implementation! Apart from array|object, this is probably only the case for int|float right now.
This commit is contained in:
@@ -532,8 +532,7 @@ function funcInfoToCode(FuncInfo $funcInfo): string {
|
||||
$argKind = $argInfo->isVariadic ? "ARG_VARIADIC" : "ARG";
|
||||
$argType = $argInfo->type;
|
||||
if ($argType !== null) {
|
||||
$simpleArgType = $argType->tryToSimpleType();
|
||||
if ($simpleArgType !== null) {
|
||||
if (null !== $simpleArgType = $argType->tryToSimpleType()) {
|
||||
if ($simpleArgType->isBuiltin) {
|
||||
$code .= sprintf(
|
||||
"\tZEND_%s_TYPE_INFO(%s, %s, %s, %d)\n",
|
||||
@@ -547,6 +546,15 @@ function funcInfoToCode(FuncInfo $funcInfo): string {
|
||||
$simpleArgType->toEscapedName(), $argType->isNullable()
|
||||
);
|
||||
}
|
||||
} else if (null !== $representableType = $argType->tryToRepresentableType()) {
|
||||
if ($representableType->classType !== null) {
|
||||
throw new Exception('Unimplemented');
|
||||
}
|
||||
$code .= sprintf(
|
||||
"\tZEND_%s_TYPE_MASK(%s, %s, %s)\n",
|
||||
$argKind, $argInfo->getSendByString(), $argInfo->name,
|
||||
$representableType->toTypeMask()
|
||||
);
|
||||
} else {
|
||||
throw new Exception('Unimplemented');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user