1 | <?php |
||
2 | |||
3 | namespace Orkhanahmadov\ContentMigrations; |
||
4 | |||
5 | use Illuminate\Contracts\Events\Dispatcher; |
||
6 | use Illuminate\Database\Migrations\DatabaseMigrationRepository; |
||
7 | use Illuminate\Database\Migrations\MigrationCreator; |
||
8 | use Illuminate\Database\Migrations\Migrator; |
||
9 | use Illuminate\Support\ServiceProvider; |
||
10 | use Orkhanahmadov\ContentMigrations\Console\InstallCommand; |
||
11 | use Orkhanahmadov\ContentMigrations\Console\MigrateCommand; |
||
12 | use Orkhanahmadov\ContentMigrations\Console\MigrateMakeCommand; |
||
13 | |||
14 | class ContentMigrationsServiceProvider extends ServiceProvider |
||
15 | { |
||
16 | public function register() |
||
17 | { |
||
18 | $this->app->singleton(InstallCommand::class, function ($app) { |
||
19 | return new InstallCommand(new DatabaseMigrationRepository($app['db'], 'content_migrations')); |
||
20 | }); |
||
21 | |||
22 | $this->app->singleton(MigrateCommand::class, function ($app) { |
||
23 | return new MigrateCommand( |
||
24 | new Migrator( |
||
25 | new DatabaseMigrationRepository($app['db'], 'content_migrations'), |
||
26 | $app['db'], |
||
27 | $app['files'], |
||
28 | $app['events'] |
||
29 | ), |
||
30 | $app[Dispatcher::class] |
||
0 ignored issues
–
show
|
|||
31 | ); |
||
32 | }); |
||
33 | |||
34 | $this->app->singleton(MigrateMakeCommand::class, function ($app) { |
||
35 | return new MigrateMakeCommand( |
||
36 | new MigrationCreator( |
||
37 | $app['files'], |
||
38 | __DIR__ . DIRECTORY_SEPARATOR . 'Console' . DIRECTORY_SEPARATOR . 'stubs' |
||
39 | ), |
||
40 | $app['composer'] |
||
41 | ); |
||
42 | }); |
||
43 | } |
||
44 | |||
45 | public function boot() |
||
46 | { |
||
47 | if ($this->app->runningInConsole()) { |
||
48 | $this->commands([ |
||
49 | InstallCommand::class, |
||
50 | MigrateCommand::class, |
||
51 | MigrateMakeCommand::class, |
||
52 | ]); |
||
53 | } |
||
54 | } |
||
55 | } |
||
56 |
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.