From 765baf248f4ffedce00981c7732e20362ddc8905 Mon Sep 17 00:00:00 2001 From: slawkens Date: Thu, 1 Feb 2024 22:39:48 +0100 Subject: [PATCH] Move errors ignoring into phpstan.neon --- phpstan.neon | 5 ++++- system/functions.php | 2 +- system/pages/highscores.php | 6 +++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index 0ccf3841..b2e8efb0 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -30,4 +30,7 @@ parameters: - '#Variable \$[a-zA-Z0-9\\_]+ might not be defined#' # Eloquent models - '#Call to an undefined static method [a-zA-Z0-9\\_]+::[a-zA-Z0-9\\_]+()#' - + # system/pages/highscores.php + - '#Call to an undefined method Illuminate\\Database\\Query\\Builder::withOnlineStatus\(\)#' + - '#Access to an undefined property Illuminate\\Database\\Eloquent\\Model::\$online_status#' + - '#Access to an undefined property Illuminate\\Database\\Eloquent\\Model::\$vocation_name#' diff --git a/system/functions.php b/system/functions.php index 6339c775..80a1b2a6 100644 --- a/system/functions.php +++ b/system/functions.php @@ -1111,7 +1111,7 @@ function getTopPlayers($limit = 5) { $columns[] = 'online'; } - $players = Player::query()/** @phpstan-ignore-line */ + $players = Player::query() ->select($columns) ->withOnlineStatus() ->notDeleted() diff --git a/system/pages/highscores.php b/system/pages/highscores.php index 2bf2dab5..1229dca3 100644 --- a/system/pages/highscores.php +++ b/system/pages/highscores.php @@ -147,7 +147,7 @@ if ($cache->enabled()) { } $offset = ($page - 1) * $configHighscoresPerPage; -$query->join('accounts', 'accounts.id', '=', 'players.account_id') /** @phpstan-ignore-line */ +$query->join('accounts', 'accounts.id', '=', 'players.account_id') ->withOnlineStatus() ->whereNotIn('players.id', setting('core.highscores_ids_hidden')) ->notDeleted() @@ -203,8 +203,8 @@ if (empty($highscores)) { $highscores = $query->get()->map(function($row) { $tmp = $row->toArray(); - $tmp['online'] = $row->online_status; /** @phpstan-ignore-line */ - $tmp['vocation'] = $row->vocation_name; /** @phpstan-ignore-line */ + $tmp['online'] = $row->online_status; + $tmp['vocation'] = $row->vocation_name; unset($tmp['online_table']); return $tmp;