File tree Expand file tree Collapse file tree 4 files changed +35
-0
lines changed
Expand file tree Collapse file tree 4 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,13 @@ public function map(callable $mapper): self
7676 return new Cons ($ mapper ($ this ->head ()), $ this ->tail ()->map ($ mapper ));
7777 }
7878
79+ /**
80+ * @template U
81+ *
82+ * @param callable(T): Traversable<U> $mapper
83+ *
84+ * @return GenericList<U>
85+ */
7986 public function flatMap (callable $ mapper )
8087 {
8188 $ list = self ::empty ();
@@ -224,6 +231,9 @@ public function reverse(): self
224231 return $ list ;
225232 }
226233
234+ /**
235+ * @return GenericList<T>
236+ */
227237 public function appendAll (Traversable $ elements )
228238 {
229239 if ($ elements ->isEmpty ()) {
@@ -233,6 +243,9 @@ public function appendAll(Traversable $elements)
233243 return self ::ofAll ($ elements )->prependAll ($ this );
234244 }
235245
246+ /**
247+ * @return GenericList<T>
248+ */
236249 public function prependAll (Traversable $ elements )
237250 {
238251 if ($ this ->isEmpty ()) {
Original file line number Diff line number Diff line change @@ -174,6 +174,13 @@ public function map(callable $mapper): self
174174 return new Cons ($ mapper ($ this ->head ()), function () use ($ mapper ) {return $ this ->tail ()->map ($ mapper ); });
175175 }
176176
177+ /**
178+ * @template U
179+ *
180+ * @param callable(T): Traversable<U> $mapper
181+ *
182+ * @return Stream<U>
183+ */
177184 public function flatMap (callable $ mapper )
178185 {
179186 $ stream = self ::empty ();
@@ -292,6 +299,9 @@ public function prepend($element)
292299 return new Cons ($ element , function () {return $ this ; });
293300 }
294301
302+ /**
303+ * @return Stream<T>
304+ */
295305 public function prependAll (Traversable $ elements )
296306 {
297307 if ($ elements ->isEmpty ()) {
Original file line number Diff line number Diff line change @@ -71,13 +71,19 @@ public function iterator(): Iterator
7171 return new StreamIterator ($ this );
7272 }
7373
74+ /**
75+ * @return Stream<T>
76+ */
7477 public function append ($ element )
7578 {
7679 return new Cons ($ this ->head , function () use ($ element ) {
7780 return $ this ->tail ()->append ($ element );
7881 });
7982 }
8083
84+ /**
85+ * @return Stream<T>
86+ */
8187 public function appendAll (Traversable $ elements )
8288 {
8389 if ($ elements ->isEmpty ()) {
Original file line number Diff line number Diff line change @@ -51,11 +51,17 @@ public function iterator(): Iterator
5151 return Iterator::empty ();
5252 }
5353
54+ /**
55+ * @return Stream<T>
56+ */
5457 public function append ($ element )
5558 {
5659 return Stream::of ($ element );
5760 }
5861
62+ /**
63+ * @return Stream<T>
64+ */
5965 public function appendAll (Traversable $ elements )
6066 {
6167 if ($ elements ->isEmpty ()) {
You can’t perform that action at this time.
0 commit comments