`registerConfiguredProviders` 方法到底是哪个父类的?

public function bootstrap(Application $app)
{
    $app->registerConfiguredProviders();
}

这里面的 $app 的路径是Illuminate\Contracts\Foundation\Application;
为何文章中说的是Illuminate\Foundation\Application; class 的registerConfiguredProviders 方法 ???
答:我自己的问题,把大家带偏了,总知道怎么回事了。

桃知夭夭
《L01 基础入门》
我们将带你从零开发一个项目并部署到线上,本课程教授 Web 开发中专业、实用的技能,如 Git 工作流、Laravel Mix 前端工作流等。
《L04 微信小程序从零到发布》
从小程序个人账户申请开始,带你一步步进行开发一个微信小程序,直到提交微信控制台上线发布。
最佳答案

``` public function bootstrapWith(array $bootstrappers) { $this->hasBeenBootstrapped = true;

    foreach ($bootstrappers as $bootstrapper) {
        $this['events']->fire('bootstrapping: '.$bootstrapper, [$this]);

        $this->make($bootstrapper)->bootstrap($this);

        $this['events']->fire('bootstrapped: '.$bootstrapper, [$this]);
    }
}

``` 就是在容器中自己实现了

3年前 评论
讨论数量: 5

Illuminate\Contracts\Foundation\Application 是容器的 key
Illuminate\Foundation\Application 是容器的 value

    dd(
        get_class(
            app(Illuminate\Contracts\Foundation\Application::class)
            )
    );
  // Illuminate\Foundation\Application

见: 契约参考

illuminate/contracts/blob/8.x/Container/Container.php

3年前 评论
AmberLavigne (楼主) 3年前
AmberLavigne (楼主) 3年前
lyxxxh (作者) 3年前
sanders

Illuminate\Contracts\Foundation\Application 基本上看到 命名空间里带 Contracts 的就是接口了,接口是将类抽象化,可以用实现相同接口的类相互替换。

3年前 评论

Contracts 下的都是抽象类或者interface,,,实际的实例,肯定是子类实现类,,,

3年前 评论

@lyxxxh 我表述的可能不清晰,我刚才想知道的是Illuminate\Contracts\Foundation\Application 是容器的 key Illuminate\Foundation\Application 是容器的 value ,这个对应关系是何时被绑定到容器里面的。我看了你发的图片和文章,最终我猜测也是被绑定到bindings这个属性上(不过很遗憾,我没有在上面找到绑定的Illuminate\Contracts\Foundation\Application),才能应用反射机制解析出来容器的实例(回到我最初问的那个方法上)

3年前 评论
sanders 3年前
AmberLavigne (作者) (楼主) 3年前

``` public function bootstrapWith(array $bootstrappers) { $this->hasBeenBootstrapped = true;

    foreach ($bootstrappers as $bootstrapper) {
        $this['events']->fire('bootstrapping: '.$bootstrapper, [$this]);

        $this->make($bootstrapper)->bootstrap($this);

        $this['events']->fire('bootstrapped: '.$bootstrapper, [$this]);
    }
}

``` 就是在容器中自己实现了

3年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!