fixes
This commit is contained in:
19
vendor/nette/utils/src/Utils/ArrayList.php
vendored
19
vendor/nette/utils/src/Utils/ArrayList.php
vendored
@@ -20,16 +20,14 @@ class ArrayList implements \ArrayAccess, \Countable, \IteratorAggregate
|
||||
{
|
||||
use Nette\SmartObject;
|
||||
|
||||
/** @var mixed[] */
|
||||
private $list = [];
|
||||
private array $list = [];
|
||||
|
||||
|
||||
/**
|
||||
* Transforms array to ArrayList.
|
||||
* @param array<T> $array
|
||||
* @return static
|
||||
*/
|
||||
public static function from(array $array)
|
||||
public static function from(array $array): static
|
||||
{
|
||||
if (!Arrays::isList($array)) {
|
||||
throw new Nette\InvalidArgumentException('Array is not valid list.');
|
||||
@@ -43,11 +41,13 @@ class ArrayList implements \ArrayAccess, \Countable, \IteratorAggregate
|
||||
|
||||
/**
|
||||
* Returns an iterator over all items.
|
||||
* @return \ArrayIterator<int, T>
|
||||
* @return \Iterator<int, T>
|
||||
*/
|
||||
public function getIterator(): \ArrayIterator
|
||||
public function &getIterator(): \Iterator
|
||||
{
|
||||
return new \ArrayIterator($this->list);
|
||||
foreach ($this->list as &$item) {
|
||||
yield $item;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -86,8 +86,7 @@ class ArrayList implements \ArrayAccess, \Countable, \IteratorAggregate
|
||||
* @return T
|
||||
* @throws Nette\OutOfRangeException
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($index)
|
||||
public function offsetGet($index): mixed
|
||||
{
|
||||
if (!is_int($index) || $index < 0 || $index >= count($this->list)) {
|
||||
throw new Nette\OutOfRangeException('Offset invalid or out of range');
|
||||
@@ -126,7 +125,7 @@ class ArrayList implements \ArrayAccess, \Countable, \IteratorAggregate
|
||||
* Prepends a item.
|
||||
* @param T $value
|
||||
*/
|
||||
public function prepend($value): void
|
||||
public function prepend(mixed $value): void
|
||||
{
|
||||
$first = array_slice($this->list, 0, 1);
|
||||
$this->offsetSet(0, $value);
|
||||
|
||||
Reference in New Issue
Block a user