diff --git a/src/Actions/StorePermission.php b/src/Actions/StorePermission.php index a459b98ab3f602430a3a4f7b76e0e5f93fd30d73..cce54b89b93dba61587ef399cbd9fa333833f846 100644 --- a/src/Actions/StorePermission.php +++ b/src/Actions/StorePermission.php @@ -14,12 +14,12 @@ class StorePermission extends Action } /** - * Handle storing a permission + * Handle storing a permission. */ public function handle(BackedEnum|string $permission, string $guard): void { if ($permission instanceof BackedEnum) { - $permission = $permission->value; + $permission = $permission->value; } $this->permission::findOrCreate($permission, $guard); diff --git a/src/Actions/SyncDefinedRole.php b/src/Actions/SyncDefinedRole.php index a7593938333e2b9837c2b8ca046e4f327bbae9be..2278aee259924e3a4e372906e2ff279b84cd3e50 100644 --- a/src/Actions/SyncDefinedRole.php +++ b/src/Actions/SyncDefinedRole.php @@ -14,7 +14,7 @@ class SyncDefinedRole extends Action } /** - * Handle syncing a defined role + * Handle syncing a defined role. */ public function handle(string $name, string $guard, array $permissions): void { diff --git a/src/Commands/RbacResetCommand.php b/src/Commands/RbacResetCommand.php index d72532aa4b7672f66edde09a61cf6ec58544d1be..31c67f93d18d655a9b68aa5162c2a42e71d80ea9 100644 --- a/src/Commands/RbacResetCommand.php +++ b/src/Commands/RbacResetCommand.php @@ -27,16 +27,16 @@ class RbacResetCommand extends Command */ public function handle(): int { - if (! $this->databaseReady()) { + if (!$this->databaseReady()) { $this->error('DB is not ready. Please run migrations.'); return self::INVALID; } - $this->jobs()->each(function(string $job) { + $this->jobs()->each(function (string $job) { $this->components->task( $job, - fn() => $this->laravel->make($job)->dispatchSync() + fn () => $this->laravel->make($job)->dispatchSync() ); }); @@ -61,7 +61,7 @@ class RbacResetCommand extends Command $tables = config('permission.table_names', []); return collect($tables) - ->map(fn(string $table) => Schema::hasTable($table)) + ->map(fn (string $table) => Schema::hasTable($table)) ->reject() ->isEmpty(); } diff --git a/src/Jobs/ResetPermissions.php b/src/Jobs/ResetPermissions.php index 9c8c5aea0f2297756048b74611f90101533f3dfd..0d53b527a466067f4be0d35eb92d46e0df6bb5d4 100644 --- a/src/Jobs/ResetPermissions.php +++ b/src/Jobs/ResetPermissions.php @@ -23,7 +23,7 @@ class ResetPermissions /** * @param string|null $guard */ - public function __construct(string $guard = null) + public function __construct(?string $guard = null) { $this->guard = $guard ?? config('auth.defaults.guard'); } diff --git a/tests/Actions/StorePermissionTest.php b/tests/Actions/StorePermissionTest.php index e6717468c99e0134ec2e33414858a53cfcc7e93e..6388d913d415417c6aa03118e63703430147c1e8 100644 --- a/tests/Actions/StorePermissionTest.php +++ b/tests/Actions/StorePermissionTest.php @@ -15,7 +15,7 @@ class StorePermissionTest extends TestCase StorePermission::run(FooAbility::One, 'web'); $this->assertDatabaseHas(config('permission.table_names.permissions'), [ - 'name' => 'una', + 'name' => 'una', 'guard_name' => 'web', ]); } diff --git a/tests/Actions/SyncDefinedRoleTest.php b/tests/Actions/SyncDefinedRoleTest.php index 33e02a654d47c25485cceb415dd710518d45e68e..316280e2de76ae15e2c244bd36453fa48c88dfe2 100644 --- a/tests/Actions/SyncDefinedRoleTest.php +++ b/tests/Actions/SyncDefinedRoleTest.php @@ -23,7 +23,7 @@ class SyncDefinedRoleTest extends TestCase ]); $this->assertDatabaseHas(config('permission.table_names.roles'), [ - 'name' => 'foo role', + 'name' => 'foo role', 'guard_name' => 'web', ]); } diff --git a/tests/Commands/RbacResetCommandTest.php b/tests/Commands/RbacResetCommandTest.php index 5558f380aad62e86f5c54663c7f979b10bef6766..91aed0a1f43adcfc991c4d46f28805e25fa51150 100644 --- a/tests/Commands/RbacResetCommandTest.php +++ b/tests/Commands/RbacResetCommandTest.php @@ -34,7 +34,7 @@ class RbacResetCommandTest extends TestCase $this->app['config']->set([ 'permission.table_names' => ['permissions' => 'foo'], ]); - + Schema::expects('hasTable') ->with('foo') ->andReturnFalse(); diff --git a/tests/TestCase.php b/tests/TestCase.php index bf407ddf9f00329dab04161d2793f667f3e37ccc..6c53892ece6a7fb11bb4ac615f660ff9585e869c 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -10,7 +10,7 @@ use Spatie\Permission\PermissionServiceProvider; class TestCase extends Orchestra { /** - * Get the package providers fopr registrations + * Get the package providers fopr registrations. * * @param \Illuminate\Foundation\Application $app */ @@ -23,16 +23,16 @@ class TestCase extends Orchestra } /** - * Define the environment + * Define the environment. */ protected function defineEnvironment($app): void { tap($app['config'], function (Repository $config) { $config->set('database.default', 'sqlite'); $config->set('database.connections.sqlite', [ - 'driver' => 'sqlite', - 'database' => ':memory:', - 'prefix' => '', + 'driver' => 'sqlite', + 'database' => ':memory:', + 'prefix' => '', ]); });