xref: /php-ast/tests/class_consts_80.phpt (revision 260678d4)
1--TEST--
2Class constants in AST version 80
3--FILE--
4<?php
5
6require __DIR__ . '/../util.php';
7
8$code = <<<'PHP'
9<?php
10class Test {
11    /** Doc A */
12    const A = 1;
13    protected const
14        /** Doc E */
15        E = 5,
16        /** Doc F */
17        F = 6;
18}
19PHP;
20
21echo ast_dump(ast\parse_code($code, $version=80));
22
23?>
24--EXPECTF--
25AST_STMT_LIST
26    0: AST_CLASS
27        name: "Test"
28        docComment: null
29        extends: null
30        implements: null
31        stmts: AST_STMT_LIST
32            0: AST_CLASS_CONST_GROUP
33                flags: MODIFIER_PUBLIC (%d)
34                const: AST_CLASS_CONST_DECL
35                    0: AST_CONST_ELEM
36                        name: "A"
37                        value: 1
38                        docComment: "/** Doc A */"
39                attributes: null
40            1: AST_CLASS_CONST_GROUP
41                flags: MODIFIER_PROTECTED (%d)
42                const: AST_CLASS_CONST_DECL
43                    0: AST_CONST_ELEM
44                        name: "E"
45                        value: 5
46                        docComment: "/** Doc E */"
47                    1: AST_CONST_ELEM
48                        name: "F"
49                        value: 6
50                        docComment: "/** Doc F */"
51                attributes: null
52        attributes: null
53        __declId: 0
54