Total Complexity | 6 |
Total Lines | 36 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
19 | final class CDataByteReader implements ByteReaderInterface |
||
20 | { |
||
21 | use ByteReaderDisableWriteAccessTrait; |
||
22 | |||
23 | /** @var CArray */ |
||
24 | private CData $source; |
||
25 | |||
26 | /** |
||
27 | * CDataByteReader constructor. |
||
28 | * @param CArray $source |
||
29 | */ |
||
30 | public function __construct(CData $source) |
||
31 | { |
||
32 | $this->source = $source; |
||
|
|||
33 | } |
||
34 | |||
35 | public function offsetExists($offset): bool |
||
36 | { |
||
37 | if (count($this->source) <= $offset) { |
||
38 | return false; |
||
39 | } |
||
40 | return !is_null($this->source[$offset]); |
||
41 | } |
||
42 | |||
43 | public function offsetGet($offset): int |
||
44 | { |
||
45 | return $this->source[$offset]; |
||
46 | } |
||
47 | |||
48 | public function createSliceAsString(int $offset, int $size): string |
||
55 | } |
||
56 | } |
||
57 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.
Either this assignment is in error or an instanceof check should be added for that assignment.