class RuboCop::Cop::Performance::CaseWhenSplat

def reorder_condition(corrector, node, new_condition)

def reorder_condition(corrector, node, new_condition)
  *_conditions, body = *node
  parent = node.parent
  _case_branch, *when_branches, _else_branch = *parent
  current_index = when_branches.index { |branch| branch == node }
  next_branch = when_branches[current_index + 1]
  range = Parser::Source::Range.new(parent,
                                    node.source_range.begin_pos,
                                    next_branch.source_range.begin_pos)
  corrector.remove(range)
  correction = if same_line?(node, body)
                 new_condition_with_then(node, new_condition)
               else
                 new_branch_without_then(node, body, new_condition)
               end
  corrector.insert_after(when_branches.last.source_range, correction)
end