@@ -146,31 +146,38 @@ public function toNonEmptyHashMap(): NonEmptyHashMap;
146146 * If each element of the collection is an associative array then call of this method will fold all elements to one associative array.
147147 *
148148 * ```php
149- * >>> HashMap::collect (['f' => ['fst' => 1], 's' => ['snd' => 2], 't' => ['thr' => 3]])->toMergedArray()
149+ * >>> NonEmptyHashMap::collectNonEmpty (['f' => ['fst' => 1], 's' => ['snd' => 2], 't' => ['thr' => 3]])->toMergedArray()
150150 * => ['fst' => 1, 'snd' => 2, 'thr' => 3]
151+ * >>> NonEmptyHashMap::collectNonEmpty(['f' => [1, 2], 's' => [3, 4], 't' => [5, 6]])->toMergedArray()
152+ * => [1, 2, 3, 4, 5, 6]
151153 * ```
152154 *
153155 * @template TKO of array-key
154156 * @template TVO
155- * @psalm-if-this-is NonEmptyMap<TK, array<TKO, TVO>>
157+ * @template TArray of array<TKO, TVO>
158+ * @psalm-if-this-is NonEmptyMap<TK, TArray>
156159 *
157160 * @return array<TKO, TVO>
161+ * @psalm-return (TArray is list ? list<TVO> : array<TKO, TVO>)
158162 */
159163 public function toMergedArray (): array ;
160164
161165 /**
162166 * Non-empty version of {@see NonEmptyMapCastableOps::toMergedArray()}.
163167 *
164168 * ```php
165- * >>> HashMap::collect (['f' => ['fst' => 1], 's' => ['snd' => 2], 't' => ['thr' => 3]])->toNonEmptyMergedArray()
169+ * >>> NonEmptyHashMap::collectNonEmpty (['f' => ['fst' => 1], 's' => ['snd' => 2], 't' => ['thr' => 3]])->toNonEmptyMergedArray()
166170 * => ['fst' => 1, 'snd' => 2, 'thr' => 3]
171+ * >>> NonEmptyHashMap::collectNonEmpty(['f' => [1, 2], 's' => [3, 4], 't' => [5, 6]])->toNonEmptyMergedArray()
172+ * => [1, 2, 3, 4, 5, 6]
167173 * ```
168174 *
169175 * @template TKO of array-key
170176 * @template TVO
171- * @psalm-if-this-is NonEmptyMap<TK, non-empty-array<TKO, TVO>>
177+ * @template TArray of non-empty-array<TKO, TVO>
178+ * @psalm-if-this-is NonEmptyMap<TK, TArray>
172179 *
173- * @return non-empty-array<TKO, TVO>
180+ * @psalm- return (TArray is non-empty-list ? non-empty-list<TVO> : non-empty- array<TKO, TVO>)
174181 */
175182 public function toNonEmptyMergedArray (): array ;
176183
0 commit comments