xref: /PHP-8.2/ext/zend_test/test.stub.php (revision 1ff277de)
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 _ZendTestChildClass extends _ZendTestClass
56    {
57        public function returnsThrowable(): Exception {}
58    }
59
60    trait _ZendTestTrait {
61        /** @var mixed */
62        public $testProp;
63        public Traversable|Countable $classUnionProp;
64
65        public function testMethod(): bool {}
66    }
67
68    #[Attribute(Attribute::TARGET_ALL)]
69    final class ZendTestAttribute {
70
71    }
72
73    #[Attribute(Attribute::TARGET_PARAMETER)]
74    final class ZendTestParameterAttribute {
75        public string $parameter;
76
77        public function __construct(string $parameter) {}
78    }
79
80    #[Attribute(Attribute::TARGET_PROPERTY)]
81    final class ZendTestPropertyAttribute {
82        public string $parameter;
83
84        public function __construct(string $parameter) {}
85    }
86
87    class ZendTestClassWithMethodWithParameterAttribute {
88        final public function no_override(string $parameter): int {}
89        public function override(string $parameter): int {}
90    }
91
92    class ZendTestChildClassWithMethodWithParameterAttribute extends ZendTestClassWithMethodWithParameterAttribute {
93        public function override(string $parameter): int {}
94    }
95
96    final class ZendTestForbidDynamicCall {
97        public function call(): void {}
98        public static function callStatic(): void {}
99    }
100
101    enum ZendTestUnitEnum {
102        case Foo;
103        case Bar;
104    }
105
106    enum ZendTestStringEnum: string {
107        case Foo = "Test1";
108        case Bar = "Test2";
109        case Baz = "Test2\\a";
110        case FortyTwo = "42";
111    }
112
113    enum ZendTestIntEnum: int {
114        case Foo = 1;
115        case Bar = 3;
116        case Baz = -1;
117    }
118
119    function zend_test_array_return(): array {}
120
121    function zend_test_nullable_array_return(): ?array {}
122
123    function zend_test_void_return(): void {}
124
125    function zend_test_compile_string(string $source_string, string $filename, int $position): void {}
126
127    /** @deprecated */
128    function zend_test_deprecated(mixed $arg = null): void {}
129
130    /** @alias zend_test_void_return */
131    function zend_test_aliased(): void {}
132
133    /**
134      * @deprecated
135      * @alias zend_test_void_return
136      */
137    function zend_test_deprecated_aliased(): void {}
138
139    function zend_create_unterminated_string(string $str): string {}
140
141    function zend_terminate_string(string &$str): void {}
142
143    function zend_leak_variable(mixed $variable): void {}
144
145    function zend_leak_bytes(int $bytes = 3): void {}
146
147    function zend_string_or_object(object|string $param): object|string {}
148
149    function zend_string_or_object_or_null(object|string|null $param): object|string|null {}
150
151    /** @param stdClass|string $param */
152    function zend_string_or_stdclass($param): stdClass|string {}
153
154    /** @param stdClass|string|null $param */
155    function zend_string_or_stdclass_or_null($param): stdClass|string|null {}
156
157    function zend_iterable(iterable $arg1, ?iterable $arg2 = null): void {}
158
159    function zend_weakmap_attach(object $object, mixed $value): bool {}
160    function zend_weakmap_remove(object $object): bool {}
161    function zend_weakmap_dump(): array {}
162
163    function zend_get_unit_enum(): ZendTestUnitEnum {}
164
165    function zend_test_parameter_with_attribute(string $parameter): int {}
166
167    function zend_get_current_func_name(): string {}
168
169    function zend_call_method(object|string $obj_or_class, string $method, mixed $arg1 = UNKNOWN, mixed $arg2 = UNKNOWN): mixed {}
170
171    function zend_test_zend_ini_parse_quantity(string $str): int {}
172    function zend_test_zend_ini_parse_uquantity(string $str): int {}
173
174    function zend_test_zend_ini_str(): string {}
175
176    function zend_get_map_ptr_last(): int {}
177
178    function zend_test_crash(?string $message = null): void {}
179
180#if defined(HAVE_LIBXML) && !defined(PHP_WIN32)
181function zend_test_override_libxml_global_state(): void {}
182#endif
183
184    function zend_test_is_pcre_bundled(): bool {}
185
186#if defined(PHP_WIN32)
187    function zend_test_set_fmode(bool $binary): void {}
188#endif
189
190    /** @param resource $stream */
191    function zend_test_cast_fread($stream): void {}
192
193    function zend_test_is_zend_ptr(int $addr): bool {}
194}
195
196namespace ZendTestNS {
197
198    class Foo {
199        /** @tentative-return-type */
200        public function method(): int {}
201    }
202
203    class UnlikelyCompileError {
204        /* This method signature would create a compile error due to the string
205         * "ZendTestNS\UnlikelyCompileError" in the generated macro call */
206        public function method(): ?UnlikelyCompileError {}
207    }
208
209    class NotUnlikelyCompileError {
210        /* This method signature would create a compile error due to the string
211         * "ZendTestNS\NotUnlikelyCompileError" in the generated macro call */
212        public function method(): ?NotUnlikelyCompileError {}
213    }
214}
215
216namespace ZendTestNS2 {
217
218    /**
219     * @var string
220     * @cvalue ZEND_TEST_NS_CONSTANT_A
221     */
222    const ZEND_CONSTANT_A = UNKNOWN;
223
224    class Foo {
225        public ZendSubNS\Foo $foo;
226
227        public function method(): void {}
228    }
229
230    function namespaced_func(): bool {}
231
232    /** @deprecated */
233    function namespaced_deprecated_func(): void {}
234
235    /** @alias zend_test_void_return */
236    function namespaced_aliased_func(): void {}
237
238    /**
239     * @deprecated
240     * @alias zend_test_void_return
241     */
242    function namespaced_deprecated_aliased_func(): void {}
243}
244
245namespace ZendTestNS2\ZendSubNS {
246
247    /** @var string */
248    const ZEND_CONSTANT_A = \ZendTestNS2\ZEND_CONSTANT_A;
249    // Reference another namespaced constant.
250
251    class Foo {
252        public function method(): void {}
253    }
254
255    function namespaced_func(): bool {}
256
257    /** @deprecated */
258    function namespaced_deprecated_func(): void {}
259
260    /** @alias zend_test_void_return */
261    function namespaced_aliased_func(): void {}
262
263    /**
264     * @deprecated
265     * @alias zend_test_void_return
266     */
267    function namespaced_deprecated_aliased_func(): void {}
268}
269