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