1 | <?php |
||
23 | class DBResult implements Iterator, ArrayAccess, Countable{ |
||
24 | use Enumerable, Magic; |
||
25 | |||
26 | /** |
||
27 | * @var \chillerlan\Database\DBResultRow[] |
||
28 | */ |
||
29 | protected $array = []; |
||
30 | |||
31 | /** |
||
32 | * @var int |
||
33 | */ |
||
34 | protected $offset = 0; |
||
35 | protected $sourceEncoding; |
||
36 | protected $destEncoding; |
||
37 | |||
38 | /** |
||
39 | * DBResult constructor. |
||
40 | * |
||
41 | * @param \Traversable|\stdClass|array|null $data |
||
42 | * @param string|null $sourceEncoding |
||
43 | * @param string $destEncoding |
||
44 | * |
||
45 | * @throws \chillerlan\Database\DBException |
||
46 | */ |
||
47 | public function __construct($data = null, $sourceEncoding = null, $destEncoding = 'UTF-8'){ |
||
67 | |||
68 | /** |
||
69 | * @param \chillerlan\Database\DBResult $DBResult |
||
70 | * |
||
71 | * @return \chillerlan\Database\DBResult |
||
72 | */ |
||
73 | public function __merge(DBResult $DBResult){ |
||
84 | |||
85 | /** |
||
86 | * @link http://api.prototypejs.org/language/Enumerable/prototype/toArray/ |
||
87 | * |
||
88 | * @return array |
||
89 | */ |
||
90 | public function __toArray():array { |
||
99 | |||
100 | public function chunk(int $size){ |
||
103 | |||
104 | /********* |
||
105 | * magic * |
||
106 | *********/ |
||
107 | |||
108 | /** |
||
109 | * @return int |
||
110 | */ |
||
111 | protected function magic_get_length():int{ |
||
114 | |||
115 | |||
116 | /*************** |
||
117 | * ArrayAccess * |
||
118 | ***************/ |
||
119 | |||
120 | /** |
||
121 | * @param int|string $offset |
||
122 | * |
||
123 | * @return bool |
||
124 | */ |
||
125 | public function offsetExists($offset):bool{ |
||
128 | |||
129 | /** |
||
130 | * @param int|string $offset |
||
131 | * |
||
132 | * @return \chillerlan\Database\DBResultRow|mixed|null |
||
133 | */ |
||
134 | public function offsetGet($offset){ |
||
137 | |||
138 | /** |
||
139 | * @param int|string $offset |
||
140 | * @param array $value |
||
141 | * |
||
142 | * @return void |
||
143 | */ |
||
144 | public function offsetSet($offset, $value){ |
||
154 | |||
155 | /** |
||
156 | * @param int|string $offset |
||
157 | * |
||
158 | * @return void |
||
159 | */ |
||
160 | public function offsetUnset($offset){ |
||
163 | |||
164 | |||
165 | /************* |
||
166 | * Countable * |
||
167 | *************/ |
||
168 | |||
169 | /** |
||
170 | * @return int |
||
171 | */ |
||
172 | public function count():int{ |
||
175 | |||
176 | |||
177 | /************ |
||
178 | * Iterator * |
||
179 | ************/ |
||
180 | |||
181 | /** |
||
182 | * @return \chillerlan\Database\DBResultRow|mixed |
||
183 | */ |
||
184 | public function current(){ |
||
187 | |||
188 | /** |
||
189 | * @return int |
||
190 | */ |
||
191 | public function key():int{ |
||
194 | |||
195 | /** |
||
196 | * @return bool |
||
197 | */ |
||
198 | public function valid():bool{ |
||
201 | |||
202 | /** |
||
203 | * @return void |
||
204 | */ |
||
205 | public function next(){ |
||
208 | |||
209 | /** |
||
210 | * @return void |
||
211 | */ |
||
212 | public function rewind(){ |
||
215 | |||
216 | } |
||
217 |
There are different options of fixing this problem.
If you want to be on the safe side, you can add an additional type-check:
If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:
Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.