public function cleanProviders()
{
$loadedProviders = $this->reflectionApp->loadedProviders();
foreach ($this->providers as $provider) {
if (class_exists($provider, false)) {
if ($this->config['is_lumen']) {
unset($loadedProviders[get_class(new $provider($this->currentApp))]);
}
switch ($this->reflectionApp->registerMethodParameterCount()) {
case 1:
$this->currentApp->register($provider);
break;
case 2:
$this->currentApp->register($provider, true);
break;
case 3:
$this->currentApp->register($provider, [], true);
break;
default:
throw new \RuntimeException('The number of parameters of the register method is unknown.');
}
}
}
if ($this->config['is_lumen']) {
$this->reflectionApp->setLoadedProviders($loadedProviders);
}
}
Your software version (Screenshot of your startup)
Detail description about this issue(error/log)
配置
register_providers
后,我发现在每次请求的时候根本无法注册这两个ServiceProvider
我查了一下原因在于下面这里,
class_exists
的第二个参数(autoload)为false
.这个如果为false
,就不会触发自动加载,类肯定就会找不到,所以这里的provider
永远都不会注册进去.这是一个bug
吗?还是为什么要这样写呢?vendor/hhxsv5/laravel-s/src/Illuminate/Laravel.php
reproducible
code blocks andsteps
-