@@ -79,7 +79,7 @@ public static function &getRef(array &$array, string|int|array $key): mixed
7979 * @template T2
8080 * @param array<T1> $array1
8181 * @param array<T2> $array2
82- * @return array<T1|T2>
82+ * @return array<T1|T2|array<mixed> >
8383 */
8484 public static function mergeTree (array $ array1 , array $ array2 ): array
8585 {
@@ -96,6 +96,7 @@ public static function mergeTree(array $array1, array $array2): array
9696
9797 /**
9898 * Returns zero-indexed position of given array key. Returns null if key is not found.
99+ * @param array<mixed> $array
99100 */
100101 public static function getKeyOffset (array $ array , string |int $ key ): ?int
101102 {
@@ -104,6 +105,7 @@ public static function getKeyOffset(array $array, string|int $key): ?int
104105
105106
106107 /**
108+ * @param array<mixed> $array
107109 * @deprecated use getKeyOffset()
108110 */
109111 public static function searchKey (array $ array , string |int $ key ): ?int
@@ -114,6 +116,7 @@ public static function searchKey(array $array, string|int $key): ?int
114116
115117 /**
116118 * Tests an array for the presence of value.
119+ * @param array<mixed> $array
117120 */
118121 public static function contains (array $ array , mixed $ value ): bool
119122 {
@@ -125,9 +128,11 @@ public static function contains(array $array, mixed $value): bool
125128 * Returns the first item (matching the specified predicate if given). If there is no such item, it returns result of invoking $else or null.
126129 * @template K of int|string
127130 * @template V
131+ * @template E
128132 * @param array<K, V> $array
129133 * @param ?callable(V, K, array<K, V>): bool $predicate
130- * @return ?V
134+ * @param ?callable(): E $else
135+ * @return ($else is null ? ?V : V|E)
131136 */
132137 public static function first (array $ array , ?callable $ predicate = null , ?callable $ else = null ): mixed
133138 {
@@ -142,9 +147,11 @@ public static function first(array $array, ?callable $predicate = null, ?callabl
142147 * Returns the last item (matching the specified predicate if given). If there is no such item, it returns result of invoking $else or null.
143148 * @template K of int|string
144149 * @template V
150+ * @template E
145151 * @param array<K, V> $array
146152 * @param ?callable(V, K, array<K, V>): bool $predicate
147- * @return ?V
153+ * @param ?callable(): E $else
154+ * @return ($else is null ? ?V : V|E)
148155 */
149156 public static function last (array $ array , ?callable $ predicate = null , ?callable $ else = null ): mixed
150157 {
@@ -196,6 +203,8 @@ public static function lastKey(array $array, ?callable $predicate = null): int|s
196203 /**
197204 * Inserts the contents of the $inserted array into the $array immediately after the $key.
198205 * If $key is null (or does not exist), it is inserted at the beginning.
206+ * @param array<mixed> $array
207+ * @param array<mixed> $inserted
199208 */
200209 public static function insertBefore (array &$ array , string |int |null $ key , array $ inserted ): void
201210 {
@@ -209,6 +218,8 @@ public static function insertBefore(array &$array, string|int|null $key, array $
209218 /**
210219 * Inserts the contents of the $inserted array into the $array before the $key.
211220 * If $key is null (or does not exist), it is inserted at the end.
221+ * @param array<mixed> $array
222+ * @param array<mixed> $inserted
212223 */
213224 public static function insertAfter (array &$ array , string |int |null $ key , array $ inserted ): void
214225 {
@@ -224,6 +235,7 @@ public static function insertAfter(array &$array, string|int|null $key, array $i
224235
225236 /**
226237 * Renames key in array.
238+ * @param array<mixed> $array
227239 */
228240 public static function renameKey (array &$ array , string |int $ oldKey , string |int $ newKey ): bool
229241 {
@@ -260,6 +272,8 @@ public static function grep(
260272
261273 /**
262274 * Transforms multidimensional array to flat array.
275+ * @param array<mixed> $array
276+ * @return array<mixed>
263277 */
264278 public static function flatten (array $ array , bool $ preserveKeys = false ): array
265279 {
@@ -284,7 +298,9 @@ public static function isList(mixed $value): bool
284298
285299 /**
286300 * Reformats table to associative tree. Path looks like 'field|field[]field->field=field'.
287- * @param string|string[] $path
301+ * @param array<mixed> $array
302+ * @param string|list<string> $path
303+ * @return array<mixed>|\stdClass
288304 */
289305 public static function associate (array $ array , string |array $ path ): array |\stdClass
290306 {
@@ -338,6 +354,8 @@ public static function associate(array $array, string|array $path): array|\stdCl
338354
339355 /**
340356 * Normalizes array to associative array. Replace numeric keys with their values, the new value will be $filling.
357+ * @param array<mixed> $array
358+ * @return array<string, mixed>
341359 */
342360 public static function normalize (array $ array , mixed $ filling = null ): array
343361 {
@@ -481,6 +499,7 @@ public static function mapWithKeys(array $array, callable $transformer): array
481499 /**
482500 * Invokes all callbacks and returns array of results.
483501 * @param callable[] $callbacks
502+ * @return array<mixed>
484503 */
485504 public static function invoke (iterable $ callbacks , mixed ...$ args ): array
486505 {
@@ -496,6 +515,7 @@ public static function invoke(iterable $callbacks, mixed ...$args): array
496515 /**
497516 * Invokes method on every object in an array and returns array of results.
498517 * @param object[] $objects
518+ * @return array<mixed>
499519 */
500520 public static function invokeMethod (iterable $ objects , string $ method , mixed ...$ args ): array
501521 {
@@ -511,6 +531,7 @@ public static function invokeMethod(iterable $objects, string $method, mixed ...
511531 /**
512532 * Copies the elements of the $array array to the $object object and then returns it.
513533 * @template T of object
534+ * @param iterable<mixed> $array
514535 * @param T $object
515536 * @return T
516537 */
0 commit comments