Skip to content

Commit

Permalink
Arrays::some(), every(), map() for iteratos & Mapper should be replac…
Browse files Browse the repository at this point in the history
…ed by Iterators
  • Loading branch information
dg committed Nov 30, 2023
1 parent 19db401 commit f04b7da
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
3 changes: 1 addition & 2 deletions src/Iterators/Mapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@
namespace Nette\Iterators;



/**
* Applies the callback to the elements of the inner iterator.
* @deprecated use Nette\Utils\Iterables::map()
*/
class Mapper extends \IteratorIterator
{
Expand Down
16 changes: 8 additions & 8 deletions src/Utils/Arrays.php
Original file line number Diff line number Diff line change
Expand Up @@ -370,10 +370,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 function,
* which has the signature `function ($value, $key, $array): bool`.
* @template K
* @template K of array-key
* @template V
* @param iterable<K, V> $array
* @param callable(V, K, ($array is array ? array<K, V> : iterable<K, V>)): bool $predicate
* @param array<K, V> $array
* @param callable(V, K, array<K, V>): bool $predicate
*/
public static function some(iterable $array, callable $predicate): bool
{
Expand All @@ -390,10 +390,10 @@ public static function some(iterable $array, callable $predicate): bool
/**
* Tests whether all elements in the array pass the test implemented by the provided function,
* which has the signature `function ($value, $key, $array): bool`.
* @template K
* @template K of array-key
* @template V
* @param iterable<K, V> $array
* @param callable(V, K, ($array is array ? array<K, V> : iterable<K, V>)): bool $predicate
* @param array<K, V> $array
* @param callable(V, K, array<K, V>): bool $predicate
*/
public static function every(iterable $array, callable $predicate): bool
{
Expand Down Expand Up @@ -434,8 +434,8 @@ public static function filter(array $array, callable $predicate): array
* @template K of array-key
* @template V
* @template R
* @param iterable<K, V> $array
* @param callable(V, K, ($array is array ? array<K, V> : iterable<K, V>)): R $transformer
* @param array<K, V> $array
* @param callable(V, K, array<K, V>): R $transformer
* @return array<K, R>
*/
public static function map(iterable $array, callable $transformer): array
Expand Down

0 comments on commit f04b7da

Please sign in to comment.