Skip to content

Commit

Permalink
rename vars to get rid unclear comment
Browse files Browse the repository at this point in the history
  • Loading branch information
keradus committed Dec 14, 2021
1 parent e9b821b commit a259150
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Tokenizer/Tokens.php
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ public function insertSlices(array $slices): void
$this->setSize($oldSize + $itemsCount);

krsort($slices);
$insertBound = $oldSize - 1;
$previousSliceIndex = $oldSize;

// since we only move already existing items around, we directly call into SplFixedArray::offset* methods.
// that way we get around additional overhead this class adds with overridden offset* methods.
Expand All @@ -874,12 +874,11 @@ public function insertSlices(array $slices): void
$slice = \is_array($slice) || $slice instanceof self ? $slice : [$slice];
$sliceCount = \count($slice);

for ($i = $insertBound; $i >= $index; --$i) {
for ($i = $previousSliceIndex - 1; $i >= $index; --$i) {
parent::offsetSet($i + $itemsCount, parent::offsetGet($i));
}

// adjust $insertBound as tokens between this index and the next index in loop
$insertBound = $index - 1;
$previousSliceIndex = $index;
$itemsCount -= $sliceCount;

foreach ($slice as $indexItem => $item) {
Expand Down

0 comments on commit a259150

Please sign in to comment.