src/ObjectManager.php
private function createWithArguments(
        string $className,
        array $constructorArguments,
        &$implementationClassName = null
    ) {
        if (interface_exists($className)) {
            $className = $implementationClassName = $this->getClassForInterface($className);
        }
        if (!class_exists($className)) {
            throw ClassDoesNotExistException::exceptionWithClassName($className);
        }
        if ($constructorArguments) {
            $reflector = new ReflectionClass($className);

            return $reflector->newInstanceArgs($constructorArguments);
        }

        return new $className();
    }
private function createWithArguments(
        string $className,
        array $constructorArguments,
        &$implementationClassName = null
    ) {
        if (interface_exists($className)) {
            $className = $implementationClassName = $this->getClassForInterface($className);
        }
        if (!class_exists($className)) {
            throw ClassDoesNotExistException::exceptionWithClassName($className);
        }
        if ($constructorArguments) {
            $reflector = new ReflectionClass($className);

            return $reflector->newInstanceArgs($constructorArguments);
        }

        return new $className();
    }
private function createWithArguments ( string $ className , array $ constructorArguments , & $ implementationClassName = null ) { if ( interface_exists ( $ className ) ) { $ className = $ implementationClassName = $ this -> getClassForInterface ( $ className ) ; } if ( ! class_exists ( $ className ) ) { throw ClassDoesNotExistException :: exceptionWithClassName ( $ className ) ; } if ( $ constructorArguments ) { $ reflector = new ReflectionClass ( $ className ) ; return $ reflector -> newInstanceArgs ( $ constructorArguments ) ; } return new $ className ( ) ; }
Returns a new instance of the given class

@param string $className
@param array  $constructorArguments
@param string $implementationClassName
@return object
Returns a new instance of the given class