From 58a391906e8a48759f9622f074562ba8a428c0af Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Wed, 29 Dec 2021 21:49:57 +0100 Subject: [PATCH] fix: Remove local variable. --- src/Operation/Flatten.php | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/Operation/Flatten.php b/src/Operation/Flatten.php index 8b0e5ce8e..0cbce22f9 100644 --- a/src/Operation/Flatten.php +++ b/src/Operation/Flatten.php @@ -45,14 +45,9 @@ static function (Iterator $iterator) use ($depth): Generator { continue; } - if (1 !== $depth) { - /** @var callable(Iterator): Generator $flatten */ - $flatten = Flatten::of()($depth - 1); - - $value = $flatten(new IterableIterator($value)); - } - - yield from $value; + yield from (1 !== $depth) + ? (new Flatten())()($depth - 1)(new IterableIterator($value)) + : $value; } }; }