From 28f98db9deaa9a6ea120d793b271dc751cfdbda7 Mon Sep 17 00:00:00 2001
From: slawkens <slawkens@gmail.com>
Date: Fri, 12 Jul 2024 20:48:27 +0200
Subject: [PATCH] Fix PHPStan errors in monsters.php

---
 phpstan.neon              | 1 +
 system/pages/monsters.php | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/phpstan.neon b/phpstan.neon
index b77bc1d2..fda6a07c 100644
--- a/phpstan.neon
+++ b/phpstan.neon
@@ -29,6 +29,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\\_]+()#'
+		- '#Call to an undefined method object::toArray\(\)#'
 		# 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#'
diff --git a/system/pages/monsters.php b/system/pages/monsters.php
index f8a8a66a..e254fb6f 100644
--- a/system/pages/monsters.php
+++ b/system/pages/monsters.php
@@ -44,6 +44,8 @@ $monster = Monster::where('hide', '!=', 1)->where('name', $monster_name)->first(
 if ($monster && isset($monster->name)) {
 	$monster = $monster->toArray();
 
+	/** @var array $monster */
+
 	function sort_by_chance($a, $b)
 	{
 		if ($a['chance'] == $b['chance']) {