xref: /php-ast/tests/prop_doc_comments.phpt (revision 260678d4)
1--TEST--
2Doc comments on properties
3--FILE--
4<?php
5
6require __DIR__ . '/../util.php';
7
8$code = <<<'PHP'
9<?php
10class A {
11    /** docComment $a */
12    public $a;
13
14    public
15        /** docComment $b */
16        $b,
17        /** docComment $c */
18        $c
19    ;
20}
21PHP;
22
23echo ast_dump(ast\parse_code($code, $version=50)), "\n";
24echo ast_dump(ast\parse_code($code, $version=80)), "\n";
25
26?>
27--EXPECTF--
28Deprecated: ast\parse_code(): Version 50 is deprecated in %s.php on line 20
29AST_STMT_LIST
30    0: AST_CLASS
31        name: "A"
32        docComment: null
33        extends: null
34        implements: null
35        stmts: AST_STMT_LIST
36            0: AST_PROP_DECL
37                flags: MODIFIER_PUBLIC (%d)
38                0: AST_PROP_ELEM
39                    name: "a"
40                    default: null
41                    docComment: "/** docComment $a */"
42            1: AST_PROP_DECL
43                flags: MODIFIER_PUBLIC (%d)
44                0: AST_PROP_ELEM
45                    name: "b"
46                    default: null
47                    docComment: "/** docComment $b */"
48                1: AST_PROP_ELEM
49                    name: "c"
50                    default: null
51                    docComment: "/** docComment $c */"
52        __declId: 0
53AST_STMT_LIST
54    0: AST_CLASS
55        name: "A"
56        docComment: null
57        extends: null
58        implements: null
59        stmts: AST_STMT_LIST
60            0: AST_PROP_GROUP
61                flags: MODIFIER_PUBLIC (%d)
62                type: null
63                props: AST_PROP_DECL
64                    0: AST_PROP_ELEM
65                        name: "a"
66                        default: null
67                        docComment: "/** docComment $a */"
68                attributes: null
69            1: AST_PROP_GROUP
70                flags: MODIFIER_PUBLIC (%d)
71                type: null
72                props: AST_PROP_DECL
73                    0: AST_PROP_ELEM
74                        name: "b"
75                        default: null
76                        docComment: "/** docComment $b */"
77                    1: AST_PROP_ELEM
78                        name: "c"
79                        default: null
80                        docComment: "/** docComment $c */"
81                attributes: null
82        attributes: null
83        __declId: 0