1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | /** |
||
6 | * This file is part of Laravel Zero. |
||
7 | * |
||
8 | * (c) Nuno Maduro <[email protected]> |
||
9 | * |
||
10 | * For the full copyright and license information, please view the LICENSE |
||
11 | * file that was distributed with this source code. |
||
12 | */ |
||
13 | |||
14 | namespace LaravelZero\Framework\Providers\Filesystem; |
||
15 | |||
16 | use Illuminate\Contracts\Filesystem\Filesystem; |
||
17 | use Illuminate\Filesystem\FilesystemServiceProvider as BaseServiceProvider; |
||
18 | |||
19 | /** |
||
20 | * @internal |
||
21 | */ |
||
22 | final class FilesystemServiceProvider extends BaseServiceProvider |
||
23 | { |
||
24 | /** |
||
25 | * {@inheritdoc} |
||
26 | */ |
||
27 | 31 | public function register(): void |
|
28 | { |
||
29 | 31 | parent::register(); |
|
30 | |||
31 | 31 | $this->app->alias('filesystem.disk', Filesystem::class); |
|
32 | |||
33 | 31 | $config = $this->app->make('config'); |
|
34 | |||
35 | 31 | if ($config->get('filesystems.default') === null) { |
|
36 | 31 | $config->set('filesystems', $this->getDefaultConfig()); |
|
37 | } |
||
38 | 31 | } |
|
39 | |||
40 | /** |
||
41 | * Returns the default application filesystems config. |
||
42 | * |
||
43 | * We it simple we use the `local` driver. |
||
44 | */ |
||
45 | 31 | protected function getDefaultConfig(): array |
|
46 | { |
||
47 | return [ |
||
48 | 31 | 'default' => 'local', |
|
49 | 'disks' => [ |
||
50 | 'local' => [ |
||
51 | 31 | 'driver' => 'local', |
|
52 | 31 | 'root' => $this->app->storagePath('app'), |
|
0 ignored issues
–
show
|
|||
53 | ], |
||
54 | ], |
||
55 | ]; |
||
56 | } |
||
57 | } |
||
58 |
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.