Skip to content

Commit 071a5ba

Browse files
committed
Fix contravariance with ArrayAccess
Signed-off-by: Kamil Tekiela <[email protected]>
1 parent 0418ed9 commit 071a5ba

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/TokensList.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ public function getNextOfTypeAndFlag(TokenType $type, int $flag): Token|null
190190
* @param int|null $offset the offset to be set
191191
* @param Token $value the token to be saved
192192
*/
193-
public function offsetSet($offset, $value): void
193+
public function offsetSet(mixed $offset, mixed $value): void
194194
{
195195
if ($offset === null) {
196196
$this->tokens[$this->count++] = $value;
@@ -204,7 +204,7 @@ public function offsetSet($offset, $value): void
204204
*
205205
* @param int $offset the offset to be returned
206206
*/
207-
public function offsetGet($offset): Token|null
207+
public function offsetGet(mixed $offset): Token|null
208208
{
209209
return $offset < $this->count ? $this->tokens[$offset] : null;
210210
}
@@ -214,7 +214,7 @@ public function offsetGet($offset): Token|null
214214
*
215215
* @param int $offset the offset to be checked
216216
*/
217-
public function offsetExists($offset): bool
217+
public function offsetExists(mixed $offset): bool
218218
{
219219
return $offset < $this->count;
220220
}
@@ -224,7 +224,7 @@ public function offsetExists($offset): bool
224224
*
225225
* @param int $offset the offset to be unset
226226
*/
227-
public function offsetUnset($offset): void
227+
public function offsetUnset(mixed $offset): void
228228
{
229229
unset($this->tokens[$offset]);
230230
--$this->count;

src/UtfString.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function __construct($str)
9090
*
9191
* @param int $offset the offset to be checked
9292
*/
93-
public function offsetExists($offset): bool
93+
public function offsetExists(mixed $offset): bool
9494
{
9595
return ($offset >= 0) && ($offset < $this->charLen);
9696
}
@@ -100,7 +100,7 @@ public function offsetExists($offset): bool
100100
*
101101
* @param int $offset the offset to be returned
102102
*/
103-
public function offsetGet($offset): string|null
103+
public function offsetGet(mixed $offset): string|null
104104
{
105105
// This function moves the internal byte and character pointer to the requested offset.
106106
// This function is part of hot code so the aim is to do the following
@@ -143,7 +143,7 @@ public function offsetGet($offset): string|null
143143
*
144144
* @throws Exception not implemented.
145145
*/
146-
public function offsetSet($offset, $value): void
146+
public function offsetSet(mixed $offset, mixed $value): void
147147
{
148148
throw new Exception('Not implemented.');
149149
}
@@ -155,7 +155,7 @@ public function offsetSet($offset, $value): void
155155
*
156156
* @throws Exception not implemented.
157157
*/
158-
public function offsetUnset($offset): void
158+
public function offsetUnset(mixed $offset): void
159159
{
160160
throw new Exception('Not implemented.');
161161
}

0 commit comments

Comments
 (0)