@@ -1247,7 +1247,7 @@ zend_string *zend_type_to_string_resolved(zend_type type, zend_class_entry *scop
1247
1247
name = called_scope -> name ;
1248
1248
}
1249
1249
}
1250
- str = add_type_string (str , name , ZEND_TYPE_IS_INTERSECTION ( type ) );
1250
+ str = add_type_string (str , name , /* is_intersection */ false );
1251
1251
}
1252
1252
if (type_mask & MAY_BE_CALLABLE ) {
1253
1253
str = add_type_string (str , ZSTR_KNOWN (ZEND_STR_CALLABLE ), /* is_intersection */ false);
@@ -6299,9 +6299,8 @@ static zend_type zend_compile_typename(
6299
6299
} else if (ast -> kind == ZEND_AST_TYPE_INTERSECTION ) {
6300
6300
zend_ast_list * list = zend_ast_get_list (ast );
6301
6301
zend_type_list * type_list ;
6302
- unsigned int has_static = 0 ;
6303
6302
6304
- // TODO static means that one slot may be unused
6303
+ // TODO Is this still true if self/parent are accepted?
6305
6304
/* Allocate the type list directly on the arena as it must be a type
6306
6305
* list of the same number of elements as the AST list has children */
6307
6306
type_list = zend_arena_alloc (& CG (arena ), ZEND_TYPE_LIST_SIZE (list -> children ));
@@ -6314,27 +6313,13 @@ static zend_type zend_compile_typename(
6314
6313
zend_type single_type = zend_compile_single_typename (type_ast );
6315
6314
6316
6315
/* An intersection of standard types cannot exist so invalidate it */
6317
- /* Treat "static" as a class type. */
6318
- if (ZEND_TYPE_IS_ONLY_MASK (single_type ) && !(ZEND_TYPE_FULL_MASK (single_type ) & MAY_BE_STATIC )) {
6316
+ if (ZEND_TYPE_IS_ONLY_MASK (single_type )) {
6319
6317
zend_string * standard_type_str = zend_type_to_string (single_type );
6320
6318
zend_error_noreturn (E_COMPILE_ERROR ,
6321
6319
"Type %s cannot be part of an intersection type" , ZSTR_VAL (standard_type_str ));
6322
6320
zend_string_release_ex (standard_type_str , false);
6323
6321
}
6324
6322
6325
- /* If the type is static */
6326
- if (UNEXPECTED (!ZEND_TYPE_IS_COMPLEX (single_type ))) {
6327
- /* Check that static doesn't overlap */
6328
- uint32_t type_mask_overlap = ZEND_TYPE_PURE_MASK (type ) & MAY_BE_STATIC ;
6329
- if (type_mask_overlap ) {
6330
- zend_error_noreturn (E_COMPILE_ERROR , "Duplicate type static is redundant" );
6331
- }
6332
- ZEND_TYPE_FULL_MASK (type ) |= MAY_BE_STATIC ;
6333
- ZEND_TYPE_FULL_MASK (single_type ) &= ~_ZEND_TYPE_MAY_BE_MASK ;
6334
- has_static = 1 ;
6335
- continue ;
6336
- }
6337
-
6338
6323
/* Add type to the type list */
6339
6324
type_list -> types [type_list -> num_types ++ ] = single_type ;
6340
6325
@@ -6349,7 +6334,7 @@ static zend_type zend_compile_typename(
6349
6334
}
6350
6335
}
6351
6336
6352
- ZEND_ASSERT (( list -> children - has_static ) == type_list -> num_types );
6337
+ ZEND_ASSERT (list -> children == type_list -> num_types );
6353
6338
6354
6339
ZEND_TYPE_SET_LIST (type , type_list );
6355
6340
ZEND_TYPE_FULL_MASK (type ) |= _ZEND_TYPE_ARENA_BIT ;
0 commit comments