1 | <?php |
||
2 | |||
3 | namespace App\Providers; |
||
4 | |||
5 | use Illuminate\Foundation\AliasLoader; |
||
6 | use Illuminate\Support\ServiceProvider; |
||
7 | |||
8 | class LocalEnvironmentServiceProvider extends ServiceProvider |
||
9 | { |
||
10 | /** |
||
11 | * List of Local Environment Providers. |
||
12 | * |
||
13 | * @var array |
||
14 | */ |
||
15 | protected $localProviders = [ |
||
16 | \Barryvdh\Debugbar\ServiceProvider::class, |
||
17 | ]; |
||
18 | |||
19 | /** |
||
20 | * List of only Local Environment Facade Aliases. |
||
21 | * |
||
22 | * @var array |
||
23 | */ |
||
24 | protected $facadeAliases = [ |
||
25 | 'Debugbar' => \Barryvdh\Debugbar\Facade::class, |
||
26 | ]; |
||
27 | |||
28 | /** |
||
29 | * Bootstrap the application services. |
||
30 | * |
||
31 | * @return void |
||
32 | */ |
||
33 | public function boot() |
||
34 | { |
||
35 | if (\App::environment(config('debugbar.enabled_environment'))) { |
||
0 ignored issues
–
show
|
|||
36 | $this->registerServiceProviders(); |
||
37 | $this->registerFacadeAliases(); |
||
38 | } |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * Register the application services. |
||
43 | * |
||
44 | * @return void |
||
45 | */ |
||
46 | public function register() |
||
47 | { |
||
48 | // |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * Load local service providers. |
||
53 | */ |
||
54 | protected function registerServiceProviders() |
||
55 | { |
||
56 | foreach ($this->localProviders as $provider) { |
||
57 | $this->app->register($provider); |
||
58 | } |
||
59 | } |
||
60 | |||
61 | /** |
||
62 | * Load additional Aliases. |
||
63 | */ |
||
64 | public function registerFacadeAliases() |
||
65 | { |
||
66 | $loader = AliasLoader::getInstance(); |
||
67 | foreach ($this->facadeAliases as $alias => $facade) { |
||
68 | $loader->alias($alias, $facade); |
||
69 | } |
||
70 | } |
||
71 | } |
||
72 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.