public function __clone()
{
foreach ($this->fields as $name => $field) {
$field = clone $field;
// this condition is only to "bypass" a PHPUnit bug with mocks
if (null !== $field->getParent()) {
$field->setParent($this);
}
$this->fields[$name] = $field;
}
}