summaryrefslogtreecommitdiff
path: root/ext/ffi/ffi.stub.php
blob: 812217f99010d6ebf9d74a58697125b839fd4eb5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?php

class FFI
{
    /** @return ?FFI */
    static function cdef(string $code = UNKNOWN, string $lib = UNKNOWN) {}

    /** @return ?FFI */
    static function load(string $filename) {}

    /** @return ?FFI */
    static function scope(string $scope_name) {}

    /**
     * @param FFI\CType|string $type
     * @return ?FFI\CData
     */
    static function new($type, bool $owned = true, bool $persistent = false) {}

    /** 
     * @prefer-ref $ptr
     * @return void
     */
    static function free(FFI\CData $ptr) {}

    /** 
     * @param FFI\CType|string $type
     * @prefer-ref $ptr
     * @return ?FFI\CData
     */
    static function cast($type, $ptr) {}

    /** @return ?FFI\CType */
    static function type(string $type) {}

    /**
     * @prefer-ref $ptr
     * @return FFI\CType
     */
    static function typeof(FFI\CData $ptr) {}

    /** @return ?FFI\CType */
    static function arrayType(FFI\CType $type, array $dims) {}

    /**
     * @prefer-ref $ptr
     * @return FFI\CData
     */
    static function addr(FFI\CData $ptr) {}

    /**
     * @prefer-ref $ptr
     * @return ?int
     */
    static function sizeof(object $ptr) {}

    /**
     * @prefer-ref $ptr
     * @return ?int
     */
    static function alignof(object $ptr) {}

    /**
     * @prefer-ref $dst
     * @prefer-ref $src
     * @param string|FFI\CData $dst
     * @return void
     */
    static function memcpy(FFI\CData $dst, $src, int $size) {}

    /**
     * @prefer-ref $ptr1
     * @param string|FFI\CData $ptr1
     * @prefer-ref $ptr2
     * @param string|FFI\CData $ptr2
     * @return ?int
     */
    static function memcmp($ptr1, $ptr2, int $size) {}

    /**
     * @prefer-ref $ptr
     * @return void
     */
    static function memset(FFI\CData $ptr, int $ch, int $size) {}

    /**
     * @prefer-ref $ptr
     * @return ?string
     */
    static function string(FFI\CData $ptr, int $size = UNKNOWN) {}

    /**
     * @prefer-ref $ptr
     */
    static function isNull(FFI\CData $ptr) {}
}