Skip to content

Commit 1f8a93a

Browse files
committed
Support class+mask union for internal argument
1 parent e96e4ac commit 1f8a93a

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

Zend/zend_API.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ typedef struct _zend_fcall_info_cache {
122122
/* Arginfo structures with complex type information */
123123
#define ZEND_ARG_TYPE_MASK(pass_by_ref, name, type_mask, default_value) \
124124
{ #name, ZEND_TYPE_INIT_MASK(type_mask | _ZEND_ARG_INFO_FLAGS(pass_by_ref, 0)), default_value },
125+
#define ZEND_ARG_OBJ_TYPE_MASK(pass_by_ref, name, class_name, type_mask, default_value) \
126+
{ #name, ZEND_TYPE_INIT_CLASS_CONST_MASK(#class_name, type_mask | _ZEND_ARG_INFO_FLAGS(pass_by_ref, 0)), default_value },
125127
/* Arginfo structures with object type information */
126128
#define ZEND_ARG_OBJ_INFO(pass_by_ref, name, classname, allow_null) \
127129
{ #name, ZEND_TYPE_INIT_CLASS_CONST(#classname, allow_null, _ZEND_ARG_INFO_FLAGS(pass_by_ref, 0)), NULL },

build/gen_stub.php

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -905,14 +905,21 @@ function funcInfoToCode(FuncInfo $funcInfo): string {
905905
}
906906
} else if (null !== $representableType = $argType->tryToRepresentableType()) {
907907
if ($representableType->classType !== null) {
908-
throw new Exception('Unimplemented');
908+
$code .= sprintf(
909+
"\tZEND_%s_OBJ_TYPE_MASK(%s, %s, %s, %s, %s)\n",
910+
$argKind, $argInfo->getSendByString(), $argInfo->name,
911+
$representableType->classType->toEscapedName(),
912+
$representableType->toTypeMask(),
913+
$argInfo->getDefaultValueString()
914+
);
915+
} else {
916+
$code .= sprintf(
917+
"\tZEND_%s_TYPE_MASK(%s, %s, %s, %s)\n",
918+
$argKind, $argInfo->getSendByString(), $argInfo->name,
919+
$representableType->toTypeMask(),
920+
$argInfo->getDefaultValueString()
921+
);
909922
}
910-
$code .= sprintf(
911-
"\tZEND_%s_TYPE_MASK(%s, %s, %s, %s)\n",
912-
$argKind, $argInfo->getSendByString(), $argInfo->name,
913-
$representableType->toTypeMask(),
914-
$argInfo->getDefaultValueString()
915-
);
916923
} else {
917924
throw new Exception('Unimplemented');
918925
}

0 commit comments

Comments
 (0)