xref: /PHP-8.2/ext/zend_test/test.stub.php (revision e643129b)
1<?php
2
3/**
4 * @generate-class-entries static
5 * @generate-legacy-arginfo 80000
6 * @undocumentable
7 */
8namespace {
9    /**
10     * @var int
11     * @deprecated
12     */
13    const ZEND_TEST_DEPRECATED = 42;
14
15    /** @var string */
16    const ZEND_CONSTANT_A = "global";
17
18    require "Zend/zend_attributes.stub.php";
19
20    interface _ZendTestInterface
21    {
22        /** @var int */
23        public const DUMMY = 0;
24    }
25
26    /** @alias _ZendTestClassAlias */
27    class _ZendTestClass implements _ZendTestInterface {
28        /** @var mixed */
29        public static $_StaticProp;
30        public static int $staticIntProp = 123;
31
32        public int $intProp = 123;
33        public ?stdClass $classProp = null;
34        public stdClass|Iterator|null $classUnionProp = null;
35        public Traversable&Countable $classIntersectionProp;
36        public readonly int $readonlyProp;
37
38        public static function is_object(): int {}
39
40        /** @deprecated */
41        public function __toString(): string {}
42
43        public function returnsStatic(): static {}
44
45        public function returnsThrowable(): Throwable {}
46
47        static public function variadicTest(string|Iterator ...$elements) : static {}
48    }
49
50    class _ZendTestMagicCall
51    {
52        public function __call(string $name, array $args): mixed {}
53    }
54
55    class _ZendTestMagicCallForward
56    {
57        public function __call(string $name, array $args): mixed {}
58    }
59
60    class _ZendTestChildClass extends _ZendTestClass
61    {
62        public function returnsThrowable(): Exception {}
63    }
64
65    trait _ZendTestTrait {
66        /** @var mixed */
67        public $testProp;
68        public Traversable|Countable $classUnionProp;
69
70        public function testMethod(): bool {}
71    }
72
73    #[Attribute(Attribute::TARGET_ALL)]
74    final class ZendTestAttribute {
75
76    }
77
78    #[Attribute(Attribute::TARGET_PARAMETER)]
79    final class ZendTestParameterAttribute {
80        public string $parameter;
81
82        public function __construct(string $parameter) {}
83    }
84
85    #[Attribute(Attribute::TARGET_PROPERTY)]
86    final class ZendTestPropertyAttribute {
87        public string $parameter;
88
89        public function __construct(string $parameter) {}
90    }
91
92    class ZendTestClassWithMethodWithParameterAttribute {
93        final public function no_override(string $parameter): int {}
94        public function override(string $parameter): int {}
95    }
96
97    class ZendTestChildClassWithMethodWithParameterAttribute extends ZendTestClassWithMethodWithParameterAttribute {
98        public function override(string $parameter): int {}
99    }
100
101    final class ZendTestForbidDynamicCall {
102        public function call(): void {}
103        public static function callStatic(): void {}
104    }
105
106    enum ZendTestUnitEnum {
107        case Foo;
108        case Bar;
109    }
110
111    enum ZendTestStringEnum: string {
112        case Foo = "Test1";
113        case Bar = "Test2";
114        case Baz = "Test2\\a";
115        case FortyTwo = "42";
116    }
117
118    enum ZendTestIntEnum: int {
119        case Foo = 1;
120        case Bar = 3;
121        case Baz = -1;
122    }
123
124    function zend_test_array_return(): array {}
125
126    function zend_test_nullable_array_return(): ?array {}
127
128    function zend_test_void_return(): void {}
129
130    function zend_test_compile_string(string $source_string, string $filename, int $position): void {}
131
132    /** @deprecated */
133    function zend_test_deprecated(mixed $arg = null): void {}
134
135    /** @alias zend_test_void_return */
136    function zend_test_aliased(): void {}
137
138    /**
139      * @deprecated
140      * @alias zend_test_void_return
141      */
142    function zend_test_deprecated_aliased(): void {}
143
144    function zend_create_unterminated_string(string $str): string {}
145
146    function zend_terminate_string(string &$str): void {}
147
148    function zend_leak_variable(mixed $variable): void {}
149
150    function zend_leak_bytes(int $bytes = 3): void {}
151
152    function zend_string_or_object(object|string $param): object|string {}
153
154    function zend_string_or_object_or_null(object|string|null $param): object|string|null {}
155
156    /** @param stdClass|string $param */
157    function zend_string_or_stdclass($param): stdClass|string {}
158
159    /** @param stdClass|string|null $param */
160    function zend_string_or_stdclass_or_null($param): stdClass|string|null {}
161
162    function zend_iterable(iterable $arg1, ?iterable $arg2 = null): void {}
163
164    function zend_weakmap_attach(object $object, mixed $value): bool {}
165    function zend_weakmap_remove(object $object): bool {}
166    function zend_weakmap_dump(): array {}
167
168    function zend_get_unit_enum(): ZendTestUnitEnum {}
169
170    function zend_test_parameter_with_attribute(string $parameter): int {}
171
172    function zend_get_current_func_name(): string {}
173
174    function zend_call_method(object|string $obj_or_class, string $method, mixed $arg1 = UNKNOWN, mixed $arg2 = UNKNOWN): mixed {}
175
176    function zend_test_zend_ini_parse_quantity(string $str): int {}
177    function zend_test_zend_ini_parse_uquantity(string $str): int {}
178
179    function zend_test_zend_ini_str(): string {}
180
181    function zend_get_map_ptr_last(): int {}
182
183    function zend_test_crash(?string $message = null): void {}
184
185#if defined(HAVE_LIBXML) && !defined(PHP_WIN32)
186function zend_test_override_libxml_global_state(): void {}
187#endif
188
189    function zend_test_is_pcre_bundled(): bool {}
190
191#if defined(PHP_WIN32)
192    function zend_test_set_fmode(bool $binary): void {}
193#endif
194
195    /** @param resource $stream */
196    function zend_test_cast_fread($stream): void {}
197
198    function zend_test_is_zend_ptr(int $addr): bool {}
199
200    function zend_test_log_err_debug(string $str): void {}
201}
202
203namespace ZendTestNS {
204
205    class Foo {
206        /** @tentative-return-type */
207        public function method(): int {}
208    }
209
210    class UnlikelyCompileError {
211        /* This method signature would create a compile error due to the string
212         * "ZendTestNS\UnlikelyCompileError" in the generated macro call */
213        public function method(): ?UnlikelyCompileError {}
214    }
215
216    class NotUnlikelyCompileError {
217        /* This method signature would create a compile error due to the string
218         * "ZendTestNS\NotUnlikelyCompileError" in the generated macro call */
219        public function method(): ?NotUnlikelyCompileError {}
220    }
221}
222
223namespace ZendTestNS2 {
224
225    /**
226     * @var string
227     * @cvalue ZEND_TEST_NS_CONSTANT_A
228     */
229    const ZEND_CONSTANT_A = UNKNOWN;
230
231    class Foo {
232        public ZendSubNS\Foo $foo;
233
234        public function method(): void {}
235    }
236
237    function namespaced_func(): bool {}
238
239    /** @deprecated */
240    function namespaced_deprecated_func(): void {}
241
242    /** @alias zend_test_void_return */
243    function namespaced_aliased_func(): void {}
244
245    /**
246     * @deprecated
247     * @alias zend_test_void_return
248     */
249    function namespaced_deprecated_aliased_func(): void {}
250}
251
252namespace ZendTestNS2\ZendSubNS {
253
254    /** @var string */
255    const ZEND_CONSTANT_A = \ZendTestNS2\ZEND_CONSTANT_A;
256    // Reference another namespaced constant.
257
258    class Foo {
259        public function method(): void {}
260    }
261
262    function namespaced_func(): bool {}
263
264    /** @deprecated */
265    function namespaced_deprecated_func(): void {}
266
267    /** @alias zend_test_void_return */
268    function namespaced_aliased_func(): void {}
269
270    /**
271     * @deprecated
272     * @alias zend_test_void_return
273     */
274    function namespaced_deprecated_aliased_func(): void {}
275}
276