Skip to content

Commit 1de4b09

Browse files
committed
Arrays::some(), every(), map() are annotated only for arrays
1 parent 0e3410d commit 1de4b09

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/Utils/Arrays.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -369,11 +369,11 @@ public static function pick(array &$array, string|int $key, mixed $default = nul
369369

370370
/**
371371
* Tests whether at least one element in the array passes the test implemented by the provided function,
372-
* which has the signature `function ($value, $key, array $array): bool`.
373-
* @template K
372+
* which has the signature `function (mixed $value, int|string $key, array $array): bool`.
373+
* @template K of int|string
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
{
@@ -389,11 +389,11 @@ public static function some(iterable $array, callable $predicate): bool
389389

390390
/**
391391
* Tests whether all elements in the array pass the test implemented by the provided function,
392-
* which has the signature `function ($value, $key, array $array): bool`.
393-
* @template K
392+
* which has the signature `function (mixed $value, int|string $key, array $array): bool`.
393+
* @template K of int|string
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
{
@@ -410,7 +410,7 @@ public static function every(iterable $array, callable $predicate): bool
410410
/**
411411
* Returns a new array containing all key-value pairs matching the given $predicate.
412412
* The callback has the signature `function (mixed $value, int|string $key, array $array): bool`.
413-
* @template K of array-key
413+
* @template K of int|string
414414
* @template V
415415
* @param array<K, V> $array
416416
* @param callable(V, K, array<K, V>): bool $predicate
@@ -430,12 +430,12 @@ public static function filter(array $array, callable $predicate): array
430430

431431
/**
432432
* Returns an array containing the original keys and results of applying the given transform function to each element.
433-
* The function has signature `function ($value, $key, array $array): mixed`.
434-
* @template K of array-key
433+
* The function has signature `function (mixed $value, int|string $key, array $array): mixed`.
434+
* @template K of int|string
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)