@@ -112,6 +112,8 @@ public function reduce(callable $callback, mixed $initial = null): mixed
112112
113113 /**
114114 * Shuffles the array.
115+ *
116+ * @return static<TKey, TValue>
115117 */
116118 public function shuffle (): self
117119 {
@@ -122,6 +124,8 @@ public function shuffle(): self
122124 * Removes the specified keys and their values from the array.
123125 *
124126 * @param array-key|array<array-key> $keys The keys of the items to remove.
127+ *
128+ * @return static<TKey, TValue>
125129 */
126130 public function removeKeys (string |int |array $ keys ): self
127131 {
@@ -132,6 +136,8 @@ public function removeKeys(string|int|array $keys): self
132136 * Removes the specified keys and their values from the array. Alias of `removeKeys`.
133137 *
134138 * @param array-key|array<array-key> $keys The keys of the items to remove.
139+ *
140+ * @return static<TKey, TValue>
135141 */
136142 public function forget (string |int |array $ keys ): self
137143 {
@@ -142,6 +148,8 @@ public function forget(string|int|array $keys): self
142148 * Removes the specified values from the array.
143149 *
144150 * @param TValue|array<TValue> $values The values to remove.
151+ *
152+ * @return static<TKey, TValue>
145153 */
146154 public function removeValues (mixed $ values ): self
147155 {
@@ -195,6 +203,8 @@ public function pluck(string $value, ?string $key = null): self
195203 * Prepends the specified values to the array.
196204 *
197205 * @param TValue $values
206+ *
207+ * @return static<TKey, TValue>
198208 */
199209 public function prepend (mixed ...$ values ): self
200210 {
@@ -205,6 +215,8 @@ public function prepend(mixed ...$values): self
205215 * Appends the specified values to the instance.
206216 *
207217 * @param TValue $values
218+ *
219+ * @return static<TKey, TValue>
208220 */
209221 public function append (mixed ...$ values ): self
210222 {
@@ -223,6 +235,8 @@ public function add(mixed $value): self
223235
224236 /**
225237 * @alias of `add`.
238+ *
239+ * @return static<TKey, TValue>
226240 */
227241 public function push (mixed $ value ): self
228242 {
@@ -401,6 +415,8 @@ public function at(int $index, mixed $default = null): mixed
401415 * Returns an instance of the array without the last value.
402416 *
403417 * @param mixed $value The popped value will be stored in this variable
418+ *
419+ * @return static<TKey, TValue>
404420 */
405421 public function pop (mixed &$ value = null ): self
406422 {
@@ -411,6 +427,8 @@ public function pop(mixed &$value = null): self
411427 * Returns an instance of the array without the first value.
412428 *
413429 * @param mixed $value The unshifted value will be stored in this variable
430+ *
431+ * @return static<TKey, TValue>
414432 */
415433 public function unshift (mixed &$ value = null ): self
416434 {
@@ -419,6 +437,8 @@ public function unshift(mixed &$value = null): self
419437
420438 /**
421439 * Returns a new instance of the array in reverse order.
440+ *
441+ * @return static<TKey, TValue>
422442 */
423443 public function reverse (): self
424444 {
@@ -473,7 +493,9 @@ public function values(): self
473493 * Returns a new instance of this array with only the items that pass the given `$filter`.
474494 * If `$filter` is `null`, the new instance will contain only values that are not `false` or `null`.
475495 *
476- * @param null|Closure(mixed $value, mixed $key): bool $filter
496+ * @param null|Closure(TValue $value, TKey $key): bool $filter
497+ *
498+ * @return static<TKey, TValue>
477499 */
478500 public function filter (?Closure $ filter = null ): self
479501 {
@@ -484,6 +506,8 @@ public function filter(?Closure $filter = null): self
484506 * Applies the given callback to all items of the instance.
485507 *
486508 * @param Closure(TValue, TKey): mixed $each
509+ *
510+ * @return static<TKey, TValue>
487511 */
488512 public function each (Closure $ each ): self
489513 {
@@ -513,7 +537,12 @@ public function map(Closure $map): self
513537 * arr(['a', 'b'])->mapWithKeys(fn (mixed $value, mixed $key) => yield $key => $value);
514538 * ```
515539 *
516- * @param Closure(mixed $value, mixed $key): \Generator $map
540+ * @template TMapKey of array-key
541+ * @template TMapValue
542+ *
543+ * @param Closure(TValue $value, TKey $key): \Generator<TMapKey, TMapValue> $map
544+ *
545+ * @return static<TMapKey, TMapValue>
517546 */
518547 public function mapWithKeys (Closure $ map ): self
519548 {
@@ -532,6 +561,8 @@ public function get(int|string $key, mixed $default = null): mixed
532561
533562 /**
534563 * Associates the given `$value` to the given `$key` on the instance.
564+ *
565+ * @return static<TKey, TValue>
535566 */
536567 public function set (string $ key , mixed $ value ): self
537568 {
@@ -540,6 +571,8 @@ public function set(string $key, mixed $value): self
540571
541572 /**
542573 * @alias of `set`
574+ *
575+ * @return static<TKey, TValue>
543576 */
544577 public function put (string $ key , mixed $ value ): self
545578 {
@@ -600,6 +633,8 @@ public function every(?Closure $callback = null): bool
600633
601634 /**
602635 * Converts the dot-notation keys of the instance to a set of nested arrays.
636+ *
637+ * @return static<TKey, TValue>
603638 */
604639 public function undot (): self
605640 {
@@ -608,6 +643,8 @@ public function undot(): self
608643
609644 /**
610645 * Returns a copy of the array that converts nested arrays to a single-dimension dot-notation array.
646+ *
647+ * @return static<TKey, TValue>
611648 */
612649 public function dot (): self
613650 {
@@ -626,6 +663,8 @@ public function join(string $glue = ', ', ?string $finalGlue = ' and '): Immutab
626663 * Groups the array by the results of the provided keyExtractor.
627664 *
628665 * @param Closure(TValue, TKey): array-key $keyExtractor
666+ *
667+ * @return static<array-key, array<TKey, TValue>>
629668 */
630669 public function groupBy (Closure $ keyExtractor ): self
631670 {
@@ -764,6 +803,8 @@ public function sortKeysByCallback(callable $callback): self
764803 * ```php
765804 * arr([1, 2, 3, 4, 5])->slice(2); // [3, 4, 5]
766805 * ```
806+ *
807+ * @return static<TKey, TValue>
767808 */
768809 public function slice (int $ offset , ?int $ length = null ): self
769810 {
@@ -798,6 +839,8 @@ public function partition(Closure $predicate): self
798839 * Executes callback with the given `$value` and returns the same `$value`.
799840 *
800841 * @param (Closure(static): void) $callback
842+ *
843+ * @return static<TKey, TValue>
801844 */
802845 public function tap (Closure $ callback ): self
803846 {
@@ -808,6 +851,8 @@ public function tap(Closure $callback): self
808851
809852 /**
810853 * Dumps the instance.
854+ *
855+ * @return static<TKey, TValue>
811856 */
812857 public function dump (mixed ...$ dumps ): self
813858 {
0 commit comments