class RuboCop::Cop::Sorbet::EnforceSigilOrder

def autocorrect(_node)

def autocorrect(_node)
  lambda do |corrector|
    tokens = extract_magic_comments(processed_source)
    # Get the magic comments tokens in their expected order
    expected = PREFERRED_ORDER.keys.map do |re|
      tokens.select { |token| re.match?(token.text) }
    end.flatten
    tokens.each_with_index do |token, index|
      corrector.replace(token.pos, expected[index].text)
    end
    # Remove blank lines between the magic comments
    lines = tokens.map(&:line).to_set
    (lines.min...lines.max).each do |line|
      next if lines.include?(line)
      next unless processed_source[line - 1].empty?
      corrector.remove(source_range(processed_source.buffer, line, 0))
    end
  end
end