bound($id) || $this->getParent()->has($id); } /** * 获取一个绑定的实例 * * @template T * @param class-string $abstract 类或接口名 * @param array $parameters 参数 * @throws EntryResolutionException * @return Closure|mixed|T 实例 */ public function make(string $abstract, array $parameters = []) { if (isset($this->shared[$abstract])) { return $this->shared[$abstract]; } // 此类没有,父类有,则从父类中获取 if (!$this->bound($abstract) && $this->getParent()->bound($abstract)) { $this->log("{$abstract} is not bound, but in parent container, using parent container"); return $this->getParent()->make($abstract, $parameters); } return $this->traitMake($abstract, $parameters); } }