mirror of
https://git.friendi.ca/friendica/friendica.git
synced 2025-06-11 23:14:26 +02:00
Fix 10 PHPStan errors
This commit is contained in:
parent
9ea4f591c7
commit
7ce6afd151
9 changed files with 122 additions and 167 deletions
|
@ -24,7 +24,7 @@ class BaseCollection extends \ArrayIterator
|
|||
* @param BaseEntity[] $entities
|
||||
* @param int|null $totalCount
|
||||
*/
|
||||
public function __construct(array $entities = [], int $totalCount = null)
|
||||
public function __construct(array $entities = [], ?int $totalCount = null)
|
||||
{
|
||||
parent::__construct($entities);
|
||||
|
||||
|
@ -102,7 +102,7 @@ class BaseCollection extends \ArrayIterator
|
|||
* @return BaseCollection
|
||||
* @see array_filter()
|
||||
*/
|
||||
public function filter(callable $callback = null, int $flag = 0): BaseCollection
|
||||
public function filter(?callable $callback = null, int $flag = 0): BaseCollection
|
||||
{
|
||||
$class = get_class($this);
|
||||
|
||||
|
@ -111,8 +111,6 @@ class BaseCollection extends \ArrayIterator
|
|||
|
||||
/**
|
||||
* Reverse the orders of the elements in the collection
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function reverse(): BaseCollection
|
||||
{
|
||||
|
@ -125,7 +123,6 @@ class BaseCollection extends \ArrayIterator
|
|||
* Split the collection in smaller collections no bigger than the provided length
|
||||
*
|
||||
* @param int $length
|
||||
* @return static[]
|
||||
*/
|
||||
public function chunk(int $length): array
|
||||
{
|
||||
|
@ -133,11 +130,14 @@ class BaseCollection extends \ArrayIterator
|
|||
throw new \RangeException('BaseCollection->chunk(): Size parameter expected to be greater than 0');
|
||||
}
|
||||
|
||||
return array_map(function ($array) {
|
||||
$class = get_class($this);
|
||||
return array_map(
|
||||
function ($array) {
|
||||
$class = get_class($this);
|
||||
|
||||
return new $class($array);
|
||||
}, array_chunk($this->getArrayCopy(), $length));
|
||||
return new $class($array);
|
||||
},
|
||||
array_chunk($this->getArrayCopy(), $length)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue