@@ -255,7 +255,7 @@ static YYSIZE_T zend_yytnamerr(char*, const char*);
255
255
%type <ast> extends_from parameter optional_type_without_static argument global_var
256
256
%type <ast> static_var class_statement trait_adaptation trait_precedence trait_alias
257
257
%type <ast> absolute_trait_method_reference trait_method_reference property echo_expr
258
- %type <ast> new_expr anonymous_class class_name class_name_reference simple_variable
258
+ %type <ast> new_with_parentheses new_without_parentheses anonymous_class class_name class_name_reference simple_variable
259
259
%type <ast> internal_functions_in_yacc
260
260
%type <ast> exit_expr scalar backticks_expr lexical_var function_call member_name property_name
261
261
%type <ast> variable_class_name dereferenceable_scalar constant class_constant
@@ -1123,15 +1123,20 @@ anonymous_class:
1123
1123
}
1124
1124
;
1125
1125
1126
- new_expr :
1127
- T_NEW class_name_reference ctor_arguments
1126
+ new_with_parentheses :
1127
+ T_NEW class_name_reference argument_list
1128
1128
{ $$ = zend_ast_create(ZEND_AST_NEW, $2 , $3 ); }
1129
1129
| T_NEW anonymous_class
1130
1130
{ $$ = $2 ; }
1131
1131
| T_NEW attributes anonymous_class
1132
1132
{ zend_ast_with_attributes($3 ->child[0 ], $2 ); $$ = $3 ; }
1133
1133
;
1134
1134
1135
+ new_without_parentheses :
1136
+ T_NEW class_name_reference
1137
+ { $$ = zend_ast_create(ZEND_AST_NEW, $2 , zend_ast_create_list(0 , ZEND_AST_ARG_LIST)); }
1138
+ ;
1139
+
1135
1140
expr :
1136
1141
variable
1137
1142
{ $$ = $1 ; }
@@ -1225,7 +1230,7 @@ expr:
1225
1230
$$ = $2 ;
1226
1231
if ($$ ->kind == ZEND_AST_CONDITIONAL) $$ ->attr = ZEND_PARENTHESIZED_CONDITIONAL;
1227
1232
}
1228
- | new_expr { $$ = $1 ; }
1233
+ | new_without_parentheses { $$ = $1 ; }
1229
1234
| expr ' ?' expr ' :' expr
1230
1235
{ $$ = zend_ast_create(ZEND_AST_CONDITIONAL, $1 , $3 , $5 ); }
1231
1236
| expr ' ?' ' :' expr
@@ -1443,6 +1448,7 @@ callable_variable:
1443
1448
| array_object_dereferenceable T_NULLSAFE_OBJECT_OPERATOR property_name argument_list
1444
1449
{ $$ = zend_ast_create(ZEND_AST_NULLSAFE_METHOD_CALL, $1 , $3 , $4 ); }
1445
1450
| function_call { $$ = $1 ; }
1451
+ | new_with_parentheses { $$ = $1 ; }
1446
1452
;
1447
1453
1448
1454
variable :
0 commit comments