Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/GenericCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@

/**
* @template T
* @implements IteratorAggregate<int,T>
* @implements ArrayAccess<int,T>
* @implements IteratorAggregate<int|string,T>
* @implements ArrayAccess<int|string,T>
*/
class GenericCollection implements IteratorAggregate, ArrayAccess, Countable
{
/**
* @var array<int,T>
* @var array<int|string,T>
*/
protected array $itemList = [];
protected ?string $type;
Expand Down Expand Up @@ -61,7 +61,7 @@
* Retrieve an external iterator.
*
* @link http://php.net/manual/en/iteratoraggregate.getiterator.php
* @return ArrayIterator<int,T> An instance of an object implementing <b>Iterator</b> or
* @return ArrayIterator<int|string,T> An instance of an object implementing <b>Iterator</b> or
* <b>Traversable</b>
*/
public function getIterator(): Iterator|Traversable
Expand All @@ -70,7 +70,7 @@
}

/**
* @return array<int,T>
* @return array<int|string,T>
*/
public function getArray(): array
{
Expand All @@ -92,7 +92,7 @@
* Whether an offset exists.
*
* @link http://php.net/manual/en/arrayaccess.offsetexists.php
* @param int $offset <p>
* @param int|string $offset <p>
* An offset to check for.
* </p>
* @return boolean true on success or false on failure.
Expand All @@ -109,7 +109,7 @@
* Offset to retrieve.
*
* @link http://php.net/manual/en/arrayaccess.offsetget.php
* @param int $offset <p>
* @param int|string $offset <p>
* The offset to retrieve.
* </p>
* @return null|T
Expand All @@ -123,7 +123,7 @@
* Offset to set.
*
* @link http://php.net/manual/en/arrayaccess.offsetset.php
* @param null|int $offset <p>
* @param null|int|string $offset <p>
* The offset to assign the value to.
* </p>
* @param T $value <p>
Expand All @@ -144,7 +144,7 @@
* Offset to unset.
*
* @link http://php.net/manual/en/arrayaccess.offsetunset.php
* @param int $offset <p>
* @param int|string $offset <p>
* The offset to unset.
* </p>
* @return void
Expand Down Expand Up @@ -439,7 +439,7 @@
* @param int<1, max> $length
* @return list<static<T>>
*/
public function chunk(int $length, bool $preserveKeys = false): array

Check warning on line 442 in src/GenericCollection.php

View workflow job for this annotation

GitHub Actions / Tests (8.2)

Escaped Mutant for Mutator "FalseValue": --- Original +++ New @@ @@ * @param int<1, max> $length * @return list<static<T>> */ - public function chunk(int $length, bool $preserveKeys = false) : array + public function chunk(int $length, bool $preserveKeys = true) : array { $chunkList = []; foreach (array_chunk($this->itemList, $length, $preserveKeys) as $chunk) {

Check warning on line 442 in src/GenericCollection.php

View workflow job for this annotation

GitHub Actions / Tests (8.2)

Escaped Mutant for Mutator "FalseValue": --- Original +++ New @@ @@ * @param int<1, max> $length * @return list<static<T>> */ - public function chunk(int $length, bool $preserveKeys = false) : array + public function chunk(int $length, bool $preserveKeys = true) : array { $chunkList = []; foreach (array_chunk($this->itemList, $length, $preserveKeys) as $chunk) {
{
$chunkList = [];
foreach (array_chunk($this->itemList, $length, $preserveKeys) as $chunk) {
Expand Down