From b9a01b68f0efbb7c6e6356c883ff7d505dad67dd Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 18 Sep 2026 17:22:18 +0930 Subject: [PATCH] Larastan --- app/Console/Commands/FixBugs/FixHashtags.php | 4 +--- app/Console/Commands/User/UserDelete.php | 15 +++------------ phpstan-baseline.neon | 12 ++++++------ 3 files changed, 10 insertions(+), 21 deletions(-) diff --git a/app/Console/Commands/FixBugs/FixHashtags.php b/app/Console/Commands/FixBugs/FixHashtags.php index 8bea215bc..bc313482c 100644 --- a/app/Console/Commands/FixBugs/FixHashtags.php +++ b/app/Console/Commands/FixBugs/FixHashtags.php @@ -60,7 +60,7 @@ class FixHashtags extends Command if ($slug === $tag->slug) { continue; } - $count = Hashtag::whereName($tag->name)->where('slug', '===', $slug)->count(); + $count = Hashtag::whereName($tag->name)->where('slug', '=', $slug)->count(); if (! $count) { continue; } @@ -70,8 +70,6 @@ class FixHashtags extends Command $this->info('Found '.$count.' broken tags'); - return; - $missingCount = StatusHashtag::doesntHave('profile')->doesntHave('status')->count(); if ($missingCount > 0) { $this->info("Found {$missingCount} orphaned StatusHashtag records to delete ..."); diff --git a/app/Console/Commands/User/UserDelete.php b/app/Console/Commands/User/UserDelete.php index a30a78d14..4f2fbcc24 100644 --- a/app/Console/Commands/User/UserDelete.php +++ b/app/Console/Commands/User/UserDelete.php @@ -73,23 +73,15 @@ class UserDelete extends Command implements PromptsForMissingInput return $u->username; }) ); - $user = Profile::whereUsername($user)->first(); + $profile = Profile::whereUsername($user)->first(); - if (! $user) { + if (! $profile) { $this->error('Invalid id or username'); return; } - $this->info($user->username); - - return; - - if (ctype_digit($id) === true) { - $user = User::find($id); - } else { - $user = User::whereUsername($id)->first(); - } + $user = $profile->user_id ? User::find($profile->user_id) : null; if (! $user) { $this->error('Could not find any user with that username or id.'); @@ -135,7 +127,6 @@ class UserDelete extends Command implements PromptsForMissingInput exit; } - return; if ($user->status !== 'deleted') { $profile = $user->profile; $profile->status = $user->status = 'deleted'; diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 834251902..e2115ea2a 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -37,8 +37,8 @@ parameters: path: app/Console/Commands/FixBugs/FixDuplicateProfiles.php - - message: '#^Unreachable statement \- code above always terminates\.$#' - identifier: deadCode.unreachable + message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$scope\.$#' + identifier: property.notFound count: 1 path: app/Console/Commands/FixBugs/FixHashtags.php @@ -133,14 +133,14 @@ parameters: path: app/Console/Commands/User/UserCheckPassword.php - - message: '#^Negated boolean expression is always false\.$#' - identifier: booleanNot.alwaysFalse + message: '#^Access to an undefined property Illuminate\\Database\\Eloquent\\Model\:\:\$status\.$#' + identifier: property.notFound count: 1 path: app/Console/Commands/User/UserDelete.php - - message: '#^Unreachable statement \- code above always terminates\.$#' - identifier: deadCode.unreachable + message: '#^Negated boolean expression is always false\.$#' + identifier: booleanNot.alwaysFalse count: 1 path: app/Console/Commands/User/UserDelete.php