4
4
5
5
namespace Ghostwriter \Option \Contract ;
6
6
7
+ use Generator ;
7
8
use Ghostwriter \Option \Exception \NullPointerException ;
8
9
use IteratorAggregate ;
9
10
use Throwable ;
10
- use Traversable ;
11
11
12
12
/**
13
- * @implements IteratorAggregate<int,TValue>
14
- *
15
13
* @template TValue
14
+ *
15
+ * @extends IteratorAggregate<int,TValue>
16
16
*/
17
17
interface OptionInterface extends IteratorAggregate
18
18
{
@@ -27,15 +27,15 @@ public function and(self $option): self;
27
27
* @template TAndThen
28
28
*
29
29
* @param callable(TValue):TAndThen $function
30
- *
31
- * @return self<TAndThen|TValue>
32
30
*/
33
31
public function andThen (callable $ function ): self ;
34
32
35
33
/**
36
34
* Returns true if the option is a Some value containing the given $value.
37
35
*
38
- * @param TValue $value
36
+ * @template TContainsValue
37
+ *
38
+ * @param TContainsValue $value
39
39
*/
40
40
public function contains (mixed $ value ): bool ;
41
41
@@ -65,7 +65,7 @@ public function filter(callable $function): self;
65
65
*/
66
66
public function flatten (): self ;
67
67
68
- public function getIterator (): Traversable ;
68
+ public function getIterator (): Generator ;
69
69
70
70
/**
71
71
* Returns true if the Option is an instance of None.
@@ -140,7 +140,7 @@ public function or(self $option): self;
140
140
*
141
141
* @template TCallableResultValue
142
142
*
143
- * @param callable(): OptionInterface <TCallableResultValue> $function
143
+ * @param callable(): self <TCallableResultValue> $function
144
144
*/
145
145
public function orElse (callable $ function ): self ;
146
146
0 commit comments