xref: /PHP-8.4/ext/ffi/ffi.stub.php (revision a37a3d3d)
1<?php
2
3/** @generate-class-entries */
4
5namespace {
6	/** @not-serializable */
7    final class FFI
8    {
9        /** @cvalue __BIGGEST_ALIGNMENT__ */
10        public const int __BIGGEST_ALIGNMENT__ = UNKNOWN;
11
12        public static function cdef(string $code = "", ?string $lib = null): FFI {}
13
14        public static function load(string $filename): ?FFI {}
15
16        public static function scope(string $name): FFI {}
17
18        public static function new(FFI\CType|string $type, bool $owned = true, bool $persistent = false): FFI\CData {}
19
20        /** @prefer-ref $ptr */
21        public static function free(FFI\CData $ptr): void {}
22
23        /**
24         * @param FFI\CData|int|float|bool|null $ptr
25         * @prefer-ref $ptr
26         */
27        public static function cast(FFI\CType|string $type, $ptr): FFI\CData {}
28
29        public static function type(string $type): FFI\CType {}
30
31        /** @prefer-ref $ptr */
32        public static function typeof(FFI\CData $ptr): FFI\CType {}
33
34        public static function arrayType(FFI\CType $type, array $dimensions): FFI\CType {}
35
36        /** @prefer-ref $ptr */
37        public static function addr(FFI\CData $ptr): FFI\CData {}
38
39        /** @prefer-ref $ptr */
40        public static function sizeof(FFI\CData|FFI\CType $ptr): int {}
41
42        /** @prefer-ref $ptr */
43        public static function alignof(FFI\CData|FFI\CType $ptr): int {}
44
45        /**
46         * @param FFI\CData|string $from
47         * @prefer-ref $to
48         * @prefer-ref $from
49         */
50        public static function memcpy(FFI\CData $to, $from, int $size): void {}
51
52        /**
53         * @prefer-ref $ptr1
54         * @param string|FFI\CData $ptr1
55         * @prefer-ref $ptr2
56         * @param string|FFI\CData $ptr2
57         */
58        public static function memcmp($ptr1, $ptr2, int $size): int {}
59
60        /** @prefer-ref $ptr */
61        public static function memset(FFI\CData $ptr, int $value, int $size): void {}
62
63        /** @prefer-ref $ptr */
64        public static function string(FFI\CData $ptr, ?int $size = null): string {}
65
66        /** @prefer-ref $ptr */
67        public static function isNull(FFI\CData $ptr): bool {}
68    }
69
70}
71
72namespace FFI {
73
74	/** @not-serializable */
75    final class CData {
76    }
77
78	/** @not-serializable */
79    final class CType {
80        /** @cvalue ZEND_FFI_TYPE_VOID */
81        public const int TYPE_VOID = UNKNOWN;
82        /** @cvalue ZEND_FFI_TYPE_FLOAT */
83        public const int TYPE_FLOAT = UNKNOWN;
84        /** @cvalue ZEND_FFI_TYPE_DOUBLE */
85        public const int TYPE_DOUBLE = UNKNOWN;
86#ifdef HAVE_LONG_DOUBLE
87        /** @cvalue ZEND_FFI_TYPE_LONGDOUBLE */
88        public const int TYPE_LONGDOUBLE = UNKNOWN;
89#endif
90        /** @cvalue ZEND_FFI_TYPE_UINT8 */
91        public const int TYPE_UINT8 = UNKNOWN;
92        /** @cvalue ZEND_FFI_TYPE_SINT8 */
93        public const int TYPE_SINT8 = UNKNOWN;
94        /** @cvalue ZEND_FFI_TYPE_UINT16 */
95        public const int TYPE_UINT16 = UNKNOWN;
96        /** @cvalue ZEND_FFI_TYPE_SINT16 */
97        public const int TYPE_SINT16 = UNKNOWN;
98        /** @cvalue ZEND_FFI_TYPE_UINT32 */
99        public const int TYPE_UINT32 = UNKNOWN;
100        /** @cvalue ZEND_FFI_TYPE_SINT32 */
101        public const int TYPE_SINT32 = UNKNOWN;
102        /** @cvalue ZEND_FFI_TYPE_UINT64 */
103        public const int TYPE_UINT64 = UNKNOWN;
104        /** @cvalue ZEND_FFI_TYPE_SINT64 */
105        public const int TYPE_SINT64 = UNKNOWN;
106        /** @cvalue ZEND_FFI_TYPE_ENUM */
107        public const int TYPE_ENUM = UNKNOWN;
108        /** @cvalue ZEND_FFI_TYPE_BOOL */
109        public const int TYPE_BOOL = UNKNOWN;
110        /** @cvalue ZEND_FFI_TYPE_CHAR */
111        public const int TYPE_CHAR = UNKNOWN;
112        /** @cvalue ZEND_FFI_TYPE_POINTER */
113        public const int TYPE_POINTER = UNKNOWN;
114        /** @cvalue ZEND_FFI_TYPE_FUNC */
115        public const int TYPE_FUNC = UNKNOWN;
116        /** @cvalue ZEND_FFI_TYPE_ARRAY */
117        public const int TYPE_ARRAY = UNKNOWN;
118        /** @cvalue ZEND_FFI_TYPE_STRUCT */
119        public const int TYPE_STRUCT = UNKNOWN;
120
121        /** @cvalue ZEND_FFI_ATTR_CONST */
122        public const int ATTR_CONST = UNKNOWN;
123        /** @cvalue ZEND_FFI_ATTR_INCOMPLETE_TAG */
124        public const int ATTR_INCOMPLETE_TAG = UNKNOWN;
125        /** @cvalue ZEND_FFI_ATTR_VARIADIC */
126        public const int ATTR_VARIADIC = UNKNOWN;
127        /** @cvalue ZEND_FFI_ATTR_INCOMPLETE_ARRAY */
128        public const int ATTR_INCOMPLETE_ARRAY = UNKNOWN;
129        /** @cvalue ZEND_FFI_ATTR_VLA */
130        public const int ATTR_VLA = UNKNOWN;
131        /** @cvalue ZEND_FFI_ATTR_UNION */
132        public const int ATTR_UNION = UNKNOWN;
133        /** @cvalue ZEND_FFI_ATTR_PACKED */
134        public const int ATTR_PACKED = UNKNOWN;
135        /** @cvalue ZEND_FFI_ATTR_MS_STRUCT */
136        public const int ATTR_MS_STRUCT = UNKNOWN;
137        /** @cvalue ZEND_FFI_ATTR_GCC_STRUCT */
138        public const int ATTR_GCC_STRUCT = UNKNOWN;
139
140        /** @cvalue ZEND_FFI_ABI_DEFAULT */
141        public const int ABI_DEFAULT = UNKNOWN;
142        /** @cvalue ZEND_FFI_ABI_CDECL */
143        public const int ABI_CDECL = UNKNOWN;
144        /** @cvalue ZEND_FFI_ABI_FASTCALL */
145        public const int ABI_FASTCALL = UNKNOWN;
146        /** @cvalue ZEND_FFI_ABI_THISCALL */
147        public const int ABI_THISCALL = UNKNOWN;
148        /** @cvalue ZEND_FFI_ABI_STDCALL */
149        public const int ABI_STDCALL = UNKNOWN;
150        /** @cvalue ZEND_FFI_ABI_PASCAL */
151        public const int ABI_PASCAL = UNKNOWN;
152        /** @cvalue ZEND_FFI_ABI_REGISTER */
153        public const int ABI_REGISTER = UNKNOWN;
154        /** @cvalue ZEND_FFI_ABI_MS */
155        public const int ABI_MS = UNKNOWN;
156        /** @cvalue ZEND_FFI_ABI_SYSV */
157        public const int ABI_SYSV = UNKNOWN;
158        /** @cvalue ZEND_FFI_ABI_VECTORCALL */
159        public const int ABI_VECTORCALL = UNKNOWN;
160
161        public function getName(): string {}
162
163        public function getKind(): int {}
164        public function getSize(): int {}
165        public function getAlignment(): int {}
166        public function getAttributes(): int {}
167
168        public function getEnumKind(): int {}
169
170        public function getArrayElementType(): CType {}
171        public function getArrayLength(): int {}
172
173        public function getPointerType(): CType {}
174
175        public function getStructFieldNames(): array {}
176        public function getStructFieldOffset(string $name): int {}
177        public function getStructFieldType(string $name): CType {}
178
179        public function getFuncABI(): int {}
180        public function getFuncReturnType(): CType {}
181        public function getFuncParameterCount(): int {}
182        public function getFuncParameterType(int $index): CType {}
183    }
184
185    class Exception extends \Error {
186    }
187
188    final class ParserException extends Exception {
189    }
190}
191