Skip to content

Commit

Permalink
Update Forget operation.
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Sep 2, 2020
1 parent aa7edf9 commit 67811b3
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/Operation/Forget.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Generator;
use Iterator;

use function array_key_exists;
use function in_array;

/**
* @psalm-template TKey
Expand All @@ -34,10 +34,8 @@ static function (...$keys): Closure {
* @psalm-return Generator<TKey, T>
*/
static function (Iterator $iterator) use ($keys): Generator {
$keys = array_flip($keys);

foreach ($iterator as $key => $value) {
if (false === array_key_exists($key, $keys)) {
if (false === in_array($key, $keys, true)) {
yield $key => $value;
}
}
Expand Down

0 comments on commit 67811b3

Please sign in to comment.