Skip to content

Commit

Permalink
Merge 322d9b9 into c7ec447
Browse files Browse the repository at this point in the history
  • Loading branch information
JanTvrdik committed Aug 5, 2023
2 parents c7ec447 + 322d9b9 commit be571cc
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Utils/Arrays.php
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,10 @@ public static function pick(array &$array, string|int $key, mixed $default = nul
/**
* Tests whether at least one element in the array passes the test implemented by the
* provided callback with signature `function ($value, $key, array $array): bool`.
* @template K
* @template V
* @param iterable<K, V> $array
* @param callable(V, K, ($array is array ? array<K, V> : iterable<K, V>)): bool $callback
*/
public static function some(iterable $array, callable $callback): bool
{
Expand All @@ -348,6 +352,10 @@ public static function some(iterable $array, callable $callback): bool
/**
* Tests whether all elements in the array pass the test implemented by the provided function,
* which has the signature `function ($value, $key, array $array): bool`.
* @template K
* @template V
* @param iterable<K, V> $array
* @param callable(V, K, ($array is array ? array<K, V> : iterable<K, V>)): bool $callback
*/
public static function every(iterable $array, callable $callback): bool
{
Expand All @@ -364,6 +372,12 @@ public static function every(iterable $array, callable $callback): bool
/**
* Calls $callback on all elements in the array and returns the array of return values.
* The callback has the signature `function ($value, $key, array $array): bool`.
* @template K
* @template V
* @template R
* @param iterable<K, V> $array
* @param callable(V, K, ($array is array ? array<K, V> : iterable<K, V>)): R $callback
* @return array<K, R>
*/
public static function map(iterable $array, callable $callback): array
{
Expand Down

0 comments on commit be571cc

Please sign in to comment.