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();
        }
    }
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();
        }
    }
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 ( ) ; } }
Create a new instance of the mocked class. There is no need to generate
the code before invoking this.

@return object
Create a new instance of the mocked class . There is no need to generate the code before invoking this .