fix: resolve PHPStan static analysis warnings

This commit is contained in:
xboard
2025-05-07 19:48:19 +08:00
parent db235c10e8
commit 97e7ffccae
86 changed files with 2335 additions and 1206 deletions

View File

@@ -10,12 +10,13 @@ use App\Models\ServerGroup;
use App\Services\ServerService;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class ManageController extends Controller
{
public function getNodes(Request $request)
{
$servers = collect(ServerService::getAllServers())->map(function ($item) {
$servers = ServerService::getAllServers()->map(function ($item) {
$item['groups'] = ServerGroup::whereIn('id', $item['group_ids'])->get(['name', 'id']);
$item['parent'] = $item->parent;
return $item;
@@ -41,7 +42,7 @@ class ManageController extends Controller
DB::commit();
} catch (\Exception $e) {
DB::rollBack();
\Log::error($e);
Log::error($e);
return $this->fail([500, '保存失败']);
}
@@ -60,7 +61,7 @@ class ManageController extends Controller
$server->update($params);
return $this->success(true);
} catch (\Exception $e) {
\Log::error($e);
Log::error($e);
return $this->fail([500, '保存失败']);
}
}
@@ -69,7 +70,7 @@ class ManageController extends Controller
Server::create($params);
return $this->success(true);
} catch (\Exception $e) {
\Log::error($e);
Log::error($e);
return $this->fail([500, '创建失败']);
}
@@ -83,7 +84,7 @@ class ManageController extends Controller
'show' => 'integer',
]);
if (Server::where('id', $request->id)->update(['show' => $request->show]) === false) {
if (!Server::where('id', $request->id)->update(['show' => $request->show])) {
return $this->fail([500, '保存失败']);
}
return $this->success(true);