/** * Remove nested patches within this patch. * * @param Bouda\Php7Backport\Patch */ private function removeNestedPatches(Patch $patch) { $start = $patch->getStartPosition(); $end = $patch->getOriginalEndPosition(); if ($start == $end) { return; } // delete all patches starting between the start and end of this patch $keysToDelete = array_flip(range($start + 1, $end)); $this->replacePatches = array_diff_key($this->replacePatches, $keysToDelete); }