xref: /PHP-8.0/ext/ffi/ffi.stub.php (revision 45fa7596)
1<?php
2
3/** @generate-function-entries */
4
5namespace {
6
7final class FFI
8{
9    public static function cdef(string $code = "", ?string $lib = null): FFI {}
10
11    public static function load(string $filename): ?FFI {}
12
13    public static function scope(string $name): FFI {}
14
15    public static function new(FFI\CType|string $type, bool $owned = true, bool $persistent = false): ?FFI\CData {}
16
17    /** @prefer-ref $ptr */
18    public static function free(FFI\CData $ptr): void {}
19
20    /**
21     * @param FFI\CData|int|float|bool|null $ptr
22     * @prefer-ref $ptr
23     */
24    public static function cast(FFI\CType|string $type, $ptr): ?FFI\CData {}
25
26    public static function type(string $type): ?FFI\CType {}
27
28    /** @prefer-ref $ptr */
29    public static function typeof(FFI\CData $ptr): FFI\CType {}
30
31    public static function arrayType(FFI\CType $type, array $dimensions): FFI\CType {}
32
33    /** @prefer-ref $ptr */
34    public static function addr(FFI\CData $ptr): FFI\CData {}
35
36    /** @prefer-ref $ptr */
37    public static function sizeof(FFI\CData|FFI\CType $ptr): int {}
38
39    /** @prefer-ref $ptr */
40    public static function alignof(FFI\CData|FFI\CType $ptr): int {}
41
42    /**
43     * @param FFI\CData|string $from
44     * @prefer-ref $to
45     * @prefer-ref $from
46     */
47    public static function memcpy(FFI\CData $to, $from, int $size): void {}
48
49    /**
50     * @prefer-ref $ptr1
51     * @param string|FFI\CData $ptr1
52     * @prefer-ref $ptr2
53     * @param string|FFI\CData $ptr2
54     */
55    public static function memcmp($ptr1, $ptr2, int $size): int {}
56
57    /** @prefer-ref $ptr */
58    public static function memset(FFI\CData $ptr, int $value, int $size): void {}
59
60    /** @prefer-ref $ptr */
61    public static function string(FFI\CData $ptr, ?int $size = null): string {}
62
63    /** @prefer-ref $ptr */
64    public static function isNull(FFI\CData $ptr): bool {}
65}
66
67}
68
69namespace FFI {
70
71final class CData {
72}
73
74final class CType {
75    public function getName() : string {}
76}
77
78class Exception extends \Error {
79}
80
81final class ParserException extends Exception {
82}
83
84}
85