1 | <?php |
||
23 | class FixedList extends AbstractList |
||
24 | { |
||
25 | /** |
||
26 | * @var ValueType[] |
||
27 | */ |
||
28 | protected $data; |
||
29 | |||
30 | /** |
||
31 | * @var int |
||
32 | */ |
||
33 | protected $pointer = 0; |
||
34 | |||
35 | 28 | public function __construct(int $size = 0) |
|
39 | |||
40 | /** |
||
41 | * {@inheritDoc} |
||
42 | */ |
||
43 | 25 | public function add($item) |
|
44 | { |
||
45 | 25 | $this->data[$this->pointer++] = $item; |
|
46 | 25 | } |
|
47 | |||
48 | /** |
||
49 | * {@inheritDoc} |
||
50 | */ |
||
51 | 2 | public function get(int $index) |
|
55 | |||
56 | /** |
||
57 | * {@inheritDoc} |
||
58 | */ |
||
59 | public function splice |
||
60 | ( |
||
61 | int $offset, |
||
62 | ?int $length = null, |
||
63 | array $replacement = [] |
||
64 | ) |
||
65 | { |
||
66 | $end = $offset + $length; |
||
67 | |||
68 | for ($i = $offset, $j = 0; $i < $end; $i++, $j++) |
||
69 | { |
||
70 | $this->data[$i] = $replacement[$j] ?? null; |
||
71 | } |
||
72 | } |
||
73 | |||
74 | /** |
||
75 | * {@inheritDoc} |
||
76 | */ |
||
77 | 2 | public function set(int $index, $value) |
|
81 | |||
82 | /** |
||
83 | * {@inheritDoc} |
||
84 | */ |
||
85 | 1 | public function remove(int $item) |
|
89 | |||
90 | /** |
||
91 | * {@inheritDoc} |
||
92 | */ |
||
93 | 13 | public function getIterator() |
|
97 | |||
98 | /** |
||
99 | * {@inheritDoc} |
||
100 | */ |
||
101 | 5 | public function size() : int |
|
105 | |||
106 | /** |
||
107 | * Resizes the FixedList, throwing away any unused elements |
||
108 | * |
||
109 | * @param int $size The new size |
||
110 | */ |
||
111 | 22 | public function resize(int $size) |
|
115 | |||
116 | /** |
||
117 | * Returns the current pointer position |
||
118 | * |
||
119 | * @return int |
||
120 | */ |
||
121 | 21 | public function getCurrentPosition() : int |
|
125 | |||
126 | /** |
||
127 | * Resizes to the current pointer |
||
128 | */ |
||
129 | 21 | public function resizeToFull() |
|
133 | } |
||
134 | |||
135 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..