forked from runkit7/runkit7
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrunkit-api.php
274 lines (251 loc) · 12.5 KB
/
runkit-api.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
<?php
// The runkit7 fork has a slightly different API from what is documented at https://secure.php.net/runkit
//
// - Return types were added for php7.0
// - Some functions are unsupported
// These constants depend on the php version, and may change.
const RUNKIT_ACC_RETURN_REFERENCE = 0x4000000;
const RUNKIT_ACC_PUBLIC = 0x100;
const RUNKIT_ACC_PROTECTED = 0x200;
const RUNKIT_ACC_PRIVATE = 0x400;
const RUNKIT_ACC_STATIC = 0x1;
const RUNKIT_VERSION = "1.0.5b1";
/**
* Similar to define(), but allows defining in class definitions as well.
*
* NOTE: Constants and class constants within the same file may be inlined by the Zend VM optimizer,
* and this may or may not have an effect if the constant already exists.
*
* @param string $constname Name of constant to declare. Either a string to indicate a global constant, or classname::constname to indicate a class constant.
* @param mixed $value null, Bool, Long, Double, String, Resource, or Array value to store in the new constant.
* @param int $visibility - Visibility of the constant. Public by default.
* @return bool - TRUE on success or FALSE on failure.
*/
function runkit_constant_add(string $constname, $value, int $visibility = RUNKIT_ACC_PUBLIC) : bool {
}
/**
* Similar to define(), but allows defining in class definitions as well.
*
* NOTE: Constants and class constants within the same file may be inlined by the Zend VM optimizer,
* and this may or may not have an effect if the constant already exists.
*
* @param string $constname Name of constant to declare. Either a string to indicate a global constant, or classname::constname to indicate a class constant.
* @param mixed $value null, Bool, Long, Double, String, Resource, or Array value to store in the new constant.
* @param int|null $newVisibility The new visibility of the constant. Unchanged by default.
* @return bool - TRUE on success or FALSE on failure.
*/
function runkit_constant_redefine(string $constname, $value, int $newVisibility = null) : bool {
}
/**
* Remove/Delete an already defined constant
*
* NOTE: Constants and class constants within the same file may be inlined by the Zend VM optimizer,
* and this may or may not have an effect if the constant already exists.
*
* @param string $constname Name of constant to declare. Either a string to indicate a global constant, or classname::constname to indicate a class constant.
* @return bool - TRUE on success or FALSE on failure.
*/
function runkit_constant_remove(string $constname) : bool {
}
/**
* Add a new function, similar to create_function()
* Gives you more control over the type of function being created
* (Signature 1 of 2)
*
* @param string $funcname Name of function to be created
* @param string $arglist Comma separated argument list
* @param string $code Code making up the function
* @param bool $return_by_reference whether the function should return by reference
* @param ?string $doc_comment The doc comment of the function
* @param ?string $return_type Return type of this function (e.g. `stdClass`, `?string`(php 7.1))
* @return bool - True on success or false on failure.
*/
function runkit_function_add(string $funcname, string $arglist, string $code, bool $return_by_reference = null, string $doc_comment = null, string $return_type = null, bool $is_strict = null) : bool {
}
/**
* Add a new function, similar to create_function()
* Gives you more control over the type of function being created
* (Signature 2 of 2)
*
* @param string $funcname Name of function to be created
* @param Closure $closure A closure to use as the source for this function. Static variables and `use` variables are copied.
* @param ?string $doc_comment The doc comment of the function
* @param ?bool $is_strict Set to true to make the redefined function use strict types.
* @return bool - True on success or false on failure.
*/
function runkit_function_add(string $funcname, Closure $closure, string $doc_comment = null, bool $is_strict = null) : bool {
}
/**
* Copy a function to a new function name
* @param string $funcname - Name of existing function
* @param string $targetname - Name of new function to copy definition to
* @return bool - True on success or false on failure.
*/
function runkit_function_copy(string $funcname, string $targetname) : bool {
}
/**
* Replace a function definition with a new implementation. (Should be equivalent to remove() then add())
* (Signature 1 of 2)
*
* @param string $funcname Name of function to redefine
* @param string $arglist New list of arguments to be accepted by function
* @param string $code New code implementation
* @param bool $return_by_reference whether the function should return by reference
* @param ?string $doc_comment The doc comment of the function
* @param ?string $return_type Return type of this function (e.g. `stdClass`, `?string`(php 7.1))
* @param ?bool $is_strict Set to true to make the redefined function use strict types.
* @return bool - True on success or false on failure.
*/
function runkit_function_redefine(string $funcname, string $arglist, string $code, bool $return_by_reference = null, string $doc_comment = null, string $return_type = null, bool $is_strict = null) : bool {
}
/**
* Replace a function definition with a new implementation. (Should be equivalent to remove() then add())
* (Signature 2 of 2)
*
* @param string $funcname Name of function to redefine
* @param Closure $closure A closure to use as the new definition for this function. Static variables and `use` variables are copied.
* @param ?string $doc_comment The doc comment of the function
* @param ?bool $is_strict Set to true to make the redefined function use strict types.
* @return bool - True on success or false on failure.
*/
function runkit_function_redefine(string $funcname, Closure $closure, string $doc_comment = null, bool $is_strict = null) : bool {
}
/**
* Remove a function definition.
*
* @param string $funcname Name of function to be deleted
* @return bool - True on success or false on failure.
*/
function runkit_function_remove(string $funcname) : bool {
}
/**
* Change a function's name
*
* @param string $funcname Current function name
* @param string $newname New function name
*
* @return bool - True on success or false on failure.
*/
function runkit_function_rename(string $funcname, string $newname) : bool {
}
/**
* Dynamically adds a new method to a given class
* (Signature 1 of 2)
*
* @param string $classname The class to which this method will be added
* @param string $methodname The name of the method to add
* @param string $arglist Comma separated argument list
* @param string $code The code to be evaluated when $methodname is called
* @param int $flags The type of method to create, can be RUNKIT_ACC_PUBLIC, RUNKIT_ACC_PROTECTED or RUNKIT_ACC_PRIVATE
* optionally combined via bitwise OR with RUNKIT_ACC_STATIC (since 1.0.1)
* @param ?string $doc_comment The doc comment of the method
* @param ?string $return_type Return type of this method (e.g. `stdClass`, `?string`(php 7.1))
* @param ?bool $is_strict Set to true to make the redefined function use strict types.
* @return bool - True on success or false on failure.
*/
function runkit_method_add(string $classname, string $methodname, string $arglist, string $code, int $flags = RUNKIT_ACC_PUBLIC, string $doc_comment = null, string $return_type = null, bool $is_strict = null) : bool {
}
/**
* Add a new function, similar to create_function()
* Gives you more control over the type of function being created
* (Signature 2 of 2)
*
* @param string $classname The class to which this method will be added
* @param string $methodname The name of the method to add
* @param Closure $closure A closure to use as the source for this function. Static variables and `use` variables and return types are copied.
* @param int $flags The type of method to create, can be RUNKIT_ACC_PUBLIC, RUNKIT_ACC_PROTECTED or RUNKIT_ACC_PRIVATE
* optionally combined via bitwise OR with RUNKIT_ACC_STATIC (since 1.0.1)
* @param ?string $doc_comment The doc comment of the method
* @param ?bool $is_strict Set to true to make the redefined function use strict types.
* @return bool - True on success or false on failure.
*/
function runkit_method_add(string $classname, string $methodname, Closure $closure, int $flags = RUNKIT_ACC_PUBLIC, string $doc_comment = null, bool $is_strict = null) : bool {
}
/**
* Copies a method from class to another
* @param string $dClass Destination class for copied method
* @param string $dMethod Destination method name
* @param string $sClass Source class of the method to copy
* @param string $sMethod Name of the method to copy from the source class. If this parameter is omitted, the value of $dMethod is assumed.
* @return bool - True on success or false on failure.
*/
function runkit_method_copy(string $dClass, string $dMethod, string $sClass, string $sMethod = null) : bool {
}
/**
* Replace a method definition with a new implementation. (Should be equivalent to remove() then add())
* (Signature 1 of 2)
*
* @param string $classname The class in which to redefine the method
* @param string $methodname The name of the method to redefine
* @param string $arglist Comma separated argument list for the redefined method
* @param string $code The new code to be evaluated when methodname is called
* @param int $flags The type of method to create, can be RUNKIT_ACC_PUBLIC, RUNKIT_ACC_PROTECTED or RUNKIT_ACC_PRIVATE
* optionally combined via bitwise OR with RUNKIT_ACC_STATIC (since 1.0.1)
* @param ?string $doc_comment The doc comment of the method
* @param ?string $return_type Return type of this method (e.g. `stdClass`, `?string`(php 7.1))
* @param ?bool $is_strict Set to true to make the redefined function use strict types.
* @return bool - True on success or false on failure.
*/
function runkit_method_redefine(string $classname, string $methodname, string $args, string $code, int $flags = RUNKIT_ACC_PUBLIC, string $doc_comment = null, string $return_type = null, bool $is_strict = null) : bool {
}
/**
* Replace a method definition with a new implementation. (Should be equivalent to remove() then add())
* (Signature 2 of 2)
*
* @param string $classname The class in which to redefine the method
* @param string $methodname The name of the method to redefine
* @param Closure $closure A closure to use as the new definition for this function. Static variables and `use` variables and return types are copied.
* @param ?string $doc_comment The doc comment of the method
* @param ?bool $is_strict Set to true to make the redefined function use strict types.
* @return bool - True on success or false on failure.
*/
function runkit_method_redefine(string $classname, string $methodname, Closure $closure, string $doc_comment = null, bool $is_strict = null) : bool {
}
/**
* Dynamically removes the given method
* (Signature 2 of 2)
*
* @param string $classname The class in which to remove the method
* @param string $methodname The name of the method to remove
* @return bool - True on success or false on failure.
*/
function runkit_method_remove(string $classname, string $methodname) : bool {
}
/**
* Dynamically changes the name of the given method
*
* @param string $classname The class in which to rename the method
* @param string $methodname The name of the method to rename
* @param string $newname The new name to give to the renamed method
* @return bool - True on success or false on failure.
*/
function runkit_method_rename(string $classname, string $methodname, string $newname) : bool {
}
/**
* Gets a unique integer identifier (Will be reused when the object is garbage collected) for an object.
* This is identical to `spl_object_id`, which will be built into PHP 7.2+.
* Similar to `spl_object_hash`, but returns an int instead of a string.
*
* @param object $obj - The object
* @return int|false - Returns false if given a non-object.
*/
function runkit_object_id($obj) : int {
}
/**
* Gets a unique integer identifier (Will be reused when the object is garbage collected) for an object.
* This is similar to `spl_object_hash`, but returns an int instead of a string.
*
* NOTE: runkit can provide an optional native implementation, but that is currently disabled by default by `./configure`.
* spl_object_id is built into PHP 7.2+.
*
* @param object $obj - The object
* @return int|null - Returns null if given a non-object.
*/
function spl_object_id($obj) : int {
}
/**
* Return numerically indexed array of registered superglobals.
* @return string[]
*/
function runkit_superglobals() : array {
}