Skip to content

Commit 222c6c9

Browse files
committed
Nits
1 parent 25c284e commit 222c6c9

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

Zend/zend_compile.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6281,20 +6281,22 @@ static zend_type zend_compile_typename(
62816281
uint32_t single_type_mask;
62826282

62836283
if (type_ast->kind == ZEND_AST_TYPE_INTERSECTION) {
6284-
if (type_list->num_types == 0) {
6285-
/* The first class type can be stored directly as the type ptr payload. */
6286-
if (ZEND_TYPE_HAS_NAME(type) || ZEND_TYPE_HAS_CE(type) || ZEND_TYPE_HAS_CE_CACHE(type)) {
6287-
/* Switch from single name to name list. */
6288-
type_list->num_types = 1;
6289-
type_list->types[0] = type;
6290-
ZEND_TYPE_FULL_MASK(type_list->types[0]) &= ~_ZEND_TYPE_MAY_BE_MASK;
6291-
}
6292-
/* TODO Check for trivially redundant class types? */
6284+
/* The first class type can be stored directly as the type ptr payload. */
6285+
if (ZEND_TYPE_IS_COMPLEX(type) && !ZEND_TYPE_HAS_LIST(type)) {
6286+
/* Switch from single name to name list. */
6287+
type_list->num_types = 1;
6288+
type_list->types[0] = type;
6289+
/* Reset flags for first type */
6290+
ZEND_TYPE_FULL_MASK(type_list->types[0]) &= ~_ZEND_TYPE_MAY_BE_MASK;
62936291
ZEND_TYPE_SET_LIST(type, type_list);
62946292
}
62956293

62966294
single_type = zend_compile_typename(type_ast, false);
6295+
ZEND_ASSERT(ZEND_TYPE_IS_INTERSECTION(single_type));
6296+
62976297
type_list->types[type_list->num_types++] = single_type;
6298+
6299+
/* TODO Check for trivially redundant class types? */
62986300
continue;
62996301
}
63006302

0 commit comments

Comments
 (0)