Skip to content

Commit

Permalink
chore(sa): fix psalm type infer for Chunk operation
Browse files Browse the repository at this point in the history
  • Loading branch information
rela589n committed Dec 11, 2024
1 parent ce28b5a commit fd1ca32
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/Operation/Chunk.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,15 @@ static function (iterable $iterable) use ($sizes): Generator {
return;
}

if (count($chunk) !== $size) {
$chunk[] = $value;
$chunk[] = $value;

continue;
}

++$chunkIndex;
if (count($chunk) >= $size) {
++$chunkIndex;

/** @psalm-var non-empty-list $chunk */
yield $chunk;

yield $chunk;

$chunk = [$value];
$chunk = [];
}
}

if ([] !== $chunk) {
Expand Down

0 comments on commit fd1ca32

Please sign in to comment.