Skip to content

Commit 10aaf38

Browse files
committed
Corrected filtering
1 parent c99ac1d commit 10aaf38

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/Comprehensions/Options/Option.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,12 @@ public function each(callable $func)
7272
}
7373

7474
/**
75-
* @param callable $func - A function that returns a boolean value when supplied with the value.
75+
* @param callable $func - A function that returns a boolean when supplied with the value.
7676
* @return Option
7777
*/
7878
public function filter(callable $func)
7979
{
80-
return $this->isEmpty() ? new None() : new Some($func($this->get()));
80+
return ($this->isEmpty()||$func($this->get())) ? $this : new None();
8181
}
8282

8383
/**

0 commit comments

Comments
 (0)