From 1d1fc2c716d9575891567c14da734192670404c1 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Mon, 7 Dec 2020 16:49:15 +0000 Subject: [PATCH] Apply fixes from StyleCI --- config/actions.php | 1 - src/Console/Make.php | 5 ++--- src/Console/Migrate.php | 5 ++--- src/Console/Refresh.php | 6 +----- src/Console/Reset.php | 2 -- src/Console/Rollback.php | 3 ++- src/ServiceProvider.php | 18 ++++++++++++++---- tests/TestCase.php | 21 ++++++++++++--------- 8 files changed, 33 insertions(+), 28 deletions(-) diff --git a/config/actions.php b/config/actions.php index b48c5b81..8c167d1c 100644 --- a/config/actions.php +++ b/config/actions.php @@ -1,7 +1,6 @@ creator->create( - $name, $this->getMigrationPath() + $name, + $this->getMigrationPath() ); $path = pathinfo($file, PATHINFO_FILENAME); diff --git a/src/Console/Migrate.php b/src/Console/Migrate.php index a3a76e5d..6e943cef 100644 --- a/src/Console/Migrate.php +++ b/src/Console/Migrate.php @@ -3,7 +3,8 @@ namespace Helldar\LaravelActions\Console; use Helldar\LaravelActions\Constants\Names; -use Helldar\LaravelActions\Traits\{Database, Optionable}; +use Helldar\LaravelActions\Traits\Database; +use Helldar\LaravelActions\Traits\Optionable; use Illuminate\Database\Console\Migrations\MigrateCommand as BaseCommand; final class Migrate extends BaseCommand @@ -54,8 +55,6 @@ public function handle() /** * Prepare the action database for running. - * - * @return void */ protected function prepareDatabase() { diff --git a/src/Console/Refresh.php b/src/Console/Refresh.php index 05c0c9cd..d212d202 100644 --- a/src/Console/Refresh.php +++ b/src/Console/Refresh.php @@ -51,7 +51,7 @@ public function handle() if ($this->laravel->bound(Dispatcher::class)) { $this->laravel[Dispatcher::class]->dispatch( - new DatabaseRefreshed + new DatabaseRefreshed() ); } @@ -63,8 +63,6 @@ public function handle() * * @param string|null $database * @param int|null $step - * - * @return void */ protected function runRollback(?string $database, ?int $step) { @@ -79,8 +77,6 @@ protected function runRollback(?string $database, ?int $step) * Run the reset command. * * @param string|null $database - * - * @return void */ protected function runReset(?string $database) { diff --git a/src/Console/Reset.php b/src/Console/Reset.php index 414033e0..fb3555e5 100644 --- a/src/Console/Reset.php +++ b/src/Console/Reset.php @@ -41,8 +41,6 @@ final class Reset extends BaseCommand * Create a new migration rollback command instance. * * @param \Illuminate\Database\Migrations\Migrator $migrator - * - * @return void */ public function __construct(Migrator $migrator) { diff --git a/src/Console/Rollback.php b/src/Console/Rollback.php index 897435db..076aeb4e 100644 --- a/src/Console/Rollback.php +++ b/src/Console/Rollback.php @@ -40,7 +40,8 @@ public function handle() $this->migrator->usingConnection($this->optionDatabase(), function () { $this->migrator->setOutput($this->output)->rollback( - $this->getMigrationPaths(), [ + $this->getMigrationPaths(), + [ 'step' => $this->optionStep(), ] ); diff --git a/src/ServiceProvider.php b/src/ServiceProvider.php index 7807e80a..ce127788 100644 --- a/src/ServiceProvider.php +++ b/src/ServiceProvider.php @@ -2,10 +2,19 @@ namespace Helldar\LaravelActions; -use Helldar\LaravelActions\Console\{Install, Make, Migrate, Refresh, Reset, Rollback, Status}; -use Helldar\LaravelActions\Constants\{Action, Command}; +use Helldar\LaravelActions\Console\Install; +use Helldar\LaravelActions\Console\Make; +use Helldar\LaravelActions\Console\Migrate; +use Helldar\LaravelActions\Console\Refresh; +use Helldar\LaravelActions\Console\Reset; +use Helldar\LaravelActions\Console\Rollback; +use Helldar\LaravelActions\Console\Status; +use Helldar\LaravelActions\Constants\Action; +use Helldar\LaravelActions\Constants\Command; use Illuminate\Contracts\Events\Dispatcher; -use Illuminate\Database\Migrations\{DatabaseMigrationRepository, MigrationCreator, Migrator}; +use Illuminate\Database\Migrations\DatabaseMigrationRepository; +use Illuminate\Database\Migrations\MigrationCreator; +use Illuminate\Database\Migrations\Migrator; use Illuminate\Support\ServiceProvider as BaseServiceProvider; final class ServiceProvider extends BaseServiceProvider @@ -128,7 +137,8 @@ protected function registerMigrateRefreshCommand(): void protected function registerConfig(): void { $this->mergeConfigFrom( - __DIR__ . '/../config/actions.php', 'actions' + __DIR__ . '/../config/actions.php', + 'actions' ); } diff --git a/tests/TestCase.php b/tests/TestCase.php index 54665080..46056bbd 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -6,7 +6,10 @@ use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Support\Facades\DB; use Orchestra\Testbench\TestCase as BaseTestCase; -use Tests\Concerns\{Actionable, Database, Files, Settings}; +use Tests\Concerns\Actionable; +use Tests\Concerns\Database; +use Tests\Concerns\Files; +use Tests\Concerns\Settings; abstract class TestCase extends BaseTestCase { @@ -16,6 +19,14 @@ abstract class TestCase extends BaseTestCase use RefreshDatabase; use Settings; + protected function setUp(): void + { + parent::setUp(); + + $this->freshDatabase(); + $this->freshFiles(); + } + protected function getEnvironmentSetUp($app) { parent::getEnvironmentSetUp($app); @@ -29,14 +40,6 @@ protected function getPackageProviders($app): array return [ServiceProvider::class]; } - protected function setUp(): void - { - parent::setUp(); - - $this->freshDatabase(); - $this->freshFiles(); - } - protected function table() { return DB::table($this->table);