diff --git a/src/Operation/Apply.php b/src/Operation/Apply.php index 72afc2ca9..28680c805 100644 --- a/src/Operation/Apply.php +++ b/src/Operation/Apply.php @@ -33,13 +33,17 @@ public function __invoke(): Closure * @psalm-return Generator */ static function (Iterator $iterator) use ($callbacks): Generator { + $continue = true; + foreach ($iterator as $key => $value) { - foreach ($callbacks as $callback) { - if (true === $callback($value, $key)) { - continue; - } + if ($continue !== false) { + foreach ($callbacks as $callback) { + if (true === $continue = $callback($value, $key)) { + continue; + } - break; + $continue = false; + } } yield $key => $value;