forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.stub.php
392 lines (291 loc) · 10.5 KB
/
test.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
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
<?php
/**
* @generate-class-entries static
* @generate-legacy-arginfo 80000
* @undocumentable
*/
namespace {
require "Zend/zend_attributes.stub.php";
/**
* @var int
* @deprecated
*/
const ZEND_TEST_DEPRECATED = 42;
/** @var string */
const ZEND_CONSTANT_A = "global";
interface _ZendTestInterface
{
/** @var int */
/** @genstubs-expose-comment-block
* "Lorem ipsum"
* @see https://www.php.net
* @since 8.2
*/
public const DUMMY = 0;
}
/** @alias _ZendTestClassAlias */
class _ZendTestClass implements _ZendTestInterface {
public const mixed TYPED_CLASS_CONST1 = [];
public const int|array TYPED_CLASS_CONST2 = 42;
/**
* @var int
* @cvalue 1
*/
public const int|string TYPED_CLASS_CONST3 = UNKNOWN;
/**
* @deprecated
*/
public const int ZEND_TEST_DEPRECATED = 42;
#[\Deprecated(message: "custom message")]
public const int ZEND_TEST_DEPRECATED_ATTR = 42;
/** @var mixed */
public static $_StaticProp;
public static int $staticIntProp = 123;
public int $intProp = 123;
public ?stdClass $classProp = null;
public stdClass|Iterator|null $classUnionProp = null;
public Traversable&Countable $classIntersectionProp;
public readonly int $readonlyProp;
public final int $finalProp;
public static function is_object(): int {}
/** @deprecated */
public function __toString(): string {}
public function returnsStatic(): static {}
public function returnsThrowable(): Throwable {}
static public function variadicTest(string|Iterator ...$elements) : static {}
public function takesUnionType(stdclass|Iterator $arg): void {}
}
class _ZendTestMagicCall
{
public function __call(string $name, array $args): mixed {}
}
class _ZendTestMagicCallForward
{
public function __call(string $name, array $args): mixed {}
}
class _ZendTestChildClass extends _ZendTestClass
{
public function returnsThrowable(): Exception {}
}
class ZendAttributeTest {
/** @var int */
#[ZendTestRepeatableAttribute]
#[ZendTestRepeatableAttribute]
public const TEST_CONST = 1;
/** @var mixed */
#[ZendTestRepeatableAttribute]
#[ZendTestPropertyAttribute("testProp")]
public $testProp;
#[ZendTestAttribute]
public function testMethod(): bool {}
}
trait _ZendTestTrait {
/** @var mixed */
public $testProp;
public Traversable|Countable $classUnionProp;
public function testMethod(): bool {}
}
#[Attribute(Attribute::TARGET_ALL)]
final class ZendTestAttribute {
}
#[Attribute(Attribute::TARGET_ALL)]
final class ZendTestAttributeWithArguments {
public readonly mixed $arg;
public function __construct(mixed $arg) {}
}
#[Attribute(Attribute::TARGET_ALL|Attribute::IS_REPEATABLE)]
final class ZendTestRepeatableAttribute {
}
#[Attribute(Attribute::TARGET_PARAMETER)]
final class ZendTestParameterAttribute {
public string $parameter;
public function __construct(string $parameter) {}
}
/** @genstubs-expose-comment-block
* "Lorem ipsum"
* @see https://www.php.net
* @since 8.1
*/
#[Attribute(Attribute::TARGET_PROPERTY)]
final class ZendTestPropertyAttribute {
/** @genstubs-expose-comment-block
* "Lorem ipsum"
* @see https://www.php.net
* @since 8.4
*/
public string $parameter;
public function __construct(string $parameter) {}
}
class ZendTestClassWithMethodWithParameterAttribute {
final public function no_override(
#[ZendTestParameterAttribute("value2")]
string $parameter
): int {}
public function override(
#[ZendTestParameterAttribute("value3")]
string $parameter
): int {}
}
class ZendTestChildClassWithMethodWithParameterAttribute extends ZendTestClassWithMethodWithParameterAttribute {
public function override(
#[ZendTestParameterAttribute("value4")]
string $parameter
): int {}
}
class ZendTestClassWithPropertyAttribute {
// this attribute must be added internally in MINIT
#[ZendTestAttribute]
public string $attributed;
}
final class ZendTestForbidDynamicCall {
public function call(): void {}
public static function callStatic(): void {}
}
enum ZendTestUnitEnum {
case Foo;
case Bar;
}
enum ZendTestStringEnum: string {
case Foo = "Test1";
case Bar = 'Test2';
case Baz = "Test2\\a";
case FortyTwo = "42";
}
enum ZendTestIntEnum: int {
case Foo = 1;
case Bar = 3;
case Baz = -1;
}
function zend_test_array_return(): array {}
/** @genstubs-expose-comment-block
* "Lorem ipsum"
* @see https://www.php.net
* @since 8.3
*/
/**
* @internal
* @compile-time-eval
*/
function zend_test_nullable_array_return(): null|array {}
function zend_test_void_return(): void {}
function zend_test_compile_string(string $source_string, string $filename, int $position): void {}
/** @deprecated */
function zend_test_deprecated(mixed $arg = null): void {}
#[\Deprecated(message: "custom message")]
function zend_test_deprecated_attr(): void {}
#[\NoDiscard(message: "custom message")]
function zend_test_nodiscard(): int {}
#[\Deprecated(message: "custom message")]
#[\NoDiscard(message: "custom message 2")]
function zend_test_deprecated_nodiscard(): int {}
/** @alias zend_test_void_return */
function zend_test_aliased(): void {}
/**
* @deprecated
* @alias zend_test_void_return
*/
function zend_test_deprecated_aliased(): void {}
function zend_create_unterminated_string(string $str): string {}
function zend_terminate_string(string &$str): void {}
function zend_leak_variable(mixed $variable): void {}
function zend_leak_bytes(int $bytes = 3): void {}
function zend_delref(mixed $variable): void {}
function zend_string_or_object(object|string $param): object|string {}
function zend_string_or_object_or_null(object|string|null $param): object|string|null {}
/** @param stdClass|string $param */
function zend_string_or_stdclass($param): stdClass|string {}
/** @param stdClass|string|null $param */
function zend_string_or_stdclass_or_null($param): stdClass|string|null {}
function zend_number_or_string(string|int|float $param): string|int|float {}
function zend_number_or_string_or_null(string|int|float|null $param): string|int|float|null {}
function zend_iterable(iterable $arg1, ?iterable $arg2 = null): void {}
function zend_weakmap_attach(object $object, mixed $value): bool {}
function zend_weakmap_remove(object $object): bool {}
function zend_weakmap_dump(): array {}
function zend_get_unit_enum(): ZendTestUnitEnum {}
function zend_test_parameter_with_attribute(
#[ZendTestParameterAttribute("value1")]
string $parameter
): int {}
#[ZendTestAttributeWithArguments(arg: "foo")]
function zend_test_attribute_with_named_argument(): void {}
function zend_get_current_func_name(): string {}
function zend_call_method(object|string $obj_or_class, string $method, mixed $arg1 = UNKNOWN, mixed $arg2 = UNKNOWN): mixed {}
function zend_object_init_with_constructor(string $class, mixed ...$args): mixed {}
function zend_test_zend_ini_parse_quantity(string $str): int {}
function zend_test_zend_ini_parse_uquantity(string $str): int {}
function zend_test_zend_ini_str(): string {}
#ifdef ZEND_CHECK_STACK_LIMIT
function zend_test_zend_call_stack_get(): ?array {}
function zend_test_zend_call_stack_use_all(): int {}
#endif
function zend_test_is_string_marked_as_valid_utf8(string $string): bool {}
function zend_get_map_ptr_last(): int {}
function zend_test_crash(?string $message = null): void {}
function zend_test_fill_packed_array(array &$array): void {}
/** @return resource */
function zend_test_create_throwing_resource() {}
function get_open_basedir(): ?string {}
#if defined(HAVE_LIBXML) && !defined(PHP_WIN32)
function zend_test_override_libxml_global_state(): void {}
#endif
function zend_test_is_pcre_bundled(): bool {}
#if defined(PHP_WIN32)
function zend_test_set_fmode(bool $binary): void {}
#endif
/** @param resource $stream */
function zend_test_cast_fread($stream): void {}
function zend_test_is_zend_ptr(int $addr): bool {}
function zend_test_log_err_debug(string $str): void {}
}
namespace ZendTestNS {
class Foo {
/** @tentative-return-type */
public function method(): int {}
}
class UnlikelyCompileError {
/* This method signature would create a compile error due to the string
* "ZendTestNS\UnlikelyCompileError" in the generated macro call */
public function method(): ?UnlikelyCompileError {}
}
class NotUnlikelyCompileError {
/* This method signature would create a compile error due to the string
* "ZendTestNS\NotUnlikelyCompileError" in the generated macro call */
public function method(): ?NotUnlikelyCompileError {}
}
}
namespace ZendTestNS2 {
/** @var string */
const ZEND_CONSTANT_A = "namespaced";
class Foo {
public ZendSubNS\Foo $foo;
public function method(): void {}
}
function namespaced_func(): bool {}
/** @deprecated */
function namespaced_deprecated_func(): void {}
/** @alias zend_test_void_return */
function namespaced_aliased_func(): void {}
/**
* @deprecated
* @alias zend_test_void_return
*/
function namespaced_deprecated_aliased_func(): void {}
}
namespace ZendTestNS2\ZendSubNS {
/** @var string */
const ZEND_CONSTANT_A = \ZendTestNS2\ZEND_CONSTANT_A;
class Foo {
public function method(): void {}
}
function namespaced_func(): bool {}
/** @deprecated */
function namespaced_deprecated_func(): void {}
/** @alias zend_test_void_return */
function namespaced_aliased_func(): void {}
/**
* @deprecated
* @alias zend_test_void_return
*/
function namespaced_deprecated_aliased_func(): void {}
}