From 54bdea85a3a7f34470066b6e9c658ae062d44a02 Mon Sep 17 00:00:00 2001 From: slawkens Date: Fri, 24 Apr 2026 20:36:56 +0200 Subject: [PATCH] Fix phpstan --- phpstan.neon | 2 -- system/pages/highscores.php | 5 ++++- system/src/Models/Player.php | 4 ++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index 68e1aa6a..05778a86 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -31,8 +31,6 @@ parameters: - '#Call to an undefined method [a-zA-Z0-9\\_]+::[a-zA-Z0-9\\_]+\(\)#' - '#Call to an undefined static method [a-zA-Z0-9\\_]+::[a-zA-Z0-9\\_]+\(\)#' # system/pages/highscores.php - - '#Access to an undefined property Illuminate\\Database\\Eloquent\\Model::\$online_status#' - - '#Access to an undefined property Illuminate\\Database\\Eloquent\\Model::\$vocation_name#' - message: '#Variable \$tmp in empty\(\) always exists and is always falsy#' path: templates\kathrine\javascript.php diff --git a/system/pages/highscores.php b/system/pages/highscores.php index b86cdf10..e3c52645 100644 --- a/system/pages/highscores.php +++ b/system/pages/highscores.php @@ -210,10 +210,13 @@ if (empty($highscores)) { } $highscores = $query->get()->map(function($row) { + /** + * @var Player $row + */ $tmp = $row->toArray(); $tmp['online'] = $row->online_status; $tmp['vocation'] = $row->vocation_name; - $tmp['outfit_url'] = $row->outfit_url; // @phpstan-ignore-line + $tmp['outfit_url'] = $row->outfit_url; $tmp['link'] = getPlayerLink($row->name, false); unset($tmp['online_table']); diff --git a/system/src/Models/Player.php b/system/src/Models/Player.php index 77fe4504..77b9313f 100644 --- a/system/src/Models/Player.php +++ b/system/src/Models/Player.php @@ -5,6 +5,7 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\HasOne; /** + * @property string $name * @property int $level * @property int $vocation * @property int $online @@ -14,6 +15,9 @@ use Illuminate\Database\Eloquent\Relations\HasOne; * @property int $looklegs * @property int $lookfeet * @property int $lookaddons + * @property int $promotion + * @property bool $online_status + * @property string $vocation_name * @property string $outfit_url * @property hasOne $onlineTable */