33namespace Salient \Collection ;
44
55use Salient \Contract \Collection \CollectionInterface ;
6- use Salient \Contract \Core \Arrayable ;
76
87/**
98 * Implements CollectionInterface
@@ -27,9 +26,7 @@ trait CollectionTrait
2726 use ReadableCollectionTrait;
2827
2928 /**
30- * @param TKey $key
31- * @param TValue $value
32- * @return static
29+ * @inheritDoc
3330 */
3431 public function set ($ key , $ value )
3532 {
@@ -39,8 +36,7 @@ public function set($key, $value)
3936 }
4037
4138 /**
42- * @param TKey $key
43- * @return static
39+ * @inheritDoc
4440 */
4541 public function unset ($ key )
4642 {
@@ -53,9 +49,7 @@ public function unset($key)
5349 }
5450
5551 /**
56- * @param TValue|null $last
57- * @param-out TValue|null $last
58- * @return static
52+ * @inheritDoc
5953 */
6054 public function pop (&$ last = null )
6155 {
@@ -88,10 +82,9 @@ public function reverse()
8882 }
8983
9084 /**
91- * @template T of TValue|TKey|array< TKey,TValue>
85+ * @template T of TValue|TKey|array{ TKey,TValue}
9286 *
93- * @param callable(T, T|null $nextValue, T|null $prevValue): bool $callback
94- * @param CollectionInterface::CALLBACK_USE_* $mode
87+ * @param callable(T, T|null $next, T|null $prev): bool $callback
9588 * @return static A copy of the collection with items that satisfy `$callback`.
9689 */
9790 public function filter (callable $ callback , int $ mode = CollectionInterface::CALLBACK_USE_VALUE )
@@ -104,11 +97,7 @@ public function filter(callable $callback, int $mode = CollectionInterface::CALL
10497 $ i = 0 ;
10598
10699 foreach ($ this ->Items as $ nextKey => $ nextValue ) {
107- $ next = $ mode === CollectionInterface::CALLBACK_USE_KEY
108- ? $ nextKey
109- : ($ mode === CollectionInterface::CALLBACK_USE_BOTH
110- ? [$ nextKey => $ nextValue ]
111- : $ nextValue );
100+ $ next = $ this ->getCallbackValue ($ mode , $ nextKey , $ nextValue );
112101 if ($ i ++) {
113102 /** @var T $item */
114103 /** @var T $next */
@@ -134,7 +123,6 @@ public function filter(callable $callback, int $mode = CollectionInterface::CALL
134123 }
135124
136125 /**
137- * @param TKey[] $keys
138126 * @return static A copy of the collection with items that have keys in
139127 * `$keys`.
140128 */
@@ -147,7 +135,6 @@ public function only(array $keys)
147135 }
148136
149137 /**
150- * @param array<TKey,true> $index
151138 * @return static A copy of the collection with items that have keys in
152139 * `$index`.
153140 */
@@ -160,7 +147,6 @@ public function onlyIn(array $index)
160147 }
161148
162149 /**
163- * @param TKey[] $keys
164150 * @return static A copy of the collection with items that have keys not in
165151 * `$keys`.
166152 */
@@ -173,7 +159,6 @@ public function except(array $keys)
173159 }
174160
175161 /**
176- * @param array<TKey,true> $index
177162 * @return static A copy of the collection with items that have keys not in
178163 * `$index`.
179164 */
@@ -196,9 +181,7 @@ public function slice(int $offset, ?int $length = null)
196181 }
197182
198183 /**
199- * @param TValue|null $first
200- * @param-out TValue|null $first
201- * @return static
184+ * @inheritDoc
202185 */
203186 public function shift (&$ first = null )
204187 {
@@ -212,8 +195,7 @@ public function shift(&$first = null)
212195 }
213196
214197 /**
215- * @param Arrayable<TKey,TValue>|iterable<TKey,TValue> $items
216- * @return static
198+ * @inheritDoc
217199 */
218200 public function merge ($ items )
219201 {
0 commit comments