forked from nikic/php-ast
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathphp86_param_doc_comments.phpt
More file actions
105 lines (101 loc) · 3.2 KB
/
Copy pathphp86_param_doc_comments.phpt
File metadata and controls
105 lines (101 loc) · 3.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
--TEST--
Doc comments on function/method parameters (PHP 8.6+)
--SKIPIF--
<?php if (PHP_VERSION_ID < 80600) die('skip PHP >=8.6 only'); ?>
--FILE--
<?php
require __DIR__ . '/../util.php';
$code = <<<'PHP'
<?php
function f(
/** doc for $a */
int $a,
$b,
/** doc for $c */
string $c = "x",
) {}
class C {
public string $p {
set(
/** doc for $value */
string $value
) { $this->p = $value; }
}
}
PHP;
echo ast_dump(ast\parse_code($code, $version=120)), "\n";
--EXPECT--
AST_STMT_LIST
0: AST_FUNC_DECL
name: "f"
docComment: null
params: AST_PARAM_LIST
0: AST_PARAM
type: AST_TYPE
flags: TYPE_LONG (4)
name: "a"
default: null
attributes: null
docComment: "/** doc for $a */"
hooks: null
1: AST_PARAM
type: null
name: "b"
default: null
attributes: null
docComment: null
hooks: null
2: AST_PARAM
type: AST_TYPE
flags: TYPE_STRING (6)
name: "c"
default: "x"
attributes: null
docComment: "/** doc for $c */"
hooks: null
stmts: AST_STMT_LIST
returnType: null
attributes: null
__declId: 0
1: AST_CLASS
name: "C"
docComment: null
extends: null
implements: null
stmts: AST_STMT_LIST
0: AST_PROP_GROUP
flags: MODIFIER_PUBLIC (1)
type: AST_TYPE
flags: TYPE_STRING (6)
props: AST_PROP_DECL
0: AST_PROP_ELEM
name: "p"
default: null
docComment: null
hooks: AST_STMT_LIST
0: AST_PROPERTY_HOOK
name: "set"
docComment: null
params: AST_PARAM_LIST
0: AST_PARAM
type: AST_TYPE
flags: TYPE_STRING (6)
name: "value"
default: null
attributes: null
docComment: "/** doc for $value */"
hooks: null
stmts: AST_STMT_LIST
0: AST_ASSIGN
var: AST_PROP
expr: AST_VAR
name: "this"
prop: "p"
expr: AST_VAR
name: "value"
attributes: null
__declId: 1
attributes: null
attributes: null
type: null
__declId: 2