I was thinking about this implementation and maybe got a better idea. What replacing all above by just something like this?
```php
if ($values instanceof \Traversable) {
    $values = iterator_to_array($values);

} elseif (!is_array($values)) {
    throw new Nette\InvalidArgumentException('First parameter must be an array, ' . gettype($values) . ' given.');
}

if ($form && $form->isAnchored() && $form->isSubmitted()) {
    $values = array_intersect_key($values, array_map(function (IControl $control) {
        return $control->isDisabled();
    }, $this->getComponents(FALSE, 'Nette\Forms\IControl');
}

$this->setValues($values, $erase);

return $this;
```

This way, we won't be duplicating the logic in setValues().