Skip to content

Commit 67420c9

Browse files
tminichprewk
authored andcommitted
Fix and improve type annotations.
1 parent 836d55b commit 67420c9

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/Option.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,20 @@ abstract public function unwrap();
5858
/**
5959
* Unwraps a result, yielding the content of a Some. Else, it returns optb.
6060
*
61-
* @param T $optb
62-
* @return T
61+
* @template U
62+
*
63+
* @param U $optb
64+
* @return T|U
6365
*/
6466
abstract public function unwrapOr($optb);
6567

6668
/**
6769
* Returns the contained value or computes it from a callable.
6870
*
69-
* @param callable(): T $op
70-
* @return T
71+
* @template U
72+
*
73+
* @param callable(): U $op
74+
* @return T|U
7175
*/
7276
abstract public function unwrapOrElse(callable $op);
7377

@@ -84,7 +88,7 @@ abstract public function inspect(callable $f): self;
8488
*
8589
* @template U
8690
*
87-
* @param callable(T=):U $mapper
91+
* @param callable(T):U $mapper
8892
* @return Option<U>
8993
*/
9094
abstract public function map(callable $mapper): self;
@@ -95,7 +99,7 @@ abstract public function map(callable $mapper): self;
9599
* @template U
96100
*
97101
* @param U $default
98-
* @param callable(T=):U $mapper
102+
* @param callable(T):U $mapper
99103
* @return U
100104
*/
101105
abstract public function mapOr($default, callable $mapper);
@@ -106,7 +110,7 @@ abstract public function mapOr($default, callable $mapper);
106110
* @template U
107111
*
108112
* @param callable():U $default
109-
* @param callable(T=):U $mapper
113+
* @param callable(T):U $mapper
110114
* @return U
111115
*/
112116
abstract public function mapOrElse(callable $default, callable $mapper);

0 commit comments

Comments
 (0)