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

@@ -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);