@@ -19,13 +19,16 @@ abstract class GenericList extends Sequence
1919 *
2020 * @param U ...$elements
2121 *
22- * @return GenericList <U>
22+ * @return self <U>
2323 */
2424 public static function of (...$ elements ): self
2525 {
2626 return self ::ofAll ($ elements );
2727 }
2828
29+ /**
30+ * @return self<T>
31+ */
2932 public static function empty (): self
3033 {
3134 return Nil::instance ();
@@ -36,7 +39,7 @@ public static function empty(): self
3639 *
3740 * @param iterable<U> $elements
3841 *
39- * @return GenericList <U>
42+ * @return self <U>
4043 */
4144 public static function ofAll (iterable $ elements ): self
4245 {
@@ -65,7 +68,7 @@ public static function range(int $start, int $end): self
6568 *
6669 * @param callable(T):U $mapper
6770 *
68- * @return GenericList <U>
71+ * @return self <U>
6972 */
7073 public function map (callable $ mapper ): self
7174 {
@@ -81,10 +84,11 @@ public function map(callable $mapper): self
8184 *
8285 * @param callable(T): Traversable<U> $mapper
8386 *
84- * @return GenericList <U>
87+ * @return self <U>
8588 */
8689 public function flatMap (callable $ mapper )
8790 {
91+ /** @var self<U> $list */
8892 $ list = self ::empty ();
8993 foreach ($ this as $ value ) {
9094 foreach ($ mapper ($ value ) as $ mapped ) {
@@ -98,7 +102,7 @@ public function flatMap(callable $mapper)
98102 /**
99103 * @param callable(T):bool $predicate
100104 *
101- * @return GenericList <T>
105+ * @return self <T>
102106 */
103107 public function filter (callable $ predicate )
104108 {
0 commit comments