Skip to content
This repository was archived by the owner on May 2, 2023. It is now read-only.

Commit ff2f5b3

Browse files
Merge pull request #62 from bshaffer/add-return-type-will-change
chore: fix return type will change deprecation in PHP 8.1
2 parents 0db3f31 + a709686 commit ff2f5b3

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/vierbergenlars/LibJs/JSArray.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,49 +149,57 @@ public function __get($name)
149149
}
150150
}
151151

152-
152+
#[\ReturnTypeWillChange]
153153
public function current()
154154
{
155155
return $this->_convert(current($this->array));
156156
}
157157

158+
#[\ReturnTypeWillChange]
158159
public function key()
159160
{
160161
return $this->_convert(key($this->array));
161162
}
162163

164+
#[\ReturnTypeWillChange]
163165
public function next()
164166
{
165167
return $this->_convert(next($this->array));
166168
}
167169

170+
#[\ReturnTypeWillChange]
168171
public function offsetExists($offset)
169172
{
170173
return isset($this->array[$offset]);
171174
}
172175

176+
#[\ReturnTypeWillChange]
173177
public function offsetGet($offset)
174178
{
175179
if(!$this->offsetExists($offset))
176180
return null;
177181
return $this->_convert($this->array[$offset]);
178182
}
179183

184+
#[\ReturnTypeWillChange]
180185
public function offsetSet($offset, $value)
181186
{
182187
$this->array[$offset] = $value;
183188
}
184189

190+
#[\ReturnTypeWillChange]
185191
public function offsetUnset($offset)
186192
{
187193
unset($this->array[$offset]);
188194
}
189195

196+
#[\ReturnTypeWillChange]
190197
public function rewind()
191198
{
192199
return reset($this->array);
193200
}
194201

202+
#[\ReturnTypeWillChange]
195203
public function valid()
196204
{
197205
return key($this->array) !== null;

src/vierbergenlars/LibJs/JString.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,21 +207,25 @@ public function __get($name)
207207
}
208208
}
209209

210+
#[\ReturnTypeWillChange]
210211
public function offsetExists($offset)
211212
{
212213
return isset($this->str[$offset]);
213214
}
214215

216+
#[\ReturnTypeWillChange]
215217
public function offsetGet($offset)
216218
{
217219
return $this->str[$offset];
218220
}
219221

222+
#[\ReturnTypeWillChange]
220223
public function offsetSet($offset, $value)
221224
{
222225
$this->str[$offset] = $value;
223226
}
224227

228+
#[\ReturnTypeWillChange]
225229
public function offsetUnset($offset)
226230
{
227231
throw new \LogicException('Cannot unset a position in a string');

0 commit comments

Comments
 (0)