Skip to content

Commit 3d980ef

Browse files
committed
Fix deprecation notices in PeekableArrayIterator on PHP 8.1+
1 parent 7bbd8a1 commit 3d980ef

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

library/PhpLatex/Utils/PeekableArrayIterator.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,46 +17,55 @@ public function __construct(array $array = array())
1717
reset($this->_array);
1818
}
1919

20+
#[\ReturnTypeWillChange]
2021
public function current()
2122
{
2223
return current($this->_array);
2324
}
2425

26+
#[\ReturnTypeWillChange]
2527
public function key()
2628
{
2729
return key($this->_array);
2830
}
2931

32+
#[\ReturnTypeWillChange]
3033
public function next()
3134
{
32-
return next($this->_array);
35+
next($this->_array);
3336
}
3437

38+
#[\ReturnTypeWillChange]
3539
public function rewind()
3640
{
37-
return reset($this->_array);
41+
reset($this->_array);
3842
}
3943

44+
#[\ReturnTypeWillChange]
4045
public function valid()
4146
{
4247
return key($this->_array) !== null;
4348
}
4449

50+
#[\ReturnTypeWillChange]
4551
public function count()
4652
{
4753
return count($this->_array);
4854
}
4955

56+
#[\ReturnTypeWillChange]
5057
public function offsetExists($offset)
5158
{
5259
return isset($this->_array[$offset]);
5360
}
5461

62+
#[\ReturnTypeWillChange]
5563
public function offsetGet($offset)
5664
{
5765
return isset($this->_array[$offset]) ? $this->_array[$offset] : null;
5866
}
5967

68+
#[\ReturnTypeWillChange]
6069
public function offsetSet($offset, $value) {
6170
if (is_null($offset)) {
6271
$this->_array[] = $value;
@@ -65,6 +74,7 @@ public function offsetSet($offset, $value) {
6574
}
6675
}
6776

77+
#[\ReturnTypeWillChange]
6878
public function offsetUnset($offset)
6979
{
7080
unset($this->_array[$offset]);
@@ -77,7 +87,7 @@ public function __isset($offset)
7787

7888
public function __unset($offset)
7989
{
80-
$this->_offsetUnset($offset);
90+
$this->offsetUnset($offset);
8191
}
8292

8393
public function peek()

0 commit comments

Comments
 (0)