From a498169148869a9fb0d7f7070381388a2359c409 Mon Sep 17 00:00:00 2001 From: JC5 Date: Sun, 9 Nov 2025 09:11:55 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20Auto=20commit=20for=20release=20?= =?UTF-8?q?'develop'=20on=202025-11-09?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Api/V1/Controllers/Controller.php | 6 +-- .../Controllers/Summary/BasicController.php | 1 + .../Correction/CorrectsUnevenAmount.php | 1 + .../Upgrade/UpgradesLiabilitiesEight.php | 1 + app/Exceptions/IntervalException.php | 4 +- app/Factory/TransactionFactory.php | 4 +- .../Report/Category/MonthReportGenerator.php | 2 +- .../Report/Standard/MonthReportGenerator.php | 4 +- .../Standard/MultiYearReportGenerator.php | 4 +- .../Report/Standard/YearReportGenerator.php | 4 +- app/Helpers/Report/ReportHelper.php | 4 +- .../Controllers/Account/DeleteController.php | 2 +- .../Controllers/Account/EditController.php | 2 +- .../Account/ReconcileController.php | 3 +- .../Controllers/Account/ShowController.php | 40 +++++++++---------- app/Http/Controllers/Admin/LinkController.php | 4 +- app/Http/Controllers/Admin/UserController.php | 2 +- app/Http/Controllers/Auth/LoginController.php | 4 +- .../Auth/ResetPasswordController.php | 1 + .../Controllers/Auth/TwoFactorController.php | 2 +- app/Http/Controllers/DebugController.php | 11 ++++- app/Http/Controllers/NewUserController.php | 2 +- .../Controllers/PreferencesController.php | 1 - .../Controllers/Profile/MfaController.php | 1 - app/Http/Controllers/ProfileController.php | 4 +- app/Http/Controllers/ReportController.php | 1 - .../Controllers/System/CronController.php | 2 +- .../Controllers/System/InstallController.php | 4 +- .../Transaction/ConvertController.php | 2 +- .../Transaction/CreateController.php | 1 - .../Transaction/DeleteController.php | 2 +- .../Transaction/EditController.php | 2 +- .../Transaction/MassController.php | 1 - .../TransactionCurrency/CreateController.php | 2 +- .../TransactionCurrency/DeleteController.php | 3 +- .../TransactionCurrency/EditController.php | 3 +- app/Http/Middleware/Authenticate.php | 1 + app/Http/Middleware/Binder.php | 4 +- app/Jobs/WarnAboutBills.php | 2 + app/Providers/AppServiceProvider.php | 1 + .../Journal/JournalRepository.php | 6 +-- app/Rules/IsAllowedGroupAction.php | 5 +-- .../Internal/Support/AccountServiceTrait.php | 1 + .../Support/CreditRecalculateService.php | 4 +- .../Internal/Update/GroupUpdateService.php | 1 + .../Internal/Update/JournalUpdateService.php | 16 ++++---- .../Authentication/RemoteUserGuard.php | 1 - .../Chart/Budget/FrontpageChartGenerator.php | 8 ++-- .../Category/FrontpageChartGenerator.php | 2 +- app/Support/Cronjobs/AbstractCronjob.php | 12 +++--- app/Support/ExpandedForm.php | 2 + app/Support/Export/ExportDataGenerator.php | 26 ++++++------ .../Http/Api/AccountBalanceGrouped.php | 2 +- .../Http/Api/SummaryBalanceGrouped.php | 6 +-- .../Http/Controllers/RequestInformation.php | 1 + .../Enrichments/BudgetLimitEnrichment.php | 6 +-- .../Enrichments/PiggyBankEnrichment.php | 4 +- .../Enrichments/PiggyBankEventEnrichment.php | 4 +- .../Enrichments/SubscriptionEnrichment.php | 6 +-- .../TransactionGroupEnrichment.php | 8 +--- .../JsonApi/Enrichments/WebhookEnrichment.php | 8 +--- app/Support/ParseDateString.php | 1 + app/Support/Request/AppendsLocationData.php | 4 +- app/Support/Request/ConvertsDataTypes.php | 1 + app/Support/Search/AccountSearch.php | 2 +- app/Support/Search/OperatorQuerySearch.php | 14 +++---- app/Support/Steam.php | 28 ++++++------- app/Support/System/OAuthKeys.php | 1 + app/Support/Twig/General.php | 1 + app/Support/Twig/TransactionGroupTwig.php | 2 +- app/Support/Twig/Translation.php | 4 +- .../Engine/SearchRuleEngine.php | 8 ++-- .../TransactionGroupTransformer.php | 1 + app/Transformers/UserGroupTransformer.php | 4 +- app/Validation/AccountValidator.php | 7 ++-- app/Validation/FireflyValidator.php | 1 + app/Validation/TransactionValidation.php | 5 +++ config/firefly.php | 4 +- 78 files changed, 183 insertions(+), 179 deletions(-) diff --git a/app/Api/V1/Controllers/Controller.php b/app/Api/V1/Controllers/Controller.php index 8c6cff0d16..93508c4ed3 100644 --- a/app/Api/V1/Controllers/Controller.php +++ b/app/Api/V1/Controllers/Controller.php @@ -102,9 +102,9 @@ abstract class Controller extends BaseController } #[Deprecated(message: <<<'TXT' - use Request classes - Method to grab all parameters from the URL - TXT)] + use Request classes + Method to grab all parameters from the URL + TXT)] private function getParameters(): ParameterBag { $bag = new ParameterBag(); diff --git a/app/Api/V1/Controllers/Summary/BasicController.php b/app/Api/V1/Controllers/Summary/BasicController.php index 730bfd3c6e..22b938783c 100644 --- a/app/Api/V1/Controllers/Summary/BasicController.php +++ b/app/Api/V1/Controllers/Summary/BasicController.php @@ -651,6 +651,7 @@ class BasicController extends Controller if ($start->greaterThanOrEqualTo($date) && $end->greaterThanOrEqualTo($date)) { return true; } + // start and end in the past? use $end return $start->lessThanOrEqualTo($date) && $end->lessThanOrEqualTo($date); } diff --git a/app/Console/Commands/Correction/CorrectsUnevenAmount.php b/app/Console/Commands/Correction/CorrectsUnevenAmount.php index 491f6dde2b..16c8140387 100644 --- a/app/Console/Commands/Correction/CorrectsUnevenAmount.php +++ b/app/Console/Commands/Correction/CorrectsUnevenAmount.php @@ -251,6 +251,7 @@ class CorrectsUnevenAmount extends Command /** @var Transaction $source */ $source = $journal->transactions()->where('amount', '<', 0)->first(); + // safety catch on NULL should not be necessary, we just had that catch. // source amount = dest foreign amount // source currency = dest foreign currency diff --git a/app/Console/Commands/Upgrade/UpgradesLiabilitiesEight.php b/app/Console/Commands/Upgrade/UpgradesLiabilitiesEight.php index 611aa7d08b..9a03e0445c 100644 --- a/app/Console/Commands/Upgrade/UpgradesLiabilitiesEight.php +++ b/app/Console/Commands/Upgrade/UpgradesLiabilitiesEight.php @@ -136,6 +136,7 @@ class UpgradesLiabilitiesEight extends Command if (null === $liabilityJournal) { return false; } + return (bool) $openingJournal->date->isSameDay($liabilityJournal->date); } diff --git a/app/Exceptions/IntervalException.php b/app/Exceptions/IntervalException.php index 046e9cdef7..09ab3c6469 100644 --- a/app/Exceptions/IntervalException.php +++ b/app/Exceptions/IntervalException.php @@ -34,10 +34,10 @@ use Throwable; final class IntervalException extends Exception { public array $availableIntervals = []; - public Periodicity $periodicity = Periodicity::Monthly; + public Periodicity $periodicity = Periodicity::Monthly; /** @var mixed */ - protected $message = 'The periodicity %s is unknown. Choose one of available periodicity: %s'; + protected $message = 'The periodicity %s is unknown. Choose one of available periodicity: %s'; public function __construct(string $message = '', int $code = 0, ?Throwable $previous = null) { diff --git a/app/Factory/TransactionFactory.php b/app/Factory/TransactionFactory.php index 354dc53418..a5a58a96a6 100644 --- a/app/Factory/TransactionFactory.php +++ b/app/Factory/TransactionFactory.php @@ -43,9 +43,9 @@ class TransactionFactory private Account $account; private array $accountInformation = []; private TransactionCurrency $currency; - private ?TransactionCurrency $foreignCurrency = null; + private ?TransactionCurrency $foreignCurrency = null; private TransactionJournal $journal; - private bool $reconciled = false; + private bool $reconciled = false; /** * Create transaction with negative amount (for source accounts). diff --git a/app/Generator/Report/Category/MonthReportGenerator.php b/app/Generator/Report/Category/MonthReportGenerator.php index 2360b93abd..3bae1a373c 100644 --- a/app/Generator/Report/Category/MonthReportGenerator.php +++ b/app/Generator/Report/Category/MonthReportGenerator.php @@ -42,7 +42,7 @@ class MonthReportGenerator implements ReportGeneratorInterface private Collection $categories; private Carbon $end; private array $expenses = []; - private array $income = []; + private array $income = []; private Carbon $start; /** diff --git a/app/Generator/Report/Standard/MonthReportGenerator.php b/app/Generator/Report/Standard/MonthReportGenerator.php index f8ad0b4f82..54cc09855e 100644 --- a/app/Generator/Report/Standard/MonthReportGenerator.php +++ b/app/Generator/Report/Standard/MonthReportGenerator.php @@ -39,10 +39,10 @@ class MonthReportGenerator implements ReportGeneratorInterface private ?Collection $accounts = null; /** @var Carbon The end date. */ - private ?Carbon $end = null; + private ?Carbon $end = null; /** @var Carbon The start date. */ - private ?Carbon $start = null; + private ?Carbon $start = null; /** * Generates the report. diff --git a/app/Generator/Report/Standard/MultiYearReportGenerator.php b/app/Generator/Report/Standard/MultiYearReportGenerator.php index dc49d75e7c..10f89ea80b 100644 --- a/app/Generator/Report/Standard/MultiYearReportGenerator.php +++ b/app/Generator/Report/Standard/MultiYearReportGenerator.php @@ -39,10 +39,10 @@ class MultiYearReportGenerator implements ReportGeneratorInterface private ?Collection $accounts = null; /** @var Carbon The end date. */ - private ?Carbon $end = null; + private ?Carbon $end = null; /** @var Carbon The start date. */ - private ?Carbon $start = null; + private ?Carbon $start = null; /** * Generates the report. diff --git a/app/Generator/Report/Standard/YearReportGenerator.php b/app/Generator/Report/Standard/YearReportGenerator.php index 995d49d335..8c394d4c64 100644 --- a/app/Generator/Report/Standard/YearReportGenerator.php +++ b/app/Generator/Report/Standard/YearReportGenerator.php @@ -39,10 +39,10 @@ class YearReportGenerator implements ReportGeneratorInterface private ?Collection $accounts = null; /** @var Carbon The end date. */ - private ?Carbon $end = null; + private ?Carbon $end = null; /** @var Carbon The start date. */ - private ?Carbon $start = null; + private ?Carbon $start = null; /** * Generates the report. diff --git a/app/Helpers/Report/ReportHelper.php b/app/Helpers/Report/ReportHelper.php index 7c1d4cc113..140667989c 100644 --- a/app/Helpers/Report/ReportHelper.php +++ b/app/Helpers/Report/ReportHelper.php @@ -42,9 +42,7 @@ class ReportHelper implements ReportHelperInterface public function __construct( /** @var BudgetRepositoryInterface The budget repository */ protected BudgetRepositoryInterface $budgetRepository - ) - { - } + ) {} /** * This method generates a full report for the given period on all diff --git a/app/Http/Controllers/Account/DeleteController.php b/app/Http/Controllers/Account/DeleteController.php index d2370eab4b..49686ffe61 100644 --- a/app/Http/Controllers/Account/DeleteController.php +++ b/app/Http/Controllers/Account/DeleteController.php @@ -66,7 +66,7 @@ class DeleteController extends Controller * * @return Factory|Redirector|RedirectResponse|View */ - public function delete(Account $account): Redirector|RedirectResponse|Factory|\Illuminate\Contracts\View\View + public function delete(Account $account): Factory|\Illuminate\Contracts\View\View|Redirector|RedirectResponse { if (!$this->isEditableAccount($account)) { return $this->redirectAccountToAccount($account); diff --git a/app/Http/Controllers/Account/EditController.php b/app/Http/Controllers/Account/EditController.php index 98b6c99ccb..9fa0eea7c0 100644 --- a/app/Http/Controllers/Account/EditController.php +++ b/app/Http/Controllers/Account/EditController.php @@ -76,7 +76,7 @@ class EditController extends Controller * * @return Factory|Redirector|RedirectResponse|View */ - public function edit(Request $request, Account $account, AccountRepositoryInterface $repository): Redirector|RedirectResponse|Factory|\Illuminate\Contracts\View\View + public function edit(Request $request, Account $account, AccountRepositoryInterface $repository): Factory|\Illuminate\Contracts\View\View|Redirector|RedirectResponse { if (!$this->isEditableAccount($account)) { return $this->redirectAccountToAccount($account); diff --git a/app/Http/Controllers/Account/ReconcileController.php b/app/Http/Controllers/Account/ReconcileController.php index ff99abb88a..a6cbc328cb 100644 --- a/app/Http/Controllers/Account/ReconcileController.php +++ b/app/Http/Controllers/Account/ReconcileController.php @@ -78,7 +78,7 @@ class ReconcileController extends Controller * * @throws FireflyException * */ - public function reconcile(Account $account, ?Carbon $start = null, ?Carbon $end = null): Redirector|RedirectResponse|Factory|\Illuminate\Contracts\View\View + public function reconcile(Account $account, ?Carbon $start = null, ?Carbon $end = null): Factory|\Illuminate\Contracts\View\View|Redirector|RedirectResponse { if (!$this->isEditableAccount($account)) { return $this->redirectAccountToAccount($account); @@ -146,7 +146,6 @@ class ReconcileController extends Controller /** * Submit a new reconciliation. * - * * @throws DuplicateTransactionException */ public function submit(ReconciliationStoreRequest $request, Account $account, Carbon $start, Carbon $end): Redirector|RedirectResponse diff --git a/app/Http/Controllers/Account/ShowController.php b/app/Http/Controllers/Account/ShowController.php index dfbb046410..1d5edb91fc 100644 --- a/app/Http/Controllers/Account/ShowController.php +++ b/app/Http/Controllers/Account/ShowController.php @@ -84,7 +84,7 @@ class ShowController extends Controller * @throws FireflyException * @throws NotFoundExceptionInterface */ - public function show(Request $request, Account $account, ?Carbon $start = null, ?Carbon $end = null): Redirector|RedirectResponse|Factory|\Illuminate\Contracts\View\View + public function show(Request $request, Account $account, ?Carbon $start = null, ?Carbon $end = null): Factory|\Illuminate\Contracts\View\View|Redirector|RedirectResponse { if (0 === $account->id) { throw new NotFoundHttpException(); @@ -187,47 +187,47 @@ class ShowController extends Controller * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ - public function showAll(Request $request, Account $account): Redirector|RedirectResponse|Factory|\Illuminate\Contracts\View\View + public function showAll(Request $request, Account $account): Factory|\Illuminate\Contracts\View\View|Redirector|RedirectResponse { if (!$this->isEditableAccount($account)) { return $this->redirectAccountToAccount($account); } - $location = $this->repository->getLocation($account); - $isLiability = $this->repository->isLiability($account); - $attachments = $this->repository->getAttachments($account); - $objectType = config(sprintf('firefly.shortNamesByFullName.%s', $account->accountType->type)); - $end = today(config('app.timezone')); - $today = today(config('app.timezone')); + $location = $this->repository->getLocation($account); + $isLiability = $this->repository->isLiability($account); + $attachments = $this->repository->getAttachments($account); + $objectType = config(sprintf('firefly.shortNamesByFullName.%s', $account->accountType->type)); + $end = today(config('app.timezone')); + $today = today(config('app.timezone')); $this->repository->getAccountCurrency($account); - $start = $this->repository->oldestJournalDate($account) ?? today(config('app.timezone'))->startOfMonth(); - $subTitleIcon = config('firefly.subIconsByIdentifier.'.$account->accountType->type); - $page = (int) $request->get('page'); - $pageSize = (int) app('preferences')->get('listPageSize', 50)->data; - $currency = $this->repository->getAccountCurrency($account) ?? $this->primaryCurrency; - $subTitle = (string) trans('firefly.all_journals_for_account', ['name' => $account->name]); - $periods = new Collection(); + $start = $this->repository->oldestJournalDate($account) ?? today(config('app.timezone'))->startOfMonth(); + $subTitleIcon = config('firefly.subIconsByIdentifier.'.$account->accountType->type); + $page = (int) $request->get('page'); + $pageSize = (int) app('preferences')->get('listPageSize', 50)->data; + $currency = $this->repository->getAccountCurrency($account) ?? $this->primaryCurrency; + $subTitle = (string) trans('firefly.all_journals_for_account', ['name' => $account->name]); + $periods = new Collection(); $end->endOfDay(); /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setAccounts(new Collection()->push($account))->setLimit($pageSize)->setPage($page)->withAccountInformation()->withCategoryInformation(); // this search will not include transaction groups where this asset account (or liability) // is just part of ONE of the journals. To force this: $collector->setExpandGroupSearch(true); - $groups = $collector->getPaginatedGroups(); + $groups = $collector->getPaginatedGroups(); $groups->setPath(route('accounts.show.all', [$account->id])); - $chartUrl = route('chart.account.period', [$account->id, $start->format('Y-m-d'), $end->format('Y-m-d')]); - $showAll = true; + $chartUrl = route('chart.account.period', [$account->id, $start->format('Y-m-d'), $end->format('Y-m-d')]); + $showAll = true; // correct Log::debug(sprintf('showAll: Call accountsBalancesOptimized with date/time "%s"', $end->toIso8601String())); // 2025-10-08 replace finalAccountBalance with accountsBalancesOptimized. // $balances = Steam::finalAccountBalance($account, $end); // $balances = Steam::filterAccountBalance($balances, $account, $this->convertToPrimary, $accountCurrency); - $balances = Steam::accountsBalancesOptimized(new Collection()->push($account), $end)[$account->id]; + $balances = Steam::accountsBalancesOptimized(new Collection()->push($account), $end)[$account->id]; return view( 'accounts.show', diff --git a/app/Http/Controllers/Admin/LinkController.php b/app/Http/Controllers/Admin/LinkController.php index 06c66deeb1..234c980471 100644 --- a/app/Http/Controllers/Admin/LinkController.php +++ b/app/Http/Controllers/Admin/LinkController.php @@ -86,7 +86,7 @@ class LinkController extends Controller * * @return Factory|Redirector|RedirectResponse|View */ - public function delete(Request $request, LinkType $linkType): Redirector|RedirectResponse|Factory|\Illuminate\Contracts\View\View + public function delete(Request $request, LinkType $linkType): Factory|\Illuminate\Contracts\View\View|Redirector|RedirectResponse { if (false === $linkType->editable) { $request->session()->flash('error', (string) trans('firefly.cannot_edit_link_type', ['name' => e($linkType->name)])); @@ -135,7 +135,7 @@ class LinkController extends Controller * * @return Factory|Redirector|RedirectResponse|View */ - public function edit(Request $request, LinkType $linkType): Redirector|RedirectResponse|Factory|\Illuminate\Contracts\View\View + public function edit(Request $request, LinkType $linkType): Factory|\Illuminate\Contracts\View\View|Redirector|RedirectResponse { if (false === $linkType->editable) { $request->session()->flash('error', (string) trans('firefly.cannot_edit_link_type', ['name' => e($linkType->name)])); diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index dbebe2ba5d..b2a50a5da5 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -73,7 +73,7 @@ class UserController extends Controller /** * @return Application|Factory|Redirector|RedirectResponse|View */ - public function delete(User $user): Redirector|RedirectResponse|Factory|\Illuminate\Contracts\View\View + public function delete(User $user): Factory|\Illuminate\Contracts\View\View|Redirector|RedirectResponse { if ($this->externalIdentity) { request()->session()->flash('error', trans('firefly.external_user_mgt_disabled')); diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 8866f1aba5..2c330a516b 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -68,7 +68,7 @@ class LoginController extends Controller protected string $redirectTo = RouteServiceProvider::HOME; private UserRepositoryInterface $repository; - private string $username = 'email'; + private string $username = 'email'; /** * Create a new controller instance. @@ -222,7 +222,7 @@ class LoginController extends Controller * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ - public function showLoginForm(Request $request): Redirector|RedirectResponse|Factory|View + public function showLoginForm(Request $request): Factory|Redirector|RedirectResponse|View { Log::channel('audit')->info('Show login form (1.1).'); diff --git a/app/Http/Controllers/Auth/ResetPasswordController.php b/app/Http/Controllers/Auth/ResetPasswordController.php index 9b4f2dc7dd..2b82d826bf 100644 --- a/app/Http/Controllers/Auth/ResetPasswordController.php +++ b/app/Http/Controllers/Auth/ResetPasswordController.php @@ -114,6 +114,7 @@ class ResetPasswordController extends Controller * * If no token is present, display the link request form. * + * @param null|mixed $token * * @return Factory|View * diff --git a/app/Http/Controllers/Auth/TwoFactorController.php b/app/Http/Controllers/Auth/TwoFactorController.php index b9e956d7e1..2116f1b827 100644 --- a/app/Http/Controllers/Auth/TwoFactorController.php +++ b/app/Http/Controllers/Auth/TwoFactorController.php @@ -59,7 +59,6 @@ class TwoFactorController extends Controller } /** - * * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ @@ -211,6 +210,7 @@ class TwoFactorController extends Controller if (!is_array($list)) { $list = []; } + return in_array($mfaCode, $list, true); } diff --git a/app/Http/Controllers/DebugController.php b/app/Http/Controllers/DebugController.php index e374dd2adb..a721ac7d83 100644 --- a/app/Http/Controllers/DebugController.php +++ b/app/Http/Controllers/DebugController.php @@ -96,7 +96,6 @@ class DebugController extends Controller /** * Clear log and session. * - * * @throws FireflyException */ public function flush(Request $request): Redirector|RedirectResponse @@ -514,30 +513,40 @@ class DebugController extends Controller case 'userGroup': return '1'; + case 'start_date': case 'date': return '20241201'; + case 'end_date': return '20241231'; + case 'fromCurrencyCode': return 'EUR'; + case 'toCurrencyCode': return 'USD'; + case 'accountList': return '1,6'; + case 'budgetList': case 'categoryList': case 'doubleList': case 'tagList': case 'journalList': return '1,2'; + case 'route': return 'accounts'; + case 'specificPage': return 'show'; + case 'reportType': return 'default'; + case 'transactionType': return 'withdrawal'; diff --git a/app/Http/Controllers/NewUserController.php b/app/Http/Controllers/NewUserController.php index 0c914d965a..db8360ba6f 100644 --- a/app/Http/Controllers/NewUserController.php +++ b/app/Http/Controllers/NewUserController.php @@ -64,7 +64,7 @@ class NewUserController extends Controller * * @return Factory|Redirector|RedirectResponse|View */ - public function index(): Redirector|RedirectResponse|Factory|\Illuminate\Contracts\View\View + public function index(): Factory|\Illuminate\Contracts\View\View|Redirector|RedirectResponse { app('view')->share('title', (string) trans('firefly.welcome')); app('view')->share('mainTitleIcon', 'fa-fire'); diff --git a/app/Http/Controllers/PreferencesController.php b/app/Http/Controllers/PreferencesController.php index 43fd16f342..229f853f3c 100644 --- a/app/Http/Controllers/PreferencesController.php +++ b/app/Http/Controllers/PreferencesController.php @@ -188,7 +188,6 @@ class PreferencesController extends Controller /** * Store new preferences. * - * * @throws FireflyException * * @SuppressWarnings("PHPMD.ExcessiveMethodLength") diff --git a/app/Http/Controllers/Profile/MfaController.php b/app/Http/Controllers/Profile/MfaController.php index 0114474be4..e434a2e525 100644 --- a/app/Http/Controllers/Profile/MfaController.php +++ b/app/Http/Controllers/Profile/MfaController.php @@ -228,7 +228,6 @@ class MfaController extends Controller /** * Submit 2FA for the first time. * - * * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index 8939c61b30..67e28666fd 100644 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -288,7 +288,7 @@ class ProfileController extends Controller * * @return Factory|Redirector|RedirectResponse|View */ - public function changePassword(Request $request): Redirector|RedirectResponse|Factory|\Illuminate\Contracts\View\View + public function changePassword(Request $request): Factory|\Illuminate\Contracts\View\View|Redirector|RedirectResponse { if (!$this->internalAuth) { $request->session()->flash('error', trans('firefly.external_user_mgt_disabled')); @@ -361,7 +361,6 @@ class ProfileController extends Controller /** * Regenerate access token. * - * * @throws Exception */ public function regenerate(Request $request): Redirector|RedirectResponse @@ -384,7 +383,6 @@ class ProfileController extends Controller /** * Undo change of user email address. * - * * @throws FireflyException */ public function undoEmailChange(UserRepositoryInterface $repository, string $token, string $hash): Redirector|RedirectResponse diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.php index b248e31bf7..3cdc068f1e 100644 --- a/app/Http/Controllers/ReportController.php +++ b/app/Http/Controllers/ReportController.php @@ -193,7 +193,6 @@ class ReportController extends Controller /** * Show account report. * - * * @throws FireflyException */ public function doubleReport(Collection $accounts, Collection $expense, Carbon $start, Carbon $end): string diff --git a/app/Http/Controllers/System/CronController.php b/app/Http/Controllers/System/CronController.php index 7667a998b5..eeb3cf9baf 100644 --- a/app/Http/Controllers/System/CronController.php +++ b/app/Http/Controllers/System/CronController.php @@ -37,7 +37,7 @@ class CronController /** * @return Application|Response|ResponseFactory */ - public function cron(): ResponseFactory|Response + public function cron(): Response|ResponseFactory { Log::error('The cron endpoint has moved to GET /api/v1/cron/[token]'); diff --git a/app/Http/Controllers/System/InstallController.php b/app/Http/Controllers/System/InstallController.php index ff2ee33a22..8a8a163082 100644 --- a/app/Http/Controllers/System/InstallController.php +++ b/app/Http/Controllers/System/InstallController.php @@ -51,9 +51,9 @@ class InstallController extends Controller public const string BASEDIR_ERROR = 'Firefly III cannot execute the upgrade commands. It is not allowed to because of an open_basedir restriction.'; public const string FORBIDDEN_ERROR = 'Internal PHP function "proc_close" is disabled for your installation. Auto-migration is not possible.'; public const string OTHER_ERROR = 'An unknown error prevented Firefly III from executing the upgrade commands. Sorry.'; - private string $lastError = ''; + private string $lastError = ''; // empty on purpose. - private array $upgradeCommands = [ + private array $upgradeCommands = [ // there are 5 initial commands // Check 4 places: InstallController, Docker image, UpgradeDatabase, composer.json 'migrate' => ['--seed' => true, '--force' => true], diff --git a/app/Http/Controllers/Transaction/ConvertController.php b/app/Http/Controllers/Transaction/ConvertController.php index 2861cfda36..603f622469 100644 --- a/app/Http/Controllers/Transaction/ConvertController.php +++ b/app/Http/Controllers/Transaction/ConvertController.php @@ -87,7 +87,7 @@ class ConvertController extends Controller * * @throws Exception */ - public function index(TransactionType $destinationType, TransactionGroup $group): Redirector|RedirectResponse|Factory|\Illuminate\Contracts\View\View + public function index(TransactionType $destinationType, TransactionGroup $group): Factory|\Illuminate\Contracts\View\View|Redirector|RedirectResponse { if (!$this->isEditableGroup($group)) { return $this->redirectGroupToAccount($group); diff --git a/app/Http/Controllers/Transaction/CreateController.php b/app/Http/Controllers/Transaction/CreateController.php index 8f7b521c31..878e589c04 100644 --- a/app/Http/Controllers/Transaction/CreateController.php +++ b/app/Http/Controllers/Transaction/CreateController.php @@ -100,7 +100,6 @@ class CreateController extends Controller /** * Create a new transaction group. * - * * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface * @throws UrlException diff --git a/app/Http/Controllers/Transaction/DeleteController.php b/app/Http/Controllers/Transaction/DeleteController.php index 990a1fd753..1e82c2cd12 100644 --- a/app/Http/Controllers/Transaction/DeleteController.php +++ b/app/Http/Controllers/Transaction/DeleteController.php @@ -68,7 +68,7 @@ class DeleteController extends Controller /** * Shows the form that allows a user to delete a transaction journal. */ - public function delete(TransactionGroup $group): Redirector|RedirectResponse|Factory|View + public function delete(TransactionGroup $group): Factory|Redirector|RedirectResponse|View { if (!$this->isEditableGroup($group)) { return $this->redirectGroupToAccount($group); diff --git a/app/Http/Controllers/Transaction/EditController.php b/app/Http/Controllers/Transaction/EditController.php index 2b26986c01..00f0e0bc62 100644 --- a/app/Http/Controllers/Transaction/EditController.php +++ b/app/Http/Controllers/Transaction/EditController.php @@ -74,7 +74,7 @@ class EditController extends Controller * @throws NotFoundExceptionInterface * @throws UrlException */ - public function edit(TransactionGroup $transactionGroup): Redirector|RedirectResponse|Factory|\Illuminate\Contracts\View\View + public function edit(TransactionGroup $transactionGroup): Factory|\Illuminate\Contracts\View\View|Redirector|RedirectResponse { app('preferences')->mark(); diff --git a/app/Http/Controllers/Transaction/MassController.php b/app/Http/Controllers/Transaction/MassController.php index b0a552097a..3c70dfb089 100644 --- a/app/Http/Controllers/Transaction/MassController.php +++ b/app/Http/Controllers/Transaction/MassController.php @@ -154,7 +154,6 @@ class MassController extends Controller /** * Mass update of journals. * - * * @throws FireflyException */ public function update(MassEditJournalRequest $request): Redirector|RedirectResponse diff --git a/app/Http/Controllers/TransactionCurrency/CreateController.php b/app/Http/Controllers/TransactionCurrency/CreateController.php index c679dd16b8..057089b5da 100644 --- a/app/Http/Controllers/TransactionCurrency/CreateController.php +++ b/app/Http/Controllers/TransactionCurrency/CreateController.php @@ -70,7 +70,7 @@ class CreateController extends Controller * * @return Factory|Redirector|RedirectResponse|View */ - public function create(Request $request): Redirector|RedirectResponse|Factory|\Illuminate\Contracts\View\View + public function create(Request $request): Factory|\Illuminate\Contracts\View\View|Redirector|RedirectResponse { /** @var User $user */ $user = auth()->user(); diff --git a/app/Http/Controllers/TransactionCurrency/DeleteController.php b/app/Http/Controllers/TransactionCurrency/DeleteController.php index 853242ea98..b9364f98e1 100644 --- a/app/Http/Controllers/TransactionCurrency/DeleteController.php +++ b/app/Http/Controllers/TransactionCurrency/DeleteController.php @@ -71,7 +71,7 @@ class DeleteController extends Controller * * @throws FireflyException */ - public function delete(Request $request, TransactionCurrency $currency): Redirector|RedirectResponse|Factory|\Illuminate\Contracts\View\View + public function delete(Request $request, TransactionCurrency $currency): Factory|\Illuminate\Contracts\View\View|Redirector|RedirectResponse { /** @var User $user */ $user = auth()->user(); @@ -102,7 +102,6 @@ class DeleteController extends Controller /** * Destroys a currency. * - * * @throws FireflyException */ public function destroy(Request $request, TransactionCurrency $currency): Redirector|RedirectResponse diff --git a/app/Http/Controllers/TransactionCurrency/EditController.php b/app/Http/Controllers/TransactionCurrency/EditController.php index 6bd0732c30..6bf640391d 100644 --- a/app/Http/Controllers/TransactionCurrency/EditController.php +++ b/app/Http/Controllers/TransactionCurrency/EditController.php @@ -67,7 +67,7 @@ class EditController extends Controller * * @return Factory|Redirector|RedirectResponse|View */ - public function edit(Request $request, TransactionCurrency $currency): Redirector|RedirectResponse|Factory|\Illuminate\Contracts\View\View + public function edit(Request $request, TransactionCurrency $currency): Factory|\Illuminate\Contracts\View\View|Redirector|RedirectResponse { /** @var User $user */ $user = auth()->user(); @@ -107,7 +107,6 @@ class EditController extends Controller /** * Updates a currency. * - * * @throws FireflyException */ public function update(CurrencyFormRequest $request, TransactionCurrency $currency): Redirector|RedirectResponse diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php index 7f920a3e23..57c3d74c9c 100644 --- a/app/Http/Middleware/Authenticate.php +++ b/app/Http/Middleware/Authenticate.php @@ -139,6 +139,7 @@ class Authenticate app('session')->flash('logoutMessage', $message); // @noinspection PhpUndefinedMethodInspection $this->auth->logout(); + // @phpstan-ignore-line (thinks function is undefined) throw new AuthenticationException('Blocked account.', $guards); } diff --git a/app/Http/Middleware/Binder.php b/app/Http/Middleware/Binder.php index 533cf46d44..0dfc35e433 100644 --- a/app/Http/Middleware/Binder.php +++ b/app/Http/Middleware/Binder.php @@ -45,8 +45,8 @@ class Binder public function __construct(/** * The authentication factory instance. */ - protected Auth $auth) - { + protected Auth $auth + ) { $this->binders = Domain::getBindables(); } diff --git a/app/Jobs/WarnAboutBills.php b/app/Jobs/WarnAboutBills.php index 0c8a3e1461..bf217497ee 100644 --- a/app/Jobs/WarnAboutBills.php +++ b/app/Jobs/WarnAboutBills.php @@ -127,6 +127,7 @@ class WarnAboutBills implements ShouldQueue $diff = $this->getDiff($bill, $field); $list = config('firefly.bill_reminder_periods'); Log::debug(sprintf('Difference in days for field "%s" ("%s") is %d day(s)', $field, $bill->{$field}->format('Y-m-d'), $diff)); + return in_array($diff, $list, true); } @@ -189,6 +190,7 @@ class WarnAboutBills implements ShouldQueue Log::debug(sprintf('Earliest expected pay date is %s', $earliest->toAtomString())); $diff = $earliest->diffInDays($this->date); Log::debug(sprintf('Difference in days is %s', $diff)); + return $diff >= 2; } diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 70eb14d731..60b90efad6 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -79,6 +79,7 @@ class AppServiceProvider extends ServiceProvider $params = Route::getCurrentRoute()->parameters(); $params ??= []; $objectType = $params['objectType'] ?? ''; + return $objectType === $firstParam && str_contains($name, $route); }); } diff --git a/app/Repositories/Journal/JournalRepository.php b/app/Repositories/Journal/JournalRepository.php index f6c99daa4b..c249f834a4 100644 --- a/app/Repositories/Journal/JournalRepository.php +++ b/app/Repositories/Journal/JournalRepository.php @@ -77,8 +77,7 @@ class JournalRepository implements JournalRepositoryInterface, UserGroupInterfac public function firstNull(): ?TransactionJournal { /** @var null|TransactionJournal $entry */ - $entry = $this->user->transactionJournals()->orderBy('date', 'ASC')->first(['transaction_journals.*']); - return $entry; + return $this->user->transactionJournals()->orderBy('date', 'ASC')->first(['transaction_journals.*']); } public function getDestinationAccount(TransactionJournal $journal): Account @@ -115,8 +114,7 @@ class JournalRepository implements JournalRepositoryInterface, UserGroupInterfac public function getLast(): ?TransactionJournal { /** @var null|TransactionJournal $entry */ - $entry = $this->user->transactionJournals()->orderBy('date', 'DESC')->first(['transaction_journals.*']); - return $entry; + return $this->user->transactionJournals()->orderBy('date', 'DESC')->first(['transaction_journals.*']); } public function getLinkNoteText(TransactionJournalLink $link): string diff --git a/app/Rules/IsAllowedGroupAction.php b/app/Rules/IsAllowedGroupAction.php index d590f21bfd..d9bbf8c3da 100644 --- a/app/Rules/IsAllowedGroupAction.php +++ b/app/Rules/IsAllowedGroupAction.php @@ -38,9 +38,7 @@ class IsAllowedGroupAction implements ValidationRule // you need these roles to do anything with any endpoint. private array $acceptedRoles = [UserRoleEnum::OWNER, UserRoleEnum::FULL]; - public function __construct(private readonly string $className, private readonly string $methodName) - { - } + public function __construct(private readonly string $className, private readonly string $methodName) {} /** * @throws AuthorizationException @@ -74,6 +72,7 @@ class IsAllowedGroupAction implements ValidationRule } catch (FireflyException $e) { Log::error($e->getTraceAsString()); } + exit('here we are'); } } diff --git a/app/Services/Internal/Support/AccountServiceTrait.php b/app/Services/Internal/Support/AccountServiceTrait.php index bce254bd60..245410d31f 100644 --- a/app/Services/Internal/Support/AccountServiceTrait.php +++ b/app/Services/Internal/Support/AccountServiceTrait.php @@ -78,6 +78,7 @@ trait AccountServiceTrait // not set, so false. return false; } + // if is set, but is empty: return (array_key_exists('opening_balance', $data) && '' === $data['opening_balance']) || (array_key_exists('opening_balance_date', $data) && '' === $data['opening_balance_date']); diff --git a/app/Services/Internal/Support/CreditRecalculateService.php b/app/Services/Internal/Support/CreditRecalculateService.php index b1dc2406aa..711732155d 100644 --- a/app/Services/Internal/Support/CreditRecalculateService.php +++ b/app/Services/Internal/Support/CreditRecalculateService.php @@ -41,9 +41,9 @@ use Illuminate\Support\Facades\Log; class CreditRecalculateService { private ?Account $account = null; - private ?TransactionGroup $group = null; + private ?TransactionGroup $group = null; private AccountRepositoryInterface $repository; - private array $work = []; + private array $work = []; public function recalculate(): void { diff --git a/app/Services/Internal/Update/GroupUpdateService.php b/app/Services/Internal/Update/GroupUpdateService.php index fcf280a403..58c245d201 100644 --- a/app/Services/Internal/Update/GroupUpdateService.php +++ b/app/Services/Internal/Update/GroupUpdateService.php @@ -105,6 +105,7 @@ class GroupUpdateService $result = array_diff($existing, $updated); Log::debug('Result of DIFF: ', $result); + /** @var string $deletedId */ foreach ($result as $deletedId) { /** @var TransactionJournal $journal */ diff --git a/app/Services/Internal/Update/JournalUpdateService.php b/app/Services/Internal/Update/JournalUpdateService.php index 0831b22d29..44278679bb 100644 --- a/app/Services/Internal/Update/JournalUpdateService.php +++ b/app/Services/Internal/Update/JournalUpdateService.php @@ -63,11 +63,11 @@ class JournalUpdateService private CurrencyRepositoryInterface $currencyRepository; private TransactionGroupRepositoryInterface $transactionGroupRepository; private array $data; - private ?Account $destinationAccount = null; - private ?Transaction $destinationTransaction = null; - private array $metaDate = ['interest_date', 'book_date', 'process_date', 'due_date', 'payment_date', + private ?Account $destinationAccount = null; + private ?Transaction $destinationTransaction = null; + private array $metaDate = ['interest_date', 'book_date', 'process_date', 'due_date', 'payment_date', 'invoice_date', ]; - private array $metaString = [ + private array $metaString = [ 'sepa_cc', 'sepa_ct_op', 'sepa_ct_id', @@ -82,11 +82,11 @@ class JournalUpdateService 'external_id', 'external_url', ]; - private ?Account $sourceAccount = null; - private ?Transaction $sourceTransaction = null; - private ?TransactionGroup $transactionGroup = null; + private ?Account $sourceAccount = null; + private ?Transaction $sourceTransaction = null; + private ?TransactionGroup $transactionGroup = null; private ?TransactionJournal $transactionJournal = null; - private string $startCompareHash = ''; + private string $startCompareHash = ''; /** * JournalUpdateService constructor. diff --git a/app/Support/Authentication/RemoteUserGuard.php b/app/Support/Authentication/RemoteUserGuard.php index a1a19ddb56..2d74a0d8c5 100644 --- a/app/Support/Authentication/RemoteUserGuard.php +++ b/app/Support/Authentication/RemoteUserGuard.php @@ -31,7 +31,6 @@ use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Contracts\Auth\Guard; use Illuminate\Contracts\Auth\UserProvider; use Illuminate\Contracts\Foundation\Application; -use Illuminate\Http\Request; use Illuminate\Support\Facades\Log; /** diff --git a/app/Support/Chart/Budget/FrontpageChartGenerator.php b/app/Support/Chart/Budget/FrontpageChartGenerator.php index 1addb48b8b..7633e4fb92 100644 --- a/app/Support/Chart/Budget/FrontpageChartGenerator.php +++ b/app/Support/Chart/Budget/FrontpageChartGenerator.php @@ -39,7 +39,7 @@ use Illuminate\Support\Facades\Log; */ class FrontpageChartGenerator { - public bool $convertToPrimary = false; + public bool $convertToPrimary = false; public TransactionCurrency $default; protected OperationsRepositoryInterface $opsRepository; private readonly BudgetLimitRepositoryInterface $blRepository; @@ -53,9 +53,9 @@ class FrontpageChartGenerator */ public function __construct() { - $this->budgetRepository = app(BudgetRepositoryInterface::class); - $this->blRepository = app(BudgetLimitRepositoryInterface::class); - $this->opsRepository = app(OperationsRepositoryInterface::class); + $this->budgetRepository = app(BudgetRepositoryInterface::class); + $this->blRepository = app(BudgetLimitRepositoryInterface::class); + $this->opsRepository = app(OperationsRepositoryInterface::class); } /** diff --git a/app/Support/Chart/Category/FrontpageChartGenerator.php b/app/Support/Chart/Category/FrontpageChartGenerator.php index 45884c710f..655f44092b 100644 --- a/app/Support/Chart/Category/FrontpageChartGenerator.php +++ b/app/Support/Chart/Category/FrontpageChartGenerator.php @@ -45,7 +45,7 @@ class FrontpageChartGenerator public bool $convertToPrimary = false; public TransactionCurrency $primaryCurrency; private AccountRepositoryInterface $accountRepos; - private array $currencies = []; + private array $currencies = []; private NoCategoryRepositoryInterface $noCatRepos; private OperationsRepositoryInterface $opsRepos; private CategoryRepositoryInterface $repository; diff --git a/app/Support/Cronjobs/AbstractCronjob.php b/app/Support/Cronjobs/AbstractCronjob.php index 6211149b05..43f4fa579c 100644 --- a/app/Support/Cronjobs/AbstractCronjob.php +++ b/app/Support/Cronjobs/AbstractCronjob.php @@ -31,20 +31,20 @@ use Carbon\Carbon; */ abstract class AbstractCronjob { - public bool $jobErrored = false; - public bool $jobFired = false; - public bool $jobSucceeded = false; - public ?string $message = null; + public bool $jobErrored = false; + public bool $jobFired = false; + public bool $jobSucceeded = false; + public ?string $message = null; public int $timeBetweenRuns = 43200; protected Carbon $date; - protected bool $force = false; + protected bool $force = false; /** * AbstractCronjob constructor. */ public function __construct() { - $this->date = today(config('app.timezone')); + $this->date = today(config('app.timezone')); } abstract public function fire(): void; diff --git a/app/Support/ExpandedForm.php b/app/Support/ExpandedForm.php index 26ca12798f..92d315ab15 100644 --- a/app/Support/ExpandedForm.php +++ b/app/Support/ExpandedForm.php @@ -225,6 +225,8 @@ class ExpandedForm } /** + * @param null|mixed $value + * * @throws FireflyException */ public function objectGroup($value = null, ?array $options = null): string diff --git a/app/Support/Export/ExportDataGenerator.php b/app/Support/Export/ExportDataGenerator.php index df551fa84b..f7cf2a8c41 100644 --- a/app/Support/Export/ExportDataGenerator.php +++ b/app/Support/Export/ExportDataGenerator.php @@ -72,18 +72,18 @@ class ExportDataGenerator { use ConvertsDataTypes; - private const string ADD_RECORD_ERR = 'Could not add record to set: %s'; - private const string EXPORT_ERR = 'Could not export to string: %s'; + private const string ADD_RECORD_ERR = 'Could not add record to set: %s'; + private const string EXPORT_ERR = 'Could not export to string: %s'; private Collection $accounts; private Carbon $end; - private bool $exportAccounts = false; - private bool $exportBills = false; - private bool $exportBudgets = false; - private bool $exportCategories = false; - private bool $exportPiggies = false; - private bool $exportRecurring = false; - private bool $exportRules = false; - private bool $exportTags = false; + private bool $exportAccounts = false; + private bool $exportBills = false; + private bool $exportBudgets = false; + private bool $exportCategories = false; + private bool $exportPiggies = false; + private bool $exportRecurring = false; + private bool $exportRules = false; + private bool $exportTags = false; private bool $exportTransactions = false; private Carbon $start; private User $user; @@ -91,10 +91,10 @@ class ExportDataGenerator public function __construct() { - $this->accounts = new Collection(); - $this->start = today(config('app.timezone')); + $this->accounts = new Collection(); + $this->start = today(config('app.timezone')); $this->start->subYear(); - $this->end = today(config('app.timezone')); + $this->end = today(config('app.timezone')); } /** diff --git a/app/Support/Http/Api/AccountBalanceGrouped.php b/app/Support/Http/Api/AccountBalanceGrouped.php index 0475d7753f..060371a4a5 100644 --- a/app/Support/Http/Api/AccountBalanceGrouped.php +++ b/app/Support/Http/Api/AccountBalanceGrouped.php @@ -52,7 +52,7 @@ class AccountBalanceGrouped public function __construct() { - $this->converter = app(ExchangeRateConverter::class); + $this->converter = app(ExchangeRateConverter::class); } /** diff --git a/app/Support/Http/Api/SummaryBalanceGrouped.php b/app/Support/Http/Api/SummaryBalanceGrouped.php index f830ed83e5..1bed87a1c6 100644 --- a/app/Support/Http/Api/SummaryBalanceGrouped.php +++ b/app/Support/Http/Api/SummaryBalanceGrouped.php @@ -31,12 +31,12 @@ use Illuminate\Support\Facades\Log; class SummaryBalanceGrouped { - private const string SUM = 'sum'; - private array $amounts = []; + private const string SUM = 'sum'; + private array $amounts = []; private array $currencies = []; private readonly CurrencyRepositoryInterface $currencyRepository; private TransactionCurrency $default; - private array $keys = [self::SUM]; + private array $keys = [self::SUM]; public function __construct() { diff --git a/app/Support/Http/Controllers/RequestInformation.php b/app/Support/Http/Controllers/RequestInformation.php index 2bd5dad925..5b7be59977 100644 --- a/app/Support/Http/Controllers/RequestInformation.php +++ b/app/Support/Http/Controllers/RequestInformation.php @@ -132,6 +132,7 @@ trait RequestInformation if ($start->greaterThanOrEqualTo($date) && $end->greaterThanOrEqualTo($date)) { return true; } + // start and end in the past? use $end return $start->lessThanOrEqualTo($date) && $end->lessThanOrEqualTo($date); } diff --git a/app/Support/JsonApi/Enrichments/BudgetLimitEnrichment.php b/app/Support/JsonApi/Enrichments/BudgetLimitEnrichment.php index a7c3385645..b5ebb7ca7f 100644 --- a/app/Support/JsonApi/Enrichments/BudgetLimitEnrichment.php +++ b/app/Support/JsonApi/Enrichments/BudgetLimitEnrichment.php @@ -83,12 +83,10 @@ class BudgetLimitEnrichment implements EnrichmentInterface public function setUser(User $user): void { - $this->user = $user; + $this->user = $user; } - public function setUserGroup(UserGroup $userGroup): void - { - } + public function setUserGroup(UserGroup $userGroup): void {} private function appendCollectedData(): void { diff --git a/app/Support/JsonApi/Enrichments/PiggyBankEnrichment.php b/app/Support/JsonApi/Enrichments/PiggyBankEnrichment.php index 2309e6b228..318768d807 100644 --- a/app/Support/JsonApi/Enrichments/PiggyBankEnrichment.php +++ b/app/Support/JsonApi/Enrichments/PiggyBankEnrichment.php @@ -90,9 +90,7 @@ class PiggyBankEnrichment implements EnrichmentInterface $this->setUserGroup($user->userGroup); } - public function setUserGroup(UserGroup $userGroup): void - { - } + public function setUserGroup(UserGroup $userGroup): void {} private function appendCollectedData(): void { diff --git a/app/Support/JsonApi/Enrichments/PiggyBankEventEnrichment.php b/app/Support/JsonApi/Enrichments/PiggyBankEventEnrichment.php index b8c78464da..4ada77c069 100644 --- a/app/Support/JsonApi/Enrichments/PiggyBankEventEnrichment.php +++ b/app/Support/JsonApi/Enrichments/PiggyBankEventEnrichment.php @@ -78,9 +78,7 @@ class PiggyBankEventEnrichment implements EnrichmentInterface $this->setUserGroup($user->userGroup); } - public function setUserGroup(UserGroup $userGroup): void - { - } + public function setUserGroup(UserGroup $userGroup): void {} private function appendCollectedData(): void { diff --git a/app/Support/JsonApi/Enrichments/SubscriptionEnrichment.php b/app/Support/JsonApi/Enrichments/SubscriptionEnrichment.php index 8d3c134f65..4a97d262a6 100644 --- a/app/Support/JsonApi/Enrichments/SubscriptionEnrichment.php +++ b/app/Support/JsonApi/Enrichments/SubscriptionEnrichment.php @@ -163,12 +163,10 @@ class SubscriptionEnrichment implements EnrichmentInterface public function setUser(User $user): void { - $this->user = $user; + $this->user = $user; } - public function setUserGroup(UserGroup $userGroup): void - { - } + public function setUserGroup(UserGroup $userGroup): void {} /** * Returns the latest date in the set, or start when set is empty. diff --git a/app/Support/JsonApi/Enrichments/TransactionGroupEnrichment.php b/app/Support/JsonApi/Enrichments/TransactionGroupEnrichment.php index f4d5fdebda..78f87d5f7b 100644 --- a/app/Support/JsonApi/Enrichments/TransactionGroupEnrichment.php +++ b/app/Support/JsonApi/Enrichments/TransactionGroupEnrichment.php @@ -94,13 +94,9 @@ class TransactionGroupEnrichment implements EnrichmentInterface throw new FireflyException('Cannot enrich single model.'); } - public function setUser(User $user): void - { - } + public function setUser(User $user): void {} - public function setUserGroup(UserGroup $userGroup): void - { - } + public function setUserGroup(UserGroup $userGroup): void {} private function appendCollectedData(): void { diff --git a/app/Support/JsonApi/Enrichments/WebhookEnrichment.php b/app/Support/JsonApi/Enrichments/WebhookEnrichment.php index 4553b494e8..6fdddf2632 100644 --- a/app/Support/JsonApi/Enrichments/WebhookEnrichment.php +++ b/app/Support/JsonApi/Enrichments/WebhookEnrichment.php @@ -73,13 +73,9 @@ class WebhookEnrichment implements EnrichmentInterface return $collection->first(); } - public function setUser(User $user): void - { - } + public function setUser(User $user): void {} - public function setUserGroup(UserGroup $userGroup): void - { - } + public function setUserGroup(UserGroup $userGroup): void {} private function appendCollectedInfo(): void { diff --git a/app/Support/ParseDateString.php b/app/Support/ParseDateString.php index b1e13aad5d..7e518f9a04 100644 --- a/app/Support/ParseDateString.php +++ b/app/Support/ParseDateString.php @@ -64,6 +64,7 @@ class ParseDateString if ('xxxx-xx-xx' === strtolower($date)) { return false; } + // no x'es return !(!str_contains($date, 'xx') && !str_contains($date, 'xxxx')); } diff --git a/app/Support/Request/AppendsLocationData.php b/app/Support/Request/AppendsLocationData.php index 26c54ef921..bcad45157d 100644 --- a/app/Support/Request/AppendsLocationData.php +++ b/app/Support/Request/AppendsLocationData.php @@ -51,9 +51,11 @@ trait AppendsLocationData /** * Abstract method stolen from "InteractsWithInput". * - * @param bool $default + * @param bool $default + * @param null|mixed $key * * @return mixed + * * @SuppressWarnings("PHPMD.BooleanArgumentFlag") */ abstract public function boolean($key = null, $default = false); diff --git a/app/Support/Request/ConvertsDataTypes.php b/app/Support/Request/ConvertsDataTypes.php index 64804987b9..8b13aefa74 100644 --- a/app/Support/Request/ConvertsDataTypes.php +++ b/app/Support/Request/ConvertsDataTypes.php @@ -274,6 +274,7 @@ trait ConvertsDataTypes if ('y' === $value) { return true; } + return '1' === $value; } diff --git a/app/Support/Search/AccountSearch.php b/app/Support/Search/AccountSearch.php index 3820caf7bc..9fbaa27e37 100644 --- a/app/Support/Search/AccountSearch.php +++ b/app/Support/Search/AccountSearch.php @@ -47,7 +47,7 @@ class AccountSearch implements GenericSearchInterface public const string SEARCH_NUMBER = 'number'; private string $field; private string $query; - private array $types = []; + private array $types = []; private User $user; public function search(): Collection diff --git a/app/Support/Search/OperatorQuerySearch.php b/app/Support/Search/OperatorQuerySearch.php index d13ebc8dd1..a8b8b6b961 100644 --- a/app/Support/Search/OperatorQuerySearch.php +++ b/app/Support/Search/OperatorQuerySearch.php @@ -66,19 +66,19 @@ class OperatorQuerySearch implements SearchInterface private readonly CategoryRepositoryInterface $categoryRepository; private GroupCollectorInterface $collector; private readonly CurrencyRepositoryInterface $currencyRepository; - private array $excludeTags = []; + private array $excludeTags = []; private array $includeAnyTags = []; // added to fix #8632 - private array $includeTags = []; - private array $invalidOperators = []; - private int $limit = 25; + private array $includeTags = []; + private array $invalidOperators = []; + private int $limit = 25; private readonly Collection $operators; - private int $page = 1; - private array $prohibitedWords = []; + private int $page = 1; + private array $prohibitedWords = []; private readonly float $startTime; private readonly TagRepositoryInterface $tagRepository; private readonly array $validOperators; - private array $words = []; + private array $words = []; /** * OperatorQuerySearch constructor. diff --git a/app/Support/Steam.php b/app/Support/Steam.php index dde23d2087..45b3595a40 100644 --- a/app/Support/Steam.php +++ b/app/Support/Steam.php @@ -291,20 +291,20 @@ class Steam } #[Deprecated(message: <<<'TXT' - - By default this method returns "smaller than or equal to", so be careful with END OF DAY. - If you need end of day balance, use "inclusive = false". - - Returns the balance of an account at exact moment given. Array with at least one value. - Always returns: - "balance": balance in the account's currency OR user's primary currency if the account has no currency - "EUR": balance in EUR (or whatever currencies the account has balance in) - - If the user has $convertToPrimary: - "balance": balance in the account's currency OR user's primary currency if the account has no currency - --> "pc_balance": balance in the user's primary currency, with all amounts converted to the primary currency. - "EUR": balance in EUR (or whatever currencies the account has balance in) - TXT)] + + By default this method returns "smaller than or equal to", so be careful with END OF DAY. + If you need end of day balance, use "inclusive = false". + + Returns the balance of an account at exact moment given. Array with at least one value. + Always returns: + "balance": balance in the account's currency OR user's primary currency if the account has no currency + "EUR": balance in EUR (or whatever currencies the account has balance in) + + If the user has $convertToPrimary: + "balance": balance in the account's currency OR user's primary currency if the account has no currency + --> "pc_balance": balance in the user's primary currency, with all amounts converted to the primary currency. + "EUR": balance in EUR (or whatever currencies the account has balance in) + TXT)] public function finalAccountBalance(Account $account, Carbon $date, ?TransactionCurrency $primary = null, ?bool $convertToPrimary = null, bool $inclusive = true): array { diff --git a/app/Support/System/OAuthKeys.php b/app/Support/System/OAuthKeys.php index a41c56085b..94b823820a 100644 --- a/app/Support/System/OAuthKeys.php +++ b/app/Support/System/OAuthKeys.php @@ -74,6 +74,7 @@ class OAuthKeys Log::error($e->getTraceAsString()); } } + return '' !== $privateKey && '' !== $publicKey; } diff --git a/app/Support/Twig/General.php b/app/Support/Twig/General.php index 7ff9b09f3e..98ca0625ae 100644 --- a/app/Support/Twig/General.php +++ b/app/Support/Twig/General.php @@ -292,6 +292,7 @@ class General extends AbstractExtension 'hasRole', static function (string $role): bool { $repository = app(UserRepositoryInterface::class); + return $repository->hasRole(auth()->user(), $role); } ); diff --git a/app/Support/Twig/TransactionGroupTwig.php b/app/Support/Twig/TransactionGroupTwig.php index 74c8199469..f22a0618d1 100644 --- a/app/Support/Twig/TransactionGroupTwig.php +++ b/app/Support/Twig/TransactionGroupTwig.php @@ -81,7 +81,7 @@ class TransactionGroupTwig extends AbstractExtension { return new TwigFunction( 'journalGetMetaDate', - static function (int $journalId, string $metaField): CarbonInterface|Carbon { + static function (int $journalId, string $metaField): Carbon|CarbonInterface { /** @var null|TransactionJournalMeta $entry */ $entry = DB::table('journal_meta') ->where('name', $metaField) diff --git a/app/Support/Twig/Translation.php b/app/Support/Twig/Translation.php index fca8a41fbb..3acc5509be 100644 --- a/app/Support/Twig/Translation.php +++ b/app/Support/Twig/Translation.php @@ -59,7 +59,7 @@ class Translation extends AbstractExtension { return new TwigFunction( 'journalLinkTranslation', - static function (string $direction, string $original): string|Translator|array { + static function (string $direction, string $original): array|string|Translator { $key = sprintf('firefly.%s_%s', $original, $direction); $translation = trans($key); if ($key === $translation) { @@ -76,7 +76,7 @@ class Translation extends AbstractExtension { return new TwigFunction( '__', - static function (string $key): string|Translator|array { + static function (string $key): array|string|Translator { $translation = trans($key); if ($key === $translation) { return $key; diff --git a/app/TransactionRules/Engine/SearchRuleEngine.php b/app/TransactionRules/Engine/SearchRuleEngine.php index fbebad10cd..80ce408749 100644 --- a/app/TransactionRules/Engine/SearchRuleEngine.php +++ b/app/TransactionRules/Engine/SearchRuleEngine.php @@ -45,17 +45,17 @@ use Illuminate\Support\Facades\Log; class SearchRuleEngine implements RuleEngineInterface { private readonly Collection $groups; - private array $operators = []; + private array $operators = []; // always collect the triggers from the database, unless indicated otherwise. private bool $refreshTriggers = true; - private array $resultCount = []; + private array $resultCount = []; private readonly Collection $rules; private User $user; public function __construct() { - $this->rules = new Collection(); - $this->groups = new Collection(); + $this->rules = new Collection(); + $this->groups = new Collection(); } public function addOperator(array $operator): void diff --git a/app/Transformers/TransactionGroupTransformer.php b/app/Transformers/TransactionGroupTransformer.php index 86e70b36bc..8f2152f973 100644 --- a/app/Transformers/TransactionGroupTransformer.php +++ b/app/Transformers/TransactionGroupTransformer.php @@ -259,6 +259,7 @@ class TransactionGroupTransformer extends AbstractTransformer return (string) $array[$key]; } + return $default; } diff --git a/app/Transformers/UserGroupTransformer.php b/app/Transformers/UserGroupTransformer.php index d89ac03fe7..2eb115fe4a 100644 --- a/app/Transformers/UserGroupTransformer.php +++ b/app/Transformers/UserGroupTransformer.php @@ -36,8 +36,8 @@ use Illuminate\Support\Collection; */ class UserGroupTransformer extends AbstractTransformer { - private array $inUse = []; - private array $memberships = []; + private array $inUse = []; + private array $memberships = []; private array $membershipsVisible = []; public function collectMetaData(Collection $objects): Collection diff --git a/app/Validation/AccountValidator.php b/app/Validation/AccountValidator.php index 385ead80da..f79768aba0 100644 --- a/app/Validation/AccountValidator.php +++ b/app/Validation/AccountValidator.php @@ -50,10 +50,10 @@ class AccountValidator use TransferValidation; use WithdrawalValidation; - public bool $createMode = false; - public string $destError = 'No error yet.'; + public bool $createMode = false; + public string $destError = 'No error yet.'; public ?Account $destination = null; - public ?Account $source = null; + public ?Account $source = null; public string $sourceError = 'No error yet.'; private AccountRepositoryInterface $accountRepository; private array $combinations; @@ -230,6 +230,7 @@ class AccountValidator protected function canCreateType(string $accountType): bool { $canCreate = [AccountTypeEnum::EXPENSE->value, AccountTypeEnum::REVENUE->value, AccountTypeEnum::INITIAL_BALANCE->value, AccountTypeEnum::LIABILITY_CREDIT->value]; + return in_array($accountType, $canCreate, true); } diff --git a/app/Validation/FireflyValidator.php b/app/Validation/FireflyValidator.php index 380d2e4e48..c613f0064f 100644 --- a/app/Validation/FireflyValidator.php +++ b/app/Validation/FireflyValidator.php @@ -123,6 +123,7 @@ class FireflyValidator extends Validator } $regex = '/^[a-z]{6}[0-9a-z]{2}([0-9a-z]{3})?\z/i'; $result = preg_match($regex, $value); + return 0 !== $result; } diff --git a/app/Validation/TransactionValidation.php b/app/Validation/TransactionValidation.php index be8270f264..373df8f9fe 100644 --- a/app/Validation/TransactionValidation.php +++ b/app/Validation/TransactionValidation.php @@ -302,6 +302,7 @@ trait TransactionValidation private function isLiability(Account $account): bool { $type = $account->accountType->type; + return in_array($type, config('firefly.valid_liabilities'), true); } @@ -323,6 +324,7 @@ trait TransactionValidation if ('' === $transaction['foreign_amount']) { return false; } + return 0 !== bccomp('0', (string) $transaction['foreign_amount']); } @@ -750,6 +752,7 @@ trait TransactionValidation // source ID's are equal, return void. return true; } + // source names are equal, return void. return (bool) $this->arrayEqual($comparison['source_name']); } @@ -765,6 +768,7 @@ trait TransactionValidation // destination ID's are equal, return void. return true; } + // destination names are equal, return void. return (bool) $this->arrayEqual($comparison['destination_name']); } @@ -783,6 +787,7 @@ trait TransactionValidation // destination ID's are equal, return void. return true; } + // destination names are equal, return void. return (bool) $this->arrayEqual($comparison['destination_name']); } diff --git a/config/firefly.php b/config/firefly.php index c84ebde36a..6f0e0ba5c9 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -78,8 +78,8 @@ return [ 'running_balance_column' => env('USE_RUNNING_BALANCE', false), // see cer.php for exchange rates feature flag. ], - 'version' => '6.4.6', - 'build_time' => 1762641809, + 'version' => 'develop/2025-11-09', + 'build_time' => 1762675805, 'api_version' => '2.1.0', // field is no longer used. 'db_version' => 28, // field is no longer used.