Skip to content

Commit c1eaa0d

Browse files
committed
Unify array and object dereferencability
1 parent ca5f7c9 commit c1eaa0d

File tree

3 files changed

+332
-299
lines changed

3 files changed

+332
-299
lines changed

grammar/php7.y

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ fully_dereferencable:
894894
| dereferencable_scalar { $$ = $1; }
895895
;
896896

897-
array_dereferencable:
897+
array_object_dereferencable:
898898
fully_dereferencable { $$ = $1; }
899899
| constant { $$ = $1; }
900900
| class_constant { $$ = $1; }
@@ -908,17 +908,18 @@ callable_expr:
908908

909909
callable_variable:
910910
simple_variable { $$ = Expr\Variable[$1]; }
911-
| array_dereferencable '[' optional_expr ']' { $$ = Expr\ArrayDimFetch[$1, $3]; }
912-
| array_dereferencable '{' expr '}' { $$ = Expr\ArrayDimFetch[$1, $3]; }
911+
| array_object_dereferencable '[' optional_expr ']' { $$ = Expr\ArrayDimFetch[$1, $3]; }
912+
| array_object_dereferencable '{' expr '}' { $$ = Expr\ArrayDimFetch[$1, $3]; }
913913
| function_call { $$ = $1; }
914-
| fully_dereferencable T_OBJECT_OPERATOR property_name argument_list
914+
| array_object_dereferencable T_OBJECT_OPERATOR property_name argument_list
915915
{ $$ = Expr\MethodCall[$1, $3, $4]; }
916916
;
917917

918918
variable:
919919
callable_variable { $$ = $1; }
920920
| static_member { $$ = $1; }
921-
| fully_dereferencable T_OBJECT_OPERATOR property_name { $$ = Expr\PropertyFetch[$1, $3]; }
921+
| array_object_dereferencable T_OBJECT_OPERATOR property_name
922+
{ $$ = Expr\PropertyFetch[$1, $3]; }
922923
;
923924

924925
simple_variable:

0 commit comments

Comments
 (0)