fix: resolve PHPStan static analysis warnings

This commit is contained in:
xboard
2025-04-14 02:12:42 +08:00
parent 3d254c02c1
commit 2d3e4b4a95
84 changed files with 2330 additions and 1190 deletions

View File

@@ -8,6 +8,7 @@ use App\Models\Plan;
use App\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class PlanController extends Controller
{
@@ -58,7 +59,7 @@ class PlanController extends Controller
return $this->success(true);
} catch (\Exception $e) {
DB::rollBack();
\Log::error($e);
Log::error($e);
return $this->fail([500, '保存失败']);
}
}
@@ -76,12 +77,12 @@ class PlanController extends Controller
if (User::where('plan_id', $request->input('id'))->first()) {
return $this->fail([400201, '该订阅下存在用户无法删除']);
}
if ($request->input('id')) {
$plan = Plan::find($request->input('id'));
if (!$plan) {
return $this->fail([400202, '该订阅不存在']);
}
$plan = Plan::find($request->input('id'));
if (!$plan) {
return $this->fail([400202, '该订阅不存在']);
}
return $this->success($plan->delete());
}
@@ -101,7 +102,7 @@ class PlanController extends Controller
try {
$plan->update($updateData);
} catch (\Exception $e) {
\Log::error($e);
Log::error($e);
return $this->fail([500, '保存失败']);
}
@@ -124,7 +125,7 @@ class PlanController extends Controller
DB::commit();
} catch (\Exception $e) {
DB::rollBack();
\Log::error($e);
Log::error($e);
return $this->fail([500, '保存失败']);
}
return $this->success(true);