Skip to content

Commit

Permalink
Include trailing semicolon in GroupUse
Browse files Browse the repository at this point in the history
Fixes #1026.

(cherry-picked from aedfcc2)
  • Loading branch information
nikic committed Sep 21, 2024
1 parent 2041245 commit 6de6ede
Show file tree
Hide file tree
Showing 7 changed files with 3,425 additions and 624 deletions.
6 changes: 3 additions & 3 deletions grammar/php5.y
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ top_statement:
$this->checkNamespace($$); }
| T_USE use_declarations ';' { $$ = Stmt\Use_[$2, Stmt\Use_::TYPE_NORMAL]; }
| T_USE use_type use_declarations ';' { $$ = Stmt\Use_[$3, $2]; }
| group_use_declaration ';' { $$ = $1; }
| group_use_declaration { $$ = $1; }
| T_CONST constant_declaration_list ';' { $$ = Stmt\Const_[$2]; }
;

Expand All @@ -98,9 +98,9 @@ use_type:
;

group_use_declaration:
T_USE use_type legacy_namespace_name T_NS_SEPARATOR '{' unprefixed_use_declarations '}'
T_USE use_type legacy_namespace_name T_NS_SEPARATOR '{' unprefixed_use_declarations '}' ';'
{ $$ = Stmt\GroupUse[$3, $6, $2]; }
| T_USE legacy_namespace_name T_NS_SEPARATOR '{' inline_use_declarations '}'
| T_USE legacy_namespace_name T_NS_SEPARATOR '{' inline_use_declarations '}' ';'
{ $$ = Stmt\GroupUse[$2, $5, Stmt\Use_::TYPE_UNKNOWN]; }
;

Expand Down
6 changes: 3 additions & 3 deletions grammar/php7.y
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ top_statement:
$this->checkNamespace($$); }
| T_USE use_declarations semi { $$ = Stmt\Use_[$2, Stmt\Use_::TYPE_NORMAL]; }
| T_USE use_type use_declarations semi { $$ = Stmt\Use_[$3, $2]; }
| group_use_declaration semi { $$ = $1; }
| group_use_declaration { $$ = $1; }
| T_CONST constant_declaration_list semi { $$ = Stmt\Const_[$2]; }
;

Expand All @@ -143,9 +143,9 @@ use_type:
;

group_use_declaration:
T_USE use_type legacy_namespace_name T_NS_SEPARATOR '{' unprefixed_use_declarations '}'
T_USE use_type legacy_namespace_name T_NS_SEPARATOR '{' unprefixed_use_declarations '}' semi
{ $$ = Stmt\GroupUse[$3, $6, $2]; }
| T_USE legacy_namespace_name T_NS_SEPARATOR '{' inline_use_declarations '}'
| T_USE legacy_namespace_name T_NS_SEPARATOR '{' inline_use_declarations '}' semi
{ $$ = Stmt\GroupUse[$2, $5, Stmt\Use_::TYPE_UNKNOWN]; }
;

Expand Down
562 changes: 281 additions & 281 deletions lib/PhpParser/Parser/Php5.php

Large diffs are not rendered by default.

673 changes: 337 additions & 336 deletions lib/PhpParser/Parser/Php7.php

Large diffs are not rendered by default.

Loading

0 comments on commit 6de6ede

Please sign in to comment.