class RuboCop::Cop::Lint::UnexpectedBlockArity

def arg_count(node)

def arg_count(node)
  return node.children[1] if node.numblock_type? # the maximum numbered param for the block
  # Only `arg`, `optarg` and `mlhs` (destructuring) count as arguments that
  # can be used. Keyword arguments are not used for these methods so are
  # ignored.
  node.arguments.count do |arg|
    return Float::INFINITY if arg.restarg_type?
    arg.arg_type? || arg.optarg_type? || arg.mlhs_type?
  end
end