From c61389037d97c029ffcd1c0a910af346bb2668f5 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 9 Feb 2025 07:10:05 +0100 Subject: [PATCH] Small code cleanup. --- app/Handlers/Observer/AccountObserver.php | 1 + app/Handlers/Observer/TransactionJournalObserver.php | 1 + app/Support/Search/QueryParser/Node.php | 2 ++ app/Support/Twig/AmountFormat.php | 2 +- 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Handlers/Observer/AccountObserver.php b/app/Handlers/Observer/AccountObserver.php index 6adbe9fcd6..b9f6156c86 100644 --- a/app/Handlers/Observer/AccountObserver.php +++ b/app/Handlers/Observer/AccountObserver.php @@ -82,6 +82,7 @@ class AccountObserver foreach ($account->piggyBanks()->get() as $piggy) { $piggy->accounts()->detach($account); } + /** @var Attachment $attachment */ foreach ($account->attachments()->get() as $attachment) { $repository->destroy($attachment); diff --git a/app/Handlers/Observer/TransactionJournalObserver.php b/app/Handlers/Observer/TransactionJournalObserver.php index adaed2b902..cb4bea3d4c 100644 --- a/app/Handlers/Observer/TransactionJournalObserver.php +++ b/app/Handlers/Observer/TransactionJournalObserver.php @@ -46,6 +46,7 @@ class TransactionJournalObserver $transaction->delete(); } }); + /** @var Attachment $attachment */ foreach ($transactionJournal->attachments()->get() as $attachment) { $repository->destroy($attachment); diff --git a/app/Support/Search/QueryParser/Node.php b/app/Support/Search/QueryParser/Node.php index e00f513585..f13331965c 100644 --- a/app/Support/Search/QueryParser/Node.php +++ b/app/Support/Search/QueryParser/Node.php @@ -66,6 +66,7 @@ abstract class Node if ($compare instanceof NodeGroup && $this instanceof NodeGroup) { if (count($compare->getNodes()) !== count($this->getNodes())) { Log::debug(sprintf('Return false because node count is different. Original is %d, compare is %d', count($this->getNodes()), count($compare->getNodes()))); + return false; } @@ -76,6 +77,7 @@ abstract class Node foreach ($this->getNodes() as $index => $node) { if (false === $node->equals($compare->getNodes()[$index])) { Log::debug('Return false because nodes are different!'); + return false; } } diff --git a/app/Support/Twig/AmountFormat.php b/app/Support/Twig/AmountFormat.php index 62a5694f87..9a70e1da0f 100644 --- a/app/Support/Twig/AmountFormat.php +++ b/app/Support/Twig/AmountFormat.php @@ -114,7 +114,7 @@ class AmountFormat extends AbstractExtension static function (string $amount, string $code, ?bool $coloured = null): string { $coloured ??= true; - /** @var TransactionCurrency|null $currency */ + /** @var null|TransactionCurrency $currency */ $currency = TransactionCurrency::whereCode($code)->first(); if (null === $currency) { Log::error(sprintf('Could not find currency with code "%s". Fallback to native currency.', $code));