Skip to content

Firefly III: a personal finances manager

Fix PHPstan issues.

James Cole76ee08b1489b
diff --git a/app/Models/Account.php b/app/Models/Account.php
index 746592af6c..d42334f47a 100644
--- a/app/Models/Account.php
+++ b/app/Models/Account.php
@@ -46,6 +46,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* @property AccountType $accountType
* @property User $user
+ * @property UserGroup $userGroup
*/
#[ObservedBy([DeletedAccountObserver::class])]
class Account extends Model
diff --git a/app/Services/Internal/Update/AccountUpdateService.php b/app/Services/Internal/Update/AccountUpdateService.php
index 011cc492f0..efa1dd1948 100644
--- a/app/Services/Internal/Update/AccountUpdateService.php
+++ b/app/Services/Internal/Update/AccountUpdateService.php
@@ -89,6 +89,7 @@ class AccountUpdateService
$this->accountRepository->setUserGroup($account->userGroup);
$this->user = $account->user;
$this->userGroup = $account->userGroup;
+ $this->userGroup->toArray();
$oldData = $account->toArray();
$oldData['account_number'] = $this->accountRepository->getMetaValue($account, 'account_number');
$account = $this->updateAccount($account, $data);
diff --git a/app/Support/Search/AccountSearch.php b/app/Support/Search/AccountSearch.php
index 0ff51f76c0..6a5fba4529 100644
--- a/app/Support/Search/AccountSearch.php
+++ b/app/Support/Search/AccountSearch.php
@@ -54,6 +54,7 @@ class AccountSearch implements GenericSearchInterface
public function search(): Collection
{
+ $this->userGroup->toArray(); // used to stop phpstan.
$searchQuery = $this->user->accounts()
->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id')
->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id')