mirror of
https://github.com/danog/PHP-Parser.git
synced 2024-12-03 17:57:59 +01:00
a0c216bf4b
Adding this as an option to avoid breaking people's tests. Some of the test results show pretty clearly that we are incorrectly assigning the same comment multiple times for nested nodes (mentioned in #36).
73 lines
1.2 KiB
Plaintext
73 lines
1.2 KiB
Plaintext
Switch
|
|
-----
|
|
<?php
|
|
|
|
switch ($a) {
|
|
case 0:
|
|
case 1;
|
|
default:
|
|
}
|
|
|
|
// alternative syntax
|
|
switch ($a):
|
|
endswitch;
|
|
|
|
// leading semicolon
|
|
switch ($a) { ; }
|
|
switch ($a): ; endswitch;
|
|
-----
|
|
array(
|
|
0: Stmt_Switch(
|
|
cond: Expr_Variable(
|
|
name: a
|
|
)
|
|
cases: array(
|
|
0: Stmt_Case(
|
|
cond: Scalar_LNumber(
|
|
value: 0
|
|
)
|
|
stmts: array(
|
|
)
|
|
)
|
|
1: Stmt_Case(
|
|
cond: Scalar_LNumber(
|
|
value: 1
|
|
)
|
|
stmts: array(
|
|
)
|
|
)
|
|
2: Stmt_Case(
|
|
cond: null
|
|
stmts: array(
|
|
)
|
|
)
|
|
)
|
|
)
|
|
1: Stmt_Switch(
|
|
cond: Expr_Variable(
|
|
name: a
|
|
)
|
|
cases: array(
|
|
)
|
|
comments: array(
|
|
0: // alternative syntax
|
|
)
|
|
)
|
|
2: Stmt_Switch(
|
|
cond: Expr_Variable(
|
|
name: a
|
|
)
|
|
cases: array(
|
|
)
|
|
comments: array(
|
|
0: // leading semicolon
|
|
)
|
|
)
|
|
3: Stmt_Switch(
|
|
cond: Expr_Variable(
|
|
name: a
|
|
)
|
|
cases: array(
|
|
)
|
|
)
|
|
) |