Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Various code cleanup
James Cole07e4e93632d5
diff --git a/app/Api/V1/Controllers/Models/TransactionCurrency/DestroyController.php b/app/Api/V1/Controllers/Models/TransactionCurrency/DestroyController.phpindex f92e69d1cd..3b16508dd5 100644--- a/app/Api/V1/Controllers/Models/TransactionCurrency/DestroyController.php+++ b/app/Api/V1/Controllers/Models/TransactionCurrency/DestroyController.php@@ -28,7 +28,6 @@ use FireflyIII\Api\V1\Controllers\Controller;use FireflyIII\Exceptions\FireflyException;use FireflyIII\Models\TransactionCurrency;use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;-use FireflyIII\Repositories\User\UserRepositoryInterface;use FireflyIII\User;use Illuminate\Http\JsonResponse;@@ -38,7 +37,6 @@ use Illuminate\Http\JsonResponse;class DestroyController extends Controller{private CurrencyRepositoryInterface $repository;- private UserRepositoryInterface $userRepository;/*** CurrencyRepository constructor.@@ -50,8 +48,7 @@ class DestroyController extends Controllerparent::__construct();$this->middleware(function ($request, $next) {- $this->repository = app(CurrencyRepositoryInterface::class);- $this->userRepository = app(UserRepositoryInterface::class);+ $this->repository = app(CurrencyRepositoryInterface::class);$this->repository->setUser(auth()->user());return $next($request);diff --git a/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php b/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.phpindex 3f9433022a..fbe18135eb 100644--- a/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php+++ b/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php@@ -67,8 +67,6 @@ class ListController extends Controlleruse TransactionFilter;private CurrencyRepositoryInterface $repository;- private UserRepositoryInterface $userRepository;-/*** CurrencyRepository constructor.*@@ -80,7 +78,6 @@ class ListController extends Controller$this->middleware(function ($request, $next) {$this->repository = app(CurrencyRepositoryInterface::class);- $this->userRepository = app(UserRepositoryInterface::class);$this->repository->setUser(auth()->user());return $next($request);diff --git a/app/Api/V1/Controllers/Models/TransactionCurrency/StoreController.php b/app/Api/V1/Controllers/Models/TransactionCurrency/StoreController.phpindex ec9ab9fec4..04f1489512 100644--- a/app/Api/V1/Controllers/Models/TransactionCurrency/StoreController.php+++ b/app/Api/V1/Controllers/Models/TransactionCurrency/StoreController.php@@ -28,7 +28,6 @@ use FireflyIII\Api\V1\Controllers\Controller;use FireflyIII\Api\V1\Requests\Models\TransactionCurrency\StoreRequest;use FireflyIII\Exceptions\FireflyException;use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;-use FireflyIII\Repositories\User\UserRepositoryInterface;use FireflyIII\Support\Http\Api\AccountFilter;use FireflyIII\Support\Http\Api\TransactionFilter;use FireflyIII\Transformers\CurrencyTransformer;@@ -45,7 +44,6 @@ class StoreController extends Controlleruse TransactionFilter;private CurrencyRepositoryInterface $repository;- private UserRepositoryInterface $userRepository;/*** CurrencyRepository constructor.@@ -57,8 +55,7 @@ class StoreController extends Controllerparent::__construct();$this->middleware(function ($request, $next) {- $this->repository = app(CurrencyRepositoryInterface::class);- $this->userRepository = app(UserRepositoryInterface::class);+ $this->repository = app(CurrencyRepositoryInterface::class);$this->repository->setUser(auth()->user());return $next($request);diff --git a/app/Api/V1/Controllers/Models/TransactionCurrency/UpdateController.php b/app/Api/V1/Controllers/Models/TransactionCurrency/UpdateController.phpindex afef552d25..8ab744ea78 100644--- a/app/Api/V1/Controllers/Models/TransactionCurrency/UpdateController.php+++ b/app/Api/V1/Controllers/Models/TransactionCurrency/UpdateController.php@@ -46,7 +46,6 @@ class UpdateController extends Controlleruse TransactionFilter;private CurrencyRepositoryInterface $repository;- private UserRepositoryInterface $userRepository;/*** CurrencyRepository constructor.@@ -58,8 +57,7 @@ class UpdateController extends Controllerparent::__construct();$this->middleware(function ($request, $next) {- $this->repository = app(CurrencyRepositoryInterface::class);- $this->userRepository = app(UserRepositoryInterface::class);+ $this->repository = app(CurrencyRepositoryInterface::class);$this->repository->setUser(auth()->user());return $next($request);diff --git a/app/Api/V1/Controllers/Models/TransactionLinkType/ListController.php b/app/Api/V1/Controllers/Models/TransactionLinkType/ListController.phpindex 3a2a98e750..52cad81493 100644--- a/app/Api/V1/Controllers/Models/TransactionLinkType/ListController.php+++ b/app/Api/V1/Controllers/Models/TransactionLinkType/ListController.php@@ -46,7 +46,6 @@ class ListController extends Controlleruse TransactionFilter;private LinkTypeRepositoryInterface $repository;- private UserRepositoryInterface $userRepository;/*** LinkTypeController constructor.@@ -61,7 +60,6 @@ class ListController extends Controller/** @var User $user */$user = auth()->user();$this->repository = app(LinkTypeRepositoryInterface::class);- $this->userRepository = app(UserRepositoryInterface::class);$this->repository->setUser($user);return $next($request);diff --git a/app/Api/V1/Controllers/Models/TransactionLinkType/ShowController.php b/app/Api/V1/Controllers/Models/TransactionLinkType/ShowController.phpindex f0020cce37..181e1a2962 100644--- a/app/Api/V1/Controllers/Models/TransactionLinkType/ShowController.php+++ b/app/Api/V1/Controllers/Models/TransactionLinkType/ShowController.php@@ -46,7 +46,6 @@ class ShowController extends Controlleruse TransactionFilter;private LinkTypeRepositoryInterface $repository;- private UserRepositoryInterface $userRepository;/*** LinkTypeController constructor.@@ -61,7 +60,6 @@ class ShowController extends Controller/** @var User $user */$user = auth()->user();$this->repository = app(LinkTypeRepositoryInterface::class);- $this->userRepository = app(UserRepositoryInterface::class);$this->repository->setUser($user);return $next($request);diff --git a/app/Api/V1/Requests/System/UserUpdateRequest.php b/app/Api/V1/Requests/System/UserUpdateRequest.phpindex bef66149fd..a6a6292543 100644--- a/app/Api/V1/Requests/System/UserUpdateRequest.php+++ b/app/Api/V1/Requests/System/UserUpdateRequest.php@@ -96,7 +96,7 @@ class UserUpdateRequest extends FormRequest*/public function withValidator(Validator $validator): void{- /** @var User $current */+ /** @var User|null $current */$current = $this->route()->parameter('user');$validator->after(static function (Validator $validator) use ($current) {diff --git a/app/Api/V2/Controllers/NetWorthController.php b/app/Api/V2/Controllers/NetWorthController.phpindex ec46198fb4..f4e1730be0 100644--- a/app/Api/V2/Controllers/NetWorthController.php+++ b/app/Api/V2/Controllers/NetWorthController.php@@ -38,7 +38,6 @@ class NetWorthController extends Controlleruse ConvertsExchangeRates;private NetWorthInterface $netWorth;- private AccountRepositoryInterface $repository;/***@@ -48,7 +47,6 @@ class NetWorthController extends Controllerparent::__construct();$this->middleware(function ($request, $next) {- $this->repository = app(AccountRepositoryInterface::class);$this->netWorth = app(NetWorthInterface::class);$this->netWorth->setUser(auth()->user());return $next($request);diff --git a/app/Console/Commands/Correction/DeleteOrphanedTransactions.php b/app/Console/Commands/Correction/DeleteOrphanedTransactions.phpindex 3ddd7e1a7d..1b2ab74827 100644--- a/app/Console/Commands/Correction/DeleteOrphanedTransactions.php+++ b/app/Console/Commands/Correction/DeleteOrphanedTransactions.php@@ -146,11 +146,7 @@ class DeleteOrphanedTransactions extends Command// delete journals$journal = TransactionJournal::find((int)$transaction->transaction_journal_id);if ($journal) {- try {- $journal->delete();- } catch (QueryException $e) {- Log::info(sprintf('Could not delete journal %s', $e->getMessage()));- }+ $journal->delete();}Transaction::where('transaction_journal_id', (int)$transaction->transaction_journal_id)->delete();$this->line(diff --git a/app/Console/Commands/Correction/DeleteZeroAmount.php b/app/Console/Commands/Correction/DeleteZeroAmount.phpindex d4550e0949..5a7fabbd39 100644--- a/app/Console/Commands/Correction/DeleteZeroAmount.php+++ b/app/Console/Commands/Correction/DeleteZeroAmount.php@@ -60,11 +60,7 @@ class DeleteZeroAmount extends Command/** @var TransactionJournal $journal */foreach ($journals as $journal) {$this->info(sprintf('Deleted transaction journal #%d because the amount is zero (0.00).', $journal->id));- try {- $journal->delete();- } catch (QueryException $e) {- $this->line($e->getMessage());- }+ $journal->delete();Transaction::where('transaction_journal_id', $journal->id)->delete();}diff --git a/app/Console/Commands/Correction/FixPiggies.php b/app/Console/Commands/Correction/FixPiggies.phpindex 13e64be2bf..8d2bca27c0 100644--- a/app/Console/Commands/Correction/FixPiggies.php+++ b/app/Console/Commands/Correction/FixPiggies.php@@ -64,7 +64,7 @@ class FixPiggies extends Commandif (null === $event->transaction_journal_id) {continue;}- /** @var TransactionJournal $journal */+ /** @var TransactionJournal|null $journal */$journal = $event->transactionJournal;if (null === $journal) {diff --git a/app/Console/Commands/Correction/FixTransactionTypes.php b/app/Console/Commands/Correction/FixTransactionTypes.phpindex fa9c0c7b6f..9f461813b1 100644--- a/app/Console/Commands/Correction/FixTransactionTypes.php+++ b/app/Console/Commands/Correction/FixTransactionTypes.php@@ -146,6 +146,7 @@ class FixTransactionTypes extends Command}/** @var Transaction $transaction */$transaction = $collection->first();+ /** @var Account|null $account */$account = $transaction->account;if (null === $account) {throw new FireflyException(sprintf('Journal #%d, transaction #%d has no source account.', $journal->id, $transaction->id));@@ -175,6 +176,7 @@ class FixTransactionTypes extends Command}/** @var Transaction $transaction */$transaction = $collection->first();+ /** @var Account|null $account */$account = $transaction->account;if (null === $account) {throw new FireflyException(sprintf('Journal #%d, transaction #%d has no destination account.', $journal->id, $transaction->id));diff --git a/app/Console/Commands/Correction/FixUnevenAmount.php b/app/Console/Commands/Correction/FixUnevenAmount.phpindex 3abf92c9a5..7013a3fd4d 100644--- a/app/Console/Commands/Correction/FixUnevenAmount.php+++ b/app/Console/Commands/Correction/FixUnevenAmount.php@@ -93,7 +93,7 @@ class FixUnevenAmount extends Commandif (!$journal) {return;}- /** @var Transaction $source */+ /** @var Transaction|null $source */$source = $journal->transactions()->where('amount', '<', 0)->first();if (null === $source) {@@ -113,7 +113,7 @@ class FixUnevenAmount extends Command$amount = bcmul('-1', (string)$source->amount);// fix amount of destination:- /** @var Transaction $destination */+ /** @var Transaction|null $destination */$destination = $journal->transactions()->where('amount', '>', 0)->first();if (null === $destination) {diff --git a/app/Console/Commands/Correction/RemoveBills.php b/app/Console/Commands/Correction/RemoveBills.phpindex f4f2d0d1a4..4e4d6fc12c 100644--- a/app/Console/Commands/Correction/RemoveBills.php+++ b/app/Console/Commands/Correction/RemoveBills.php@@ -53,7 +53,7 @@ class RemoveBills extends Commandpublic function handle(): int{$start = microtime(true);- /** @var TransactionType $withdrawal */+ /** @var TransactionType|null $withdrawal */$withdrawal = TransactionType::where('type', TransactionType::WITHDRAWAL)->first();if (null === $withdrawal) {return 0;diff --git a/app/Console/Commands/Upgrade/BackToJournals.php b/app/Console/Commands/Upgrade/BackToJournals.phpindex 7f280c839c..e0a8454410 100644--- a/app/Console/Commands/Upgrade/BackToJournals.php+++ b/app/Console/Commands/Upgrade/BackToJournals.php@@ -163,16 +163,16 @@ class BackToJournals extends Commandprivate function migrateBudgetsForJournal(TransactionJournal $journal): void{// grab category from first transaction- /** @var Transaction $transaction */+ /** @var Transaction|null $transaction */$transaction = $journal->transactions->first();if (null === $transaction) {$this->info(sprintf('Transaction journal #%d has no transactions. Will be fixed later.', $journal->id));return;}- /** @var Budget $budget */+ /** @var Budget|null $budget */$budget = $transaction->budgets->first();- /** @var Budget $journalBudget */+ /** @var Budget|null $journalBudget */$journalBudget = $journal->budgets->first();// both have a budget, but they don't match.@@ -239,16 +239,16 @@ class BackToJournals extends Commandprivate function migrateCategoriesForJournal(TransactionJournal $journal): void{// grab category from first transaction- /** @var Transaction $transaction */+ /** @var Transaction|null $transaction */$transaction = $journal->transactions->first();if (null === $transaction) {$this->info(sprintf('Transaction journal #%d has no transactions. Will be fixed later.', $journal->id));return;}- /** @var Category $category */+ /** @var Category|null $category */$category = $transaction->categories->first();- /** @var Category $journalCategory */+ /** @var Category|null $journalCategory */$journalCategory = $journal->categories->first();// both have a category, but they don't match.diff --git a/app/Console/Commands/Upgrade/CreateGroupMemberships.php b/app/Console/Commands/Upgrade/CreateGroupMemberships.phpindex e6e33a37a0..16d58a928d 100644--- a/app/Console/Commands/Upgrade/CreateGroupMemberships.php+++ b/app/Console/Commands/Upgrade/CreateGroupMemberships.php@@ -134,6 +134,7 @@ class CreateGroupMemberships extends Commandthrow new FireflyException('Firefly III could not find a user role. Please make sure all validations have run.');}+ /** @var GroupMembership|null $membership */$membership = GroupMembership::create(['user_id' => $user->id,diff --git a/app/Console/Commands/Upgrade/MigrateJournalNotes.php b/app/Console/Commands/Upgrade/MigrateJournalNotes.phpindex 0e578daf50..96b92b349b 100644--- a/app/Console/Commands/Upgrade/MigrateJournalNotes.php+++ b/app/Console/Commands/Upgrade/MigrateJournalNotes.php@@ -81,11 +81,7 @@ class MigrateJournalNotes extends Command$note->text = $meta->data;$note->save();Log::debug(sprintf('Migrated meta note #%d to Note #%d', $meta->id, $note->id));- try {- $meta->delete();- } catch (QueryException $e) {- Log::error(sprintf('Could not delete old meta entry #%d: %s', $meta->id, $e->getMessage()));- }+ $meta->delete();$count++;}diff --git a/app/Console/Commands/Upgrade/MigrateRecurrenceMeta.php b/app/Console/Commands/Upgrade/MigrateRecurrenceMeta.phpindex 1e1b25dd4f..267f93ec5f 100644--- a/app/Console/Commands/Upgrade/MigrateRecurrenceMeta.php+++ b/app/Console/Commands/Upgrade/MigrateRecurrenceMeta.php@@ -25,6 +25,7 @@ declare(strict_types=1);namespace FireflyIII\Console\Commands\Upgrade;use FireflyIII\Exceptions\FireflyException;+use FireflyIII\Models\Recurrence;use FireflyIII\Models\RecurrenceMeta;use FireflyIII\Models\RecurrenceTransactionMeta;use Illuminate\Console\Command;@@ -124,6 +125,7 @@ class MigrateRecurrenceMeta extends Command*/private function migrateEntry(RecurrenceMeta $meta): int{+ /** @var Recurrence|null $recurrence */$recurrence = $meta->recurrence;if (null === $recurrence) {return 0;diff --git a/app/Console/Commands/Upgrade/MigrateToGroups.php b/app/Console/Commands/Upgrade/MigrateToGroups.phpindex ca183bb25b..2266b06b96 100644--- a/app/Console/Commands/Upgrade/MigrateToGroups.php+++ b/app/Console/Commands/Upgrade/MigrateToGroups.php@@ -351,7 +351,7 @@ class MigrateToGroups extends CommandLog::debug('Now in getTransactionBudget()');// try to get a budget ID from the left transaction:- /** @var Budget $budget */+ /** @var Budget|null $budget */$budget = $left->budgets()->first();if (null !== $budget) {Log::debug(sprintf('Return budget #%d, from transaction #%d', $budget->id, $left->id));@@ -360,7 +360,7 @@ class MigrateToGroups extends Command}// try to get a budget ID from the right transaction:- /** @var Budget $budget */+ /** @var Budget|null $budget */$budget = $right->budgets()->first();if (null !== $budget) {Log::debug(sprintf('Return budget #%d, from transaction #%d', $budget->id, $right->id));@@ -384,7 +384,7 @@ class MigrateToGroups extends CommandLog::debug('Now in getTransactionCategory()');// try to get a category ID from the left transaction:- /** @var Category $category */+ /** @var Category|null $category */$category = $left->categories()->first();if (null !== $category) {Log::debug(sprintf('Return category #%d, from transaction #%d', $category->id, $left->id));@@ -393,7 +393,7 @@ class MigrateToGroups extends Command}// try to get a category ID from the left transaction:- /** @var Category $category */+ /** @var Category|null $category */$category = $right->categories()->first();if (null !== $category) {Log::debug(sprintf('Return category #%d, from transaction #%d', $category->id, $category->id));diff --git a/app/Console/Commands/Upgrade/TransactionIdentifier.php b/app/Console/Commands/Upgrade/TransactionIdentifier.phpindex 9a27dafc74..bb04bb7bb1 100644--- a/app/Console/Commands/Upgrade/TransactionIdentifier.php+++ b/app/Console/Commands/Upgrade/TransactionIdentifier.php@@ -57,8 +57,6 @@ class TransactionIdentifier extends Commandprivate $cliRepository;/** @var int */private $count;- /** @var JournalRepositoryInterface */- private $journalRepository;/*** This method gives all transactions which are part of a split journal (so more than 2) a sort of "order" so they are easier@@ -117,7 +115,6 @@ class TransactionIdentifier extends Command*/private function stupidLaravel(): void{- $this->journalRepository = app(JournalRepositoryInterface::class);$this->cliRepository = app(JournalCLIRepositoryInterface::class);$this->count = 0;}diff --git a/app/Events/DestroyedTransactionLink.php b/app/Events/DestroyedTransactionLink.phpindex 90a19e07e0..b795515e72 100644--- a/app/Events/DestroyedTransactionLink.php+++ b/app/Events/DestroyedTransactionLink.php@@ -33,7 +33,7 @@ class DestroyedTransactionLink extends Event{use SerializesModels;- private TransactionJournalLink $link;+ private TransactionJournalLink $link; /// @phpstan-ignore-line PHPStan thinks this property is never read./*** DestroyedTransactionLink constructor.diff --git a/app/Exceptions/GracefulNotFoundHandler.php b/app/Exceptions/GracefulNotFoundHandler.phpindex b44ea5981e..7b444427e2 100644--- a/app/Exceptions/GracefulNotFoundHandler.php+++ b/app/Exceptions/GracefulNotFoundHandler.php@@ -138,7 +138,7 @@ class GracefulNotFoundHandler extends ExceptionHandler* @param Request $request* @param Throwable $exception*- * @return Redirector|Response+ * @return Response* @throws Throwable*/private function handleAccount(Request $request, Throwable $exception)@@ -154,7 +154,7 @@ class GracefulNotFoundHandler extends ExceptionHandlerif (!($param instanceof Account)) {$accountId = (int)$param;}- /** @var Account $account */+ /** @var Account|null $account */$account = $user->accounts()->with(['accountType'])->withTrashed()->find($accountId);if (null === $account) {Log::error(sprintf('Could not find account %d, so give big fat error.', $accountId));@@ -172,7 +172,7 @@ class GracefulNotFoundHandler extends ExceptionHandler* @param Request $request* @param Throwable $exception*- * @return RedirectResponse|\Illuminate\Http\Response|Redirector|Response+ * @return Response* @throws Throwable*/private function handleGroup(Request $request, Throwable $exception)@@ -183,14 +183,14 @@ class GracefulNotFoundHandler extends ExceptionHandler$route = $request->route();$groupId = (int)$route->parameter('transactionGroup');- /** @var TransactionGroup $group */+ /** @var TransactionGroup|null $group */$group = $user->transactionGroups()->withTrashed()->find($groupId);if (null === $group) {Log::error(sprintf('Could not find group %d, so give big fat error.', $groupId));return parent::render($request, $exception);}- /** @var TransactionJournal $journal */+ /** @var TransactionJournal|null $journal */$journal = $group->transactionJournals()->withTrashed()->first();if (null === $journal) {Log::error(sprintf('Could not find journal for group %d, so give big fat error.', $groupId));@@ -211,7 +211,7 @@ class GracefulNotFoundHandler extends ExceptionHandler* @param Request $request* @param Throwable $exception*- * @return RedirectResponse|Redirector|Response+ * @return Response* @throws Throwable*/private function handleAttachment(Request $request, Throwable $exception)diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.phpindex 54e7ae0d7f..98ee8323bd 100644--- a/app/Exceptions/Handler.php+++ b/app/Exceptions/Handler.php@@ -177,10 +177,7 @@ class Handler extends ExceptionHandler$userData['email'] = auth()->user()->email;}- $headers = [];- if (request()->headers) {- $headers = request()->headers->all();- }+ $headers = request()->headers->all();$data = ['class' => get_class($e),diff --git a/app/Factory/AccountMetaFactory.php b/app/Factory/AccountMetaFactory.phpindex 1312b6670e..1a927edb24 100644--- a/app/Factory/AccountMetaFactory.php+++ b/app/Factory/AccountMetaFactory.php@@ -26,7 +26,6 @@ namespace FireflyIII\Factory;use FireflyIII\Models\Account;use FireflyIII\Models\AccountMeta;-use Illuminate\Database\QueryException;use Log;/**@@ -45,7 +44,7 @@ class AccountMetaFactory*/public function crud(Account $account, string $field, string $value): ?AccountMeta{- /** @var AccountMeta $entry */+ /** @var AccountMeta|null $entry */$entry = $account->accountMeta()->where('name', $field)->first();// must not be an empty string:if ('' !== $value) {@@ -62,11 +61,7 @@ class AccountMetaFactoryLog::debug(sprintf('Updated meta-field "%s":"%s" for #%d ("%s") ', $field, $value, $account->id, $account->name));}if ('' === $value && null !== $entry) {- try {- $entry->delete();- } catch (QueryException $e) {- Log::debug(sprintf('Could not delete entry: %s', $e->getMessage()));- }+ $entry->delete();return null;}diff --git a/app/Factory/AttachmentFactory.php b/app/Factory/AttachmentFactory.phpindex 26c8415f99..54402dde9d 100644--- a/app/Factory/AttachmentFactory.php+++ b/app/Factory/AttachmentFactory.php@@ -51,7 +51,7 @@ class AttachmentFactory// get journal instead of transaction.if (Transaction::class === $model) {- /** @var Transaction $transaction */+ /** @var Transaction|null $transaction */$transaction = $this->user->transactions()->find((int)$data['attachable_id']);if (null === $transaction) {throw new FireflyException('Unexpectedly could not find transaction');diff --git a/app/Factory/TagFactory.php b/app/Factory/TagFactory.phpindex c8533cf28b..b7dab2d4a3 100644--- a/app/Factory/TagFactory.php+++ b/app/Factory/TagFactory.php@@ -45,7 +45,7 @@ class TagFactory$tag = trim($tag);Log::debug(sprintf('Now in TagFactory::findOrCreate("%s")', $tag));- /** @var Tag $dbTag */+ /** @var Tag|null $dbTag */$dbTag = $this->user->tags()->where('tag', $tag)->first();if (null !== $dbTag) {Log::debug(sprintf('Tag exists (#%d), return it.', $dbTag->id));diff --git a/app/Factory/TransactionFactory.php b/app/Factory/TransactionFactory.phpindex 915fe6ec8f..40e9e9d27b 100644--- a/app/Factory/TransactionFactory.php+++ b/app/Factory/TransactionFactory.php@@ -43,7 +43,6 @@ class TransactionFactoryprivate ?TransactionCurrency $foreignCurrency;private TransactionJournal $journal;private bool $reconciled;- private User $user;/*** Constructor.@@ -85,7 +84,6 @@ class TransactionFactory*/private function create(string $amount, ?string $foreignAmount): Transaction{- $result = null;if ('' === $foreignAmount) {$foreignAmount = null;}@@ -101,6 +99,7 @@ class TransactionFactory'identifier' => 0,];try {+ /** @var Transaction|null $result */$result = Transaction::create($data);} catch (QueryException $e) {Log::error(sprintf('Could not create transaction: %s', $e->getMessage()), $data);@@ -112,25 +111,23 @@ class TransactionFactorythrow new FireflyException('Transaction is NULL.');}- if (null !== $result) {- Log::debug(- sprintf(- 'Created transaction #%d (%s %s, account %s), part of journal #%d',- $result->id,- $this->currency->code,- $amount,- $this->account->name,- $this->journal->id- )- );-- // do foreign currency thing: add foreign currency info to $one and $two if necessary.- if (null !== $this->foreignCurrency && null !== $foreignAmount && $this->foreignCurrency->id !== $this->currency->id && '' !== $foreignAmount) {- $result->foreign_currency_id = $this->foreignCurrency->id;- $result->foreign_amount = $foreignAmount;- }- $result->save();+ Log::debug(+ sprintf(+ 'Created transaction #%d (%s %s, account %s), part of journal #%d',+ $result->id,+ $this->currency->code,+ $amount,+ $this->account->name,+ $this->journal->id+ )+ );++ // do foreign currency thing: add foreign currency info to $one and $two if necessary.+ if (null !== $this->foreignCurrency && null !== $foreignAmount && $this->foreignCurrency->id !== $this->currency->id && '' !== $foreignAmount) {+ $result->foreign_currency_id = $this->foreignCurrency->id;+ $result->foreign_amount = $foreignAmount;}+ $result->save();return $result;}@@ -213,6 +210,6 @@ class TransactionFactory*/public function setUser(User $user): void{- $this->user = $user;+ // empty function.}}diff --git a/app/Factory/TransactionJournalFactory.php b/app/Factory/TransactionJournalFactory.phpindex b006be8bd8..3ac8ba5503 100644--- a/app/Factory/TransactionJournalFactory.php+++ b/app/Factory/TransactionJournalFactory.php@@ -28,6 +28,7 @@ use Exception;use FireflyIII\Exceptions\DuplicateTransactionException;use FireflyIII\Exceptions\FireflyException;use FireflyIII\Models\Account;+use FireflyIII\Models\Preference;use FireflyIII\Models\Transaction;use FireflyIII\Models\TransactionCurrency;use FireflyIII\Models\TransactionJournal;@@ -45,7 +46,6 @@ use FireflyIII\Services\Internal\Support\JournalServiceTrait;use FireflyIII\Support\NullArrayObject;use FireflyIII\User;use FireflyIII\Validation\AccountValidator;-use Illuminate\Database\QueryException;use Illuminate\Support\Collection;use JsonException;use Log;@@ -312,10 +312,6 @@ class TransactionJournalFactoryunset($dataRow['import_hash_v2'], $dataRow['original_source']);$json = json_encode($dataRow, JSON_THROW_ON_ERROR);- if (false === $json) {- $json = json_encode((string)microtime(), JSON_THROW_ON_ERROR);- Log::error(sprintf('Could not hash the original row! %s', json_last_error_msg()), $dataRow);- }$hash = hash('sha256', $json);Log::debug(sprintf('The hash is: %s', $hash), $dataRow);@@ -336,15 +332,12 @@ class TransactionJournalFactoryif (false === $this->errorOnHash) {return;}- $result = null;- if ($this->errorOnHash) {- Log::debug('Will verify duplicate!');- /** @var TransactionJournalMeta $result */- $result = TransactionJournalMeta::withTrashed()- ->where('data', json_encode($hash, JSON_THROW_ON_ERROR))- ->with(['transactionJournal', 'transactionJournal.transactionGroup'])- ->first();- }+ Log::debug('Will verify duplicate!');+ /** @var TransactionJournalMeta|null $result */+ $result = TransactionJournalMeta::withTrashed()+ ->where('data', json_encode($hash, JSON_THROW_ON_ERROR))+ ->with(['transactionJournal', 'transactionJournal.transactionGroup'])+ ->first();if (null !== $result) {app('log')->warning(sprintf('Found a duplicate in errorIfDuplicate because hash %s is not unique!', $hash));$journal = $result->transactionJournal()->withTrashed()->first();@@ -474,6 +467,7 @@ class TransactionJournalFactoryprivate function getCurrency(?TransactionCurrency $currency, Account $account): TransactionCurrency{Log::debug('Now in getCurrency()');+ /** @var Preference|null $preference */$preference = $this->accountRepository->getAccountCurrency($account);if (null === $preference && null === $currency) {// return user's default:@@ -555,13 +549,7 @@ class TransactionJournalFactory*/private function forceTrDelete(Transaction $transaction): void{- try {- $transaction->delete();- } catch (QueryException $e) {- Log::error($e->getMessage());- Log::error($e->getTraceAsString());- Log::error('Could not delete negative transaction.');- }+ $transaction->delete();}/**diff --git a/app/Factory/TransactionJournalMetaFactory.php b/app/Factory/TransactionJournalMetaFactory.phpindex b77e0d4566..c22da98f58 100644--- a/app/Factory/TransactionJournalMetaFactory.php+++ b/app/Factory/TransactionJournalMetaFactory.php@@ -42,15 +42,11 @@ class TransactionJournalMetaFactory{//Log::debug('In updateOrCreate()');$value = $data['data'];- /** @var TransactionJournalMeta $entry */+ /** @var TransactionJournalMeta|null $entry */$entry = $data['journal']->transactionJournalMeta()->where('name', $data['name'])->first();if (null === $value && null !== $entry) {//Log::debug('Value is empty, delete meta value.');- try {- $entry->delete();- } catch (QueryException $e) {- Log::error(sprintf('Could not delete transaction journal meta: %s', $e->getMessage()));- }+ $entry->delete();return null;}@@ -64,11 +60,7 @@ class TransactionJournalMetaFactory// don't store blank strings.if (null !== $entry) {Log::debug('Will not store empty strings, delete meta value');- try {- $entry->delete();- } catch (QueryException $e) {- Log::error(sprintf('Could not delete transaction journal meta: %s', $e->getMessage()));- }+ $entry->delete();}return null;diff --git a/app/Generator/Report/Tag/MonthReportGenerator.php b/app/Generator/Report/Tag/MonthReportGenerator.phpindex c95f550c52..bc974e2943 100644--- a/app/Generator/Report/Tag/MonthReportGenerator.php+++ b/app/Generator/Report/Tag/MonthReportGenerator.php@@ -39,8 +39,6 @@ class MonthReportGenerator implements ReportGeneratorInterface{private Collection $accounts;private Carbon $end;- private array $expenses;- private array $income;private Carbon $start;private Collection $tags;@@ -49,8 +47,6 @@ class MonthReportGenerator implements ReportGeneratorInterface*/public function __construct(){- $this->expenses = [];- $this->income = [];$this->tags = new Collection();$this->accounts = new Collection();}diff --git a/app/Handlers/Events/BillEventHandler.php b/app/Handlers/Events/BillEventHandler.phpindex 802eec7e36..48b9e7c306 100644--- a/app/Handlers/Events/BillEventHandler.php+++ b/app/Handlers/Events/BillEventHandler.php@@ -44,6 +44,7 @@ class BillEventHandlerLog::debug(sprintf('Now in %s', __METHOD__));$bill = $event->bill;+ /** @var bool $preference */$preference = Preferences::getForUser($bill->user, 'notification_bill_reminder', true)->data;if (true === $preference) {diff --git a/app/Handlers/Events/UpdatedGroupEventHandler.php b/app/Handlers/Events/UpdatedGroupEventHandler.phpindex d3dd7b98d9..af1882d7b0 100644--- a/app/Handlers/Events/UpdatedGroupEventHandler.php+++ b/app/Handlers/Events/UpdatedGroupEventHandler.php@@ -125,7 +125,7 @@ class UpdatedGroupEventHandlerreturn;}// first journal:- /** @var TransactionJournal $first */+ /** @var TransactionJournal|null $first */$first = $group->transactionJournals()->orderBy('transaction_journals.date', 'DESC')->orderBy('transaction_journals.order', 'ASC')diff --git a/app/Handlers/Events/UserEventHandler.php b/app/Handlers/Events/UserEventHandler.phpindex 224eb935c6..2c23b85cdc 100644--- a/app/Handlers/Events/UserEventHandler.php+++ b/app/Handlers/Events/UserEventHandler.php@@ -143,7 +143,7 @@ class UserEventHandlerthrow new FireflyException('Email address can no longer be used for registrations.');}}- /** @var UserRole $role */+ /** @var UserRole|null $role */$role = UserRole::where('title', UserRole::OWNER)->first();if (null === $role) {throw new FireflyException('The user role is unexpectedly empty. Did you run all migrations?');@@ -366,6 +366,7 @@ class UserEventHandler];}$preference = array_values($preference);+ /** @var bool $send */$send = app('preferences')->getForUser($user, 'notification_user_login', true)->data;app('preferences')->setForUser($user, 'login_ip_history', $preference);diff --git a/app/Helpers/Collector/Extensions/AttachmentCollection.php b/app/Helpers/Collector/Extensions/AttachmentCollection.phpindex c86bf93209..bc6b36f002 100644--- a/app/Helpers/Collector/Extensions/AttachmentCollection.php+++ b/app/Helpers/Collector/Extensions/AttachmentCollection.php@@ -323,9 +323,9 @@ trait AttachmentCollectionforeach ($object['transactions'] as $transaction) {/** @var array $attachment */foreach ($transaction['attachments'] as $attachment) {- /** @var Attachment $object */+ /** @var Attachment|null $object */$object = auth()->user()->attachments()->find($attachment['id']);- $notes = (string)$object->notes()?->first()?->text;+ $notes = (string)$object?->notes()->first()?->text;return $notes !== '' && $notes === $value;}}@@ -349,9 +349,9 @@ trait AttachmentCollectionforeach ($object['transactions'] as $transaction) {/** @var array $attachment */foreach ($transaction['attachments'] as $attachment) {- /** @var Attachment $object */+ /** @var Attachment|null $object */$object = auth()->user()->attachments()->find($attachment['id']);- $notes = (string)$object->notes()?->first()?->text;+ $notes = (string)$object?->notes()->first()?->text;return $notes !== '' && $notes !== $value;}}@@ -375,9 +375,9 @@ trait AttachmentCollectionforeach ($object['transactions'] as $transaction) {/** @var array $attachment */foreach ($transaction['attachments'] as $attachment) {- /** @var Attachment $object */+ /** @var Attachment|null $object */$object = auth()->user()->attachments()->find($attachment['id']);- $notes = (string)$object->notes()?->first()?->text;+ $notes = (string)$object?->notes()->first()?->text;return $notes !== '' && str_contains(strtolower($notes), strtolower($value));}}@@ -401,9 +401,9 @@ trait AttachmentCollectionforeach ($object['transactions'] as $transaction) {/** @var array $attachment */foreach ($transaction['attachments'] as $attachment) {- /** @var Attachment $object */+ /** @var Attachment|null $object */$object = auth()->user()->attachments()->find($attachment['id']);- $notes = (string)$object->notes()?->first()?->text;+ $notes = (string)$object?->notes()->first()?->text;return $notes !== '' && !str_contains(strtolower($notes), strtolower($value));}}@@ -427,9 +427,9 @@ trait AttachmentCollectionforeach ($object['transactions'] as $transaction) {/** @var array $attachment */foreach ($transaction['attachments'] as $attachment) {- /** @var Attachment $object */+ /** @var Attachment|null $object */$object = auth()->user()->attachments()->find($attachment['id']);- $notes = (string)$object->notes()?->first()?->text;+ $notes = (string)$object?->notes()->first()?->text;return $notes !== '' && !str_ends_with(strtolower($notes), strtolower($value));}}@@ -453,9 +453,9 @@ trait AttachmentCollectionforeach ($object['transactions'] as $transaction) {/** @var array $attachment */foreach ($transaction['attachments'] as $attachment) {- /** @var Attachment $object */+ /** @var Attachment|null $object */$object = auth()->user()->attachments()->find($attachment['id']);- $notes = (string)$object->notes()?->first()?->text;+ $notes = (string)$object?->notes()->first()?->text;return $notes !== '' && !str_starts_with(strtolower($notes), strtolower($value));}}@@ -479,9 +479,9 @@ trait AttachmentCollectionforeach ($object['transactions'] as $transaction) {/** @var array $attachment */foreach ($transaction['attachments'] as $attachment) {- /** @var Attachment $object */+ /** @var Attachment|null $object */$object = auth()->user()->attachments()->find($attachment['id']);- $notes = (string)$object->notes()?->first()?->text;+ $notes = (string)$object?->notes()->first()?->text;return $notes !== '' && str_ends_with(strtolower($notes), strtolower($value));}}@@ -505,9 +505,9 @@ trait AttachmentCollectionforeach ($object['transactions'] as $transaction) {/** @var array $attachment */foreach ($transaction['attachments'] as $attachment) {- /** @var Attachment $object */+ /** @var Attachment|null $object */$object = auth()->user()->attachments()->find($attachment['id']);- $notes = (string)$object->notes()?->first()?->text;+ $notes = (string)$object?->notes()->first()?->text;return $notes !== '' && str_starts_with(strtolower($notes), strtolower($value));}}diff --git a/app/Helpers/Collector/GroupCollector.php b/app/Helpers/Collector/GroupCollector.phpindex 9f2a980dd1..a4fcb71568 100644--- a/app/Helpers/Collector/GroupCollector.php+++ b/app/Helpers/Collector/GroupCollector.php@@ -25,6 +25,7 @@ namespace FireflyIII\Helpers\Collector;use Carbon\Carbon;use Carbon\Exceptions\InvalidDateException;+use Carbon\Exceptions\InvalidFormatException;use Closure;use Exception;use FireflyIII\Exceptions\FireflyException;@@ -602,7 +603,7 @@ class GroupCollector implements GroupCollectorInterface$tagDate = null;try {$tagDate = Carbon::parse($augumentedJournal['tag_date']);- } catch (InvalidDateException $e) {+ } catch (InvalidFormatException $e) {Log::debug(sprintf('Could not parse date: %s', $e->getMessage()));}@@ -682,7 +683,7 @@ class GroupCollector implements GroupCollectorInterface$tagDate = null;try {$tagDate = Carbon::parse($newArray['tag_date']);- } catch (InvalidDateException $e) {+ } catch (InvalidFormatException $e) {Log::debug(sprintf('Could not parse date: %s', $e->getMessage()));}@@ -754,10 +755,7 @@ class GroupCollector implements GroupCollectorInterface$groups[$groudId]['sums'][$currencyId]['currency_decimal_places'] = $transaction['foreign_currency_decimal_places'];$groups[$groudId]['sums'][$currencyId]['amount'] = '0';}- $groups[$groudId]['sums'][$currencyId]['amount'] = bcadd(- $groups[$groudId]['sums'][$currencyId]['amount'],- $transaction['foreign_amount'] ?? '0'- );+ $groups[$groudId]['sums'][$currencyId]['amount'] = bcadd($groups[$groudId]['sums'][$currencyId]['amount'], $transaction['foreign_amount']);}}}diff --git a/app/Http/Controllers/Account/EditController.php b/app/Http/Controllers/Account/EditController.phpindex b84b2851f5..d2a71fb09e 100644--- a/app/Http/Controllers/Account/EditController.php+++ b/app/Http/Controllers/Account/EditController.php@@ -28,7 +28,6 @@ use FireflyIII\Http\Controllers\Controller;use FireflyIII\Http\Requests\AccountFormRequest;use FireflyIII\Models\Account;use FireflyIII\Repositories\Account\AccountRepositoryInterface;-use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;use FireflyIII\Support\Http\Controllers\ModelInformation;use Illuminate\Contracts\View\Factory;use Illuminate\Http\RedirectResponse;@@ -44,9 +43,8 @@ class EditController extends Controller{use ModelInformation;- private AttachmentHelperInterface $attachments;- private CurrencyRepositoryInterface $currencyRepos;- private AccountRepositoryInterface $repository;+ private AttachmentHelperInterface $attachments;+ private AccountRepositoryInterface $repository;/*** EditController constructor.@@ -61,9 +59,8 @@ class EditController extends Controllerapp('view')->share('mainTitleIcon', 'fa-credit-card');app('view')->share('title', (string)trans('firefly.accounts'));- $this->repository = app(AccountRepositoryInterface::class);- $this->currencyRepos = app(CurrencyRepositoryInterface::class);- $this->attachments = app(AttachmentHelperInterface::class);+ $this->repository = app(AccountRepositoryInterface::class);+ $this->attachments = app(AttachmentHelperInterface::class);return $next($request);}diff --git a/app/Http/Controllers/Account/ReconcileController.php b/app/Http/Controllers/Account/ReconcileController.phpindex 8c1d7e40b2..d3ba54baae 100644--- a/app/Http/Controllers/Account/ReconcileController.php+++ b/app/Http/Controllers/Account/ReconcileController.php@@ -33,7 +33,6 @@ use FireflyIII\Models\Account;use FireflyIII\Models\AccountType;use FireflyIII\Models\TransactionType;use FireflyIII\Repositories\Account\AccountRepositoryInterface;-use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;use FireflyIII\Repositories\Journal\JournalRepositoryInterface;use FireflyIII\User;use Illuminate\Contracts\View\Factory;@@ -50,12 +49,8 @@ use Psr\Container\NotFoundExceptionInterface;*/class ReconcileController extends Controller{- /** @var AccountRepositoryInterface The account repository */- private $accountRepos;- /** @var CurrencyRepositoryInterface The currency repository */- private $currencyRepos;- /** @var JournalRepositoryInterface Journals and transactions overview */- private $repository;+ private AccountRepositoryInterface $accountRepos;+ private JournalRepositoryInterface $repository;/*** ReconcileController constructor.@@ -71,9 +66,8 @@ class ReconcileController extends Controllerfunction ($request, $next) {app('view')->share('mainTitleIcon', 'fa-credit-card');app('view')->share('title', (string)trans('firefly.accounts'));- $this->repository = app(JournalRepositoryInterface::class);- $this->accountRepos = app(AccountRepositoryInterface::class);- $this->currencyRepos = app(CurrencyRepositoryInterface::class);+ $this->repository = app(JournalRepositoryInterface::class);+ $this->accountRepos = app(AccountRepositoryInterface::class);return $next($request);}diff --git a/app/Http/Controllers/Account/ShowController.php b/app/Http/Controllers/Account/ShowController.phpindex dcf5c3b3ec..d7c182df7b 100644--- a/app/Http/Controllers/Account/ShowController.php+++ b/app/Http/Controllers/Account/ShowController.php@@ -29,7 +29,6 @@ use FireflyIII\Helpers\Collector\GroupCollectorInterface;use FireflyIII\Http\Controllers\Controller;use FireflyIII\Models\Account;use FireflyIII\Repositories\Account\AccountRepositoryInterface;-use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;use FireflyIII\Support\Http\Controllers\PeriodOverview;use Illuminate\Contracts\View\Factory;use Illuminate\Http\RedirectResponse;@@ -49,8 +48,7 @@ class ShowController extends Controller{use PeriodOverview;- private CurrencyRepositoryInterface $currencyRepos;- private AccountRepositoryInterface $repository;+ private AccountRepositoryInterface $repository;/*** ShowController constructor.@@ -69,8 +67,7 @@ class ShowController extends Controllerapp('view')->share('mainTitleIcon', 'fa-credit-card');app('view')->share('title', (string)trans('firefly.accounts'));- $this->repository = app(AccountRepositoryInterface::class);- $this->currencyRepos = app(CurrencyRepositoryInterface::class);+ $this->repository = app(AccountRepositoryInterface::class);return $next($request);}diff --git a/app/Http/Controllers/Budget/IndexController.php b/app/Http/Controllers/Budget/IndexController.phpindex 35e6072e5e..7f06d75ced 100644--- a/app/Http/Controllers/Budget/IndexController.php+++ b/app/Http/Controllers/Budget/IndexController.php@@ -305,6 +305,10 @@ class IndexController extends Controller}}// final calculation for 'left':+ /**+ * @var int $currencyId+ * @var array $info+ */foreach ($sums['budgeted'] as $currencyId => $info) {$spent = $sums['spent'][$currencyId]['amount'] ?? '0';$budgeted = $sums['budgeted'][$currencyId]['amount'] ?? '0';diff --git a/app/Http/Controllers/Chart/ExpenseReportController.php b/app/Http/Controllers/Chart/ExpenseReportController.phpindex be3a777d5d..09af4994c7 100644--- a/app/Http/Controllers/Chart/ExpenseReportController.php+++ b/app/Http/Controllers/Chart/ExpenseReportController.php@@ -185,6 +185,7 @@ class ExpenseReportController extends Controller// remove all empty entries to prevent cluttering:$newSet = [];foreach ($chartData as $key => $entry) {+ // TODO not sure, this is a bad comparison.if (0 === !array_sum($entry['entries'])) {$newSet[$key] = $entry;}diff --git a/app/Http/Controllers/Chart/PiggyBankController.php b/app/Http/Controllers/Chart/PiggyBankController.phpindex ebdd6cb8f1..7e5c609470 100644--- a/app/Http/Controllers/Chart/PiggyBankController.php+++ b/app/Http/Controllers/Chart/PiggyBankController.php@@ -83,7 +83,7 @@ class PiggyBankController extends Controller// get first event or start date of piggy bank or today$startDate = $piggyBank->startdate ?? today(config('app.timezone'));- /** @var PiggyBankEvent $firstEvent */+ /** @var PiggyBankEvent|null $firstEvent */$firstEvent = $set->first();$firstDate = null === $firstEvent ? new Carbon() : $firstEvent->date;diff --git a/app/Http/Controllers/Json/BudgetController.php b/app/Http/Controllers/Json/BudgetController.phpindex 59ac6fd3a3..2b1475b1ec 100644--- a/app/Http/Controllers/Json/BudgetController.php+++ b/app/Http/Controllers/Json/BudgetController.php@@ -30,8 +30,6 @@ use FireflyIII\Models\TransactionCurrency;use FireflyIII\Repositories\Budget\AvailableBudgetRepositoryInterface;use FireflyIII\Repositories\Budget\BudgetLimitRepositoryInterface;use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;-use FireflyIII\Repositories\Budget\OperationsRepositoryInterface;-use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;use FireflyIII\Support\Http\Controllers\DateCalculation;use Illuminate\Http\JsonResponse;@@ -42,16 +40,9 @@ class BudgetController extends Controller{use DateCalculation;- /** @var AvailableBudgetRepositoryInterface */- private $abRepository;- /** @var BudgetLimitRepositoryInterface */- private $blRepository;- /** @var CurrencyRepositoryInterface */- private $currencyRepository;- /** @var OperationsRepositoryInterface */- private $opsRepository;- /** @var BudgetRepositoryInterface The budget repository */- private $repository;+ private AvailableBudgetRepositoryInterface $abRepository;+ private BudgetLimitRepositoryInterface $blRepository;+ private BudgetRepositoryInterface $repository;/*** IndexController constructor.@@ -66,11 +57,9 @@ class BudgetController extends Controllerfunction ($request, $next) {app('view')->share('title', (string)trans('firefly.budgets'));app('view')->share('mainTitleIcon', 'fa-pie-chart');- $this->repository = app(BudgetRepositoryInterface::class);- $this->opsRepository = app(OperationsRepositoryInterface::class);- $this->abRepository = app(AvailableBudgetRepositoryInterface::class);- $this->currencyRepository = app(CurrencyRepositoryInterface::class);- $this->blRepository = app(BudgetLimitRepositoryInterface::class);+ $this->repository = app(BudgetRepositoryInterface::class);+ $this->abRepository = app(AvailableBudgetRepositoryInterface::class);+ $this->blRepository = app(BudgetLimitRepositoryInterface::class);$this->repository->cleanupBudgets();return $next($request);diff --git a/app/Http/Controllers/Json/ReconcileController.php b/app/Http/Controllers/Json/ReconcileController.phpindex f50ddc4452..562c569474 100644--- a/app/Http/Controllers/Json/ReconcileController.php+++ b/app/Http/Controllers/Json/ReconcileController.php@@ -47,8 +47,6 @@ use Throwable;class ReconcileController extends Controller{private AccountRepositoryInterface $accountRepos;- private CurrencyRepositoryInterface $currencyRepos;- private JournalRepositoryInterface $repository;/*** ReconcileController constructor.@@ -64,9 +62,7 @@ class ReconcileController extends Controllerfunction ($request, $next) {app('view')->share('mainTitleIcon', 'fa-credit-card');app('view')->share('title', (string)trans('firefly.accounts'));- $this->repository = app(JournalRepositoryInterface::class);$this->accountRepos = app(AccountRepositoryInterface::class);- $this->currencyRepos = app(CurrencyRepositoryInterface::class);return $next($request);}diff --git a/app/Http/Controllers/PreferencesController.php b/app/Http/Controllers/PreferencesController.phpindex 05f4b325ef..efab3cc8d3 100644--- a/app/Http/Controllers/PreferencesController.php+++ b/app/Http/Controllers/PreferencesController.php@@ -88,7 +88,7 @@ class PreferencesController extends Controller$role = sprintf('opt_group_l_%s', $type);}- if ('' === $role || 'opt_group_' === $role) {+ if ('opt_group_' === $role) {$role = 'opt_group_defaultAsset';}$groupedAccounts[trans(sprintf('firefly.%s', $role))][$account->id] = $account->name;diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.phpindex 237d6b9de5..7a6a8e171a 100644--- a/app/Http/Controllers/ProfileController.php+++ b/app/Http/Controllers/ProfileController.php@@ -197,9 +197,9 @@ class ProfileController extends Controller** @param Request $request*- * @return Application|RedirectResponse|Redirector+ * @return View|RedirectResponse*/- public function deleteAccount(Request $request): Application|RedirectResponse|Redirector+ public function deleteAccount(Request $request): View|RedirectResponse{if (!$this->internalAuth || !$this->internalIdentity) {$request->session()->flash('error', trans('firefly.external_user_mgt_disabled'));diff --git a/app/Http/Controllers/Report/BudgetController.php b/app/Http/Controllers/Report/BudgetController.phpindex c56139c216..cac91f5608 100644--- a/app/Http/Controllers/Report/BudgetController.php+++ b/app/Http/Controllers/Report/BudgetController.php@@ -28,9 +28,6 @@ use FireflyIII\Exceptions\FireflyException;use FireflyIII\Http\Controllers\Controller;use FireflyIII\Models\Account;use FireflyIII\Models\Budget;-use FireflyIII\Repositories\Budget\BudgetLimitRepositoryInterface;-use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;-use FireflyIII\Repositories\Budget\NoBudgetRepositoryInterface;use FireflyIII\Repositories\Budget\OperationsRepositoryInterface;use FireflyIII\Support\CacheProperties;use FireflyIII\Support\Http\Controllers\BasicDataSupport;@@ -49,10 +46,7 @@ class BudgetController extends Controller{use BasicDataSupport;- private BudgetLimitRepositoryInterface $blRepository;- private NoBudgetRepositoryInterface $nbRepository;- private OperationsRepositoryInterface $opsRepository;- private BudgetRepositoryInterface $repository;+ private OperationsRepositoryInterface $opsRepository;/*** ExpenseReportController constructor.@@ -65,9 +59,6 @@ class BudgetController extends Controller$this->middleware(function ($request, $next) {$this->opsRepository = app(OperationsRepositoryInterface::class);- $this->repository = app(BudgetRepositoryInterface::class);- $this->blRepository = app(BudgetLimitRepositoryInterface::class);- $this->nbRepository = app(NoBudgetRepositoryInterface::class);return $next($request);}diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.phpindex ae8721a359..9607e2e107 100644--- a/app/Http/Controllers/ReportController.php+++ b/app/Http/Controllers/ReportController.php@@ -290,7 +290,7 @@ class ReportController extends Controller$role = sprintf('opt_group_l_%s', $type);}- if ('' === $role || 'opt_group_' === $role) {+ if ('opt_group_' === $role) {$role = 'opt_group_defaultAsset';}$groupedAccounts[trans(sprintf('firefly.%s', $role))][$account->id] = $account;