Skip to content

Commit f04b7da

Browse files
committed
Arrays::some(), every(), map() for iteratos & Mapper should be replaced by Iterators
1 parent 19db401 commit f04b7da

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

src/Iterators/Mapper.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@
1010
namespace Nette\Iterators;
1111

1212

13-
1413
/**
15-
* Applies the callback to the elements of the inner iterator.
14+
* @deprecated use Nette\Utils\Iterables::map()
1615
*/
1716
class Mapper extends \IteratorIterator
1817
{

src/Utils/Arrays.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -370,10 +370,10 @@ public static function pick(array &$array, string|int $key, mixed $default = nul
370370
/**
371371
* Tests whether at least one element in the array passes the test implemented by the provided function,
372372
* which has the signature `function ($value, $key, $array): bool`.
373-
* @template K
373+
* @template K of array-key
374374
* @template V
375-
* @param iterable<K, V> $array
376-
* @param callable(V, K, ($array is array ? array<K, V> : iterable<K, V>)): bool $predicate
375+
* @param array<K, V> $array
376+
* @param callable(V, K, array<K, V>): bool $predicate
377377
*/
378378
public static function some(iterable $array, callable $predicate): bool
379379
{
@@ -390,10 +390,10 @@ public static function some(iterable $array, callable $predicate): bool
390390
/**
391391
* Tests whether all elements in the array pass the test implemented by the provided function,
392392
* which has the signature `function ($value, $key, $array): bool`.
393-
* @template K
393+
* @template K of array-key
394394
* @template V
395-
* @param iterable<K, V> $array
396-
* @param callable(V, K, ($array is array ? array<K, V> : iterable<K, V>)): bool $predicate
395+
* @param array<K, V> $array
396+
* @param callable(V, K, array<K, V>): bool $predicate
397397
*/
398398
public static function every(iterable $array, callable $predicate): bool
399399
{
@@ -434,8 +434,8 @@ public static function filter(array $array, callable $predicate): array
434434
* @template K of array-key
435435
* @template V
436436
* @template R
437-
* @param iterable<K, V> $array
438-
* @param callable(V, K, ($array is array ? array<K, V> : iterable<K, V>)): R $transformer
437+
* @param array<K, V> $array
438+
* @param callable(V, K, array<K, V>): R $transformer
439439
* @return array<K, R>
440440
*/
441441
public static function map(iterable $array, callable $transformer): array

0 commit comments

Comments
 (0)