php-parser/test/code/parser/stmt/switch.test
nikic 81e53ce0ff Insert comments when pretty printing
This changset also adds unit tests for Comments and adds a way to test the
pretty printer.
2012-05-11 16:18:14 +02:00

67 lines
1.1 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(
stmts: array(
)
cond: Scalar_LNumber(
value: 0
)
)
1: Stmt_Case(
stmts: array(
)
cond: Scalar_LNumber(
value: 1
)
)
2: Stmt_Case(
stmts: array(
)
cond: null
)
)
)
1: Stmt_Switch(
cond: Expr_Variable(
name: a
)
cases: array(
)
)
2: Stmt_Switch(
cond: Expr_Variable(
name: a
)
cases: array(
)
)
3: Stmt_Switch(
cond: Expr_Variable(
name: a
)
cases: array(
)
)
)