xref: /PHP-8.1/ext/ffi/ffi.stub.php (revision 2378f357)
1<?php
2
3/** @generate-class-entries */
4
5namespace {
6
7	/** @not-serializable */
8    final class FFI
9    {
10        public static function cdef(string $code = "", ?string $lib = null): FFI {}
11
12        public static function load(string $filename): ?FFI {}
13
14        public static function scope(string $name): FFI {}
15
16        public static function new(FFI\CType|string $type, bool $owned = true, bool $persistent = false): ?FFI\CData {}
17
18        /** @prefer-ref $ptr */
19        public static function free(FFI\CData $ptr): void {}
20
21        /**
22         * @param FFI\CData|int|float|bool|null $ptr
23         * @prefer-ref $ptr
24         */
25        public static function cast(FFI\CType|string $type, $ptr): ?FFI\CData {}
26
27        public static function type(string $type): ?FFI\CType {}
28
29        /** @prefer-ref $ptr */
30        public static function typeof(FFI\CData $ptr): FFI\CType {}
31
32        public static function arrayType(FFI\CType $type, array $dimensions): FFI\CType {}
33
34        /** @prefer-ref $ptr */
35        public static function addr(FFI\CData $ptr): FFI\CData {}
36
37        /** @prefer-ref $ptr */
38        public static function sizeof(FFI\CData|FFI\CType $ptr): int {}
39
40        /** @prefer-ref $ptr */
41        public static function alignof(FFI\CData|FFI\CType $ptr): int {}
42
43        /**
44         * @param FFI\CData|string $from
45         * @prefer-ref $to
46         * @prefer-ref $from
47         */
48        public static function memcpy(FFI\CData $to, $from, int $size): void {}
49
50        /**
51         * @prefer-ref $ptr1
52         * @param string|FFI\CData $ptr1
53         * @prefer-ref $ptr2
54         * @param string|FFI\CData $ptr2
55         */
56        public static function memcmp($ptr1, $ptr2, int $size): int {}
57
58        /** @prefer-ref $ptr */
59        public static function memset(FFI\CData $ptr, int $value, int $size): void {}
60
61        /** @prefer-ref $ptr */
62        public static function string(FFI\CData $ptr, ?int $size = null): string {}
63
64        /** @prefer-ref $ptr */
65        public static function isNull(FFI\CData $ptr): bool {}
66    }
67
68}
69
70namespace FFI {
71
72	/** @not-serializable */
73    final class CData {
74    }
75
76	/** @not-serializable */
77    final class CType {
78        public function getName(): string {}
79
80        public function getKind(): int {}
81        public function getSize(): int {}
82        public function getAlignment(): int {}
83        public function getAttributes(): int {}
84
85        public function getEnumKind(): int {}
86
87        public function getArrayElementType(): CType {}
88        public function getArrayLength(): int {}
89
90        public function getPointerType(): CType {}
91
92        public function getStructFieldNames(): array {}
93        public function getStructFieldOffset(string $name): int {}
94        public function getStructFieldType(string $name): CType {}
95
96        public function getFuncABI(): int {}
97        public function getFuncReturnType(): CType {}
98        public function getFuncParameterCount(): int {}
99        public function getFuncParameterType(int $index): CType {}
100    }
101
102    class Exception extends \Error {
103    }
104
105    final class ParserException extends Exception {
106    }
107
108}
109