@@ -1247,7 +1247,7 @@ zend_string *zend_type_to_string_resolved(zend_type type, zend_class_entry *scop
12471247 name = called_scope -> name ;
12481248 }
12491249 }
1250- str = add_type_string (str , name , ZEND_TYPE_IS_INTERSECTION ( type ) );
1250+ str = add_type_string (str , name , /* is_intersection */ false );
12511251 }
12521252 if (type_mask & MAY_BE_CALLABLE ) {
12531253 str = add_type_string (str , ZSTR_KNOWN (ZEND_STR_CALLABLE ), /* is_intersection */ false);
@@ -6306,9 +6306,8 @@ static zend_type zend_compile_typename(
63066306 } else if (ast -> kind == ZEND_AST_TYPE_INTERSECTION ) {
63076307 zend_ast_list * list = zend_ast_get_list (ast );
63086308 zend_type_list * type_list ;
6309- unsigned int has_static = 0 ;
63106309
6311- // TODO static means that one slot may be unused
6310+ // TODO Is this still true if self/parent are accepted?
63126311 /* Allocate the type list directly on the arena as it must be a type
63136312 * list of the same number of elements as the AST list has children */
63146313 type_list = zend_arena_alloc (& CG (arena ), ZEND_TYPE_LIST_SIZE (list -> children ));
@@ -6321,27 +6320,13 @@ static zend_type zend_compile_typename(
63216320 zend_type single_type = zend_compile_single_typename (type_ast );
63226321
63236322 /* An intersection of standard types cannot exist so invalidate it */
6324- /* Treat "static" as a class type. */
6325- if (ZEND_TYPE_IS_ONLY_MASK (single_type ) && !(ZEND_TYPE_FULL_MASK (single_type ) & MAY_BE_STATIC )) {
6323+ if (ZEND_TYPE_IS_ONLY_MASK (single_type )) {
63266324 zend_string * standard_type_str = zend_type_to_string (single_type );
63276325 zend_error_noreturn (E_COMPILE_ERROR ,
63286326 "Type %s cannot be part of an intersection type" , ZSTR_VAL (standard_type_str ));
63296327 zend_string_release_ex (standard_type_str , false);
63306328 }
63316329
6332- /* If the type is static */
6333- if (UNEXPECTED (!ZEND_TYPE_IS_COMPLEX (single_type ))) {
6334- /* Check that static doesn't overlap */
6335- uint32_t type_mask_overlap = ZEND_TYPE_PURE_MASK (type ) & MAY_BE_STATIC ;
6336- if (type_mask_overlap ) {
6337- zend_error_noreturn (E_COMPILE_ERROR , "Duplicate type static is redundant" );
6338- }
6339- ZEND_TYPE_FULL_MASK (type ) |= MAY_BE_STATIC ;
6340- ZEND_TYPE_FULL_MASK (single_type ) &= ~_ZEND_TYPE_MAY_BE_MASK ;
6341- has_static = 1 ;
6342- continue ;
6343- }
6344-
63456330 /* Add type to the type list */
63466331 type_list -> types [type_list -> num_types ++ ] = single_type ;
63476332
@@ -6356,7 +6341,7 @@ static zend_type zend_compile_typename(
63566341 }
63576342 }
63586343
6359- ZEND_ASSERT (( list -> children - has_static ) == type_list -> num_types );
6344+ ZEND_ASSERT (list -> children == type_list -> num_types );
63606345
63616346 ZEND_TYPE_SET_LIST (type , type_list );
63626347 ZEND_TYPE_FULL_MASK (type ) |= _ZEND_TYPE_ARENA_BIT ;
0 commit comments