src/Leevel/Di/Container.php
public function make(string $name, array $args = [])
    {
        // 别名
        $name = $this->getAlias($name);

        // 存在直接返回
        if (isset($this->instances[$name])) {
            return $this->instances[$name];
        }

        if ($this->existsCoroutine($name)) {
            return $this->coroutineInstances[$this->coroutineUid()][$name];
        }

        // 生成实例
        if (!isset($this->services[$name])) {
            $instance = $this->getInjectionObject($name, $args);
        } else {
            if (!is_string($this->services[$name]) && is_callable($this->services[$name])) {
                array_unshift($args, $this);
                $instance = call_user_func_array($this->services[$name], $args);
            } else {
                if (is_string($this->services[$name])) {
                    $instance = $this->getInjectionObject($this->services[$name], $args);
                } else {
                    $instance = $this->services[$name];
                }
            }
        }

        // 单一实例
        if (in_array($name, $this->singletons, true)) {
            if ($this->coroutineContext($instance)) {
                return $this->coroutineInstances[$this->coroutineUid()][$name] = $instance;
            }

            return $this->instances[$name] = $instance;
        }

        // 多个实例

        return $instance;
    }
public function make(string $name, array $args = [])
    {
        // 别名
        $name = $this->getAlias($name);

        // 存在直接返回
        if (isset($this->instances[$name])) {
            return $this->instances[$name];
        }

        if ($this->existsCoroutine($name)) {
            return $this->coroutineInstances[$this->coroutineUid()][$name];
        }

        // 生成实例
        if (!isset($this->services[$name])) {
            $instance = $this->getInjectionObject($name, $args);
        } else {
            if (!is_string($this->services[$name]) && is_callable($this->services[$name])) {
                array_unshift($args, $this);
                $instance = call_user_func_array($this->services[$name], $args);
            } else {
                if (is_string($this->services[$name])) {
                    $instance = $this->getInjectionObject($this->services[$name], $args);
                } else {
                    $instance = $this->services[$name];
                }
            }
        }

        // 单一实例
        if (in_array($name, $this->singletons, true)) {
            if ($this->coroutineContext($instance)) {
                return $this->coroutineInstances[$this->coroutineUid()][$name] = $instance;
            }

            return $this->instances[$name] = $instance;
        }

        // 多个实例

        return $instance;
    }
服务容器返回对象.

@param string $name
@param array  $args

@return mixed