Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Fix phpstan issues.
James Coleb87b99a755d0
diff --git a/app/Console/Commands/System/ResetsErrorMailLimit.php b/app/Console/Commands/System/ResetsErrorMailLimit.phpindex d24d64a1d1..177e89a434 100644--- a/app/Console/Commands/System/ResetsErrorMailLimit.php+++ b/app/Console/Commands/System/ResetsErrorMailLimit.php@@ -25,6 +25,8 @@ declare(strict_types=1);namespace FireflyIII\Console\Commands\System;+use function Safe\file_put_contents;+use function Safe\json_encode;use FireflyIII\Console\Commands\ShowsFriendlyMessages;use Illuminate\Console\Command;use Symfony\Component\Console\Command\Command as CommandAlias;diff --git a/app/Console/Commands/System/ScansAttachments.php b/app/Console/Commands/System/ScansAttachments.phpindex 24c6f6199b..0225cf0008 100644--- a/app/Console/Commands/System/ScansAttachments.php+++ b/app/Console/Commands/System/ScansAttachments.php@@ -78,8 +78,8 @@ class ScansAttachments extends Command}$tempFileName = tempnam(sys_get_temp_dir(), 'FireflyIII');file_put_contents($tempFileName, $decryptedContent);- $attachment->md5 = (string)md5_file($tempFileName);- $attachment->mime = (string)mime_content_type($tempFileName);+ $attachment->md5 = md5_file($tempFileName);+ $attachment->mime = mime_content_type($tempFileName);$attachment->save();$this->friendlyInfo(sprintf('Fixed attachment #%d', $attachment->id));}diff --git a/app/Events/DestroyedTransactionLink.php b/app/Events/DestroyedTransactionLink.phpdeleted file mode 100644index 60d43011ad..0000000000--- a/app/Events/DestroyedTransactionLink.php+++ /dev/null@@ -1,43 +0,0 @@-<?php--/*- * DestroyedTransactionLink.php- * Copyright (c) 2020 [email protected]- *- * This file is part of Firefly III (https://github.com/firefly-iii).- *- * This program is free software: you can redistribute it and/or modify- * it under the terms of the GNU Affero General Public License as- * published by the Free Software Foundation, either version 3 of the- * License, or (at your option) any later version.- *- * This program is distributed in the hope that it will be useful,- * but WITHOUT ANY WARRANTY; without even the implied warranty of- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- * GNU Affero General Public License for more details.- *- * You should have received a copy of the GNU Affero General Public License- * along with this program. If not, see <https://www.gnu.org/licenses/>.- */--declare(strict_types=1);--namespace FireflyIII\Events;--use FireflyIII\Models\TransactionJournalLink;-use Illuminate\Queue\SerializesModels;--/**- * Class DestroyedTransactionLink- */-class DestroyedTransactionLink extends Event-{- use SerializesModels;-- // @phpstan-ignore-line-- /**- * DestroyedTransactionLink constructor.- */- public function __construct(private TransactionJournalLink $link) {}-}diff --git a/app/Factory/PiggyBankFactory.php b/app/Factory/PiggyBankFactory.phpindex 539e1999b8..40455001d3 100644--- a/app/Factory/PiggyBankFactory.php+++ b/app/Factory/PiggyBankFactory.php@@ -282,7 +282,7 @@ class PiggyBankFactory// create event:Log::debug('linkToAccountIds: Trigger change for positive amount [b].');- event(new ChangedAmount($piggyBank, $toBeLinked[$account->id]['current_amount'], null, null));+ event(new ChangedAmount($piggyBank, $toBeLinked[$account->id]['current_amount'] ?? '0', null, null));}if (!array_key_exists('current_amount', $info)) {$toBeLinked[$account->id] ??= [];diff --git a/app/Generator/Webhook/StandardMessageGenerator.php b/app/Generator/Webhook/StandardMessageGenerator.phpindex f614feb292..055f2ee9da 100644--- a/app/Generator/Webhook/StandardMessageGenerator.php+++ b/app/Generator/Webhook/StandardMessageGenerator.php@@ -184,6 +184,7 @@ class StandardMessageGenerator implements MessageGeneratorInterfaceif ($model instanceof Budget) {$enrichment = new BudgetEnrichment();$enrichment->setUser($model->user);+ /** @var Budget $model */$model = $enrichment->enrichSingle($model);$transformer = new BudgetTransformer();$basicMessage['content'] = $transformer->transform($model);@@ -196,7 +197,7 @@ class StandardMessageGenerator implements MessageGeneratorInterface$parameters = new ParameterBag();$parameters->set('start', $model->start_date);$parameters->set('end', $model->end_date);-+ /** @var BudgetLimit $model */$model = $enrichment->enrichSingle($model);$transformer = new BudgetLimitTransformer();$transformer->setParameters($parameters);@@ -295,7 +296,7 @@ class StandardMessageGenerator implements MessageGeneratorInterface$this->webhooks = $webhooks;}- private function getRelevantResponse(array $triggers, WebhookResponseModel $response, $class): string+ private function getRelevantResponse(array $triggers, WebhookResponseModel $response, string $class): string{// return none if none.if (WebhookResponse::NONE->name === $response->title) {diff --git a/app/Handlers/Events/BillEventHandler.php b/app/Handlers/Events/BillEventHandler.phpindex 9bdb7bc1d4..c55c35bf71 100644--- a/app/Handlers/Events/BillEventHandler.php+++ b/app/Handlers/Events/BillEventHandler.php@@ -24,6 +24,7 @@ declare(strict_types=1);namespace FireflyIII\Handlers\Events;+use function Safe\json_encode;use Exception;use FireflyIII\Events\Model\Bill\WarnUserAboutBill;use FireflyIII\Events\Model\Bill\WarnUserAboutOverdueSubscriptions;diff --git a/app/Helpers/Attachments/AttachmentHelper.php b/app/Helpers/Attachments/AttachmentHelper.phpindex 28194b7e03..6ae170ab73 100644--- a/app/Helpers/Attachments/AttachmentHelper.php+++ b/app/Helpers/Attachments/AttachmentHelper.php@@ -35,6 +35,8 @@ use Illuminate\Support\Facades\Crypt;use Illuminate\Support\Facades\Log;use Illuminate\Support\Facades\Storage;use Illuminate\Support\MessageBag;+use Safe\Exceptions\FileinfoException;+use Safe\Exceptions\FilesystemException;use Symfony\Component\HttpFoundation\File\UploadedFile;use function Safe\tmpfile;@@ -126,9 +128,10 @@ class AttachmentHelper implements AttachmentHelperInterfacepublic function saveAttachmentFromApi(Attachment $attachment, string $content): bool{Log::debug(sprintf('Now in %s', __METHOD__));- $resource = tmpfile();- if (false === $resource) {- Log::error('Cannot create temp-file for file upload.');+ try {+ $resource = tmpfile();+ } catch (FilesystemException $e) {+ Log::error(sprintf('Cannot create temp-file for file upload: %s', $e->getMessage()));return false;}@@ -141,17 +144,18 @@ class AttachmentHelper implements AttachmentHelperInterface$path = stream_get_meta_data($resource)['uri'];Log::debug(sprintf('Path is %s', $path));- $result = fwrite($resource, $content);- if (false === $result) {- Log::error('Could not write temp file.');+ try {+ $result = fwrite($resource, $content);+ } catch (FilesystemException $e) {+ Log::error(sprintf('Could not write to temp file: %s', $e->getMessage()));return false;}Log::debug(sprintf('Wrote %d bytes to temp file.', $result));- $finfo = finfo_open(FILEINFO_MIME_TYPE);- if (false === $finfo) {- Log::error('Could not open finfo.');- fclose($resource);+ try {+ $finfo = finfo_open(FILEINFO_MIME_TYPE);+ } catch (FileinfoException $e) {+ Log::error(sprintf('Could not open finfo handler: %s', $e->getMessage()));return false;}@@ -171,7 +175,7 @@ class AttachmentHelper implements AttachmentHelperInterface$this->uploadDisk->put($file, $content);// update attachment.- $attachment->md5 = (string) md5_file($path);+ $attachment->md5 = md5_file($path);$attachment->mime = $mime;$attachment->size = strlen($content);$attachment->uploaded = true;@@ -233,7 +237,7 @@ class AttachmentHelper implements AttachmentHelperInterface$attachment = new Attachment(); // create Attachment object.$attachment->user()->associate($user);$attachment->attachable()->associate($model);- $attachment->md5 = (string) md5_file($file->getRealPath());+ $attachment->md5 = md5_file($file->getRealPath());$attachment->filename = $file->getClientOriginalName();$attachment->mime = $file->getMimeType();$attachment->size = $file->getSize();diff --git a/app/Helpers/Collector/Extensions/MetaCollection.php b/app/Helpers/Collector/Extensions/MetaCollection.phpindex 5e6dd7e85c..f13a55dc9c 100644--- a/app/Helpers/Collector/Extensions/MetaCollection.php+++ b/app/Helpers/Collector/Extensions/MetaCollection.php@@ -199,7 +199,7 @@ trait MetaCollectionpublic function excludeInternalReference(string $internalReference): GroupCollectorInterface{- $internalReference = (string) json_encode($internalReference);+ $internalReference = json_encode($internalReference);$internalReference = str_replace('\\', '\\\\', trim($internalReference, '"'));$this->joinMetaDataTables();@@ -220,7 +220,7 @@ trait MetaCollectionpublic function externalIdContains(string $externalId): GroupCollectorInterface{- $externalId = (string) json_encode($externalId);+ $externalId = json_encode($externalId);$externalId = str_replace('\\', '\\\\', trim($externalId, '"'));$this->joinMetaDataTables();@@ -232,7 +232,7 @@ trait MetaCollectionpublic function externalIdDoesNotContain(string $externalId): GroupCollectorInterface{- $externalId = (string) json_encode($externalId);+ $externalId = json_encode($externalId);$externalId = str_replace('\\', '\\\\', trim($externalId, '"'));$this->joinMetaDataTables();@@ -244,7 +244,7 @@ trait MetaCollectionpublic function externalIdDoesNotEnd(string $externalId): GroupCollectorInterface{- $externalId = (string) json_encode($externalId);+ $externalId = json_encode($externalId);$externalId = str_replace('\\', '\\\\', trim($externalId, '"'));$this->joinMetaDataTables();@@ -256,7 +256,7 @@ trait MetaCollectionpublic function externalIdDoesNotStart(string $externalId): GroupCollectorInterface{- $externalId = (string) json_encode($externalId);+ $externalId = json_encode($externalId);$externalId = str_replace('\\', '\\\\', trim($externalId, '"'));$this->joinMetaDataTables();@@ -268,7 +268,7 @@ trait MetaCollectionpublic function externalIdEnds(string $externalId): GroupCollectorInterface{- $externalId = (string) json_encode($externalId);+ $externalId = json_encode($externalId);$externalId = str_replace('\\', '\\\\', trim($externalId, '"'));$this->joinMetaDataTables();@@ -280,7 +280,7 @@ trait MetaCollectionpublic function externalIdStarts(string $externalId): GroupCollectorInterface{- $externalId = (string) json_encode($externalId);+ $externalId = json_encode($externalId);$externalId = str_replace('\\', '\\\\', trim($externalId, '"'));$this->joinMetaDataTables();@@ -293,7 +293,7 @@ trait MetaCollectionpublic function externalUrlContains(string $url): GroupCollectorInterface{$this->joinMetaDataTables();- $url = (string) json_encode($url);+ $url = json_encode($url);$url = str_replace('\\', '\\\\', trim($url, '"'));$this->query->where('journal_meta.name', '=', 'external_url');$this->query->whereLike('journal_meta.data', sprintf('%%%s%%', $url));@@ -304,7 +304,7 @@ trait MetaCollectionpublic function externalUrlDoesNotContain(string $url): GroupCollectorInterface{$this->joinMetaDataTables();- $url = (string) json_encode($url);+ $url = json_encode($url);$url = str_replace('\\', '\\\\', trim($url, '"'));$this->query->where('journal_meta.name', '=', 'external_url');$this->query->whereNotLike('journal_meta.data', sprintf('%%%s%%', $url));@@ -315,7 +315,7 @@ trait MetaCollectionpublic function externalUrlDoesNotEnd(string $url): GroupCollectorInterface{$this->joinMetaDataTables();- $url = (string) json_encode($url);+ $url = json_encode($url);$url = str_replace('\\', '\\\\', ltrim($url, '"'));$this->query->where('journal_meta.name', '=', 'external_url');$this->query->whereNotLike('journal_meta.data', sprintf('%%%s', $url));@@ -326,7 +326,7 @@ trait MetaCollectionpublic function externalUrlDoesNotStart(string $url): GroupCollectorInterface{$this->joinMetaDataTables();- $url = (string) json_encode($url);+ $url = json_encode($url);$url = str_replace('\\', '\\\\', rtrim($url, '"'));// var_dump($url);@@ -339,7 +339,7 @@ trait MetaCollectionpublic function externalUrlEnds(string $url): GroupCollectorInterface{$this->joinMetaDataTables();- $url = (string) json_encode($url);+ $url = json_encode($url);$url = str_replace('\\', '\\\\', ltrim($url, '"'));$this->query->where('journal_meta.name', '=', 'external_url');$this->query->whereLike('journal_meta.data', sprintf('%%%s', $url));@@ -350,7 +350,7 @@ trait MetaCollectionpublic function externalUrlStarts(string $url): GroupCollectorInterface{$this->joinMetaDataTables();- $url = (string) json_encode($url);+ $url = json_encode($url);$url = str_replace('\\', '\\\\', rtrim($url, '"'));// var_dump($url);@@ -401,7 +401,7 @@ trait MetaCollectionpublic function internalReferenceContains(string $internalReference): GroupCollectorInterface{- $internalReference = (string) json_encode($internalReference);+ $internalReference = json_encode($internalReference);$internalReference = str_replace('\\', '\\\\', trim($internalReference, '"'));// var_dump($internalReference);// exit;@@ -416,7 +416,7 @@ trait MetaCollectionpublic function internalReferenceDoesNotContain(string $internalReference): GroupCollectorInterface{- $internalReference = (string) json_encode($internalReference);+ $internalReference = json_encode($internalReference);$internalReference = str_replace('\\', '\\\\', trim($internalReference, '"'));$this->joinMetaDataTables();@@ -429,7 +429,7 @@ trait MetaCollectionpublic function internalReferenceDoesNotEnd(string $internalReference): GroupCollectorInterface{- $internalReference = (string) json_encode($internalReference);+ $internalReference = json_encode($internalReference);$internalReference = str_replace('\\', '\\\\', trim($internalReference, '"'));$this->joinMetaDataTables();@@ -442,7 +442,7 @@ trait MetaCollectionpublic function internalReferenceDoesNotStart(string $internalReference): GroupCollectorInterface{- $internalReference = (string) json_encode($internalReference);+ $internalReference = json_encode($internalReference);$internalReference = str_replace('\\', '\\\\', trim($internalReference, '"'));$this->joinMetaDataTables();@@ -455,7 +455,7 @@ trait MetaCollectionpublic function internalReferenceEnds(string $internalReference): GroupCollectorInterface{- $internalReference = (string) json_encode($internalReference);+ $internalReference = json_encode($internalReference);$internalReference = str_replace('\\', '\\\\', trim($internalReference, '"'));$this->joinMetaDataTables();@@ -468,7 +468,7 @@ trait MetaCollectionpublic function internalReferenceStarts(string $internalReference): GroupCollectorInterface{- $internalReference = (string) json_encode($internalReference);+ $internalReference = json_encode($internalReference);$internalReference = str_replace('\\', '\\\\', trim($internalReference, '"'));$this->joinMetaDataTables();@@ -724,7 +724,7 @@ trait MetaCollectionpublic function setInternalReference(string $internalReference): GroupCollectorInterface{- $internalReference = (string) json_encode($internalReference);+ $internalReference = json_encode($internalReference);$internalReference = str_replace('\\', '\\\\', trim($internalReference, '"'));$this->joinMetaDataTables();diff --git a/app/Helpers/Report/NetWorth.php b/app/Helpers/Report/NetWorth.phpindex c3a2f0592c..b375af03e8 100644--- a/app/Helpers/Report/NetWorth.php+++ b/app/Helpers/Report/NetWorth.php@@ -51,7 +51,7 @@ class NetWorth implements NetWorthInterfaceprivate AccountRepositoryInterface $accountRepository;private CurrencyRepositoryInterface $currencyRepos;private User $user; // @phpstan-ignore-line- private ?UserGroup $userGroup = null; // @phpstan-ignore-line+ private ?UserGroup $userGroup = null;/*** This method collects the user's net worth in ALL the user's currenciesdiff --git a/app/Http/Controllers/Auth/ForgotPasswordController.php b/app/Http/Controllers/Auth/ForgotPasswordController.phpindex dc292cc570..02a13d3225 100644--- a/app/Http/Controllers/Auth/ForgotPasswordController.php+++ b/app/Http/Controllers/Auth/ForgotPasswordController.php@@ -34,6 +34,7 @@ use Illuminate\Http\Request;use Illuminate\Support\Facades\Log;use Illuminate\View\View;+use Safe\Exceptions\UrlException;use function Safe\parse_url;/**@@ -103,8 +104,12 @@ class ForgotPasswordController extends Controller*/private function validateHost(): void{- $configuredHost = parse_url((string) config('app.url'), PHP_URL_HOST);- if (false === $configuredHost || null === $configuredHost) {+ try {+ $configuredHost = parse_url((string)config('app.url'), PHP_URL_HOST);+ } catch (UrlException $e) {+ throw new FireflyException('Please set a valid and correct Firefly III URL in the APP_URL environment variable.',0, $e);+ }+ if (!is_string( $configuredHost)) {throw new FireflyException('Please set a valid and correct Firefly III URL in the APP_URL environment variable.');}$host = request()->host();diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.phpindex 19a1b37764..c1566b5ed1 100644--- a/app/Http/Controllers/Auth/LoginController.php+++ b/app/Http/Controllers/Auth/LoginController.php@@ -249,8 +249,8 @@ class LoginController extends Controller$allowReset = false;}- $email = $request?->old('email');- $remember = $request?->old('remember');+ $email = $request->old('email');+ $remember = $request->old('remember');$storeInCookie = config('google2fa.store_in_cookie', false);if (false !== $storeInCookie) {diff --git a/app/Http/Controllers/Chart/AccountController.php b/app/Http/Controllers/Chart/AccountController.phpindex cf5cec649a..775aae212c 100644--- a/app/Http/Controllers/Chart/AccountController.php+++ b/app/Http/Controllers/Chart/AccountController.php@@ -330,6 +330,7 @@ class AccountController extends Controller/** @var array $journal */foreach ($journals as $journal) {$key = sprintf('%d-%d', $journal['category_id'], $journal['currency_id']);+ $field = 'amount';if (!array_key_exists($key, $result)) {// currency info:@@ -338,7 +339,6 @@ class AccountController extends Controller$currencySymbol = $journal['currency_symbol'];$currencyCode = $journal['currency_code'];$currencyDecimalPlaces = $journal['currency_decimal_places'];- $field = 'amount';if ($this->convertToPrimary && $this->primaryCurrency->id !== $currencyId) {$field = 'pc_amount';$currencyName = $this->primaryCurrency->name;@@ -437,6 +437,7 @@ class AccountController extends Controller/** @var array $journal */foreach ($journals as $journal) {$key = sprintf('%d-%d', $journal['category_id'], $journal['currency_id']);+ $field = 'amount';if (!array_key_exists($key, $result)) {// currency info:@@ -445,7 +446,6 @@ class AccountController extends Controller$currencySymbol = $journal['currency_symbol'];$currencyCode = $journal['currency_code'];$currencyDecimalPlaces = $journal['currency_decimal_places'];- $field = 'amount';if ($this->convertToPrimary && $this->primaryCurrency->id !== $currencyId) {$field = 'pc_amount';$currencyName = $this->primaryCurrency->name;diff --git a/app/Repositories/LinkType/LinkTypeRepository.php b/app/Repositories/LinkType/LinkTypeRepository.phpindex 9b2924b191..691ffbf65b 100644--- a/app/Repositories/LinkType/LinkTypeRepository.php+++ b/app/Repositories/LinkType/LinkTypeRepository.php@@ -23,7 +23,7 @@ declare(strict_types=1);namespace FireflyIII\Repositories\LinkType;-use FireflyIII\Events\DestroyedTransactionLink;+use Exception;use FireflyIII\Models\LinkType;use FireflyIII\Models\Note;use FireflyIII\Models\TransactionJournal;@@ -31,7 +31,6 @@ use FireflyIII\Models\TransactionJournalLink;use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface;use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait;use Illuminate\Support\Collection;-use Exception;/*** Class LinkTypeRepository.@@ -57,13 +56,13 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface, UserGroupInterfpublic function update(LinkType $linkType, array $data): LinkType{- if (array_key_exists('name', $data) && '' !== (string) $data['name']) {+ if (array_key_exists('name', $data) && '' !== (string)$data['name']) {$linkType->name = $data['name'];}- if (array_key_exists('inward', $data) && '' !== (string) $data['inward']) {+ if (array_key_exists('inward', $data) && '' !== (string)$data['inward']) {$linkType->inward = $data['inward'];}- if (array_key_exists('outward', $data) && '' !== (string) $data['outward']) {+ if (array_key_exists('outward', $data) && '' !== (string)$data['outward']) {$linkType->outward = $data['outward'];}$linkType->save();@@ -76,7 +75,6 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface, UserGroupInterf*/public function destroyLink(TransactionJournalLink $link): bool{- event(new DestroyedTransactionLink($link));$link->delete();return true;@@ -117,13 +115,12 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface, UserGroupInterfpublic function getJournalLinks(?LinkType $linkType = null): Collection{$query = TransactionJournalLink::with(['source', 'destination'])- ->leftJoin('transaction_journals as source_journals', 'journal_links.source_id', '=', 'source_journals.id')- ->leftJoin('transaction_journals as dest_journals', 'journal_links.destination_id', '=', 'dest_journals.id')- ->where('source_journals.user_id', $this->user->id)- ->where('dest_journals.user_id', $this->user->id)- ->whereNull('source_journals.deleted_at')- ->whereNull('dest_journals.deleted_at')- ;+ ->leftJoin('transaction_journals as source_journals', 'journal_links.source_id', '=', 'source_journals.id')+ ->leftJoin('transaction_journals as dest_journals', 'journal_links.destination_id', '=', 'dest_journals.id')+ ->where('source_journals.user_id', $this->user->id)+ ->where('dest_journals.user_id', $this->user->id)+ ->whereNull('source_journals.deleted_at')+ ->whereNull('dest_journals.deleted_at');if ($linkType instanceof LinkType) {$query->where('journal_links.link_type_id', $linkType->id);@@ -152,7 +149,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface, UserGroupInterf$merged = $outward->merge($inward);return $merged->filter(- static fn (TransactionJournalLink $link) => null !== $link->source && null !== $link->destination+ static fn(TransactionJournalLink $link) => null !== $link->source && null !== $link->destination);}@@ -175,7 +172,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface, UserGroupInterf*/public function storeLink(array $information, TransactionJournal $inward, TransactionJournal $outward): ?TransactionJournalLink{- $linkType = $this->find((int) ($information['link_type_id'] ?? 0));+ $linkType = $this->find((int)($information['link_type_id'] ?? 0));if (!$linkType instanceof LinkType) {$linkType = $this->findByName($information['link_type_name']);@@ -191,7 +188,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface, UserGroupInterfreturn $existing;}- $link = new TransactionJournalLink();+ $link = new TransactionJournalLink();$link->linkType()->associate($linkType);if ('inward' === $information['direction']) {app('log')->debug(sprintf('Link type is inwards ("%s"), so %d is source and %d is destination.', $linkType->inward, $inward->id, $outward->id));@@ -207,7 +204,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface, UserGroupInterf$link->save();// make note in noteable:- $this->setNoteText($link, (string) $information['notes']);+ $this->setNoteText($link, (string)$information['notes']);return $link;}@@ -232,9 +229,8 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface, UserGroupInterfpublic function findSpecificLink(LinkType $linkType, TransactionJournal $inward, TransactionJournal $outward): ?TransactionJournalLink{return TransactionJournalLink::where('link_type_id', $linkType->id)- ->where('source_id', $inward->id)- ->where('destination_id', $outward->id)->first()- ;+ ->where('source_id', $inward->id)+ ->where('destination_id', $outward->id)->first();}/**@@ -296,7 +292,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface, UserGroupInterf$journalLink->refresh();}- $journalLink->link_type_id = $data['link_type_id'] ?? $journalLink->link_type_id;+ $journalLink->link_type_id = $data['link_type_id'] ?? $journalLink->link_type_id;$journalLink->save();if (array_key_exists('notes', $data) && null !== $data['notes']) {$this->setNoteText($journalLink, $data['notes']);diff --git a/app/Support/JsonApi/Enrichments/RecurringEnrichment.php b/app/Support/JsonApi/Enrichments/RecurringEnrichment.phpindex 75833fed1d..43d244a3dd 100644--- a/app/Support/JsonApi/Enrichments/RecurringEnrichment.php+++ b/app/Support/JsonApi/Enrichments/RecurringEnrichment.php@@ -25,9 +25,9 @@ declare(strict_types=1);namespace FireflyIII\Support\JsonApi\Enrichments;+use function Safe\json_decode;use Carbon\Carbon;use FireflyIII\Enums\RecurrenceRepetitionWeekend;-use FireflyIII\Enums\TransactionTypeEnum;use FireflyIII\Exceptions\FireflyException;use FireflyIII\Factory\CategoryFactory;use FireflyIII\Models\Account;@@ -42,7 +42,6 @@ use FireflyIII\Models\RecurrenceRepetition;use FireflyIII\Models\RecurrenceTransaction;use FireflyIII\Models\RecurrenceTransactionMeta;use FireflyIII\Models\TransactionCurrency;-use FireflyIII\Models\TransactionType;use FireflyIII\Models\UserGroup;use FireflyIII\Repositories\Recurring\RecurringRepositoryInterface;use FireflyIII\Support\Facades\Amount;@@ -73,7 +72,7 @@ class RecurringEnrichment implements EnrichmentInterfaceprivate array $accounts = [];private array $currencies = [];private array $recurrenceIds = [];- private TransactionCurrency $primaryCurrency;+ private readonly TransactionCurrency $primaryCurrency;private bool $convertToPrimary = false;public function __construct()@@ -147,9 +146,7 @@ class RecurringEnrichment implements EnrichmentInterface/** @var RecurrenceRepetition $repetition */foreach ($set as $repetition) {- $recurrence = $this->collection->filter(function (Recurrence $item) use ($repetition) {- return (int)$item->id === (int)$repetition->recurrence_id;- })->first();+ $recurrence = $this->collection->filter(fn(Recurrence $item) => (int)$item->id === (int)$repetition->recurrence_id)->first();$fromDate = clone ($recurrence->latest_date ?? $recurrence->first_date);$id = (int)$repetition->recurrence_id;$repId = (int)$repetition->id;diff --git a/tests/integration/Api/Autocomplete/CurrencyControllerTest.php b/tests/integration/Api/Autocomplete/CurrencyControllerTest.phpindex b517ec6445..a034b6c728 100644--- a/tests/integration/Api/Autocomplete/CurrencyControllerTest.php+++ b/tests/integration/Api/Autocomplete/CurrencyControllerTest.php@@ -27,7 +27,6 @@ namespace Tests\integration\Api\Autocomplete;use FireflyIII\Models\TransactionCurrency;use Illuminate\Foundation\Testing\RefreshDatabase;use Tests\integration\TestCase;-use FireflyIII\User;/*** Class CurrencyControllerTestdiff --git a/tests/integration/Api/Chart/AccountControllerTest.php b/tests/integration/Api/Chart/AccountControllerTest.phpindex ff2b717df6..9fe3436cef 100644--- a/tests/integration/Api/Chart/AccountControllerTest.php+++ b/tests/integration/Api/Chart/AccountControllerTest.php@@ -39,6 +39,7 @@ final class AccountControllerTest extends TestCaseprivate $user;#[Override]+ #[\Override]protected function setUp(): void{parent::setUp();diff --git a/tests/integration/Api/Chart/BalanceControllerTest.php b/tests/integration/Api/Chart/BalanceControllerTest.phpindex 3762d0a22c..2a984e5f9d 100644--- a/tests/integration/Api/Chart/BalanceControllerTest.php+++ b/tests/integration/Api/Chart/BalanceControllerTest.php@@ -39,6 +39,7 @@ final class BalanceControllerTest extends TestCaseprivate $user;#[Override]+ #[\Override]protected function setUp(): void{parent::setUp();diff --git a/tests/integration/Api/Chart/BudgetControllerTest.php b/tests/integration/Api/Chart/BudgetControllerTest.phpindex f5e6603483..56ca6f5099 100644--- a/tests/integration/Api/Chart/BudgetControllerTest.php+++ b/tests/integration/Api/Chart/BudgetControllerTest.php@@ -39,6 +39,7 @@ final class BudgetControllerTest extends TestCaseprivate $user;#[Override]+ #[\Override]protected function setUp(): void{parent::setUp();diff --git a/tests/integration/Api/Chart/CategoryControllerTest.php b/tests/integration/Api/Chart/CategoryControllerTest.phpindex d80e4fccb2..5c8540b3fb 100644--- a/tests/integration/Api/Chart/CategoryControllerTest.php+++ b/tests/integration/Api/Chart/CategoryControllerTest.php@@ -39,6 +39,7 @@ final class CategoryControllerTest extends TestCaseprivate $user;#[Override]+ #[\Override]protected function setUp(): void{parent::setUp();