Skip to content

Commit

Permalink
More type information fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamCampbell committed Dec 4, 2021
1 parent 38d6532 commit 89e9fda
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/PhpOption/LazyOption.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

namespace PhpOption;

use Iterator;
use Traversable;

/**
* @template T
Expand Down Expand Up @@ -137,7 +137,10 @@ public function reject($value)
return $this->option()->reject($value);
}

public function getIterator(): Iterator
/**
* @return Traversable<T>
*/
public function getIterator(): Traversable
{
return $this->option()->getIterator();
}
Expand Down
3 changes: 3 additions & 0 deletions src/PhpOption/Some.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ public function reject($value)
return $this;
}

/**
* @return ArrayIterator<int, T>
*/
public function getIterator(): ArrayIterator
{
return new ArrayIterator([$this->value]);
Expand Down

0 comments on commit 89e9fda

Please sign in to comment.