@@ -6456,6 +6456,14 @@ static zend_type zend_compile_typename(
6456
6456
}
6457
6457
6458
6458
free_alloca (type_list , use_heap );
6459
+
6460
+ uint32_t type_mask = ZEND_TYPE_FULL_MASK (type );
6461
+ if ((type_mask & MAY_BE_OBJECT ) && (ZEND_TYPE_IS_COMPLEX (type ) || (type_mask & MAY_BE_STATIC ))) {
6462
+ zend_string * type_str = zend_type_to_string (type );
6463
+ zend_error_noreturn (E_COMPILE_ERROR ,
6464
+ "Type %s contains both object and a class type, which is redundant" ,
6465
+ ZSTR_VAL (type_str ));
6466
+ }
6459
6467
} else if (ast -> kind == ZEND_AST_TYPE_INTERSECTION ) {
6460
6468
zend_ast_list * list = zend_ast_get_list (ast );
6461
6469
zend_type_list * type_list ;
@@ -6516,13 +6524,6 @@ static zend_type zend_compile_typename(
6516
6524
zend_error_noreturn (E_COMPILE_ERROR , "Type mixed cannot be marked as nullable since mixed already includes null" );
6517
6525
}
6518
6526
6519
- if ((type_mask & MAY_BE_OBJECT ) && (ZEND_TYPE_IS_COMPLEX (type ) || (type_mask & MAY_BE_STATIC ))) {
6520
- zend_string * type_str = zend_type_to_string (type );
6521
- zend_error_noreturn (E_COMPILE_ERROR ,
6522
- "Type %s contains both object and a class type, which is redundant" ,
6523
- ZSTR_VAL (type_str ));
6524
- }
6525
-
6526
6527
if ((type_mask & MAY_BE_NULL ) && is_marked_nullable ) {
6527
6528
zend_error_noreturn (E_COMPILE_ERROR , "null cannot be marked as nullable" );
6528
6529
}
@@ -8084,7 +8085,7 @@ static void zend_compile_use(zend_ast *ast) /* {{{ */
8084
8085
8085
8086
/* Check that we are not attempting to alias a built-in type */
8086
8087
if (type == ZEND_SYMBOL_CLASS && zend_is_reserved_class_name (old_name )) {
8087
- zend_error_noreturn (E_COMPILE_ERROR ,
8088
+ zend_error_noreturn (E_COMPILE_ERROR ,
8088
8089
"Cannot alias '%s' as it is a built-in type" , ZSTR_VAL (old_name ));
8089
8090
}
8090
8091
0 commit comments