xref: /php-ast/tests/php82_encaps_list2.phpt (revision 1fc2c3a1)
1--TEST--
2Encapsulated variable flags in PHP 8.2
3--SKIPIF--
4<?php if (PHP_VERSION_ID < 80200) die('skip PHP >= 8.2 only'); ?>
5--FILE--
6<?php
7
8require __DIR__ . '/../util.php';
9
10$code = '<?php "${a}${b->c}{$d}${$e["f"]}${g[\'h\']}{$i[\'j\']}";';
11$node = ast\parse_code($code, $version=85);
12echo ast_dump($node), "\n";
13--EXPECTF--
14AST_STMT_LIST
15    0: AST_ENCAPS_LIST
16        0: AST_VAR
17            flags: ENCAPS_VAR_DOLLAR_CURLY (%d)
18            name: "a"
19        1: AST_VAR
20            flags: ENCAPS_VAR_DOLLAR_CURLY_VAR_VAR (%d)
21            name: AST_PROP
22                expr: AST_CONST
23                    name: AST_NAME
24                        flags: NAME_NOT_FQ (%d)
25                        name: "b"
26                prop: "c"
27        2: AST_VAR
28            name: "d"
29        3: AST_VAR
30            flags: ENCAPS_VAR_DOLLAR_CURLY_VAR_VAR (%d)
31            name: AST_DIM
32                expr: AST_VAR
33                    name: "e"
34                dim: "f"
35        4: AST_DIM
36            flags: ENCAPS_VAR_DOLLAR_CURLY (%d)
37            expr: AST_VAR
38                name: "g"
39            dim: "h"
40        5: AST_DIM
41            expr: AST_VAR
42                name: "i"
43            dim: "j"
44