private function cloneData($var)
    {
        if (method_exists($this, 'cloneVar')) {
            // Symfony 3.2 or higher
            return $this->cloneVar($var);
        }

        if (null === $this->cloner) {
            $this->cloner = new VarCloner();
            $this->cloner->setMaxItems(-1);
            $this->cloner->addCasters($this->getCloneCasters());
        }

        return $this->cloner->cloneVar($var);
    }