Issues (200)

tools/stubs/ffi/php.php (3 issues)

1
<?php
2
namespace FFI\PhpInternals;
3
4
use FFI\CArray;
5
use FFI\CData;
6
use FFI\CInteger;
7
use FFI\CPointer;
8
use PhpProfiler\Lib\Process\Pointer\Pointer;
9
10
/**
11
 * This file is part of the sj-i/php-profiler package.
12
 *
13
 * (c) sji <[email protected]>
14
 *
15
 * For the full copyright and license information, please view the LICENSE
16
 * file that was distributed with this source code.
17
 */
18
19
class zend_executor_globals extends CData
20
{
21
    public ?CPointer $current_execute_data;
22
}
23
24
class zend_execute_data extends CData
25
{
26
    public ?CPointer $opline;
27
    public ?CPointer $func;
28
    public ?CPointer $prev_execute_data;
29
}
30
31
class zend_op extends CData
32
{
33
    public CInteger $op1;
34
    public CInteger $op2;
35
    public CInteger $result;
36
    public int $op1_type;
37
    public int $op2_type;
38
    public int $opcode;
39
    public int $result_type;
40
    public int $extended_value;
41
    public int $lineno;
42
}
43
44
class zend_function extends CData
45
{
46
    public int $type;
47
    public zend_function_common $common;
48
    public zend_op_array $op_array;
49
}
50
51
class zend_op_array extends CData
52
{
53
    public ?CPointer $filename;
54
}
55
56
class zend_function_common extends CData
57
{
58
    public ?CPointer $function_name;
59
    public ?CPointer $scope;
60
}
61
62
class zend_string extends CData
63
{
64
    public zend_refcounted_h $gc;
65
66
    /** @var int */
67
    public int $h;
68
69
    /** @var int */
70
    public int $len;
71
72
    /** @var CPointer*/
73
    public CData $val;
74
}
75
76
class zend_refcounted_h extends CData
77
{
78
    public int $refcount;
79
80
    public zend_refcounted_h_u $u;
81
}
82
83
class zend_refcounted_h_u extends CData
84
{
85
    public int $type_info;
86
}
87
88
class zend_class_entry extends CData
89
{
90
    public CPointer $name;
91
}
92
93
class zend_value_ww extends CData
94
{
95
    public int $w1;
96
    public int $w2;
97
}
98
99
class zend_value extends CData
100
{
101
    public int $lval;
102
    public float $dval;
103
    public CPointer $counted;
104
    public CPointer $str;
105
    public CPointer $obj;
106
    public CPointer $res;
107
    public CPointer $ref;
108
    public CPointer $ast;
109
    public CPointer $zv;
110
    public CPointer $ptr;
111
    public CPointer $ce;
112
    public CPointer $func;
113
    public zend_value_ww $ww;
114
}
115
116
class zval_u1_u extends CData
117
{
118
    public int $extra;
119
}
120
121
class zval_u1_v extends CData
122
{
123
    public int $type;
124
    public int $type_flags;
125
    public zval_u1_u $u;
126
}
127
128
class zval_u1 extends CData
129
{
130
    public int $type_info;
131
    public zval_u1_v $v;
132
}
133
134
class zval_u2 extends CData
135
{
136
    public int $next;
137
    public int $opline_num;
138
    public int $lineno;
139
    public int $num_args;
140
    public int $fe_pos;
141
    public int $fe_iter_idx;
142
    public int $access_flags;
143
    public int $property_guard;
144
    public int $constant_flags;
145
    public int $extra;
146
}
147
148
class zval extends CData
149
{
150
    public zend_value $value;
151
    public zval_u1 $u1;
152
    public zval_u2 $u2;
153
}
154
155
class Bucket extends CData
156
{
157
    public zval $val;
158
    public int $h;
159
    public CPointer $key;
160
}
161
162
class zend_module_entry extends CData
163
{
164
    public int $zts;
165
    public CPointer $version;
166
}
167
168
class zend_hash_func_ffi extends \FFI
169
{
170
    public function zend_hash_func(string $str, int $len): int {}
0 ignored issues
show
The parameter $len is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

170
    public function zend_hash_func(string $str, /** @scrutinizer ignore-unused */ int $len): int {}

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
The parameter $str is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

170
    public function zend_hash_func(/** @scrutinizer ignore-unused */ string $str, int $len): int {}

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Bug Best Practice introduced by
In this branch, the function will implicitly return null which is incompatible with the type-hinted return integer. Consider adding a return statement or allowing null as return value.

For hinted functions/methods where all return statements with the correct type are only reachable via conditions, ?null? gets implicitly returned which may be incompatible with the hinted type. Let?s take a look at an example:

interface ReturnsInt {
    public function returnsIntHinted(): int;
}

class MyClass implements ReturnsInt {
    public function returnsIntHinted(): int
    {
        if (foo()) {
            return 123;
        }
        // here: null is implicitly returned
    }
}
Loading history...
171
}
172
173
class zend_array_v extends CData
174
{
175
    public int $flags;
176
    public int $nApplyCount;
177
    public int $nIteratorsCount;
178
    public int $consistency;
179
}
180
181
class zend_array_u extends CData
182
{
183
    public int $flags;
184
    public zend_array_v $v;
185
186
}
187
188
class zend_array extends CData
189
{
190
    public zend_array_u $u;
191
    public int $nTableMask;
192
    public CPointer $arData;
193
    public int $nNumUsed;
194
    public int $nNumOfElements;
195
    public int $nTableSize;
196
    public int $nInternalPointer;
197
    public int $nNextFreeElement;
198
}
199