Skip to content

Commit

Permalink
#183 short closure
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxGoryunov committed Jul 14, 2022
1 parent 26d10c9 commit 4333bdb
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions src/SavingIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,19 @@ public function __construct(
AddingIterator $target
) {
parent::__construct(
/**
* @todo #179:30min Consider making ValidTernary a variable. Maybe
* it is possible to implement this with a constant expression.
*/
/** @phpstan-ignore-next-line */
new ContextVeil(
$target,
new ClosureReaction(
function (AddingIterator $stored) use ($origin) {
return (new ValidTernary(
$origin,
function (Iterator $source) use ($stored) {
$temp = $stored->from($source);
$source->next();
return $temp;
},
fn () => $stored
))->value();
}
fn (AddingIterator $stored) => (new ValidTernary(
$origin,
function (Iterator $source) use ($stored) {
$temp = $stored->from($source);
$source->next();
return $temp;
},
fn () => $stored
))->value()
)
)
);
Expand Down

0 comments on commit 4333bdb

Please sign in to comment.