Move errors ignoring into phpstan.neon

This commit is contained in:
slawkens 2024-02-01 22:39:48 +01:00
parent 42ce80170e
commit 765baf248f
3 changed files with 8 additions and 5 deletions

View File

@ -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#'

View File

@ -1111,7 +1111,7 @@ function getTopPlayers($limit = 5) {
$columns[] = 'online';
}
$players = Player::query()/** @phpstan-ignore-line */
$players = Player::query()
->select($columns)
->withOnlineStatus()
->notDeleted()

View File

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