From 8724aeb590ec3dee036c5f47ec8ded1083950c18 Mon Sep 17 00:00:00 2001 From: StyleCI Bot Date: Fri, 9 May 2025 18:26:35 +0000 Subject: [PATCH] Apply fixes from StyleCI --- src/Actions/StorePermission.php | 4 ++-- src/Actions/SyncDefinedRole.php | 2 +- src/Commands/RbacResetCommand.php | 8 ++++---- src/Jobs/ResetPermissions.php | 2 +- tests/Actions/StorePermissionTest.php | 2 +- tests/Actions/SyncDefinedRoleTest.php | 2 +- tests/Commands/RbacResetCommandTest.php | 2 +- tests/TestCase.php | 10 +++++----- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Actions/StorePermission.php b/src/Actions/StorePermission.php index a459b98..cce54b8 100644 --- a/src/Actions/StorePermission.php +++ b/src/Actions/StorePermission.php @@ -14,12 +14,12 @@ public function __construct( } /** - * 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 a759393..2278aee 100644 --- a/src/Actions/SyncDefinedRole.php +++ b/src/Actions/SyncDefinedRole.php @@ -14,7 +14,7 @@ public function __construct( } /** - * 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 d72532a..31c67f9 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 @@ protected function databaseReady(): bool $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 9c8c5ae..0d53b52 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 e671746..6388d91 100644 --- a/tests/Actions/StorePermissionTest.php +++ b/tests/Actions/StorePermissionTest.php @@ -15,7 +15,7 @@ public function it_will_handle_creating_permission(): void 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 33e02a6..316280e 100644 --- a/tests/Actions/SyncDefinedRoleTest.php +++ b/tests/Actions/SyncDefinedRoleTest.php @@ -23,7 +23,7 @@ public function it_will_defer_syncing_defined_role_to_artisan(): void ]); $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 5558f38..91aed0a 100644 --- a/tests/Commands/RbacResetCommandTest.php +++ b/tests/Commands/RbacResetCommandTest.php @@ -34,7 +34,7 @@ public function it_will_not_dispatch_if_not_migrated(): void $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 bf407dd..6c53892 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -10,7 +10,7 @@ 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 @@ protected function getPackageProviders($app): array } /** - * 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' => '', ]); });