File tree Expand file tree Collapse file tree 2 files changed +4
-12
lines changed Expand file tree Collapse file tree 2 files changed +4
-12
lines changed Original file line number Diff line number Diff line change @@ -9,4 +9,4 @@ class Test {
9
9
10
10
?>
11
11
--EXPECTF--
12
- Fatal error: Cannot use 'static' as trait name as it is reserved in %s on line %d
12
+ Fatal error: Cannot use 'static' as trait name, as it is reserved in %s on line %d
Original file line number Diff line number Diff line change @@ -6474,23 +6474,15 @@ void zend_compile_use_trait(zend_ast *ast) /* {{{ */
6474
6474
6475
6475
for (i = 0 ; i < traits -> children ; ++ i ) {
6476
6476
zend_ast * trait_ast = traits -> child [i ];
6477
- zend_string * name = zend_ast_get_str (trait_ast );
6478
6477
6479
6478
if (ce -> ce_flags & ZEND_ACC_INTERFACE ) {
6479
+ zend_string * name = zend_ast_get_str (trait_ast );
6480
6480
zend_error_noreturn (E_COMPILE_ERROR , "Cannot use traits inside of interfaces. "
6481
6481
"%s is used in %s" , ZSTR_VAL (name ), ZSTR_VAL (ce -> name ));
6482
6482
}
6483
6483
6484
- switch (zend_get_class_fetch_type (name )) {
6485
- case ZEND_FETCH_CLASS_SELF :
6486
- case ZEND_FETCH_CLASS_PARENT :
6487
- case ZEND_FETCH_CLASS_STATIC :
6488
- zend_error_noreturn (E_COMPILE_ERROR , "Cannot use '%s' as trait name "
6489
- "as it is reserved" , ZSTR_VAL (name ));
6490
- break ;
6491
- }
6492
-
6493
- ce -> trait_names [ce -> num_traits ].name = zend_resolve_class_name_ast (trait_ast );
6484
+ ce -> trait_names [ce -> num_traits ].name =
6485
+ zend_resolve_const_class_name_reference (trait_ast , "trait name" );
6494
6486
ce -> trait_names [ce -> num_traits ].lc_name = zend_string_tolower (ce -> trait_names [ce -> num_traits ].name );
6495
6487
ce -> num_traits ++ ;
6496
6488
}
You can’t perform that action at this time.
0 commit comments