public function replace(Rule $replacement, $type, $index = 0)
    {
        $current = $this->rule($type, $index);
        if ($current->name !== null) {
            $replacement->name = $current->name;
        }

        $this[$type][$index] = $replacement;
    }