public function newInstance()
    {
        /** @noinspection PhpUnusedLocalVariableInspection */
        $name = "{$this->getMockNamespaceName()}\\{$this->getMockName()}";
        /** @noinspection PhpUnusedLocalVariableInspection */
        $code = $this->generateCode();
        /** @var $reflect \ReflectionClass */
        $reflect = eval("$code return new \\ReflectionClass('$name');");

        try {
            return $reflect->newInstanceArgs($this->constructorArgs);
        } catch (ReflectionException $e) {
            return $reflect->newInstance();
        }
    }