@@ -1437,6 +1437,7 @@ static zend_string *add_intersection_type(zend_string *str,
14371437zend_string * zend_type_to_string_resolved (const zend_type type , zend_class_entry * scope ) {
14381438 zend_string * str = NULL ;
14391439
1440+ ZEND_ASSERT (!ZEND_TYPE_IS_GENERIC_PARAM_NAME (type ) && "Generic type declarations do not exist yet" );
14401441 /* Pure intersection type */
14411442 if (ZEND_TYPE_IS_INTERSECTION (type )) {
14421443 ZEND_ASSERT (!ZEND_TYPE_IS_UNION (type ));
@@ -1457,8 +1458,6 @@ zend_string *zend_type_to_string_resolved(const zend_type type, zend_class_entry
14571458 str = add_type_string (str , resolved , /* is_intersection */ false);
14581459 zend_string_release (resolved );
14591460 } ZEND_TYPE_LIST_FOREACH_END ();
1460- } else if (ZEND_TYPE_IS_ASSOCIATED (type )) {
1461- ZEND_ASSERT (false && "Generic type declarations do not exist yet" );
14621461 } else if (ZEND_TYPE_HAS_NAME (type )) {
14631462 str = resolve_class_name (ZEND_TYPE_NAME (type ), scope );
14641463 }
@@ -7220,7 +7219,7 @@ static zend_type zend_compile_typename_ex(
72207219 single_type = zend_compile_single_typename (type_ast );
72217220 uint32_t single_type_mask = ZEND_TYPE_PURE_MASK (single_type );
72227221
7223- if (ZEND_TYPE_IS_ASSOCIATED (single_type )) {
7222+ if (ZEND_TYPE_IS_GENERIC_PARAM_NAME (single_type )) {
72247223 zend_error_noreturn (E_COMPILE_ERROR , "Generic type cannot be part of a union type" );
72257224 }
72267225 if (single_type_mask == MAY_BE_ANY ) {
@@ -7305,7 +7304,7 @@ static zend_type zend_compile_typename_ex(
73057304 zend_ast * type_ast = list -> child [i ];
73067305 zend_type single_type = zend_compile_single_typename (type_ast );
73077306
7308- if (ZEND_TYPE_IS_ASSOCIATED (single_type )) {
7307+ if (ZEND_TYPE_IS_GENERIC_PARAM_NAME (single_type )) {
73097308 zend_error_noreturn (E_COMPILE_ERROR , "Generic type cannot be part of an intersection type" );
73107309 }
73117310 /* An intersection of union types cannot exist so invalidate it
@@ -7374,10 +7373,10 @@ static zend_type zend_compile_typename_ex(
73747373 if ((type_mask & MAY_BE_NULL ) && is_marked_nullable ) {
73757374 zend_error_noreturn (E_COMPILE_ERROR , "null cannot be marked as nullable" );
73767375 }
7377- if (ZEND_TYPE_IS_ASSOCIATED (type ) && is_marked_nullable ) {
7376+ if (ZEND_TYPE_IS_GENERIC_PARAM_NAME (type ) && is_marked_nullable ) {
73787377 zend_error_noreturn (E_COMPILE_ERROR , "Generic type cannot be part of a union type" );
73797378 }
7380- if (ZEND_TYPE_IS_ASSOCIATED (type ) && force_allow_null ) {
7379+ if (ZEND_TYPE_IS_GENERIC_PARAM_NAME (type ) && force_allow_null ) {
73817380 zend_error_noreturn (E_COMPILE_ERROR , "Generic type cannot be part of a union type (implicitly nullable due to default null value)" );
73827381 }
73837382
@@ -9173,7 +9172,7 @@ static void zend_compile_generic_params(zend_ast *params_ast)
91739172
91749173 if (param_ast -> child [1 ]) {
91759174 constraint_type = zend_compile_typename (param_ast -> child [1 ]);
9176- if (ZEND_TYPE_IS_ASSOCIATED (constraint_type )) {
9175+ if (ZEND_TYPE_IS_GENERIC_PARAM_NAME (constraint_type )) {
91779176 zend_error_noreturn (E_COMPILE_ERROR ,
91789177 "Cannot use generic parameter %s to constrain generic parameter %s" ,
91799178 ZSTR_VAL (ZEND_TYPE_NAME (constraint_type )), ZSTR_VAL (name ));
0 commit comments