mirror of
https://github.com/phabelio/PHP-Parser.git
synced 2024-11-27 04:24:43 +01:00
Use Identifier for property names as well
This commit is contained in:
parent
f46c909b5a
commit
d32d937d47
@ -516,9 +516,13 @@ property_declaration_list:
|
||||
| property_declaration_list ',' property_declaration { push($1, $3); }
|
||||
;
|
||||
|
||||
property_decl_name:
|
||||
T_VARIABLE { $$ = maybeMakeIdent(parseVar($1)); }
|
||||
;
|
||||
|
||||
property_declaration:
|
||||
T_VARIABLE { $$ = Stmt\PropertyProperty[parseVar($1), null]; }
|
||||
| T_VARIABLE '=' static_scalar { $$ = Stmt\PropertyProperty[parseVar($1), $3]; }
|
||||
property_decl_name { $$ = Stmt\PropertyProperty[$1, null]; }
|
||||
| property_decl_name '=' static_scalar { $$ = Stmt\PropertyProperty[$1, $3]; }
|
||||
;
|
||||
|
||||
expr_list:
|
||||
|
@ -521,9 +521,13 @@ property_declaration_list:
|
||||
| property_declaration_list ',' property_declaration { push($1, $3); }
|
||||
;
|
||||
|
||||
property_decl_name:
|
||||
T_VARIABLE { $$ = maybeMakeIdent(parseVar($1)); }
|
||||
;
|
||||
|
||||
property_declaration:
|
||||
T_VARIABLE { $$ = Stmt\PropertyProperty[parseVar($1), null]; }
|
||||
| T_VARIABLE '=' expr { $$ = Stmt\PropertyProperty[parseVar($1), $3]; }
|
||||
property_decl_name { $$ = Stmt\PropertyProperty[$1, null]; }
|
||||
| property_decl_name '=' expr { $$ = Stmt\PropertyProperty[$1, $3]; }
|
||||
;
|
||||
|
||||
expr_list:
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -12,6 +12,8 @@ class Foo {
|
||||
A::b as c;
|
||||
d as public e;
|
||||
}
|
||||
|
||||
public $foo, $bar = 42;
|
||||
}
|
||||
interface Bar {}
|
||||
trait Baz {}
|
||||
@ -127,6 +129,25 @@ array(
|
||||
)
|
||||
)
|
||||
)
|
||||
3: Stmt_Property(
|
||||
flags: MODIFIER_PUBLIC (1)
|
||||
props: array(
|
||||
0: Stmt_PropertyProperty(
|
||||
name: Identifier(
|
||||
name: foo
|
||||
)
|
||||
default: null
|
||||
)
|
||||
1: Stmt_PropertyProperty(
|
||||
name: Identifier(
|
||||
name: bar
|
||||
)
|
||||
default: Scalar_LNumber(
|
||||
value: 42
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
2: Stmt_Interface(
|
||||
|
Loading…
Reference in New Issue
Block a user