@@ -74,7 +74,7 @@ public static function reduce(iterable $iterable, callable $callback, mixed $ini
7474 * @param string $kv_sep the separator for key and value
7575 * @since 1.0
7676 */
77- public static function kvjoin (array $ data , string $ sep = ', ' , string $ kv_sep = '= ' ): string
77+ public static function kvjoin (iterable $ data , string $ sep = ', ' , string $ kv_sep = '= ' ): string
7878 {
7979 $ first = true ;
8080 $ str = '' ;
@@ -88,21 +88,21 @@ public static function kvjoin(array $data, string $sep = ', ', string $kv_sep =
8888
8989 /**
9090 * Returns the first mapping (element) of an array as key and value in an array, or null/null if the array is empty.
91- * Array destructuring is a very convenient way to handle the result: `['k' => $key, 'v' => $value] = array_first ($array)`
92- * @param array $array the source array
91+ * Array destructuring is a very convenient way to handle the result: `['k' => $key, 'v' => $value] = Arr::first ($array)`
92+ * @param iterable $iterable the source iterable
9393 * @return array ['k' => <key>/null, 'v' => <value>/null]
9494 * @since 1.0
9595 */
96- public static function first (array $ array ): array
96+ public static function first (iterable $ iterable ): array
9797 {
98- foreach ($ array as $ k => $ v )
98+ foreach ($ iterable as $ k => $ v )
9999 return compact ('k ' , 'v ' );
100100 return ['k ' => null , 'v ' => null ];
101101 }
102102
103103 /**
104104 * Searches for a mapping in the array whose key is one of $keys, returns the key and the value or null/null (if not found) as an array.
105- * Array destructuring is a very convenient way to handle the result: `['k' => $key, 'v' => $value] = array_find ($array, 'key1', 'key2')`
105+ * Array destructuring is a very convenient way to handle the result: `['k' => $key, 'v' => $value] = Arr::find ($array, 'key1', 'key2')`
106106 * @param array $array the source array
107107 * @param string|int ...$ks the keys
108108 * @return array ['k' => <key>/null, 'v' => <value>/null]
0 commit comments