From c6161f69977d13b9f3b89c84df6bb6f7240c0ce3 Mon Sep 17 00:00:00 2001 From: PHP CS Fixer Date: Fri, 22 Jul 2022 07:28:16 +0000 Subject: [PATCH] Fix code style (php-cs-fixer) --- src/Commands/ClearPendingTenants.php | 3 --- src/Commands/CreatePendingTenants.php | 4 ---- src/Concerns/HasATenantsOption.php | 2 +- src/Database/Concerns/HasPending.php | 9 ++++----- src/Database/Concerns/PendingScope.php | 10 +--------- src/Jobs/ClearPendingTenants.php | 1 - src/Jobs/CreatePendingTenants.php | 1 - src/Tenancy.php | 2 +- 8 files changed, 7 insertions(+), 25 deletions(-) diff --git a/src/Commands/ClearPendingTenants.php b/src/Commands/ClearPendingTenants.php index 5c895c28..089f9db5 100644 --- a/src/Commands/ClearPendingTenants.php +++ b/src/Commands/ClearPendingTenants.php @@ -28,8 +28,6 @@ class ClearPendingTenants extends Command /** * Execute the console command. - * - * @return mixed */ public function handle() { @@ -50,7 +48,6 @@ class ClearPendingTenants extends Command } } - $deletedPendingCount = tenancy() ->query() ->onlyPending() diff --git a/src/Commands/CreatePendingTenants.php b/src/Commands/CreatePendingTenants.php index b6d05353..c918fedb 100644 --- a/src/Commands/CreatePendingTenants.php +++ b/src/Commands/CreatePendingTenants.php @@ -24,8 +24,6 @@ class CreatePendingTenants extends Command /** * Execute the console command. - * - * @return mixed */ public function handle() { @@ -53,8 +51,6 @@ class CreatePendingTenants extends Command /** * Calculate the number of currently deployed pending tenants. - * - * @return int */ private function getPendingTenantCount(): int { diff --git a/src/Concerns/HasATenantsOption.php b/src/Concerns/HasATenantsOption.php index 120bb21c..d3fea6e0 100644 --- a/src/Concerns/HasATenantsOption.php +++ b/src/Concerns/HasATenantsOption.php @@ -12,7 +12,7 @@ trait HasATenantsOption protected function getOptions() { return array_merge([ - ['tenants', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_OPTIONAL, '', null], + ['tenants', null, InputOption::VALUE_IS_ARRAY|InputOption::VALUE_OPTIONAL, '', null], ['with-pending', null, InputOption::VALUE_NONE, 'include pending tenants in query', null], ], parent::getOptions()); } diff --git a/src/Database/Concerns/HasPending.php b/src/Database/Concerns/HasPending.php index e71c0b0a..5231695a 100644 --- a/src/Database/Concerns/HasPending.php +++ b/src/Database/Concerns/HasPending.php @@ -5,10 +5,10 @@ declare(strict_types=1); namespace Stancl\Tenancy\Database\Concerns; use Stancl\Tenancy\Contracts\Tenant; -use Stancl\Tenancy\Events\PullingPendingTenant; -use Stancl\Tenancy\Events\PendingTenantPulled; use Stancl\Tenancy\Events\CreatingPendingTenant; use Stancl\Tenancy\Events\PendingTenantCreated; +use Stancl\Tenancy\Events\PendingTenantPulled; +use Stancl\Tenancy\Events\PullingPendingTenant; /** * @property $pending_since @@ -39,7 +39,6 @@ trait HasPending $this->casts['pending_since'] = 'timestamp'; } - /** * Determine if the model instance is in a pending state. * @@ -59,7 +58,7 @@ trait HasPending // Add the pending value only after creating the model // To ensure it's not marked as pending until finishing running the migrations, seeders, etc. $tenant->update([ - 'pending_since' => now()->timestamp + 'pending_since' => now()->timestamp, ]); event(new PendingTenantCreated($tenant)); @@ -80,7 +79,7 @@ trait HasPending event(new PullingPendingTenant($tenant)); $tenant->update([ - 'pending_since' => null + 'pending_since' => null, ]); event(new PendingTenantPulled($tenant)); diff --git a/src/Database/Concerns/PendingScope.php b/src/Database/Concerns/PendingScope.php index 01a7b17a..f28988d4 100644 --- a/src/Database/Concerns/PendingScope.php +++ b/src/Database/Concerns/PendingScope.php @@ -10,7 +10,6 @@ use Illuminate\Database\Eloquent\Scope; class PendingScope implements Scope { - /** * All of the extensions to be added to the builder. * @@ -21,13 +20,11 @@ class PendingScope implements Scope /** * Apply the scope to a given Eloquent query builder. * - * @param Builder $builder - * @param Model $model * @return void */ public function apply(Builder $builder, Model $model) { - $builder->when(! config('tenancy.pending.include_in_queries'), function (Builder $builder){ + $builder->when(! config('tenancy.pending.include_in_queries'), function (Builder $builder) { $builder->whereNull('data->pending_since'); }); } @@ -35,7 +32,6 @@ class PendingScope implements Scope /** * Extend the query builder with the needed functions. * - * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ public function extend(Builder $builder) @@ -47,7 +43,6 @@ class PendingScope implements Scope /** * Add the with-pending extension to the builder. * - * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithPending(Builder $builder) @@ -64,13 +59,11 @@ class PendingScope implements Scope /** * Add the without-pending extension to the builder. * - * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addWithoutPending(Builder $builder) { $builder->macro('withoutPending', function (Builder $builder) { - $builder->withoutGlobalScope($this) ->whereNull('data->pending_since') ->orWhereNull('data'); @@ -82,7 +75,6 @@ class PendingScope implements Scope /** * Add the only-pending extension to the builder. * - * @param \Illuminate\Database\Eloquent\Builder $builder * @return void */ protected function addOnlyPending(Builder $builder) diff --git a/src/Jobs/ClearPendingTenants.php b/src/Jobs/ClearPendingTenants.php index 31720904..52d7b1a4 100644 --- a/src/Jobs/ClearPendingTenants.php +++ b/src/Jobs/ClearPendingTenants.php @@ -10,7 +10,6 @@ use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; use Illuminate\Support\Facades\Artisan; -use Stancl\Tenancy\Contracts\TenantWithDatabase; class ClearPendingTenants implements ShouldQueue { diff --git a/src/Jobs/CreatePendingTenants.php b/src/Jobs/CreatePendingTenants.php index bdd68e9a..4e65cbbc 100644 --- a/src/Jobs/CreatePendingTenants.php +++ b/src/Jobs/CreatePendingTenants.php @@ -10,7 +10,6 @@ use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; use Illuminate\Support\Facades\Artisan; -use Stancl\Tenancy\Contracts\TenantWithDatabase; class CreatePendingTenants implements ShouldQueue { diff --git a/src/Tenancy.php b/src/Tenancy.php index 19eb4c6b..7c1d28b3 100644 --- a/src/Tenancy.php +++ b/src/Tenancy.php @@ -135,7 +135,7 @@ class Tenancy { $query = $this->model()->newQuery(); - if (is_bool($withPending) && $this->model()::hasGlobalScope(PendingScope::class)){ + if (is_bool($withPending) && $this->model()::hasGlobalScope(PendingScope::class)) { $query->withPending($withPending); } // Convert null to all tenants