xref: /php-ast/tests/stmt_list.phpt (revision 260678d4)
1--TEST--
2Statement list normalization
3--FILE--
4<?php
5
6require __DIR__ . '/../util.php';
7
8$code = <<<'PHP'
9<?php
10while ($a);
11while ($a) $b;
12while ($a) { $b; }
13
14declare(ticks=1);
15declare(ticks=1) {}
16PHP;
17
18echo ast_dump(ast\parse_code($code, $version=70)), "\n";
19
20?>
21--EXPECT--
22AST_STMT_LIST
23    0: AST_WHILE
24        cond: AST_VAR
25            name: "a"
26        stmts: AST_STMT_LIST
27    1: AST_WHILE
28        cond: AST_VAR
29            name: "a"
30        stmts: AST_STMT_LIST
31            0: AST_VAR
32                name: "b"
33    2: AST_WHILE
34        cond: AST_VAR
35            name: "a"
36        stmts: AST_STMT_LIST
37            0: AST_VAR
38                name: "b"
39    3: AST_DECLARE
40        declares: AST_CONST_DECL
41            0: AST_CONST_ELEM
42                name: "ticks"
43                value: 1
44                docComment: null
45        stmts: null
46    4: AST_DECLARE
47        declares: AST_CONST_DECL
48            0: AST_CONST_ELEM
49                name: "ticks"
50                value: 1
51                docComment: null
52        stmts: AST_STMT_LIST