Total Complexity | 4 |
Total Lines | 36 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | final class IndexListSelector implements IndexListSelectorInterface |
||
10 | { |
||
11 | /** |
||
12 | * @var array<int> |
||
13 | */ |
||
14 | private array $value; |
||
15 | |||
16 | /** |
||
17 | * @param array<int>|ArrayViewInterface<int> $value |
||
18 | */ |
||
19 | public function __construct($value) |
||
20 | { |
||
21 | $this->value = \is_array($value) ? $value : $value->toArray(); |
||
|
|||
22 | } |
||
23 | |||
24 | /** |
||
25 | * @template T |
||
26 | * |
||
27 | * @param ArrayViewInterface<T> $source |
||
28 | * @param bool|null $readonly |
||
29 | * |
||
30 | * @return ArrayIndexListView<T> |
||
31 | * |
||
32 | * {@inheritDoc} |
||
33 | */ |
||
34 | public function select(ArrayViewInterface $source, ?bool $readonly = null): ArrayIndexListView |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * {@inheritDoc} |
||
41 | */ |
||
42 | public function getValue(): array |
||
47 |
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.