mirror of
https://github.com/phabelio/PHP-Parser.git
synced 2025-01-22 13:21:12 +01:00
Fix trait alias to semi-reserved name parsing
This was missing the explicit construction of an Identifier node.
This commit is contained in:
parent
5054a68bfb
commit
b241a121a3
@ -44,6 +44,10 @@ identifier:
|
||||
T_STRING { $$ = Node\Identifier[$1]; }
|
||||
;
|
||||
|
||||
reserved_non_modifiers_identifier:
|
||||
reserved_non_modifiers { $$ = Node\Identifier[$1]; }
|
||||
;
|
||||
|
||||
namespace_name_parts:
|
||||
T_STRING { init($1); }
|
||||
| namespace_name_parts T_NS_SEPARATOR T_STRING { push($1, $3); }
|
||||
@ -484,7 +488,7 @@ trait_adaptation:
|
||||
{ $$ = Stmt\TraitUseAdaptation\Alias[$1[0], $1[1], $3, null]; }
|
||||
| trait_method_reference T_AS identifier ';'
|
||||
{ $$ = Stmt\TraitUseAdaptation\Alias[$1[0], $1[1], null, $3]; }
|
||||
| trait_method_reference T_AS reserved_non_modifiers ';'
|
||||
| trait_method_reference T_AS reserved_non_modifiers_identifier ';'
|
||||
{ $$ = Stmt\TraitUseAdaptation\Alias[$1[0], $1[1], null, $3]; }
|
||||
;
|
||||
|
||||
|
@ -44,6 +44,10 @@ identifier:
|
||||
T_STRING { $$ = Node\Identifier[$1]; }
|
||||
;
|
||||
|
||||
reserved_non_modifiers_identifier:
|
||||
reserved_non_modifiers { $$ = Node\Identifier[$1]; }
|
||||
;
|
||||
|
||||
namespace_name_parts:
|
||||
T_STRING { init($1); }
|
||||
| namespace_name_parts T_NS_SEPARATOR T_STRING { push($1, $3); }
|
||||
@ -544,7 +548,7 @@ trait_adaptation:
|
||||
{ $$ = Stmt\TraitUseAdaptation\Alias[$1[0], $1[1], $3, null]; }
|
||||
| trait_method_reference T_AS identifier ';'
|
||||
{ $$ = Stmt\TraitUseAdaptation\Alias[$1[0], $1[1], null, $3]; }
|
||||
| trait_method_reference T_AS reserved_non_modifiers ';'
|
||||
| trait_method_reference T_AS reserved_non_modifiers_identifier ';'
|
||||
{ $$ = Stmt\TraitUseAdaptation\Alias[$1[0], $1[1], null, $3]; }
|
||||
;
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
19
test/code/formatPreservation/traitAlias.test
Normal file
19
test/code/formatPreservation/traitAlias.test
Normal file
@ -0,0 +1,19 @@
|
||||
Trait alias
|
||||
-----
|
||||
<?php
|
||||
class X {
|
||||
use T {
|
||||
exit
|
||||
as die;
|
||||
}
|
||||
}
|
||||
-----
|
||||
/* do nothing */
|
||||
-----
|
||||
<?php
|
||||
class X {
|
||||
use T {
|
||||
exit
|
||||
as die;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user