1 | <?php |
||||
2 | |||||
3 | namespace Larafast\Fastapi; |
||||
4 | |||||
5 | use Illuminate\Database\Migrations\MigrationCreator; |
||||
6 | use Illuminate\Support\ServiceProvider; |
||||
7 | use Larafast\Fastapi\Console\Commands\ControllerMakeCommand; |
||||
8 | use Larafast\Fastapi\Console\Commands\FactoryMakeCommand; |
||||
9 | use Larafast\Fastapi\Console\Commands\Fastapi; |
||||
0 ignored issues
–
show
|
|||||
10 | use Larafast\Fastapi\Console\Commands\MigrateMakeCommand; |
||||
11 | use Larafast\Fastapi\Console\Commands\ModelMakeCommand; |
||||
12 | use Larafast\Fastapi\Console\Commands\RequestMakeCommand; |
||||
13 | use Larafast\Fastapi\Console\Commands\ResourceMakeCommand; |
||||
14 | |||||
15 | class FastapiServiceProvider extends ServiceProvider |
||||
16 | { |
||||
17 | |||||
18 | protected $commands = [ |
||||
19 | ControllerMakeCommand::class, |
||||
20 | FactoryMakeCommand::class, |
||||
21 | Fastapi::class, |
||||
22 | MigrateMakeCommand::class, |
||||
23 | ModelMakeCommand::class, |
||||
24 | RequestMakeCommand::class, |
||||
25 | ResourceMakeCommand::class, |
||||
26 | ]; |
||||
27 | |||||
28 | /** |
||||
29 | * Bootstrap the application services. |
||||
30 | */ |
||||
31 | public function boot() |
||||
32 | { |
||||
33 | |||||
34 | $this->publishes([ |
||||
35 | __DIR__ . '/../config/config.php' => config_path('fastApi.php'), |
||||
36 | ], 'fastApi'); |
||||
37 | |||||
38 | |||||
39 | // $this->publishes([ |
||||
40 | // __DIR__ . '/../resources/stubs' => resource_path('stubs') |
||||
41 | // ], 'fastApi'); |
||||
42 | |||||
43 | |||||
44 | $this->app->when(MigrationCreator::class) |
||||
45 | ->needs('$customStubPath') |
||||
46 | ->give(function ($app) { |
||||
0 ignored issues
–
show
The parameter
$app is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. ![]() |
|||||
47 | return base_path('vendor/larafast/fastapi/resources/stubs'); |
||||
48 | }); |
||||
49 | |||||
50 | $this->commands($this->commands); |
||||
51 | } |
||||
52 | |||||
53 | /** |
||||
54 | * Register the application services. |
||||
55 | */ |
||||
56 | public function register() |
||||
57 | { |
||||
58 | // Automatically apply the package configuration |
||||
59 | $this->mergeConfigFrom(__DIR__ . '/../config/config.php', 'fastApi'); |
||||
60 | |||||
61 | // Register the main class to use with the facade |
||||
62 | $this->app->singleton('fastApi', function () { |
||||
63 | return new Fastapi; |
||||
0 ignored issues
–
show
The call to
Larafast\Fastapi\Console...\Fastapi::__construct() has too few arguments starting with files .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check compares calls to functions or methods with their respective definitions. If the call has less 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. ![]() |
|||||
64 | }); |
||||
65 | } |
||||
66 | } |
||||
67 |
Let?s assume that you have a directory layout like this:
and let?s assume the following content of
Bar.php
:If both files
OtherDir/Foo.php
andSomeDir/Foo.php
are loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php
However, as
OtherDir/Foo.php
does not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php
, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: