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