forked from nikic/php-ast
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathast_stub.php
278 lines (263 loc) · 6.75 KB
/
ast_stub.php
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
<?php
/**
* PHPDoc stub file for ast extension
* @author Bill Schaller <[email protected]>
* @author Nikita Popov <[email protected]>
*/
// AST KIND CONSTANTS
namespace ast;
const AST_FUNC_DECL = 66;
const AST_CLOSURE = 67;
const AST_METHOD = 68;
const AST_CLASS = 69;
const AST_ARG_LIST = 128;
const AST_LIST = 129;
const AST_ARRAY = 130;
const AST_ENCAPS_LIST = 131;
const AST_EXPR_LIST = 132;
const AST_STMT_LIST = 133;
const AST_IF = 134;
const AST_SWITCH_LIST = 135;
const AST_CATCH_LIST = 136;
const AST_PARAM_LIST = 137;
const AST_CLOSURE_USES = 138;
const AST_PROP_DECL = 139;
const AST_CONST_DECL = 140;
const AST_CLASS_CONST_DECL = 141;
const AST_NAME_LIST = 142;
const AST_TRAIT_ADAPTATIONS = 143;
const AST_USE = 144;
const AST_MAGIC_CONST = 0;
const AST_TYPE = 1;
const AST_VAR = 256;
const AST_CONST = 257;
const AST_UNPACK = 258;
const AST_UNARY_PLUS = 259;
const AST_UNARY_MINUS = 260;
const AST_CAST = 261;
const AST_EMPTY = 262;
const AST_ISSET = 263;
const AST_SILENCE = 264;
const AST_SHELL_EXEC = 265;
const AST_CLONE = 266;
const AST_EXIT = 267;
const AST_PRINT = 268;
const AST_INCLUDE_OR_EVAL = 269;
const AST_UNARY_OP = 270;
const AST_PRE_INC = 271;
const AST_PRE_DEC = 272;
const AST_POST_INC = 273;
const AST_POST_DEC = 274;
const AST_YIELD_FROM = 275;
const AST_GLOBAL = 276;
const AST_UNSET = 277;
const AST_RETURN = 278;
const AST_LABEL = 279;
const AST_REF = 280;
const AST_HALT_COMPILER = 281;
const AST_ECHO = 282;
const AST_THROW = 283;
const AST_GOTO = 284;
const AST_BREAK = 285;
const AST_CONTINUE = 286;
const AST_DIM = 512;
const AST_PROP = 513;
const AST_STATIC_PROP = 514;
const AST_CALL = 515;
const AST_CLASS_CONST = 516;
const AST_ASSIGN = 517;
const AST_ASSIGN_REF = 518;
const AST_ASSIGN_OP = 519;
const AST_BINARY_OP = 520;
const AST_GREATER = 521;
const AST_GREATER_EQUAL = 522;
const AST_AND = 523;
const AST_OR = 524;
const AST_ARRAY_ELEM = 525;
const AST_NEW = 526;
const AST_INSTANCEOF = 527;
const AST_YIELD = 528;
const AST_COALESCE = 529;
const AST_STATIC = 530;
const AST_WHILE = 531;
const AST_DO_WHILE = 532;
const AST_IF_ELEM = 533;
const AST_SWITCH = 534;
const AST_SWITCH_CASE = 535;
const AST_DECLARE = 536;
const AST_CONST_ELEM = 537;
const AST_USE_TRAIT = 538;
const AST_TRAIT_PRECEDENCE = 539;
const AST_METHOD_REFERENCE = 540;
const AST_NAMESPACE = 541;
const AST_USE_ELEM = 542;
const AST_TRAIT_ALIAS = 543;
const AST_GROUP_USE = 544;
const AST_METHOD_CALL = 768;
const AST_STATIC_CALL = 769;
const AST_CONDITIONAL = 770;
const AST_TRY = 771;
const AST_CATCH = 772;
const AST_PARAM = 773;
const AST_PROP_ELEM = 774;
const AST_FOR = 1024;
const AST_FOREACH = 1025;
const AST_NAME = 2048;
const AST_CLOSURE_VAR = 2049;
// END AST KIND CONSTANTS
// AST FLAG CONSTANTS
namespace ast\flags;
const NAME_FQ = 0;
const NAME_NOT_FQ = 1;
const NAME_RELATIVE = 2;
const MODIFIER_PUBLIC = 256;
const MODIFIER_PROTECTED = 512;
const MODIFIER_PRIVATE = 1024;
const MODIFIER_STATIC = 1;
const MODIFIER_ABSTRACT = 2;
const MODIFIER_FINAL = 4;
const RETURNS_REF = 67108864;
const CLASS_ABSTRACT = 32;
const CLASS_FINAL = 4;
const CLASS_TRAIT = 128;
const CLASS_INTERFACE = 64;
const CLASS_ANONYMOUS = 256;
const PARAM_REF = 1;
const PARAM_VARIADIC = 2;
const TYPE_NULL = 1;
const TYPE_BOOL = 13;
const TYPE_LONG = 4;
const TYPE_DOUBLE = 5;
const TYPE_STRING = 6;
const TYPE_ARRAY = 7;
const TYPE_OBJECT = 8;
const TYPE_CALLABLE = 14;
const UNARY_BOOL_NOT = 13;
const UNARY_BITWISE_NOT = 12;
const UNARY_SILENCE = 260;
const UNARY_PLUS = 261;
const UNARY_MINUS = 262;
const BINARY_BOOL_AND = 259;
const BINARY_BOOL_OR = 258;
const BINARY_BOOL_XOR = 14;
const BINARY_BITWISE_OR = 9;
const BINARY_BITWISE_AND = 10;
const BINARY_BITWISE_XOR = 11;
const BINARY_CONCAT = 8;
const BINARY_ADD = 1;
const BINARY_SUB = 2;
const BINARY_MUL = 3;
const BINARY_DIV = 4;
const BINARY_MOD = 5;
const BINARY_POW = 166;
const BINARY_SHIFT_LEFT = 6;
const BINARY_SHIFT_RIGHT = 7;
const BINARY_IS_IDENTICAL = 15;
const BINARY_IS_NOT_IDENTICAL = 16;
const BINARY_IS_EQUAL = 17;
const BINARY_IS_NOT_EQUAL = 18;
const BINARY_IS_SMALLER = 19;
const BINARY_IS_SMALLER_OR_EQUAL = 20;
const BINARY_IS_GREATER = 256;
const BINARY_IS_GREATER_OR_EQUAL = 257;
const BINARY_SPACESHIP = 170;
const ASSIGN_BITWISE_OR = 31;
const ASSIGN_BITWISE_AND = 32;
const ASSIGN_BITWISE_XOR = 33;
const ASSIGN_CONCAT = 30;
const ASSIGN_ADD = 23;
const ASSIGN_SUB = 24;
const ASSIGN_MUL = 25;
const ASSIGN_DIV = 26;
const ASSIGN_MOD = 27;
const ASSIGN_POW = 167;
const ASSIGN_SHIFT_LEFT = 28;
const ASSIGN_SHIFT_RIGHT = 29;
const EXEC_EVAL = 1;
const EXEC_INCLUDE = 2;
const EXEC_INCLUDE_ONCE = 4;
const EXEC_REQUIRE = 8;
const EXEC_REQUIRE_ONCE = 16;
const USE_NORMAL = 361;
const USE_FUNCTION = 346;
const USE_CONST = 347;
const MAGIC_LINE = 370;
const MAGIC_FILE = 371;
const MAGIC_DIR = 372;
const MAGIC_NAMESPACE = 389;
const MAGIC_FUNCTION = 376;
const MAGIC_METHOD = 375;
const MAGIC_CLASS = 373;
const MAGIC_TRAIT = 374;
// END AST FLAG CONSTANTS
namespace ast;
/**
* Parses code file and returns AST root node.
*
* @param string $filename Code file to parse
* @param int $version AST version
* @return Node Root node of AST
*
* @see https://github.com/nikic/php-ast for version information
*/
function parse_file($filename, $version)
{
}
/**
* Parses code string and returns AST root node.
*
* @param string $code Code string to parse
* @param int $version AST version
* @param string $filename Optional filename for use in parse errors
* @return Node Root node of AST
*
* @see https://github.com/nikic/php-ast for version information
*/
function parse_code($code, $version, $filename = "string code")
{
}
/**
* @param int $kind AST_* constant value defining the kind of an AST node
* @return string String representation of AST kind value
*/
function get_kind_name($kind)
{
}
/**
* @param int $kind AST_* constant value defining the kind of an AST node
* @return bool Returns true if AST kind uses flags
*/
function kind_uses_flags($kind)
{
}
/**
* This class describes a single node in a PHP AST.
*/
class Node
{
/** @var int AST Node Kind. Values are one of ast\AST_* constants. */
public $kind;
/**
* @var int AST Flags.
* Certain node kinds have flags that can be set.
* These will be a bitfield of ast\flags\* constants.
*/
public $flags;
/** @var int Line the node starts in */
public $lineno;
/** @var array Child nodes (may be empty) */
public $children;
}
namespace ast\Node;
/**
* AST Node type for function and class declarations.
*/
class Decl extends \ast\Node
{
/** @var int End line number of the declaration */
public $endLineno;
/** @var string Name of the function or class (not including the namespace prefix) */
public $name;
/** @var string|null Doc comment preceeding the declaration. null if no doc comment was used. */
public $docComment;
}