From ba0843d0bb6f095a6b9dc87fe470872fbb51fe57 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 4 Nov 2023 14:18:49 +0100 Subject: [PATCH] Code cleanup --- .../Autocomplete/AccountController.php | 2 +- app/Api/V1/Controllers/Controller.php | 4 +- .../TransactionCurrency/ListController.php | 4 +- .../Autocomplete/AutocompleteRequest.php | 2 +- app/Api/V1/Requests/Data/DateRequest.php | 2 +- app/Api/V1/Requests/Data/DestroyRequest.php | 2 +- app/Api/V1/Requests/Data/SameDateRequest.php | 2 +- .../V1/Requests/Insight/GenericRequest.php | 2 +- .../Requests/Models/Account/StoreRequest.php | 4 +- .../Requests/Models/Account/UpdateRequest.php | 2 +- .../Models/Attachment/StoreRequest.php | 2 +- .../Models/Attachment/UpdateRequest.php | 2 +- .../Models/AvailableBudget/Request.php | 4 +- .../V1/Requests/Models/Bill/StoreRequest.php | 2 +- .../V1/Requests/Models/Bill/UpdateRequest.php | 2 +- .../Requests/Models/Budget/StoreRequest.php | 2 +- .../Requests/Models/Budget/UpdateRequest.php | 2 +- .../Models/BudgetLimit/StoreRequest.php | 2 +- .../Models/BudgetLimit/UpdateRequest.php | 4 +- .../Requests/Models/Category/StoreRequest.php | 2 +- .../Models/Category/UpdateRequest.php | 2 +- .../Models/ObjectGroup/UpdateRequest.php | 2 +- .../Models/PiggyBank/StoreRequest.php | 2 +- .../Models/PiggyBank/UpdateRequest.php | 2 +- .../Models/Recurrence/StoreRequest.php | 6 +- .../Models/Recurrence/UpdateRequest.php | 6 +- .../V1/Requests/Models/Rule/StoreRequest.php | 2 +- .../V1/Requests/Models/Rule/TestRequest.php | 2 +- .../Requests/Models/Rule/TriggerRequest.php | 2 +- .../V1/Requests/Models/Rule/UpdateRequest.php | 2 +- .../Models/RuleGroup/StoreRequest.php | 2 +- .../Requests/Models/RuleGroup/TestRequest.php | 2 +- .../Models/RuleGroup/TriggerRequest.php | 2 +- .../Models/RuleGroup/UpdateRequest.php | 2 +- .../V1/Requests/Models/Tag/StoreRequest.php | 4 +- .../V1/Requests/Models/Tag/UpdateRequest.php | 4 +- .../Models/Transaction/StoreRequest.php | 10 +- .../Models/Transaction/UpdateRequest.php | 6 +- .../TransactionCurrency/StoreRequest.php | 2 +- .../TransactionCurrency/UpdateRequest.php | 2 +- .../Models/TransactionLink/StoreRequest.php | 2 +- .../Models/TransactionLink/UpdateRequest.php | 2 +- .../TransactionLinkType/StoreRequest.php | 2 +- .../TransactionLinkType/UpdateRequest.php | 2 +- .../Requests/Models/Webhook/CreateRequest.php | 6 +- app/Api/V1/Requests/System/UpdateRequest.php | 2 +- .../V1/Requests/System/UserStoreRequest.php | 2 +- .../V1/Requests/System/UserUpdateRequest.php | 2 +- .../Autocomplete/AccountController.php | 2 +- .../Controllers/Chart/CategoryController.php | 2 +- .../Autocomplete/AutocompleteRequest.php | 2 +- .../V2/Request/Chart/BalanceChartRequest.php | 6 +- app/Api/V2/Request/Generic/DateRequest.php | 2 +- .../V2/Request/Generic/SingleDateRequest.php | 2 +- .../Model/Transaction/StoreRequest.php | 12 +- .../UserGroup/UpdateMembershipRequest.php | 2 +- .../Commands/Correction/EnableCurrencies.php | 2 +- .../Commands/Correction/FixAccountTypes.php | 4 +- .../Commands/Correction/FixUnevenAmount.php | 2 +- .../Commands/System/ForceDecimalSize.php | 16 +- app/Events/DestroyedTransactionLink.php | 2 +- app/Exceptions/Handler.php | 8 +- app/Exceptions/IntervalException.php | 6 +- app/Factory/RecurrenceFactory.php | 2 +- .../Report/ReportGeneratorInterface.php | 14 +- app/Handlers/Events/APIEventHandler.php | 2 +- app/Handlers/Events/AdminEventHandler.php | 6 +- app/Handlers/Events/AutomationHandler.php | 2 +- app/Handlers/Events/BillEventHandler.php | 2 +- app/Handlers/Events/UserEventHandler.php | 8 +- app/Handlers/Events/WebhookEventHandler.php | 2 +- .../Observer/TransactionJournalObserver.php | 2 +- app/Helpers/Attachments/AttachmentHelper.php | 2 +- .../Collector/Extensions/AmountCollection.php | 8 +- .../Extensions/AttachmentCollection.php | 36 +- .../Collector/Extensions/MetaCollection.php | 20 +- .../Collector/Extensions/TimeCollection.php | 32 +- app/Helpers/Collector/GroupCollector.php | 14 +- .../Collector/GroupCollectorInterface.php | 374 +++++++++--------- .../Controllers/Auth/RegisterController.php | 2 +- .../Controllers/Budget/ShowController.php | 2 +- .../Controllers/Chart/AccountController.php | 2 +- .../Controllers/Chart/BudgetController.php | 2 +- .../Controllers/Chart/CategoryController.php | 2 +- .../Controllers/Chart/PiggyBankController.php | 4 +- app/Http/Controllers/Controller.php | 2 +- app/Http/Controllers/DebugController.php | 8 +- app/Http/Controllers/Json/BoxController.php | 4 +- .../Controllers/PreferencesController.php | 2 +- .../Controllers/Rule/CreateController.php | 2 +- app/Http/Controllers/Rule/EditController.php | 2 +- .../Controllers/Rule/SelectController.php | 2 +- .../TransactionCurrency/IndexController.php | 2 +- .../Controllers/Webhooks/CreateController.php | 2 +- .../Controllers/Webhooks/DeleteController.php | 2 +- .../Controllers/Webhooks/EditController.php | 2 +- .../Controllers/Webhooks/IndexController.php | 2 +- .../Controllers/Webhooks/ShowController.php | 2 +- app/Http/Requests/AccountFormRequest.php | 2 +- app/Http/Requests/AttachmentFormRequest.php | 2 +- app/Http/Requests/BillStoreRequest.php | 4 +- app/Http/Requests/BillUpdateRequest.php | 4 +- app/Http/Requests/BudgetFormStoreRequest.php | 2 +- app/Http/Requests/BudgetFormUpdateRequest.php | 2 +- app/Http/Requests/BulkEditJournalRequest.php | 2 +- app/Http/Requests/CategoryFormRequest.php | 2 +- app/Http/Requests/CurrencyFormRequest.php | 2 +- app/Http/Requests/InviteUserFormRequest.php | 2 +- app/Http/Requests/JournalLinkRequest.php | 2 +- app/Http/Requests/NewUserFormRequest.php | 2 +- app/Http/Requests/ObjectGroupFormRequest.php | 2 +- app/Http/Requests/PiggyBankStoreRequest.php | 2 +- app/Http/Requests/PiggyBankUpdateRequest.php | 2 +- .../Requests/ReconciliationStoreRequest.php | 2 +- app/Http/Requests/RecurrenceFormRequest.php | 2 +- app/Http/Requests/RuleFormRequest.php | 2 +- app/Http/Requests/RuleGroupFormRequest.php | 2 +- app/Http/Requests/TagFormRequest.php | 2 +- app/Http/Requests/TestRuleFormRequest.php | 2 +- .../Requests/TriggerRecurrenceRequest.php | 2 +- app/Http/Requests/UserFormRequest.php | 2 +- app/Jobs/MailError.php | 6 +- app/Models/Account.php | 6 +- app/Models/Attachment.php | 2 +- app/Models/AutoBudget.php | 2 +- app/Models/AvailableBudget.php | 4 +- app/Models/Bill.php | 6 +- app/Models/Budget.php | 2 +- app/Models/BudgetLimit.php | 4 +- app/Models/Category.php | 2 +- app/Models/CurrencyExchangeRate.php | 4 +- app/Models/InvitedUser.php | 2 +- app/Models/LinkType.php | 2 +- app/Models/ObjectGroup.php | 2 +- app/Models/PiggyBank.php | 4 +- app/Models/PiggyBankEvent.php | 2 +- app/Models/PiggyBankRepetition.php | 6 +- app/Models/Preference.php | 4 +- app/Models/Recurrence.php | 2 +- app/Models/RecurrenceTransaction.php | 4 +- app/Models/Rule.php | 2 +- app/Models/RuleGroup.php | 2 +- app/Models/Tag.php | 2 +- app/Models/Transaction.php | 6 +- app/Models/TransactionCurrency.php | 2 +- app/Models/TransactionGroup.php | 2 +- app/Models/TransactionJournal.php | 4 +- app/Models/TransactionJournalLink.php | 2 +- app/Models/TransactionType.php | 2 +- app/Models/UserGroup.php | 4 +- app/Models/Webhook.php | 2 +- app/Models/WebhookAttempt.php | 2 +- app/Models/WebhookMessage.php | 4 +- .../Admin/VersionCheckResult.php | 2 +- app/Notifications/User/BillReminder.php | 2 +- app/Notifications/User/RuleActionFailed.php | 4 +- app/Providers/AccountServiceProvider.php | 6 +- app/Providers/AdminServiceProvider.php | 2 +- app/Providers/AppServiceProvider.php | 2 +- app/Providers/AttachmentServiceProvider.php | 2 +- app/Providers/AuthServiceProvider.php | 2 +- app/Providers/BillServiceProvider.php | 4 +- app/Providers/CurrencyServiceProvider.php | 4 +- app/Providers/FireflySessionProvider.php | 4 +- app/Providers/PiggyBankServiceProvider.php | 4 +- app/Providers/RecurringServiceProvider.php | 2 +- app/Providers/RuleGroupServiceProvider.php | 2 +- app/Providers/RuleServiceProvider.php | 2 +- app/Providers/SearchServiceProvider.php | 2 +- app/Providers/TagServiceProvider.php | 4 +- .../Account/AccountRepository.php | 12 +- .../Journal/JournalAPIRepository.php | 2 +- .../LinkType/LinkTypeRepository.php | 2 +- .../Recurring/RecurringRepository.php | 4 +- .../RuleGroup/RuleGroupRepository.php | 8 +- .../UserGroup/UserGroupRepository.php | 4 +- .../UserGroups/Account/AccountRepository.php | 2 +- .../Currency/CurrencyRepository.php | 8 +- .../Webhook/WebhookRepository.php | 2 +- app/Rules/IsValidBulkClause.php | 2 +- app/Rules/UniqueIban.php | 2 +- .../Internal/Update/CurrencyUpdateService.php | 4 +- .../Internal/Update/GroupUpdateService.php | 2 +- .../Update/RecurrenceUpdateService.php | 2 +- .../Authentication/RemoteUserGuard.php | 2 +- app/Support/Binder/Date.php | 2 +- app/Support/Calendar/Calculator.php | 2 +- app/Support/ExpandedForm.php | 2 +- app/Support/Navigation.php | 2 +- app/Support/NullArrayObject.php | 2 +- app/Support/Search/AccountSearch.php | 4 +- app/Support/Search/OperatorQuerySearch.php | 4 +- app/Support/Twig/General.php | 2 +- .../Engine/SearchRuleEngine.php | 2 +- app/User.php | 12 +- app/Validation/AccountValidator.php | 8 +- app/Validation/FireflyValidator.php | 4 +- .../2020_07_24_162820_changes_for_v540.php | 2 +- .../2020_11_12_070604_changes_for_v550.php | 8 +- .../2021_03_12_061213_changes_for_v550b2.php | 4 +- ...064644_add_ldap_columns_to_users_table.php | 4 +- ...2021_05_13_053836_extend_currency_info.php | 2 +- .../2021_08_28_073733_user_groups.php | 8 +- ...ate_local_personal_access_tokens_table.php | 2 +- .../2022_08_21_104626_add_user_groups.php | 4 +- ...9_18_123911_create_notifications_table.php | 2 +- .../2022_10_01_074908_invited_users.php | 2 +- .../2022_10_01_210238_audit_log_entries.php | 2 +- .../2023_08_11_192521_upgrade_og_table.php | 4 +- ...10_21_113213_add_currency_pivot_tables.php | 4 +- routes/web.php | 2 +- 211 files changed, 566 insertions(+), 568 deletions(-) diff --git a/app/Api/V1/Controllers/Autocomplete/AccountController.php b/app/Api/V1/Controllers/Autocomplete/AccountController.php index ec5b9e614a..e608f9f6ed 100644 --- a/app/Api/V1/Controllers/Autocomplete/AccountController.php +++ b/app/Api/V1/Controllers/Autocomplete/AccountController.php @@ -118,7 +118,7 @@ class AccountController extends Controller // custom order. usort( $return, - function ($a, $b) { + static function ($a, $b) { $order = [AccountType::ASSET, AccountType::REVENUE, AccountType::EXPENSE]; $posA = array_search($a['type'], $order, true); $posB = array_search($b['type'], $order, true); diff --git a/app/Api/V1/Controllers/Controller.php b/app/Api/V1/Controllers/Controller.php index 5c38c5cd80..e23553a25d 100644 --- a/app/Api/V1/Controllers/Controller.php +++ b/app/Api/V1/Controllers/Controller.php @@ -88,8 +88,8 @@ abstract class Controller extends BaseController if ($page < 1) { $page = 1; } - if ($page > pow(2, 16)) { - $page = pow(2, 16); + if ($page > 2** 16) { + $page = 2** 16; } $bag->set('page', $page); diff --git a/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php b/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php index f4a2fa05b3..9259afde53 100644 --- a/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php +++ b/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php @@ -255,7 +255,7 @@ class ListController extends Controller $unfiltered = $recurringRepos->getAll(); // filter selection - $collection = $unfiltered->filter( // @phpstan-ignore-line + $collection = $unfiltered->filter( /** @phpstan-ignore-line */ static function (Recurrence $recurrence) use ($currency) { // @phpstan-ignore-line /** @var RecurrenceTransaction $transaction */ foreach ($recurrence->recurrenceTransactions as $transaction) { @@ -305,7 +305,7 @@ class ListController extends Controller $ruleRepos = app(RuleRepositoryInterface::class); $unfiltered = $ruleRepos->getAll(); - $collection = $unfiltered->filter( // @phpstan-ignore-line + $collection = $unfiltered->filter( /** @phpstan-ignore-line */ static function (Rule $rule) use ($currency) { // @phpstan-ignore-line /** @var RuleTrigger $trigger */ foreach ($rule->ruleTriggers as $trigger) { diff --git a/app/Api/V1/Requests/Autocomplete/AutocompleteRequest.php b/app/Api/V1/Requests/Autocomplete/AutocompleteRequest.php index 875d1f7335..c1d6069f15 100644 --- a/app/Api/V1/Requests/Autocomplete/AutocompleteRequest.php +++ b/app/Api/V1/Requests/Autocomplete/AutocompleteRequest.php @@ -33,8 +33,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class AutocompleteRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * @return array diff --git a/app/Api/V1/Requests/Data/DateRequest.php b/app/Api/V1/Requests/Data/DateRequest.php index a6e1cdf23b..882412a46b 100644 --- a/app/Api/V1/Requests/Data/DateRequest.php +++ b/app/Api/V1/Requests/Data/DateRequest.php @@ -35,8 +35,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class DateRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Get all data from the request. diff --git a/app/Api/V1/Requests/Data/DestroyRequest.php b/app/Api/V1/Requests/Data/DestroyRequest.php index ea96e92c26..3a9ca8d1d9 100644 --- a/app/Api/V1/Requests/Data/DestroyRequest.php +++ b/app/Api/V1/Requests/Data/DestroyRequest.php @@ -32,8 +32,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class DestroyRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Get all data from the request. diff --git a/app/Api/V1/Requests/Data/SameDateRequest.php b/app/Api/V1/Requests/Data/SameDateRequest.php index 549bf58563..19fe7829a6 100644 --- a/app/Api/V1/Requests/Data/SameDateRequest.php +++ b/app/Api/V1/Requests/Data/SameDateRequest.php @@ -35,8 +35,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class SameDateRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Get all data from the request. diff --git a/app/Api/V1/Requests/Insight/GenericRequest.php b/app/Api/V1/Requests/Insight/GenericRequest.php index 0eb22bc584..82624ba7df 100644 --- a/app/Api/V1/Requests/Insight/GenericRequest.php +++ b/app/Api/V1/Requests/Insight/GenericRequest.php @@ -42,8 +42,8 @@ use Illuminate\Support\Collection; */ class GenericRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; private Collection $accounts; private Collection $bills; diff --git a/app/Api/V1/Requests/Models/Account/StoreRequest.php b/app/Api/V1/Requests/Models/Account/StoreRequest.php index d46322bea9..3f42208f1b 100644 --- a/app/Api/V1/Requests/Models/Account/StoreRequest.php +++ b/app/Api/V1/Requests/Models/Account/StoreRequest.php @@ -40,9 +40,9 @@ use Illuminate\Foundation\Http\FormRequest; */ class StoreRequest extends FormRequest { - use ConvertsDataTypes; use AppendsLocationData; use ChecksLogin; + use ConvertsDataTypes; /** * @return array @@ -124,7 +124,7 @@ class StoreRequest extends FormRequest 'liability_start_date' => 'required_with:liability_amount|date', 'liability_direction' => 'nullable|required_if:type,liability|required_if:type,liabilities|in:credit,debit', 'interest' => 'between:0,100|numeric', - 'interest_period' => sprintf('nullable|in:%s', join(',', config('firefly.interest_periods'))), + 'interest_period' => sprintf('nullable|in:%s', implode(',', config('firefly.interest_periods'))), 'notes' => 'min:0|max:65536', ]; diff --git a/app/Api/V1/Requests/Models/Account/UpdateRequest.php b/app/Api/V1/Requests/Models/Account/UpdateRequest.php index d50f9d10eb..9428fa545a 100644 --- a/app/Api/V1/Requests/Models/Account/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/Account/UpdateRequest.php @@ -41,9 +41,9 @@ use Illuminate\Foundation\Http\FormRequest; */ class UpdateRequest extends FormRequest { - use ConvertsDataTypes; use AppendsLocationData; use ChecksLogin; + use ConvertsDataTypes; /** * @return array diff --git a/app/Api/V1/Requests/Models/Attachment/StoreRequest.php b/app/Api/V1/Requests/Models/Attachment/StoreRequest.php index 565c8a4cd4..aca785df2f 100644 --- a/app/Api/V1/Requests/Models/Attachment/StoreRequest.php +++ b/app/Api/V1/Requests/Models/Attachment/StoreRequest.php @@ -35,8 +35,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class StoreRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Get all data from the request. diff --git a/app/Api/V1/Requests/Models/Attachment/UpdateRequest.php b/app/Api/V1/Requests/Models/Attachment/UpdateRequest.php index 854a156df4..98734b2713 100644 --- a/app/Api/V1/Requests/Models/Attachment/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/Attachment/UpdateRequest.php @@ -35,8 +35,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class UpdateRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Get all data from the request. diff --git a/app/Api/V1/Requests/Models/AvailableBudget/Request.php b/app/Api/V1/Requests/Models/AvailableBudget/Request.php index f92de0da5a..637f1ca192 100644 --- a/app/Api/V1/Requests/Models/AvailableBudget/Request.php +++ b/app/Api/V1/Requests/Models/AvailableBudget/Request.php @@ -36,8 +36,8 @@ use Illuminate\Validation\Validator; */ class Request extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Get all data from the request. @@ -84,7 +84,7 @@ class Request extends FormRequest public function withValidator(Validator $validator): void { $validator->after( - function (Validator $validator) { + static function (Validator $validator) { // validate start before end only if both are there. $data = $validator->getData(); if (array_key_exists('start', $data) && array_key_exists('end', $data)) { diff --git a/app/Api/V1/Requests/Models/Bill/StoreRequest.php b/app/Api/V1/Requests/Models/Bill/StoreRequest.php index 6be7a232f0..3dfbe6c012 100644 --- a/app/Api/V1/Requests/Models/Bill/StoreRequest.php +++ b/app/Api/V1/Requests/Models/Bill/StoreRequest.php @@ -37,8 +37,8 @@ use Illuminate\Validation\Validator; */ class StoreRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Get all data from the request. diff --git a/app/Api/V1/Requests/Models/Bill/UpdateRequest.php b/app/Api/V1/Requests/Models/Bill/UpdateRequest.php index 25adeb2705..dc912d1197 100644 --- a/app/Api/V1/Requests/Models/Bill/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/Bill/UpdateRequest.php @@ -38,8 +38,8 @@ use Illuminate\Validation\Validator; */ class UpdateRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Get all data from the request. diff --git a/app/Api/V1/Requests/Models/Budget/StoreRequest.php b/app/Api/V1/Requests/Models/Budget/StoreRequest.php index 78714bb474..a4e762411b 100644 --- a/app/Api/V1/Requests/Models/Budget/StoreRequest.php +++ b/app/Api/V1/Requests/Models/Budget/StoreRequest.php @@ -37,9 +37,9 @@ use Illuminate\Validation\Validator; */ class StoreRequest extends FormRequest { + use ChecksLogin; use ConvertsDataTypes; use ValidatesAutoBudgetRequest; - use ChecksLogin; /** * Get all data from the request. diff --git a/app/Api/V1/Requests/Models/Budget/UpdateRequest.php b/app/Api/V1/Requests/Models/Budget/UpdateRequest.php index 2fd5e43560..4365619962 100644 --- a/app/Api/V1/Requests/Models/Budget/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/Budget/UpdateRequest.php @@ -38,9 +38,9 @@ use Illuminate\Validation\Validator; */ class UpdateRequest extends FormRequest { + use ChecksLogin; use ConvertsDataTypes; use ValidatesAutoBudgetRequest; - use ChecksLogin; /** * Get all data from the request. diff --git a/app/Api/V1/Requests/Models/BudgetLimit/StoreRequest.php b/app/Api/V1/Requests/Models/BudgetLimit/StoreRequest.php index 1c003221ef..d3f9de820c 100644 --- a/app/Api/V1/Requests/Models/BudgetLimit/StoreRequest.php +++ b/app/Api/V1/Requests/Models/BudgetLimit/StoreRequest.php @@ -34,8 +34,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class StoreRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Get all data from the request. diff --git a/app/Api/V1/Requests/Models/BudgetLimit/UpdateRequest.php b/app/Api/V1/Requests/Models/BudgetLimit/UpdateRequest.php index 4df2b88936..81b4d3499a 100644 --- a/app/Api/V1/Requests/Models/BudgetLimit/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/BudgetLimit/UpdateRequest.php @@ -36,8 +36,8 @@ use Illuminate\Validation\Validator; */ class UpdateRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Get all data from the request. @@ -84,7 +84,7 @@ class UpdateRequest extends FormRequest public function withValidator(Validator $validator): void { $validator->after( - function (Validator $validator) { + static function (Validator $validator) { // validate start before end only if both are there. $data = $validator->getData(); if (array_key_exists('start', $data) && array_key_exists('end', $data)) { diff --git a/app/Api/V1/Requests/Models/Category/StoreRequest.php b/app/Api/V1/Requests/Models/Category/StoreRequest.php index 5bff239013..4d06ada65b 100644 --- a/app/Api/V1/Requests/Models/Category/StoreRequest.php +++ b/app/Api/V1/Requests/Models/Category/StoreRequest.php @@ -35,8 +35,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class StoreRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Get all data from the request. diff --git a/app/Api/V1/Requests/Models/Category/UpdateRequest.php b/app/Api/V1/Requests/Models/Category/UpdateRequest.php index aaaf9bfde1..43e1f4cc5f 100644 --- a/app/Api/V1/Requests/Models/Category/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/Category/UpdateRequest.php @@ -35,8 +35,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class UpdateRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Get all data from the request. diff --git a/app/Api/V1/Requests/Models/ObjectGroup/UpdateRequest.php b/app/Api/V1/Requests/Models/ObjectGroup/UpdateRequest.php index 9a9f96d8da..afd86d9ca9 100644 --- a/app/Api/V1/Requests/Models/ObjectGroup/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/ObjectGroup/UpdateRequest.php @@ -36,8 +36,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class UpdateRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * @return array diff --git a/app/Api/V1/Requests/Models/PiggyBank/StoreRequest.php b/app/Api/V1/Requests/Models/PiggyBank/StoreRequest.php index d737a7e00e..237134bd50 100644 --- a/app/Api/V1/Requests/Models/PiggyBank/StoreRequest.php +++ b/app/Api/V1/Requests/Models/PiggyBank/StoreRequest.php @@ -34,8 +34,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class StoreRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Get all data from the request. diff --git a/app/Api/V1/Requests/Models/PiggyBank/UpdateRequest.php b/app/Api/V1/Requests/Models/PiggyBank/UpdateRequest.php index 7eb4ae1dba..f133190265 100644 --- a/app/Api/V1/Requests/Models/PiggyBank/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/PiggyBank/UpdateRequest.php @@ -37,8 +37,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class UpdateRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Get all data from the request. diff --git a/app/Api/V1/Requests/Models/Recurrence/StoreRequest.php b/app/Api/V1/Requests/Models/Recurrence/StoreRequest.php index bfd273969d..5cd4ea8071 100644 --- a/app/Api/V1/Requests/Models/Recurrence/StoreRequest.php +++ b/app/Api/V1/Requests/Models/Recurrence/StoreRequest.php @@ -39,12 +39,12 @@ use Illuminate\Validation\Validator; */ class StoreRequest extends FormRequest { + use ChecksLogin; use ConvertsDataTypes; - use RecurrenceValidation; - use TransactionValidation; use CurrencyValidation; use GetRecurrenceData; - use ChecksLogin; + use RecurrenceValidation; + use TransactionValidation; /** * Get all data from the request. diff --git a/app/Api/V1/Requests/Models/Recurrence/UpdateRequest.php b/app/Api/V1/Requests/Models/Recurrence/UpdateRequest.php index dc30dbaf1b..829b6a26d7 100644 --- a/app/Api/V1/Requests/Models/Recurrence/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/Recurrence/UpdateRequest.php @@ -40,12 +40,12 @@ use Illuminate\Validation\Validator; */ class UpdateRequest extends FormRequest { + use ChecksLogin; use ConvertsDataTypes; - use RecurrenceValidation; - use TransactionValidation; use CurrencyValidation; use GetRecurrenceData; - use ChecksLogin; + use RecurrenceValidation; + use TransactionValidation; /** * Get all data from the request. diff --git a/app/Api/V1/Requests/Models/Rule/StoreRequest.php b/app/Api/V1/Requests/Models/Rule/StoreRequest.php index 74a08c019e..8e128c980f 100644 --- a/app/Api/V1/Requests/Models/Rule/StoreRequest.php +++ b/app/Api/V1/Requests/Models/Rule/StoreRequest.php @@ -35,9 +35,9 @@ use Illuminate\Validation\Validator; */ class StoreRequest extends FormRequest { + use ChecksLogin; use ConvertsDataTypes; use GetRuleConfiguration; - use ChecksLogin; /** * Get all data from the request. diff --git a/app/Api/V1/Requests/Models/Rule/TestRequest.php b/app/Api/V1/Requests/Models/Rule/TestRequest.php index 85bca14157..479941f43d 100644 --- a/app/Api/V1/Requests/Models/Rule/TestRequest.php +++ b/app/Api/V1/Requests/Models/Rule/TestRequest.php @@ -34,8 +34,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class TestRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * @return array diff --git a/app/Api/V1/Requests/Models/Rule/TriggerRequest.php b/app/Api/V1/Requests/Models/Rule/TriggerRequest.php index 85a32acc4c..5786a4f9cc 100644 --- a/app/Api/V1/Requests/Models/Rule/TriggerRequest.php +++ b/app/Api/V1/Requests/Models/Rule/TriggerRequest.php @@ -34,8 +34,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class TriggerRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * @return array diff --git a/app/Api/V1/Requests/Models/Rule/UpdateRequest.php b/app/Api/V1/Requests/Models/Rule/UpdateRequest.php index 8a54a07c44..e99b1ebca0 100644 --- a/app/Api/V1/Requests/Models/Rule/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/Rule/UpdateRequest.php @@ -36,9 +36,9 @@ use Illuminate\Validation\Validator; */ class UpdateRequest extends FormRequest { + use ChecksLogin; use ConvertsDataTypes; use GetRuleConfiguration; - use ChecksLogin; /** * Get all data from the request. diff --git a/app/Api/V1/Requests/Models/RuleGroup/StoreRequest.php b/app/Api/V1/Requests/Models/RuleGroup/StoreRequest.php index 00ffa6ec55..afbf3a1c83 100644 --- a/app/Api/V1/Requests/Models/RuleGroup/StoreRequest.php +++ b/app/Api/V1/Requests/Models/RuleGroup/StoreRequest.php @@ -33,8 +33,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class StoreRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Get all data from the request. diff --git a/app/Api/V1/Requests/Models/RuleGroup/TestRequest.php b/app/Api/V1/Requests/Models/RuleGroup/TestRequest.php index cd0adf758b..65e1c4c352 100644 --- a/app/Api/V1/Requests/Models/RuleGroup/TestRequest.php +++ b/app/Api/V1/Requests/Models/RuleGroup/TestRequest.php @@ -34,8 +34,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class TestRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * @return array diff --git a/app/Api/V1/Requests/Models/RuleGroup/TriggerRequest.php b/app/Api/V1/Requests/Models/RuleGroup/TriggerRequest.php index 9049dc3310..671fc4f12c 100644 --- a/app/Api/V1/Requests/Models/RuleGroup/TriggerRequest.php +++ b/app/Api/V1/Requests/Models/RuleGroup/TriggerRequest.php @@ -34,8 +34,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class TriggerRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * @return array diff --git a/app/Api/V1/Requests/Models/RuleGroup/UpdateRequest.php b/app/Api/V1/Requests/Models/RuleGroup/UpdateRequest.php index a417570bce..1989cdaaf5 100644 --- a/app/Api/V1/Requests/Models/RuleGroup/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/RuleGroup/UpdateRequest.php @@ -34,8 +34,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class UpdateRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Get all data from the request. diff --git a/app/Api/V1/Requests/Models/Tag/StoreRequest.php b/app/Api/V1/Requests/Models/Tag/StoreRequest.php index 5f0ce7737b..a68ca04c61 100644 --- a/app/Api/V1/Requests/Models/Tag/StoreRequest.php +++ b/app/Api/V1/Requests/Models/Tag/StoreRequest.php @@ -36,9 +36,9 @@ use Illuminate\Foundation\Http\FormRequest; */ class StoreRequest extends FormRequest { - use ConvertsDataTypes; - use ChecksLogin; use AppendsLocationData; + use ChecksLogin; + use ConvertsDataTypes; /** * Get all data from the request. diff --git a/app/Api/V1/Requests/Models/Tag/UpdateRequest.php b/app/Api/V1/Requests/Models/Tag/UpdateRequest.php index d364e8605f..52b64662ed 100644 --- a/app/Api/V1/Requests/Models/Tag/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/Tag/UpdateRequest.php @@ -38,9 +38,9 @@ use Illuminate\Foundation\Http\FormRequest; */ class UpdateRequest extends FormRequest { - use ConvertsDataTypes; - use ChecksLogin; use AppendsLocationData; + use ChecksLogin; + use ConvertsDataTypes; /** * Get all data from the request. diff --git a/app/Api/V1/Requests/Models/Transaction/StoreRequest.php b/app/Api/V1/Requests/Models/Transaction/StoreRequest.php index caf1aee813..bf3d9a56e5 100644 --- a/app/Api/V1/Requests/Models/Transaction/StoreRequest.php +++ b/app/Api/V1/Requests/Models/Transaction/StoreRequest.php @@ -42,12 +42,12 @@ use Illuminate\Validation\Validator; */ class StoreRequest extends FormRequest { - use TransactionValidation; - use GroupValidation; - use CurrencyValidation; - use ConvertsDataTypes; - use ChecksLogin; use AppendsLocationData; + use ChecksLogin; + use ConvertsDataTypes; + use CurrencyValidation; + use GroupValidation; + use TransactionValidation; /** * Get all data. Is pretty complex because of all the ??-statements. diff --git a/app/Api/V1/Requests/Models/Transaction/UpdateRequest.php b/app/Api/V1/Requests/Models/Transaction/UpdateRequest.php index 133fe9f67d..56fa03f2fa 100644 --- a/app/Api/V1/Requests/Models/Transaction/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/Transaction/UpdateRequest.php @@ -41,10 +41,10 @@ use Illuminate\Validation\Validator; */ class UpdateRequest extends FormRequest { - use TransactionValidation; - use GroupValidation; - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; + use GroupValidation; + use TransactionValidation; private array $arrayFields; private array $booleanFields; diff --git a/app/Api/V1/Requests/Models/TransactionCurrency/StoreRequest.php b/app/Api/V1/Requests/Models/TransactionCurrency/StoreRequest.php index 479348c85b..955f6a0aaa 100644 --- a/app/Api/V1/Requests/Models/TransactionCurrency/StoreRequest.php +++ b/app/Api/V1/Requests/Models/TransactionCurrency/StoreRequest.php @@ -35,8 +35,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class StoreRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Get all data from the request. diff --git a/app/Api/V1/Requests/Models/TransactionCurrency/UpdateRequest.php b/app/Api/V1/Requests/Models/TransactionCurrency/UpdateRequest.php index 7c15fb7357..8e2e8b99d8 100644 --- a/app/Api/V1/Requests/Models/TransactionCurrency/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/TransactionCurrency/UpdateRequest.php @@ -36,8 +36,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class UpdateRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Get all data from the request. diff --git a/app/Api/V1/Requests/Models/TransactionLink/StoreRequest.php b/app/Api/V1/Requests/Models/TransactionLink/StoreRequest.php index dd97a2a4c1..7857e5df0a 100644 --- a/app/Api/V1/Requests/Models/TransactionLink/StoreRequest.php +++ b/app/Api/V1/Requests/Models/TransactionLink/StoreRequest.php @@ -36,8 +36,8 @@ use Illuminate\Validation\Validator; */ class StoreRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Get all data from the request. diff --git a/app/Api/V1/Requests/Models/TransactionLink/UpdateRequest.php b/app/Api/V1/Requests/Models/TransactionLink/UpdateRequest.php index 92cc96c909..8fd2aba40c 100644 --- a/app/Api/V1/Requests/Models/TransactionLink/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/TransactionLink/UpdateRequest.php @@ -36,8 +36,8 @@ use Illuminate\Validation\Validator; */ class UpdateRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Get all data from the request. diff --git a/app/Api/V1/Requests/Models/TransactionLinkType/StoreRequest.php b/app/Api/V1/Requests/Models/TransactionLinkType/StoreRequest.php index cc9a4a0dcf..ecc201b9fb 100644 --- a/app/Api/V1/Requests/Models/TransactionLinkType/StoreRequest.php +++ b/app/Api/V1/Requests/Models/TransactionLinkType/StoreRequest.php @@ -34,8 +34,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class StoreRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Get all data from the request. diff --git a/app/Api/V1/Requests/Models/TransactionLinkType/UpdateRequest.php b/app/Api/V1/Requests/Models/TransactionLinkType/UpdateRequest.php index ed3d1e7c95..f7e98e94c6 100644 --- a/app/Api/V1/Requests/Models/TransactionLinkType/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/TransactionLinkType/UpdateRequest.php @@ -36,8 +36,8 @@ use Illuminate\Validation\Rule; */ class UpdateRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Get all data from the request. diff --git a/app/Api/V1/Requests/Models/Webhook/CreateRequest.php b/app/Api/V1/Requests/Models/Webhook/CreateRequest.php index eb6b1ad5bf..5041c5e30b 100644 --- a/app/Api/V1/Requests/Models/Webhook/CreateRequest.php +++ b/app/Api/V1/Requests/Models/Webhook/CreateRequest.php @@ -57,9 +57,9 @@ class CreateRequest extends FormRequest // this is the way. $return = $this->getAllData($fields); - $return['trigger'] = $triggers[$return['trigger']] ?? intval($return['trigger']); - $return['response'] = $responses[$return['response']] ?? intval($return['response']); - $return['delivery'] = $deliveries[$return['delivery']] ?? intval($return['delivery']); + $return['trigger'] = $triggers[$return['trigger']] ?? (int) ($return['trigger']); + $return['response'] = $responses[$return['response']] ?? (int) ($return['response']); + $return['delivery'] = $deliveries[$return['delivery']] ?? (int) ($return['delivery']); return $return; } diff --git a/app/Api/V1/Requests/System/UpdateRequest.php b/app/Api/V1/Requests/System/UpdateRequest.php index 5c6c59fe07..173f49fa01 100644 --- a/app/Api/V1/Requests/System/UpdateRequest.php +++ b/app/Api/V1/Requests/System/UpdateRequest.php @@ -36,8 +36,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class UpdateRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Get all data from the request. diff --git a/app/Api/V1/Requests/System/UserStoreRequest.php b/app/Api/V1/Requests/System/UserStoreRequest.php index 28dae61728..b8e44ebc5d 100644 --- a/app/Api/V1/Requests/System/UserStoreRequest.php +++ b/app/Api/V1/Requests/System/UserStoreRequest.php @@ -34,8 +34,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class UserStoreRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Logged in + owner diff --git a/app/Api/V1/Requests/System/UserUpdateRequest.php b/app/Api/V1/Requests/System/UserUpdateRequest.php index 87013e88fd..46280e7b2b 100644 --- a/app/Api/V1/Requests/System/UserUpdateRequest.php +++ b/app/Api/V1/Requests/System/UserUpdateRequest.php @@ -36,8 +36,8 @@ use Illuminate\Validation\Validator; */ class UserUpdateRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Logged in + owner diff --git a/app/Api/V2/Controllers/Autocomplete/AccountController.php b/app/Api/V2/Controllers/Autocomplete/AccountController.php index a3dd036c4b..bb048cd766 100644 --- a/app/Api/V2/Controllers/Autocomplete/AccountController.php +++ b/app/Api/V2/Controllers/Autocomplete/AccountController.php @@ -123,7 +123,7 @@ class AccountController extends Controller usort( $allItems, - function (array $a, array $b): int { + static function (array $a, array $b): int { $order = [AccountType::ASSET, AccountType::REVENUE, AccountType::EXPENSE]; $pos_a = array_search($a['type'], $order, true); $pos_b = array_search($b['type'], $order, true); diff --git a/app/Api/V2/Controllers/Chart/CategoryController.php b/app/Api/V2/Controllers/Chart/CategoryController.php index 6346c40f66..421a7b6700 100644 --- a/app/Api/V2/Controllers/Chart/CategoryController.php +++ b/app/Api/V2/Controllers/Chart/CategoryController.php @@ -135,7 +135,7 @@ class CategoryController extends Controller $return = array_values($return); // order by native amount - usort($return, function (array $a, array $b) { + usort($return, static function (array $a, array $b) { return (float)$a['native_amount'] < (float)$b['native_amount'] ? 1 : -1; }); return response()->json($this->clean($return)); diff --git a/app/Api/V2/Request/Autocomplete/AutocompleteRequest.php b/app/Api/V2/Request/Autocomplete/AutocompleteRequest.php index e406a9e8b3..fbe991dc49 100644 --- a/app/Api/V2/Request/Autocomplete/AutocompleteRequest.php +++ b/app/Api/V2/Request/Autocomplete/AutocompleteRequest.php @@ -35,8 +35,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class AutocompleteRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; protected array $acceptedRoles = [UserRoleEnum::MANAGE_TRANSACTIONS]; diff --git a/app/Api/V2/Request/Chart/BalanceChartRequest.php b/app/Api/V2/Request/Chart/BalanceChartRequest.php index b2e137fe35..c0023bb944 100644 --- a/app/Api/V2/Request/Chart/BalanceChartRequest.php +++ b/app/Api/V2/Request/Chart/BalanceChartRequest.php @@ -36,8 +36,8 @@ use Illuminate\Validation\Validator; */ class BalanceChartRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; use ValidatesUserGroupTrait; /** @@ -64,7 +64,7 @@ class BalanceChartRequest extends FormRequest 'start' => 'required|date|after:1900-01-01|before:2099-12-31', 'end' => 'required|date|after_or_equal:start|before:2099-12-31|after:1900-01-01', 'accounts.*' => 'required|exists:accounts,id', - 'period' => sprintf('required|in:%s', join(',', config('firefly.valid_view_ranges'))), + 'period' => sprintf('required|in:%s', implode(',', config('firefly.valid_view_ranges'))), ]; } @@ -76,7 +76,7 @@ class BalanceChartRequest extends FormRequest public function withValidator(Validator $validator): void { $validator->after( - function (Validator $validator) { + static function (Validator $validator) { // validate transaction query data. $data = $validator->getData(); if (!array_key_exists('accounts', $data)) { diff --git a/app/Api/V2/Request/Generic/DateRequest.php b/app/Api/V2/Request/Generic/DateRequest.php index 4f8eff34d8..baa7b2c521 100644 --- a/app/Api/V2/Request/Generic/DateRequest.php +++ b/app/Api/V2/Request/Generic/DateRequest.php @@ -35,8 +35,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class DateRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Get all data from the request. diff --git a/app/Api/V2/Request/Generic/SingleDateRequest.php b/app/Api/V2/Request/Generic/SingleDateRequest.php index c76e6df39a..afd460cdcc 100644 --- a/app/Api/V2/Request/Generic/SingleDateRequest.php +++ b/app/Api/V2/Request/Generic/SingleDateRequest.php @@ -36,8 +36,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class SingleDateRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Get all data from the request. diff --git a/app/Api/V2/Request/Model/Transaction/StoreRequest.php b/app/Api/V2/Request/Model/Transaction/StoreRequest.php index 44ba9fffcc..58ffc0fc33 100644 --- a/app/Api/V2/Request/Model/Transaction/StoreRequest.php +++ b/app/Api/V2/Request/Model/Transaction/StoreRequest.php @@ -50,13 +50,13 @@ use Illuminate\Validation\Validator; */ class StoreRequest extends FormRequest { - use ChecksLogin; - use ConvertsDataTypes; - - use TransactionValidation; - use GroupValidation; - use CurrencyValidation; use AppendsLocationData; + use ChecksLogin; + + use ConvertsDataTypes; + use CurrencyValidation; + use GroupValidation; + use TransactionValidation; protected array $acceptedRoles = [UserRoleEnum::MANAGE_TRANSACTIONS]; diff --git a/app/Api/V2/Request/UserGroup/UpdateMembershipRequest.php b/app/Api/V2/Request/UserGroup/UpdateMembershipRequest.php index 75b56e49ad..552ebee6de 100644 --- a/app/Api/V2/Request/UserGroup/UpdateMembershipRequest.php +++ b/app/Api/V2/Request/UserGroup/UpdateMembershipRequest.php @@ -64,7 +64,7 @@ class UpdateMembershipRequest extends FormRequest return [ 'id' => 'exists:users,id|required_without:email', 'email' => 'exists:users,email|required_without:id', - 'roles.*' => 'required|in:' . join(',', $validRoles), + 'roles.*' => 'required|in:' . implode(',', $validRoles), ]; } } diff --git a/app/Console/Commands/Correction/EnableCurrencies.php b/app/Console/Commands/Correction/EnableCurrencies.php index f2b2e094b5..f337603954 100644 --- a/app/Console/Commands/Correction/EnableCurrencies.php +++ b/app/Console/Commands/Correction/EnableCurrencies.php @@ -80,7 +80,7 @@ class EnableCurrencies extends Command $found = array_values( array_filter( $found, - function (int $currencyId) { + static function (int $currencyId) { return $currencyId !== 0; } ) diff --git a/app/Console/Commands/Correction/FixAccountTypes.php b/app/Console/Commands/Correction/FixAccountTypes.php index a9d74e3d11..501ea2202b 100644 --- a/app/Console/Commands/Correction/FixAccountTypes.php +++ b/app/Console/Commands/Correction/FixAccountTypes.php @@ -81,11 +81,11 @@ class FixAccountTypes extends Command ->leftJoin('account_types as destination_account_type', 'destination_account.account_type_id', '=', 'destination_account_type.id'); // list all valid combinations, those are allowed. So we select those which are broken. - $query->where(function (Builder $q) use ($expected) { + $query->where(static function (Builder $q) use ($expected) { foreach ($expected as $transactionType => $info) { foreach ($info as $source => $destinations) { foreach ($destinations as $destination) { - $q->whereNot(function (Builder $q1) use ($transactionType, $source, $destination) { + $q->whereNot(static function (Builder $q1) use ($transactionType, $source, $destination) { $q1->where('transaction_types.type', $transactionType); $q1->where('source_account_type.type', $source); $q1->where('destination_account_type.type', $destination); diff --git a/app/Console/Commands/Correction/FixUnevenAmount.php b/app/Console/Commands/Correction/FixUnevenAmount.php index 9ab65c70e4..7f3668368c 100644 --- a/app/Console/Commands/Correction/FixUnevenAmount.php +++ b/app/Console/Commands/Correction/FixUnevenAmount.php @@ -56,7 +56,7 @@ class FixUnevenAmount extends Command foreach ($journals as $entry) { $sum = (string)$entry->the_sum; if (!is_numeric($sum) || - 0 === strlen($sum) || // @phpstan-ignore-line + '' === $sum || // @phpstan-ignore-line str_contains($sum, 'e') || str_contains($sum, ',')) { $message = sprintf( diff --git a/app/Console/Commands/System/ForceDecimalSize.php b/app/Console/Commands/System/ForceDecimalSize.php index 5d963ff900..09d48e7965 100644 --- a/app/Console/Commands/System/ForceDecimalSize.php +++ b/app/Console/Commands/System/ForceDecimalSize.php @@ -136,7 +136,7 @@ class ForceDecimalSize extends Command { // if sqlite, add function? if ('sqlite' === (string)config('database.default')) { - DB::connection()->getPdo()->sqliteCreateFunction('REGEXP', function ($pattern, $value) { + DB::connection()->getPdo()->sqliteCreateFunction('REGEXP', static function ($pattern, $value) { mb_regex_encoding('UTF-8'); $pattern = trim($pattern, '"'); @@ -259,7 +259,7 @@ class ForceDecimalSize extends Command continue; } // fix $field by rounding it down correctly. - $pow = pow(10, (int)$currency->decimal_places); + $pow = 10** (int)$currency->decimal_places; $correct = bcdiv((string)round($value * $pow), (string)$pow, 12); $this->friendlyInfo(sprintf('Account #%d has %s with value "%s", this has been corrected to "%s".', $account->id, $field, $value, $correct)); Account::find($account->id)->update([$field => $correct]); @@ -310,7 +310,7 @@ class ForceDecimalSize extends Command continue; } // fix $field by rounding it down correctly. - $pow = pow(10, (int)$currency->decimal_places); + $pow = 10** (int)$currency->decimal_places; $correct = bcdiv((string)round($value * $pow), (string)$pow, 12); $this->friendlyWarning(sprintf('%s #%d has %s with value "%s", this has been corrected to "%s".', $table, $item->id, $field, $value, $correct)); $class::find($item->id)->update([$field => $correct]); @@ -362,7 +362,7 @@ class ForceDecimalSize extends Command continue; } // fix $field by rounding it down correctly. - $pow = pow(10, (int)$currency->decimal_places); + $pow = 10** (int)$currency->decimal_places; $correct = bcdiv((string)round($value * $pow), (string)$pow, 12); $this->friendlyWarning( sprintf('Piggy bank event #%d has %s with value "%s", this has been corrected to "%s".', $item->id, $field, $value, $correct) @@ -416,7 +416,7 @@ class ForceDecimalSize extends Command continue; } // fix $field by rounding it down correctly. - $pow = pow(10, (int)$currency->decimal_places); + $pow = 10** (int)$currency->decimal_places; $correct = bcdiv((string)round($value * $pow), (string)$pow, 12); $this->friendlyWarning( sprintf('Piggy bank repetition #%d has %s with value "%s", this has been corrected to "%s".', $item->id, $field, $value, $correct) @@ -469,7 +469,7 @@ class ForceDecimalSize extends Command continue; } // fix $field by rounding it down correctly. - $pow = pow(10, (int)$currency->decimal_places); + $pow = 10** (int)$currency->decimal_places; $correct = bcdiv((string)round($value * $pow), (string)$pow, 12); $this->friendlyWarning(sprintf('Piggy bank #%d has %s with value "%s", this has been corrected to "%s".', $item->id, $field, $value, $correct)); PiggyBank::find($item->id)->update([$field => $correct]); @@ -506,7 +506,7 @@ class ForceDecimalSize extends Command continue; } // fix $field by rounding it down correctly. - $pow = (float)pow(10, (int)$currency->decimal_places); + $pow = (float)10** (int)$currency->decimal_places; $correct = bcdiv((string)round((float)$value * $pow), (string)$pow, 12); $this->friendlyWarning(sprintf('Transaction #%d has amount with value "%s", this has been corrected to "%s".', $item->id, $value, $correct)); Transaction::find($item->id)->update(['amount' => $correct]); @@ -533,7 +533,7 @@ class ForceDecimalSize extends Command continue; } // fix $field by rounding it down correctly. - $pow = (float)pow(10, (int)$currency->decimal_places); + $pow = (float)10** (int)$currency->decimal_places; $correct = bcdiv((string)round((float)$value * $pow), (string)$pow, 12); $this->friendlyWarning( sprintf('Transaction #%d has foreign amount with value "%s", this has been corrected to "%s".', $item->id, $value, $correct) diff --git a/app/Events/DestroyedTransactionLink.php b/app/Events/DestroyedTransactionLink.php index 9353e95883..d4b1c3d924 100644 --- a/app/Events/DestroyedTransactionLink.php +++ b/app/Events/DestroyedTransactionLink.php @@ -33,7 +33,7 @@ class DestroyedTransactionLink extends Event { use SerializesModels; - private TransactionJournalLink $link; // @phpstan-ignore-line + private TransactionJournalLink $link; /** @phpstan-ignore-line */ /** * DestroyedTransactionLink constructor. diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 8e0650d321..0154ecc54b 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -231,14 +231,12 @@ class Handler extends ExceptionHandler */ private function shouldntReportLocal(Throwable $e): bool { - return !is_null( - Arr::first( + return null !== Arr::first( $this->dontReport, - function ($type) use ($e) { + static function ($type) use ($e) { return $e instanceof $type; } - ) - ); + ); } /** diff --git a/app/Exceptions/IntervalException.php b/app/Exceptions/IntervalException.php index 6c841b0462..75bf19530a 100644 --- a/app/Exceptions/IntervalException.php +++ b/app/Exceptions/IntervalException.php @@ -59,14 +59,14 @@ final class IntervalException extends Exception array $intervals, int $code = 0, ?Throwable $previous = null - ): IntervalException { + ): self { $message = sprintf( 'The periodicity %s is unknown. Choose one of available periodicity: %s', $periodicity->name, - join(', ', $intervals) + implode(', ', $intervals) ); - $exception = new IntervalException($message, $code, $previous); + $exception = new self($message, $code, $previous); $exception->periodicity = $periodicity; $exception->availableIntervals = $intervals; return $exception; diff --git a/app/Factory/RecurrenceFactory.php b/app/Factory/RecurrenceFactory.php index d7c1531747..3eab740fbd 100644 --- a/app/Factory/RecurrenceFactory.php +++ b/app/Factory/RecurrenceFactory.php @@ -37,8 +37,8 @@ use JsonException; */ class RecurrenceFactory { - use TransactionTypeTrait; use RecurringTransactionTrait; + use TransactionTypeTrait; private MessageBag $errors; private User $user; diff --git a/app/Generator/Report/ReportGeneratorInterface.php b/app/Generator/Report/ReportGeneratorInterface.php index c56c71afbd..1040e3c4c2 100644 --- a/app/Generator/Report/ReportGeneratorInterface.php +++ b/app/Generator/Report/ReportGeneratorInterface.php @@ -45,7 +45,7 @@ interface ReportGeneratorInterface * * @return ReportGeneratorInterface */ - public function setAccounts(Collection $accounts): ReportGeneratorInterface; + public function setAccounts(Collection $accounts): self; /** * Set the involved budgets. @@ -54,7 +54,7 @@ interface ReportGeneratorInterface * * @return ReportGeneratorInterface */ - public function setBudgets(Collection $budgets): ReportGeneratorInterface; + public function setBudgets(Collection $budgets): self; /** * Set the involved categories. @@ -63,7 +63,7 @@ interface ReportGeneratorInterface * * @return ReportGeneratorInterface */ - public function setCategories(Collection $categories): ReportGeneratorInterface; + public function setCategories(Collection $categories): self; /** * Set the end date. @@ -72,7 +72,7 @@ interface ReportGeneratorInterface * * @return ReportGeneratorInterface */ - public function setEndDate(Carbon $date): ReportGeneratorInterface; + public function setEndDate(Carbon $date): self; /** * Set the expense accounts. @@ -81,7 +81,7 @@ interface ReportGeneratorInterface * * @return ReportGeneratorInterface */ - public function setExpense(Collection $expense): ReportGeneratorInterface; + public function setExpense(Collection $expense): self; /** * Set the start date. @@ -90,7 +90,7 @@ interface ReportGeneratorInterface * * @return ReportGeneratorInterface */ - public function setStartDate(Carbon $date): ReportGeneratorInterface; + public function setStartDate(Carbon $date): self; /** * Set the tags. @@ -99,5 +99,5 @@ interface ReportGeneratorInterface * * @return ReportGeneratorInterface */ - public function setTags(Collection $tags): ReportGeneratorInterface; + public function setTags(Collection $tags): self; } diff --git a/app/Handlers/Events/APIEventHandler.php b/app/Handlers/Events/APIEventHandler.php index 510d90b764..fc7c819d79 100644 --- a/app/Handlers/Events/APIEventHandler.php +++ b/app/Handlers/Events/APIEventHandler.php @@ -50,7 +50,7 @@ class APIEventHandler if (null !== $user) { try { Notification::send($user, new NewAccessToken()); - } catch (Exception $e) { // @phpstan-ignore-line + } catch (Exception $e) { /** @phpstan-ignore-line */ $message = $e->getMessage(); if (str_contains($message, 'Bcc')) { app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); diff --git a/app/Handlers/Events/AdminEventHandler.php b/app/Handlers/Events/AdminEventHandler.php index b30aed8b57..2f54f3cf18 100644 --- a/app/Handlers/Events/AdminEventHandler.php +++ b/app/Handlers/Events/AdminEventHandler.php @@ -58,7 +58,7 @@ class AdminEventHandler if ($repository->hasRole($user, 'owner')) { try { Notification::send($user, new UserInvitation($event->invitee)); - } catch (Exception $e) { // @phpstan-ignore-line + } catch (Exception $e) { /** @phpstan-ignore-line */ $message = $e->getMessage(); if (str_contains($message, 'Bcc')) { app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); @@ -96,7 +96,7 @@ class AdminEventHandler if ($repository->hasRole($user, 'owner')) { try { Notification::send($user, new VersionCheckResult($event->message)); - } catch (Exception $e) { // @phpstan-ignore-line + } catch (Exception $e) { /** @phpstan-ignore-line */ $message = $e->getMessage(); if (str_contains($message, 'Bcc')) { app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); @@ -130,7 +130,7 @@ class AdminEventHandler } try { Notification::send($event->user, new TestNotification($event->user->email)); - } catch (Exception $e) { // @phpstan-ignore-line + } catch (Exception $e) { /** @phpstan-ignore-line */ $message = $e->getMessage(); if (str_contains($message, 'Bcc')) { app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); diff --git a/app/Handlers/Events/AutomationHandler.php b/app/Handlers/Events/AutomationHandler.php index e7e8dc68b8..500b5ceec1 100644 --- a/app/Handlers/Events/AutomationHandler.php +++ b/app/Handlers/Events/AutomationHandler.php @@ -75,7 +75,7 @@ class AutomationHandler } try { Notification::send($user, new TransactionCreation($groups)); - } catch (Exception $e) { // @phpstan-ignore-line + } catch (Exception $e) { /** @phpstan-ignore-line */ $message = $e->getMessage(); if (str_contains($message, 'Bcc')) { app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); diff --git a/app/Handlers/Events/BillEventHandler.php b/app/Handlers/Events/BillEventHandler.php index d6864d095d..ced3ab2aa9 100644 --- a/app/Handlers/Events/BillEventHandler.php +++ b/app/Handlers/Events/BillEventHandler.php @@ -51,7 +51,7 @@ class BillEventHandler app('log')->debug('Bill reminder is true!'); try { Notification::send($bill->user, new BillReminder($bill, $event->field, $event->diff)); - } catch (Exception $e) { // @phpstan-ignore-line + } catch (Exception $e) { /** @phpstan-ignore-line */ $message = $e->getMessage(); if (str_contains($message, 'Bcc')) { app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); diff --git a/app/Handlers/Events/UserEventHandler.php b/app/Handlers/Events/UserEventHandler.php index 0fb02025d9..26f39e2c22 100644 --- a/app/Handlers/Events/UserEventHandler.php +++ b/app/Handlers/Events/UserEventHandler.php @@ -203,7 +203,7 @@ class UserEventHandler if (false === $entry['notified']) { try { Notification::send($user, new UserLogin($ipAddress)); - } catch (Exception $e) { // @phpstan-ignore-line + } catch (Exception $e) { /** @phpstan-ignore-line */ $message = $e->getMessage(); if (str_contains($message, 'Bcc')) { app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); @@ -237,7 +237,7 @@ class UserEventHandler if ($repository->hasRole($user, 'owner')) { try { Notification::send($user, new AdminRegistrationNotification($event->user)); - } catch (Exception $e) { // @phpstan-ignore-line + } catch (Exception $e) { /** @phpstan-ignore-line */ $message = $e->getMessage(); if (str_contains($message, 'Bcc')) { app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); @@ -314,7 +314,7 @@ class UserEventHandler { try { Notification::send($event->user, new UserNewPassword(route('password.reset', [$event->token]))); - } catch (Exception $e) { // @phpstan-ignore-line + } catch (Exception $e) { /** @phpstan-ignore-line */ $message = $e->getMessage(); if (str_contains($message, 'Bcc')) { app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); @@ -362,7 +362,7 @@ class UserEventHandler if ($sendMail) { try { Notification::send($event->user, new UserRegistrationNotification()); - } catch (Exception $e) { // @phpstan-ignore-line + } catch (Exception $e) { /** @phpstan-ignore-line */ $message = $e->getMessage(); if (str_contains($message, 'Bcc')) { app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.'); diff --git a/app/Handlers/Events/WebhookEventHandler.php b/app/Handlers/Events/WebhookEventHandler.php index db681b8763..ea9236e191 100644 --- a/app/Handlers/Events/WebhookEventHandler.php +++ b/app/Handlers/Events/WebhookEventHandler.php @@ -41,7 +41,7 @@ class WebhookEventHandler $messages = WebhookMessage::where('webhook_messages.sent', false) ->get(['webhook_messages.*']) ->filter( - function (WebhookMessage $message) { + static function (WebhookMessage $message) { return $message->webhookAttempts()->count() <= 2; } )->splice(0, 5); diff --git a/app/Handlers/Observer/TransactionJournalObserver.php b/app/Handlers/Observer/TransactionJournalObserver.php index c24f1089da..bab42543d0 100644 --- a/app/Handlers/Observer/TransactionJournalObserver.php +++ b/app/Handlers/Observer/TransactionJournalObserver.php @@ -40,7 +40,7 @@ class TransactionJournalObserver app('log')->debug('Observe "deleting" of a transaction journal.'); // to make sure the listener doesn't get back to use and loop - TransactionJournal::withoutEvents(function () use ($transactionJournal) { + TransactionJournal::withoutEvents(static function () use ($transactionJournal) { foreach ($transactionJournal->transactions()->get() as $transaction) { $transaction->delete(); } diff --git a/app/Helpers/Attachments/AttachmentHelper.php b/app/Helpers/Attachments/AttachmentHelper.php index 9e0761f11b..8dee4f8353 100644 --- a/app/Helpers/Attachments/AttachmentHelper.php +++ b/app/Helpers/Attachments/AttachmentHelper.php @@ -95,7 +95,7 @@ class AttachmentHelper implements AttachmentHelperInterface */ public function getAttachmentLocation(Attachment $attachment): string { - return sprintf('%sat-%d.data', DIRECTORY_SEPARATOR, (int)$attachment->id); + return sprintf('%sat-%d.data', \DIRECTORY_SEPARATOR, (int)$attachment->id); } /** diff --git a/app/Helpers/Collector/Extensions/AmountCollection.php b/app/Helpers/Collector/Extensions/AmountCollection.php index 9635a46568..42edbe55fc 100644 --- a/app/Helpers/Collector/Extensions/AmountCollection.php +++ b/app/Helpers/Collector/Extensions/AmountCollection.php @@ -74,7 +74,7 @@ trait AmountCollection public function amountLess(string $amount): GroupCollectorInterface { $this->query->where( - function (EloquentBuilder $q) use ($amount) { // @phpstan-ignore-line + static function (EloquentBuilder $q) use ($amount) { // @phpstan-ignore-line $q->where('destination.amount', '<=', app('steam')->positive($amount)); } ); @@ -92,7 +92,7 @@ trait AmountCollection public function amountMore(string $amount): GroupCollectorInterface { $this->query->where( - function (EloquentBuilder $q) use ($amount) { // @phpstan-ignore-line + static function (EloquentBuilder $q) use ($amount) { // @phpstan-ignore-line $q->where('destination.amount', '>=', app('steam')->positive($amount)); } ); @@ -148,7 +148,7 @@ trait AmountCollection public function foreignAmountLess(string $amount): GroupCollectorInterface { $this->query->where( - function (EloquentBuilder $q) use ($amount) { // @phpstan-ignore-line + static function (EloquentBuilder $q) use ($amount) { // @phpstan-ignore-line $q->whereNotNull('destination.foreign_amount'); $q->where('destination.foreign_amount', '<=', app('steam')->positive($amount)); } @@ -167,7 +167,7 @@ trait AmountCollection public function foreignAmountMore(string $amount): GroupCollectorInterface { $this->query->where( - function (EloquentBuilder $q) use ($amount) { // @phpstan-ignore-line + static function (EloquentBuilder $q) use ($amount) { // @phpstan-ignore-line $q->whereNotNull('destination.foreign_amount'); $q->where('destination.foreign_amount', '>=', app('steam')->positive($amount)); } diff --git a/app/Helpers/Collector/Extensions/AttachmentCollection.php b/app/Helpers/Collector/Extensions/AttachmentCollection.php index 0d8aa4b162..6de6510044 100644 --- a/app/Helpers/Collector/Extensions/AttachmentCollection.php +++ b/app/Helpers/Collector/Extensions/AttachmentCollection.php @@ -44,7 +44,7 @@ trait AttachmentCollection { $this->hasAttachments(); $this->withAttachmentInformation(); - $filter = function (int $index, array $object) use ($name): bool { + $filter = static function (int $index, array $object) use ($name): bool { /** @var array $transaction */ foreach ($object['transactions'] as $transaction) { /** @var array $attachment */ @@ -123,7 +123,7 @@ trait AttachmentCollection { $this->hasAttachments(); $this->withAttachmentInformation(); - $filter = function (int $index, array $object) use ($name): bool { + $filter = static function (int $index, array $object) use ($name): bool { /** @var array $transaction */ foreach ($object['transactions'] as $transaction) { /** @var array $attachment */ @@ -153,7 +153,7 @@ trait AttachmentCollection { $this->hasAttachments(); $this->withAttachmentInformation(); - $filter = function (int $index, array $object) use ($name): bool { + $filter = static function (int $index, array $object) use ($name): bool { /** @var array $transaction */ foreach ($object['transactions'] as $transaction) { /** @var array $attachment */ @@ -183,7 +183,7 @@ trait AttachmentCollection { $this->hasAttachments(); $this->withAttachmentInformation(); - $filter = function (int $index, array $object) use ($name): bool { + $filter = static function (int $index, array $object) use ($name): bool { /** @var array $transaction */ foreach ($object['transactions'] as $transaction) { /** @var array $attachment */ @@ -213,7 +213,7 @@ trait AttachmentCollection { $this->hasAttachments(); $this->withAttachmentInformation(); - $filter = function (int $index, array $object) use ($name): bool { + $filter = static function (int $index, array $object) use ($name): bool { /** @var array $transaction */ foreach ($object['transactions'] as $transaction) { /** @var array $attachment */ @@ -243,7 +243,7 @@ trait AttachmentCollection { $this->hasAttachments(); $this->withAttachmentInformation(); - $filter = function (int $index, array $object) use ($name): bool { + $filter = static function (int $index, array $object) use ($name): bool { /** @var array $transaction */ foreach ($object['transactions'] as $transaction) { /** @var array $attachment */ @@ -270,7 +270,7 @@ trait AttachmentCollection { $this->hasAttachments(); $this->withAttachmentInformation(); - $filter = function (int $index, array $object) use ($name): bool { + $filter = static function (int $index, array $object) use ($name): bool { /** @var array $transaction */ foreach ($object['transactions'] as $transaction) { /** @var array $attachment */ @@ -297,7 +297,7 @@ trait AttachmentCollection { $this->hasAttachments(); $this->withAttachmentInformation(); - $filter = function (int $index, array $object) use ($name): bool { + $filter = static function (int $index, array $object) use ($name): bool { /** @var array $transaction */ foreach ($object['transactions'] as $transaction) { /** @var array $attachment */ @@ -327,7 +327,7 @@ trait AttachmentCollection { $this->hasAttachments(); $this->withAttachmentInformation(); - $filter = function (int $index, array $object) use ($value): bool { + $filter = static function (int $index, array $object) use ($value): bool { /** @var array $transaction */ foreach ($object['transactions'] as $transaction) { /** @var array $attachment */ @@ -354,7 +354,7 @@ trait AttachmentCollection { $this->hasAttachments(); $this->withAttachmentInformation(); - $filter = function (int $index, array $object) use ($value): bool { + $filter = static function (int $index, array $object) use ($value): bool { /** @var array $transaction */ foreach ($object['transactions'] as $transaction) { /** @var array $attachment */ @@ -381,7 +381,7 @@ trait AttachmentCollection { $this->hasAttachments(); $this->withAttachmentInformation(); - $filter = function (int $index, array $object) use ($value): bool { + $filter = static function (int $index, array $object) use ($value): bool { /** @var array $transaction */ foreach ($object['transactions'] as $transaction) { /** @var array $attachment */ @@ -408,7 +408,7 @@ trait AttachmentCollection { $this->hasAttachments(); $this->withAttachmentInformation(); - $filter = function (int $index, array $object) use ($value): bool { + $filter = static function (int $index, array $object) use ($value): bool { /** @var array $transaction */ foreach ($object['transactions'] as $transaction) { /** @var array $attachment */ @@ -435,7 +435,7 @@ trait AttachmentCollection { $this->hasAttachments(); $this->withAttachmentInformation(); - $filter = function (int $index, array $object) use ($value): bool { + $filter = static function (int $index, array $object) use ($value): bool { /** @var array $transaction */ foreach ($object['transactions'] as $transaction) { /** @var array $attachment */ @@ -462,7 +462,7 @@ trait AttachmentCollection { $this->hasAttachments(); $this->withAttachmentInformation(); - $filter = function (int $index, array $object) use ($value): bool { + $filter = static function (int $index, array $object) use ($value): bool { /** @var array $transaction */ foreach ($object['transactions'] as $transaction) { /** @var array $attachment */ @@ -489,7 +489,7 @@ trait AttachmentCollection { $this->hasAttachments(); $this->withAttachmentInformation(); - $filter = function (int $index, array $object) use ($value): bool { + $filter = static function (int $index, array $object) use ($value): bool { /** @var array $transaction */ foreach ($object['transactions'] as $transaction) { /** @var array $attachment */ @@ -516,7 +516,7 @@ trait AttachmentCollection { $this->hasAttachments(); $this->withAttachmentInformation(); - $filter = function (int $index, array $object) use ($value): bool { + $filter = static function (int $index, array $object) use ($value): bool { /** @var array $transaction */ foreach ($object['transactions'] as $transaction) { /** @var array $attachment */ @@ -544,10 +544,10 @@ trait AttachmentCollection app('log')->debug('Add filter on no attachments.'); $this->joinAttachmentTables(); - $this->query->where(function (Builder $q1) { // @phpstan-ignore-line + $this->query->where(static function (Builder $q1) { // @phpstan-ignore-line $q1 ->whereNull('attachments.attachable_id') - ->orWhere(function (Builder $q2) { + ->orWhere(static function (Builder $q2) { $q2 ->whereNotNull('attachments.attachable_id') ->whereNotNull('attachments.deleted_at'); diff --git a/app/Helpers/Collector/Extensions/MetaCollection.php b/app/Helpers/Collector/Extensions/MetaCollection.php index 7e867bae00..c593e856a6 100644 --- a/app/Helpers/Collector/Extensions/MetaCollection.php +++ b/app/Helpers/Collector/Extensions/MetaCollection.php @@ -915,7 +915,7 @@ trait MetaCollection // this method adds a "postFilter" to the collector. $list = $tags->pluck('tag')->toArray(); - $filter = function (int $index, array $object) use ($list): bool { + $filter = static function (int $index, array $object) use ($list): bool { foreach ($object['transactions'] as $transaction) { foreach ($transaction['tags'] as $tag) { if (in_array($tag['name'], $list, true)) { @@ -1050,13 +1050,13 @@ trait MetaCollection { $this->joinMetaDataTables(); // TODO not sure if this will work properly. - $this->query->where(function (Builder $q1) { // @phpstan-ignore-line - $q1->where(function (Builder $q2) { + $this->query->where(static function (Builder $q1) { // @phpstan-ignore-line + $q1->where(static function (Builder $q2) { $q2->where('journal_meta.name', '=', 'external_id'); $q2->whereNull('journal_meta.data'); - })->orWhere(function (Builder $q3) { + })->orWhere(static function (Builder $q3) { $q3->where('journal_meta.name', '!=', 'external_id'); - })->orWhere(function (Builder $q4) { + })->orWhere(static function (Builder $q4) { $q4->whereNull('journal_meta.name'); }); }); @@ -1071,13 +1071,13 @@ trait MetaCollection { $this->joinMetaDataTables(); // TODO not sure if this will work properly. - $this->query->where(function (Builder $q1) { // @phpstan-ignore-line - $q1->where(function (Builder $q2) { + $this->query->where(static function (Builder $q1) { // @phpstan-ignore-line + $q1->where(static function (Builder $q2) { $q2->where('journal_meta.name', '=', 'external_url'); $q2->whereNull('journal_meta.data'); - })->orWhere(function (Builder $q3) { + })->orWhere(static function (Builder $q3) { $q3->where('journal_meta.name', '!=', 'external_url'); - })->orWhere(function (Builder $q4) { + })->orWhere(static function (Builder $q4) { $q4->whereNull('journal_meta.name'); }); }); @@ -1091,7 +1091,7 @@ trait MetaCollection public function withoutNotes(): GroupCollectorInterface { $this->withNotes(); - $this->query->where(function (Builder $q) { // @phpstan-ignore-line + $this->query->where(static function (Builder $q) { // @phpstan-ignore-line $q->whereNull('notes.text'); $q->orWhere('notes.text', ''); }); diff --git a/app/Helpers/Collector/Extensions/TimeCollection.php b/app/Helpers/Collector/Extensions/TimeCollection.php index 3908686d69..6a095d0100 100644 --- a/app/Helpers/Collector/Extensions/TimeCollection.php +++ b/app/Helpers/Collector/Extensions/TimeCollection.php @@ -93,7 +93,7 @@ trait TimeCollection $start->startOfDay(); $this->withMetaDate($field); - $filter = function (int $index, array $object) use ($field, $start, $end): bool { + $filter = static function (int $index, array $object) use ($field, $start, $end): bool { foreach ($object['transactions'] as $transaction) { if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon) { return $transaction[$field]->lt($start) || $transaction[$field]->gt($end); @@ -166,7 +166,7 @@ trait TimeCollection public function metaDayAfter(string $day, string $field): GroupCollectorInterface { $this->withMetaDate($field); - $filter = function (int $index, array $object) use ($field, $day): bool { + $filter = static function (int $index, array $object) use ($field, $day): bool { foreach ($object['transactions'] as $transaction) { if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon ) { @@ -190,7 +190,7 @@ trait TimeCollection public function metaDayBefore(string $day, string $field): GroupCollectorInterface { $this->withMetaDate($field); - $filter = function (int $index, array $object) use ($field, $day): bool { + $filter = static function (int $index, array $object) use ($field, $day): bool { foreach ($object['transactions'] as $transaction) { if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon ) { @@ -214,7 +214,7 @@ trait TimeCollection public function metaDayIs(string $day, string $field): GroupCollectorInterface { $this->withMetaDate($field); - $filter = function (int $index, array $object) use ($field, $day): bool { + $filter = static function (int $index, array $object) use ($field, $day): bool { foreach ($object['transactions'] as $transaction) { if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon ) { @@ -237,7 +237,7 @@ trait TimeCollection public function metaDayIsNot(string $day, string $field): GroupCollectorInterface { $this->withMetaDate($field); - $filter = function (int $index, array $object) use ($field, $day): bool { + $filter = static function (int $index, array $object) use ($field, $day): bool { foreach ($object['transactions'] as $transaction) { if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon ) { @@ -260,7 +260,7 @@ trait TimeCollection public function metaMonthAfter(string $month, string $field): GroupCollectorInterface { $this->withMetaDate($field); - $filter = function (int $index, array $object) use ($field, $month): bool { + $filter = static function (int $index, array $object) use ($field, $month): bool { foreach ($object['transactions'] as $transaction) { if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon ) { @@ -284,7 +284,7 @@ trait TimeCollection public function metaMonthBefore(string $month, string $field): GroupCollectorInterface { $this->withMetaDate($field); - $filter = function (int $index, array $object) use ($field, $month): bool { + $filter = static function (int $index, array $object) use ($field, $month): bool { foreach ($object['transactions'] as $transaction) { if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon ) { @@ -308,7 +308,7 @@ trait TimeCollection public function metaMonthIs(string $month, string $field): GroupCollectorInterface { $this->withMetaDate($field); - $filter = function (int $index, array $object) use ($field, $month): bool { + $filter = static function (int $index, array $object) use ($field, $month): bool { foreach ($object['transactions'] as $transaction) { if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon ) { @@ -331,7 +331,7 @@ trait TimeCollection public function metaMonthIsNot(string $month, string $field): GroupCollectorInterface { $this->withMetaDate($field); - $filter = function (int $index, array $object) use ($field, $month): bool { + $filter = static function (int $index, array $object) use ($field, $month): bool { foreach ($object['transactions'] as $transaction) { if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon ) { @@ -354,7 +354,7 @@ trait TimeCollection public function metaYearAfter(string $year, string $field): GroupCollectorInterface { $this->withMetaDate($field); - $filter = function (int $index, array $object) use ($field, $year): bool { + $filter = static function (int $index, array $object) use ($field, $year): bool { foreach ($object['transactions'] as $transaction) { if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon ) { @@ -378,7 +378,7 @@ trait TimeCollection public function metaYearBefore(string $year, string $field): GroupCollectorInterface { $this->withMetaDate($field); - $filter = function (int $index, array $object) use ($field, $year): bool { + $filter = static function (int $index, array $object) use ($field, $year): bool { foreach ($object['transactions'] as $transaction) { if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon ) { @@ -402,7 +402,7 @@ trait TimeCollection public function metaYearIs(string $year, string $field): GroupCollectorInterface { $this->withMetaDate($field); - $filter = function (int $index, array $object) use ($field, $year): bool { + $filter = static function (int $index, array $object) use ($field, $year): bool { foreach ($object['transactions'] as $transaction) { if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon ) { @@ -426,7 +426,7 @@ trait TimeCollection public function metaYearIsNot(string $year, string $field): GroupCollectorInterface { $this->withMetaDate($field); - $filter = function (int $index, array $object) use ($field, $year): bool { + $filter = static function (int $index, array $object) use ($field, $year): bool { foreach ($object['transactions'] as $transaction) { if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon ) { @@ -702,7 +702,7 @@ trait TimeCollection { $this->withMetaDate($field); $date->startOfDay(); - $filter = function (int $index, array $object) use ($field, $date): bool { + $filter = static function (int $index, array $object) use ($field, $date): bool { foreach ($object['transactions'] as $transaction) { if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon ) { @@ -726,7 +726,7 @@ trait TimeCollection public function setMetaBefore(Carbon $date, string $field): GroupCollectorInterface { $this->withMetaDate($field); - $filter = function (int $index, array $object) use ($field, $date): bool { + $filter = static function (int $index, array $object) use ($field, $date): bool { foreach ($object['transactions'] as $transaction) { if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon ) { @@ -758,7 +758,7 @@ trait TimeCollection $start->startOfDay(); $this->withMetaDate($field); - $filter = function (int $index, array $object) use ($field, $start, $end): bool { + $filter = static function (int $index, array $object) use ($field, $start, $end): bool { foreach ($object['transactions'] as $transaction) { if (array_key_exists($field, $transaction) && $transaction[$field] instanceof Carbon ) { diff --git a/app/Helpers/Collector/GroupCollector.php b/app/Helpers/Collector/GroupCollector.php index a5596ec208..7fc6570316 100644 --- a/app/Helpers/Collector/GroupCollector.php +++ b/app/Helpers/Collector/GroupCollector.php @@ -52,12 +52,12 @@ use Illuminate\Support\Collection; */ class GroupCollector implements GroupCollectorInterface { - use CollectorProperties; use AccountCollection; use AmountCollection; - use TimeCollection; - use MetaCollection; use AttachmentCollection; + use CollectorProperties; + use MetaCollection; + use TimeCollection; /** * Group collector constructor. @@ -1077,7 +1077,7 @@ class GroupCollector implements GroupCollectorInterface // join source transaction. ->leftJoin( 'transactions as source', - function (JoinClause $join) { + static function (JoinClause $join) { $join->on('source.transaction_journal_id', '=', 'transaction_journals.id') ->where('source.amount', '<', 0); } @@ -1085,7 +1085,7 @@ class GroupCollector implements GroupCollectorInterface // join destination transaction ->leftJoin( 'transactions as destination', - function (JoinClause $join) { + static function (JoinClause $join) { $join->on('destination.transaction_journal_id', '=', 'transaction_journals.id') ->where('destination.amount', '>', 0); } @@ -1135,7 +1135,7 @@ class GroupCollector implements GroupCollectorInterface // join source transaction. ->leftJoin( 'transactions as source', - function (JoinClause $join) { + static function (JoinClause $join) { $join->on('source.transaction_journal_id', '=', 'transaction_journals.id') ->where('source.amount', '<', 0); } @@ -1143,7 +1143,7 @@ class GroupCollector implements GroupCollectorInterface // join destination transaction ->leftJoin( 'transactions as destination', - function (JoinClause $join) { + static function (JoinClause $join) { $join->on('destination.transaction_journal_id', '=', 'transaction_journals.id') ->where('destination.amount', '>', 0); } diff --git a/app/Helpers/Collector/GroupCollectorInterface.php b/app/Helpers/Collector/GroupCollectorInterface.php index 05d12d63d7..5ab713e689 100644 --- a/app/Helpers/Collector/GroupCollectorInterface.php +++ b/app/Helpers/Collector/GroupCollectorInterface.php @@ -47,14 +47,14 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function amountIs(string $amount): GroupCollectorInterface; + public function amountIs(string $amount): self; /** * @param string $amount * * @return GroupCollectorInterface */ - public function amountIsNot(string $amount): GroupCollectorInterface; + public function amountIsNot(string $amount): self; /** * Get transactions where the amount is less than. @@ -63,7 +63,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function amountLess(string $amount): GroupCollectorInterface; + public function amountLess(string $amount): self; /** * Get transactions where the foreign amount is more than. @@ -72,147 +72,147 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function amountMore(string $amount): GroupCollectorInterface; + public function amountMore(string $amount): self; /** * @param string $name * * @return GroupCollectorInterface */ - public function attachmentNameContains(string $name): GroupCollectorInterface; + public function attachmentNameContains(string $name): self; /** * @param string $name * * @return GroupCollectorInterface */ - public function attachmentNameDoesNotContain(string $name): GroupCollectorInterface; + public function attachmentNameDoesNotContain(string $name): self; /** * @param string $name * * @return GroupCollectorInterface */ - public function attachmentNameDoesNotEnd(string $name): GroupCollectorInterface; + public function attachmentNameDoesNotEnd(string $name): self; /** * @param string $name * * @return GroupCollectorInterface */ - public function attachmentNameDoesNotStart(string $name): GroupCollectorInterface; + public function attachmentNameDoesNotStart(string $name): self; /** * @param string $name * * @return GroupCollectorInterface */ - public function attachmentNameEnds(string $name): GroupCollectorInterface; + public function attachmentNameEnds(string $name): self; /** * @param string $name * * @return GroupCollectorInterface */ - public function attachmentNameIs(string $name): GroupCollectorInterface; + public function attachmentNameIs(string $name): self; /** * @param string $name * * @return GroupCollectorInterface */ - public function attachmentNameIsNot(string $name): GroupCollectorInterface; + public function attachmentNameIsNot(string $name): self; /** * @param string $name * * @return GroupCollectorInterface */ - public function attachmentNameStarts(string $name): GroupCollectorInterface; + public function attachmentNameStarts(string $name): self; /** * @param string $value * * @return GroupCollectorInterface */ - public function attachmentNotesAre(string $value): GroupCollectorInterface; + public function attachmentNotesAre(string $value): self; /** * @param string $value * * @return GroupCollectorInterface */ - public function attachmentNotesAreNot(string $value): GroupCollectorInterface; + public function attachmentNotesAreNot(string $value): self; /** * @param string $value * * @return GroupCollectorInterface */ - public function attachmentNotesContains(string $value): GroupCollectorInterface; + public function attachmentNotesContains(string $value): self; /** * @param string $value * * @return GroupCollectorInterface */ - public function attachmentNotesDoNotContain(string $value): GroupCollectorInterface; + public function attachmentNotesDoNotContain(string $value): self; /** * @param string $value * * @return GroupCollectorInterface */ - public function attachmentNotesDoNotEnd(string $value): GroupCollectorInterface; + public function attachmentNotesDoNotEnd(string $value): self; /** * @param string $value * * @return GroupCollectorInterface */ - public function attachmentNotesDoNotStart(string $value): GroupCollectorInterface; + public function attachmentNotesDoNotStart(string $value): self; /** * @param string $value * * @return GroupCollectorInterface */ - public function attachmentNotesEnds(string $value): GroupCollectorInterface; + public function attachmentNotesEnds(string $value): self; /** * @param string $value * * @return GroupCollectorInterface */ - public function attachmentNotesStarts(string $value): GroupCollectorInterface; + public function attachmentNotesStarts(string $value): self; /** * @param string $day * * @return GroupCollectorInterface */ - public function dayAfter(string $day): GroupCollectorInterface; + public function dayAfter(string $day): self; /** * @param string $day * * @return GroupCollectorInterface */ - public function dayBefore(string $day): GroupCollectorInterface; + public function dayBefore(string $day): self; /** * @param string $day * * @return GroupCollectorInterface */ - public function dayIs(string $day): GroupCollectorInterface; + public function dayIs(string $day): self; /** * @param string $day * * @return GroupCollectorInterface */ - public function dayIsNot(string $day): GroupCollectorInterface; + public function dayIsNot(string $day): self; /** * End of the description must not match: @@ -221,7 +221,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function descriptionDoesNotEnd(array $array): GroupCollectorInterface; + public function descriptionDoesNotEnd(array $array): self; /** * Beginning of the description must not start with: @@ -230,7 +230,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function descriptionDoesNotStart(array $array): GroupCollectorInterface; + public function descriptionDoesNotStart(array $array): self; /** * End of the description must match: @@ -239,7 +239,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function descriptionEnds(array $array): GroupCollectorInterface; + public function descriptionEnds(array $array): self; /** * Description must be: @@ -248,7 +248,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function descriptionIs(string $value): GroupCollectorInterface; + public function descriptionIs(string $value): self; /** * Description must not be: @@ -257,7 +257,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function descriptionIsNot(string $value): GroupCollectorInterface; + public function descriptionIsNot(string $value): self; /** * Beginning of the description must match: @@ -266,7 +266,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function descriptionStarts(array $array): GroupCollectorInterface; + public function descriptionStarts(array $array): self; /** * These accounts must not be accounts. @@ -275,7 +275,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function excludeAccounts(Collection $accounts): GroupCollectorInterface; + public function excludeAccounts(Collection $accounts): self; /** * Exclude a specific set of bills @@ -284,7 +284,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function excludeBills(Collection $bills): GroupCollectorInterface; + public function excludeBills(Collection $bills): self; /** * Exclude a budget @@ -293,7 +293,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function excludeBudget(Budget $budget): GroupCollectorInterface; + public function excludeBudget(Budget $budget): self; /** * Exclude a budget. @@ -302,7 +302,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function excludeBudgets(Collection $budgets): GroupCollectorInterface; + public function excludeBudgets(Collection $budgets): self; /** * Exclude a set of categories. @@ -311,7 +311,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function excludeCategories(Collection $categories): GroupCollectorInterface; + public function excludeCategories(Collection $categories): self; /** * Exclude a specific category @@ -320,7 +320,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function excludeCategory(Category $category): GroupCollectorInterface; + public function excludeCategory(Category $category): self; /** * Limit results to NOT a specific currency, either foreign or normal one. @@ -329,7 +329,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function excludeCurrency(TransactionCurrency $currency): GroupCollectorInterface; + public function excludeCurrency(TransactionCurrency $currency): self; /** * Exclude destination accounts. @@ -338,7 +338,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function excludeDestinationAccounts(Collection $accounts): GroupCollectorInterface; + public function excludeDestinationAccounts(Collection $accounts): self; /** * Look for specific external ID's. @@ -347,14 +347,14 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function excludeExternalId(string $externalId): GroupCollectorInterface; + public function excludeExternalId(string $externalId): self; /** * @param string $url * * @return GroupCollectorInterface */ - public function excludeExternalUrl(string $url): GroupCollectorInterface; + public function excludeExternalUrl(string $url): self; /** * Limit results to exclude a specific foreign currency. @@ -363,7 +363,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function excludeForeignCurrency(TransactionCurrency $currency): GroupCollectorInterface; + public function excludeForeignCurrency(TransactionCurrency $currency): self; /** * Limit the result to NOT a set of specific transaction groups. @@ -372,7 +372,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function excludeIds(array $groupIds): GroupCollectorInterface; + public function excludeIds(array $groupIds): self; /** * Look for specific external ID's. @@ -381,7 +381,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function excludeInternalReference(string $internalReference): GroupCollectorInterface; + public function excludeInternalReference(string $internalReference): self; /** * Limit the result to NOT a set of specific transaction journals. @@ -390,7 +390,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function excludeJournalIds(array $journalIds): GroupCollectorInterface; + public function excludeJournalIds(array $journalIds): self; /** * @param Carbon $start @@ -399,7 +399,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function excludeMetaDateRange(Carbon $start, Carbon $end, string $field): GroupCollectorInterface; + public function excludeMetaDateRange(Carbon $start, Carbon $end, string $field): self; /** * @param Carbon $start @@ -408,7 +408,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function excludeObjectRange(Carbon $start, Carbon $end, string $field): GroupCollectorInterface; + public function excludeObjectRange(Carbon $start, Carbon $end, string $field): self; /** * @param Carbon $start @@ -416,14 +416,14 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function excludeRange(Carbon $start, Carbon $end): GroupCollectorInterface; + public function excludeRange(Carbon $start, Carbon $end): self; /** * @param string $recurringId * * @return GroupCollectorInterface */ - public function excludeRecurrenceId(string $recurringId): GroupCollectorInterface; + public function excludeRecurrenceId(string $recurringId): self; /** * Exclude words in descriptions. @@ -432,7 +432,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function excludeSearchWords(array $array): GroupCollectorInterface; + public function excludeSearchWords(array $array): self; /** * These accounts must not be source accounts. @@ -441,7 +441,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function excludeSourceAccounts(Collection $accounts): GroupCollectorInterface; + public function excludeSourceAccounts(Collection $accounts): self; /** * Limit the included transaction types. @@ -450,103 +450,103 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function excludeTypes(array $types): GroupCollectorInterface; + public function excludeTypes(array $types): self; /** * @return GroupCollectorInterface */ - public function exists(): GroupCollectorInterface; + public function exists(): self; /** * @param string $externalId * * @return GroupCollectorInterface */ - public function externalIdContains(string $externalId): GroupCollectorInterface; + public function externalIdContains(string $externalId): self; /** * @param string $externalId * * @return GroupCollectorInterface */ - public function externalIdDoesNotContain(string $externalId): GroupCollectorInterface; + public function externalIdDoesNotContain(string $externalId): self; /** * @param string $externalId * * @return GroupCollectorInterface */ - public function externalIdDoesNotEnd(string $externalId): GroupCollectorInterface; + public function externalIdDoesNotEnd(string $externalId): self; /** * @param string $externalId * * @return GroupCollectorInterface */ - public function externalIdDoesNotStart(string $externalId): GroupCollectorInterface; + public function externalIdDoesNotStart(string $externalId): self; /** * @param string $externalId * * @return GroupCollectorInterface */ - public function externalIdEnds(string $externalId): GroupCollectorInterface; + public function externalIdEnds(string $externalId): self; /** * @param string $externalId * * @return GroupCollectorInterface */ - public function externalIdStarts(string $externalId): GroupCollectorInterface; + public function externalIdStarts(string $externalId): self; /** * @param string $url * * @return GroupCollectorInterface */ - public function externalUrlContains(string $url): GroupCollectorInterface; + public function externalUrlContains(string $url): self; /** * @param string $url * * @return GroupCollectorInterface */ - public function externalUrlDoesNotContain(string $url): GroupCollectorInterface; + public function externalUrlDoesNotContain(string $url): self; /** * @param string $url * * @return GroupCollectorInterface */ - public function externalUrlDoesNotEnd(string $url): GroupCollectorInterface; + public function externalUrlDoesNotEnd(string $url): self; /** * @param string $url * * @return GroupCollectorInterface */ - public function externalUrlDoesNotStart(string $url): GroupCollectorInterface; + public function externalUrlDoesNotStart(string $url): self; /** * @param string $url * * @return GroupCollectorInterface */ - public function externalUrlEnds(string $url): GroupCollectorInterface; + public function externalUrlEnds(string $url): self; /** * @param string $url * * @return GroupCollectorInterface */ - public function externalUrlStarts(string $url): GroupCollectorInterface; + public function externalUrlStarts(string $url): self; /** * Ensure the search will find nothing at all, zero results. * * @return GroupCollectorInterface */ - public function findNothing(): GroupCollectorInterface; + public function findNothing(): self; /** * Get transactions with a specific foreign amount. @@ -555,7 +555,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function foreignAmountIs(string $amount): GroupCollectorInterface; + public function foreignAmountIs(string $amount): self; /** * Get transactions with a specific foreign amount. @@ -564,7 +564,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function foreignAmountIsNot(string $amount): GroupCollectorInterface; + public function foreignAmountIsNot(string $amount): self; /** * Get transactions where the amount is less than. @@ -573,7 +573,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function foreignAmountLess(string $amount): GroupCollectorInterface; + public function foreignAmountLess(string $amount): self; /** * Get transactions where the foreign amount is more than. @@ -582,7 +582,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function foreignAmountMore(string $amount): GroupCollectorInterface; + public function foreignAmountMore(string $amount): self; /** * @return bool @@ -613,77 +613,77 @@ interface GroupCollectorInterface /** * @return GroupCollectorInterface */ - public function hasAnyTag(): GroupCollectorInterface; + public function hasAnyTag(): self; /** * Has attachments * * @return GroupCollectorInterface */ - public function hasAttachments(): GroupCollectorInterface; + public function hasAttachments(): self; /** * Has no attachments * * @return GroupCollectorInterface */ - public function hasNoAttachments(): GroupCollectorInterface; + public function hasNoAttachments(): self; /** * @param string $internalReference * * @return GroupCollectorInterface */ - public function internalReferenceContains(string $internalReference): GroupCollectorInterface; + public function internalReferenceContains(string $internalReference): self; /** * @param string $internalReference * * @return GroupCollectorInterface */ - public function internalReferenceDoesNotContain(string $internalReference): GroupCollectorInterface; + public function internalReferenceDoesNotContain(string $internalReference): self; /** * @param string $internalReference * * @return GroupCollectorInterface */ - public function internalReferenceDoesNotEnd(string $internalReference): GroupCollectorInterface; + public function internalReferenceDoesNotEnd(string $internalReference): self; /** * @param string $internalReference * * @return GroupCollectorInterface */ - public function internalReferenceDoesNotStart(string $internalReference): GroupCollectorInterface; + public function internalReferenceDoesNotStart(string $internalReference): self; /** * @param string $internalReference * * @return GroupCollectorInterface */ - public function internalReferenceEnds(string $internalReference): GroupCollectorInterface; + public function internalReferenceEnds(string $internalReference): self; /** * @param string $internalReference * * @return GroupCollectorInterface */ - public function internalReferenceStarts(string $internalReference): GroupCollectorInterface; + public function internalReferenceStarts(string $internalReference): self; /** * Only journals that are reconciled. * * @return GroupCollectorInterface */ - public function isNotReconciled(): GroupCollectorInterface; + public function isNotReconciled(): self; /** * Only journals that are reconciled. * * @return GroupCollectorInterface */ - public function isReconciled(): GroupCollectorInterface; + public function isReconciled(): self; /** * @param string $day @@ -691,7 +691,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function metaDayAfter(string $day, string $field): GroupCollectorInterface; + public function metaDayAfter(string $day, string $field): self; /** * @param string $day @@ -699,7 +699,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function metaDayBefore(string $day, string $field): GroupCollectorInterface; + public function metaDayBefore(string $day, string $field): self; /** * @param string $day @@ -707,7 +707,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function metaDayIs(string $day, string $field): GroupCollectorInterface; + public function metaDayIs(string $day, string $field): self; /** * @param string $day @@ -715,7 +715,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function metaDayIsNot(string $day, string $field): GroupCollectorInterface; + public function metaDayIsNot(string $day, string $field): self; /** * @param string $month @@ -723,7 +723,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function metaMonthAfter(string $month, string $field): GroupCollectorInterface; + public function metaMonthAfter(string $month, string $field): self; /** * @param string $month @@ -731,7 +731,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function metaMonthBefore(string $month, string $field): GroupCollectorInterface; + public function metaMonthBefore(string $month, string $field): self; /** * @param string $month @@ -739,7 +739,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function metaMonthIs(string $month, string $field): GroupCollectorInterface; + public function metaMonthIs(string $month, string $field): self; /** * @param string $month @@ -747,7 +747,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function metaMonthIsNot(string $month, string $field): GroupCollectorInterface; + public function metaMonthIsNot(string $month, string $field): self; /** * @param string $year @@ -755,7 +755,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function metaYearAfter(string $year, string $field): GroupCollectorInterface; + public function metaYearAfter(string $year, string $field): self; /** * @param string $year @@ -763,7 +763,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function metaYearBefore(string $year, string $field): GroupCollectorInterface; + public function metaYearBefore(string $year, string $field): self; /** * @param string $year @@ -771,7 +771,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function metaYearIs(string $year, string $field): GroupCollectorInterface; + public function metaYearIs(string $year, string $field): self; /** * @param string $year @@ -779,91 +779,91 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function metaYearIsNot(string $year, string $field): GroupCollectorInterface; + public function metaYearIsNot(string $year, string $field): self; /** * @param string $month * * @return GroupCollectorInterface */ - public function monthAfter(string $month): GroupCollectorInterface; + public function monthAfter(string $month): self; /** * @param string $month * * @return GroupCollectorInterface */ - public function monthBefore(string $month): GroupCollectorInterface; + public function monthBefore(string $month): self; /** * @param string $month * * @return GroupCollectorInterface */ - public function monthIs(string $month): GroupCollectorInterface; + public function monthIs(string $month): self; /** * @param string $month * * @return GroupCollectorInterface */ - public function monthIsNot(string $month): GroupCollectorInterface; + public function monthIsNot(string $month): self; /** * @param string $value * * @return GroupCollectorInterface */ - public function notesContain(string $value): GroupCollectorInterface; + public function notesContain(string $value): self; /** * @param string $value * * @return GroupCollectorInterface */ - public function notesDoNotContain(string $value): GroupCollectorInterface; + public function notesDoNotContain(string $value): self; /** * @param string $value * * @return GroupCollectorInterface */ - public function notesDontEndWith(string $value): GroupCollectorInterface; + public function notesDontEndWith(string $value): self; /** * @param string $value * * @return GroupCollectorInterface */ - public function notesDontStartWith(string $value): GroupCollectorInterface; + public function notesDontStartWith(string $value): self; /** * @param string $value * * @return GroupCollectorInterface */ - public function notesEndWith(string $value): GroupCollectorInterface; + public function notesEndWith(string $value): self; /** * @param string $value * * @return GroupCollectorInterface */ - public function notesExactly(string $value): GroupCollectorInterface; + public function notesExactly(string $value): self; /** * @param string $value * * @return GroupCollectorInterface */ - public function notesExactlyNot(string $value): GroupCollectorInterface; + public function notesExactlyNot(string $value): self; /** * @param string $value * * @return GroupCollectorInterface */ - public function notesStartWith(string $value): GroupCollectorInterface; + public function notesStartWith(string $value): self; /** * @param string $day @@ -871,7 +871,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function objectDayAfter(string $day, string $field): GroupCollectorInterface; + public function objectDayAfter(string $day, string $field): self; /** * @param string $day @@ -879,7 +879,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function objectDayBefore(string $day, string $field): GroupCollectorInterface; + public function objectDayBefore(string $day, string $field): self; /** * @param string $day @@ -887,7 +887,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function objectDayIs(string $day, string $field): GroupCollectorInterface; + public function objectDayIs(string $day, string $field): self; /** * @param string $day @@ -895,7 +895,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function objectDayIsNot(string $day, string $field): GroupCollectorInterface; + public function objectDayIsNot(string $day, string $field): self; /** * @param string $month @@ -903,7 +903,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function objectMonthAfter(string $month, string $field): GroupCollectorInterface; + public function objectMonthAfter(string $month, string $field): self; /** * @param string $month @@ -911,7 +911,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function objectMonthBefore(string $month, string $field): GroupCollectorInterface; + public function objectMonthBefore(string $month, string $field): self; /** * @param string $month @@ -919,7 +919,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function objectMonthIs(string $month, string $field): GroupCollectorInterface; + public function objectMonthIs(string $month, string $field): self; /** * @param string $month @@ -927,7 +927,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function objectMonthIsNot(string $month, string $field): GroupCollectorInterface; + public function objectMonthIsNot(string $month, string $field): self; /** * @param string $year @@ -935,7 +935,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function objectYearAfter(string $year, string $field): GroupCollectorInterface; + public function objectYearAfter(string $year, string $field): self; /** * @param string $year @@ -943,7 +943,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function objectYearBefore(string $year, string $field): GroupCollectorInterface; + public function objectYearBefore(string $year, string $field): self; /** * @param string $year @@ -951,7 +951,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function objectYearIs(string $year, string $field): GroupCollectorInterface; + public function objectYearIs(string $year, string $field): self; /** * @param string $year @@ -959,7 +959,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function objectYearIsNot(string $year, string $field): GroupCollectorInterface; + public function objectYearIsNot(string $year, string $field): self; /** * Define which accounts can be part of the source and destination transactions. @@ -968,7 +968,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setAccounts(Collection $accounts): GroupCollectorInterface; + public function setAccounts(Collection $accounts): self; /** * Collect transactions after a specific date. @@ -977,7 +977,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setAfter(Carbon $date): GroupCollectorInterface; + public function setAfter(Carbon $date): self; /** * Collect transactions before a specific date. @@ -986,7 +986,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setBefore(Carbon $date): GroupCollectorInterface; + public function setBefore(Carbon $date): self; /** * Limit the search to a specific bill. @@ -995,7 +995,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setBill(Bill $bill): GroupCollectorInterface; + public function setBill(Bill $bill): self; /** * Limit the search to a specific set of bills. @@ -1004,7 +1004,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setBills(Collection $bills): GroupCollectorInterface; + public function setBills(Collection $bills): self; /** * Both source AND destination must be in this list of accounts. @@ -1013,7 +1013,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setBothAccounts(Collection $accounts): GroupCollectorInterface; + public function setBothAccounts(Collection $accounts): self; /** * Limit the search to a specific budget. @@ -1022,7 +1022,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setBudget(Budget $budget): GroupCollectorInterface; + public function setBudget(Budget $budget): self; /** * Limit the search to a specific set of budgets. @@ -1031,7 +1031,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setBudgets(Collection $budgets): GroupCollectorInterface; + public function setBudgets(Collection $budgets): self; /** * Limit the search to a specific bunch of categories. @@ -1040,7 +1040,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setCategories(Collection $categories): GroupCollectorInterface; + public function setCategories(Collection $categories): self; /** * Limit the search to a specific category. @@ -1049,7 +1049,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setCategory(Category $category): GroupCollectorInterface; + public function setCategory(Category $category): self; /** * Collect transactions created on a specific date. @@ -1058,7 +1058,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setCreatedAt(Carbon $date): GroupCollectorInterface; + public function setCreatedAt(Carbon $date): self; /** * Limit results to a specific currency, either foreign or normal one. @@ -1067,7 +1067,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setCurrency(TransactionCurrency $currency): GroupCollectorInterface; + public function setCurrency(TransactionCurrency $currency): self; /** * Set destination accounts. @@ -1076,7 +1076,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setDestinationAccounts(Collection $accounts): GroupCollectorInterface; + public function setDestinationAccounts(Collection $accounts): self; /** * Set the end time of the results to return. @@ -1085,12 +1085,12 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setEnd(Carbon $end): GroupCollectorInterface; + public function setEnd(Carbon $end): self; /** * @param bool $expandGroupSearch */ - public function setExpandGroupSearch(bool $expandGroupSearch): GroupCollectorInterface; + public function setExpandGroupSearch(bool $expandGroupSearch): self; /** * Look for specific external ID's. @@ -1099,14 +1099,14 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setExternalId(string $externalId): GroupCollectorInterface; + public function setExternalId(string $externalId): self; /** * @param string $url * * @return GroupCollectorInterface */ - public function setExternalUrl(string $url): GroupCollectorInterface; + public function setExternalUrl(string $url): self; /** * Limit results to a specific foreign currency. @@ -1115,7 +1115,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setForeignCurrency(TransactionCurrency $currency): GroupCollectorInterface; + public function setForeignCurrency(TransactionCurrency $currency): self; /** * Limit the result to a set of specific transaction groups. @@ -1124,7 +1124,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setIds(array $groupIds): GroupCollectorInterface; + public function setIds(array $groupIds): self; /** * Look for specific external ID's. @@ -1133,7 +1133,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setInternalReference(string $internalReference): GroupCollectorInterface; + public function setInternalReference(string $internalReference): self; /** * Limit the result to a set of specific transaction journals. @@ -1142,7 +1142,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setJournalIds(array $journalIds): GroupCollectorInterface; + public function setJournalIds(array $journalIds): self; /** * Limit the number of returned entries. @@ -1151,7 +1151,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setLimit(int $limit): GroupCollectorInterface; + public function setLimit(int $limit): self; /** * Collect transactions after a specific date. @@ -1161,7 +1161,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setMetaAfter(Carbon $date, string $field): GroupCollectorInterface; + public function setMetaAfter(Carbon $date, string $field): self; /** * Collect transactions before a specific date. @@ -1171,7 +1171,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setMetaBefore(Carbon $date, string $field): GroupCollectorInterface; + public function setMetaBefore(Carbon $date, string $field): self; /** * Set the start and end time of the results to return, based on meta data. @@ -1182,7 +1182,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setMetaDateRange(Carbon $start, Carbon $end, string $field): GroupCollectorInterface; + public function setMetaDateRange(Carbon $start, Carbon $end, string $field): self; /** * Define which accounts can NOT be part of the source and destination transactions. @@ -1191,7 +1191,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setNotAccounts(Collection $accounts): GroupCollectorInterface; + public function setNotAccounts(Collection $accounts): self; /** * @param Carbon $date @@ -1199,7 +1199,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setObjectAfter(Carbon $date, string $field): GroupCollectorInterface; + public function setObjectAfter(Carbon $date, string $field): self; /** * @param Carbon $date @@ -1207,7 +1207,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setObjectBefore(Carbon $date, string $field): GroupCollectorInterface; + public function setObjectBefore(Carbon $date, string $field): self; /** * @param Carbon $start @@ -1216,7 +1216,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setObjectRange(Carbon $start, Carbon $end, string $field): GroupCollectorInterface; + public function setObjectRange(Carbon $start, Carbon $end, string $field): self; /** * Set the page to get. @@ -1225,7 +1225,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setPage(int $page): GroupCollectorInterface; + public function setPage(int $page): self; /** * Set the start and end time of the results to return. @@ -1235,7 +1235,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setRange(Carbon $start, Carbon $end): GroupCollectorInterface; + public function setRange(Carbon $start, Carbon $end): self; /** * Look for specific recurring ID's. @@ -1244,7 +1244,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setRecurrenceId(string $recurringId): GroupCollectorInterface; + public function setRecurrenceId(string $recurringId): self; /** * Search for words in descriptions. @@ -1253,14 +1253,14 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setSearchWords(array $array): GroupCollectorInterface; + public function setSearchWords(array $array): self; /** * @param string $sepaCT * * @return GroupCollectorInterface */ - public function setSepaCT(string $sepaCT): GroupCollectorInterface; + public function setSepaCT(string $sepaCT): self; /** * Set source accounts. @@ -1269,7 +1269,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setSourceAccounts(Collection $accounts): GroupCollectorInterface; + public function setSourceAccounts(Collection $accounts): self; /** * Set the start time of the results to return. @@ -1278,7 +1278,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setStart(Carbon $start): GroupCollectorInterface; + public function setStart(Carbon $start): self; /** * Limit results to a specific tag. @@ -1287,7 +1287,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setTag(Tag $tag): GroupCollectorInterface; + public function setTag(Tag $tag): self; /** * Limit results to a specific set of tags. @@ -1296,7 +1296,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setTags(Collection $tags): GroupCollectorInterface; + public function setTags(Collection $tags): self; /** * Limit the search to one specific transaction group. @@ -1305,7 +1305,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setTransactionGroup(TransactionGroup $transactionGroup): GroupCollectorInterface; + public function setTransactionGroup(TransactionGroup $transactionGroup): self; /** * Limit the included transaction types. @@ -1314,7 +1314,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setTypes(array $types): GroupCollectorInterface; + public function setTypes(array $types): self; /** * Collect transactions updated on a specific date. @@ -1323,7 +1323,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setUpdatedAt(Carbon $date): GroupCollectorInterface; + public function setUpdatedAt(Carbon $date): self; /** * Set the user object and start the query. @@ -1332,7 +1332,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setUser(User $user): GroupCollectorInterface; + public function setUser(User $user): self; /** * Set the user group object and start the query. @@ -1341,7 +1341,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setUserGroup(UserGroup $userGroup): GroupCollectorInterface; + public function setUserGroup(UserGroup $userGroup): self; /** * Only when does not have these tags @@ -1350,7 +1350,7 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setWithoutSpecificTags(Collection $tags): GroupCollectorInterface; + public function setWithoutSpecificTags(Collection $tags): self; /** * Either account can be set, but NOT both. This effectively excludes internal transfers. @@ -1359,91 +1359,91 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function setXorAccounts(Collection $accounts): GroupCollectorInterface; + public function setXorAccounts(Collection $accounts): self; /** * Automatically include all stuff required to make API calls work. * * @return GroupCollectorInterface */ - public function withAPIInformation(): GroupCollectorInterface; + public function withAPIInformation(): self; /** * Will include the source and destination account names and types. * * @return GroupCollectorInterface */ - public function withAccountInformation(): GroupCollectorInterface; + public function withAccountInformation(): self; /** * Any notes, no matter what. * * @return GroupCollectorInterface */ - public function withAnyNotes(): GroupCollectorInterface; + public function withAnyNotes(): self; /** * Add basic info on attachments of transactions. * * @return GroupCollectorInterface */ - public function withAttachmentInformation(): GroupCollectorInterface; + public function withAttachmentInformation(): self; /** * Limit results to transactions without a bill.. * * @return GroupCollectorInterface */ - public function withBill(): GroupCollectorInterface; + public function withBill(): self; /** * Include bill name + ID. * * @return GroupCollectorInterface */ - public function withBillInformation(): GroupCollectorInterface; + public function withBillInformation(): self; /** * Limit results to a transactions with a budget. * * @return GroupCollectorInterface */ - public function withBudget(): GroupCollectorInterface; + public function withBudget(): self; /** * Will include budget ID + name, if any. * * @return GroupCollectorInterface */ - public function withBudgetInformation(): GroupCollectorInterface; + public function withBudgetInformation(): self; /** * Limit results to a transactions with a category. * * @return GroupCollectorInterface */ - public function withCategory(): GroupCollectorInterface; + public function withCategory(): self; /** * Will include category ID + name, if any. * * @return GroupCollectorInterface */ - public function withCategoryInformation(): GroupCollectorInterface; + public function withCategoryInformation(): self; /** * Transactions with any external ID * * @return GroupCollectorInterface */ - public function withExternalId(): GroupCollectorInterface; + public function withExternalId(): self; /** * Transactions with any external URL * * @return GroupCollectorInterface */ - public function withExternalUrl(): GroupCollectorInterface; + public function withExternalUrl(): self; /** * Transaction must have meta date field X. @@ -1452,94 +1452,94 @@ interface GroupCollectorInterface * * @return GroupCollectorInterface */ - public function withMetaDate(string $field): GroupCollectorInterface; + public function withMetaDate(string $field): self; /** * Will include notes. * * @return GroupCollectorInterface */ - public function withNotes(): GroupCollectorInterface; + public function withNotes(): self; /** * Add tag info. * * @return GroupCollectorInterface */ - public function withTagInformation(): GroupCollectorInterface; + public function withTagInformation(): self; /** * Limit results to a transactions without a bill. * * @return GroupCollectorInterface */ - public function withoutBill(): GroupCollectorInterface; + public function withoutBill(): self; /** * Limit results to a transactions without a budget. * * @return GroupCollectorInterface */ - public function withoutBudget(): GroupCollectorInterface; + public function withoutBudget(): self; /** * Limit results to a transactions without a category. * * @return GroupCollectorInterface */ - public function withoutCategory(): GroupCollectorInterface; + public function withoutCategory(): self; /** * Transactions without an external ID * * @return GroupCollectorInterface */ - public function withoutExternalId(): GroupCollectorInterface; + public function withoutExternalId(): self; /** * Transactions without an external URL * * @return GroupCollectorInterface */ - public function withoutExternalUrl(): GroupCollectorInterface; + public function withoutExternalUrl(): self; /** * @return GroupCollectorInterface */ - public function withoutNotes(): GroupCollectorInterface; + public function withoutNotes(): self; /** * @return GroupCollectorInterface */ - public function withoutTags(): GroupCollectorInterface; + public function withoutTags(): self; /** * @param string $year * * @return GroupCollectorInterface */ - public function yearAfter(string $year): GroupCollectorInterface; + public function yearAfter(string $year): self; /** * @param string $year * * @return GroupCollectorInterface */ - public function yearBefore(string $year): GroupCollectorInterface; + public function yearBefore(string $year): self; /** * @param string $year * * @return GroupCollectorInterface */ - public function yearIs(string $year): GroupCollectorInterface; + public function yearIs(string $year): self; /** * @param string $year * * @return GroupCollectorInterface */ - public function yearIsNot(string $year): GroupCollectorInterface; + public function yearIsNot(string $year): self; } diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index f0a7adced6..31a0b2cf3a 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -51,8 +51,8 @@ use Psr\Container\NotFoundExceptionInterface; */ class RegisterController extends Controller { - use RegistersUsers; use CreateStuff; + use RegistersUsers; /** * Where to redirect users after registration. diff --git a/app/Http/Controllers/Budget/ShowController.php b/app/Http/Controllers/Budget/ShowController.php index c07af019e7..4767db1a3a 100644 --- a/app/Http/Controllers/Budget/ShowController.php +++ b/app/Http/Controllers/Budget/ShowController.php @@ -46,8 +46,8 @@ use Psr\Container\NotFoundExceptionInterface; */ class ShowController extends Controller { - use PeriodOverview; use AugumentData; + use PeriodOverview; protected JournalRepositoryInterface $journalRepos; private BudgetRepositoryInterface $repository; diff --git a/app/Http/Controllers/Chart/AccountController.php b/app/Http/Controllers/Chart/AccountController.php index 19c62b31e9..b105b29db4 100644 --- a/app/Http/Controllers/Chart/AccountController.php +++ b/app/Http/Controllers/Chart/AccountController.php @@ -50,9 +50,9 @@ use Psr\Container\NotFoundExceptionInterface; */ class AccountController extends Controller { - use DateCalculation; use AugumentData; use ChartGeneration; + use DateCalculation; protected GeneratorInterface $generator; private AccountRepositoryInterface $accountRepository; diff --git a/app/Http/Controllers/Chart/BudgetController.php b/app/Http/Controllers/Chart/BudgetController.php index cc77852515..237357cc3c 100644 --- a/app/Http/Controllers/Chart/BudgetController.php +++ b/app/Http/Controllers/Chart/BudgetController.php @@ -49,8 +49,8 @@ use Illuminate\Support\Collection; */ class BudgetController extends Controller { - use DateCalculation; use AugumentData; + use DateCalculation; protected GeneratorInterface $generator; protected OperationsRepositoryInterface $opsRepository; diff --git a/app/Http/Controllers/Chart/CategoryController.php b/app/Http/Controllers/Chart/CategoryController.php index f600454d4d..0cc7060e33 100644 --- a/app/Http/Controllers/Chart/CategoryController.php +++ b/app/Http/Controllers/Chart/CategoryController.php @@ -47,9 +47,9 @@ use Psr\Container\NotFoundExceptionInterface; */ class CategoryController extends Controller { - use DateCalculation; use AugumentData; use ChartGeneration; + use DateCalculation; /** @var GeneratorInterface Chart generation methods. */ protected $generator; diff --git a/app/Http/Controllers/Chart/PiggyBankController.php b/app/Http/Controllers/Chart/PiggyBankController.php index 7057f84947..125b7e26d6 100644 --- a/app/Http/Controllers/Chart/PiggyBankController.php +++ b/app/Http/Controllers/Chart/PiggyBankController.php @@ -96,7 +96,7 @@ class PiggyBankController extends Controller $chartData = []; while ($oldest <= $today) { $filtered = $set->filter( - function (PiggyBankEvent $event) use ($oldest) { + static function (PiggyBankEvent $event) use ($oldest) { return $event->date->lte($oldest); } ); @@ -106,7 +106,7 @@ class PiggyBankController extends Controller $oldest = app('navigation')->addPeriod($oldest, $step, 0); } $finalFiltered = $set->filter( - function (PiggyBankEvent $event) use ($today) { + static function (PiggyBankEvent $event) use ($today) { return $event->date->lte($today); } ); diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index f77fc7ccef..bccf11d3a2 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -39,9 +39,9 @@ abstract class Controller extends BaseController { use AuthorizesRequests; use DispatchesJobs; - use ValidatesRequests; use RequestInformation; use UserNavigation; + use ValidatesRequests; protected string $dateTimeFormat; protected string $monthAndDayFormat; diff --git a/app/Http/Controllers/DebugController.php b/app/Http/Controllers/DebugController.php index 163d321fcb..002222f5ac 100644 --- a/app/Http/Controllers/DebugController.php +++ b/app/Http/Controllers/DebugController.php @@ -129,7 +129,7 @@ class DebugController extends Controller // get latest log file: $logger = Log::driver(); // PHPstan doesn't recognize the method because of its polymorphic nature. - $handlers = $logger->getHandlers(); // @phpstan-ignore-line + $handlers = $logger->getHandlers(); /** @phpstan-ignore-line */ $logContent = ''; foreach ($handlers as $handler) { if ($handler instanceof RotatingFileHandler) { @@ -174,7 +174,7 @@ class DebugController extends Controller 'db_version' => app('fireflyconfig')->get('db_version', 1)->data, 'php_version' => PHP_VERSION, 'php_os' => PHP_OS, - 'interface' => PHP_SAPI, + 'interface' => \PHP_SAPI, 'bcscale' => bcscale(), 'display_errors' => ini_get('display_errors'), 'error_reporting' => $this->errorReporting((int)ini_get('error_reporting')), @@ -246,7 +246,7 @@ class DebugController extends Controller 'default_locale' => (string)config('firefly.default_locale'), 'remote_header' => $userGuard === 'remote_user_guard' ? config('auth.guard_header') : 'N/A', 'remote_mail_header' => $userGuard === 'remote_user_guard' ? config('auth.guard_email') : 'N/A', - 'stateful_domains' => join(', ', config('sanctum.stateful')), + 'stateful_domains' => implode(', ', config('sanctum.stateful')), // the dates for the cron job are based on the recurring cron job's times. // any of the cron jobs will do, they always run at the same time. @@ -339,7 +339,7 @@ class DebugController extends Controller if ($user->bills()->count() > 0) { $flags[] = ':email:'; } - return join(' ', $flags); + return implode(' ', $flags); } /** diff --git a/app/Http/Controllers/Json/BoxController.php b/app/Http/Controllers/Json/BoxController.php index 880405105f..e915cf7f63 100644 --- a/app/Http/Controllers/Json/BoxController.php +++ b/app/Http/Controllers/Json/BoxController.php @@ -118,7 +118,7 @@ class BoxController extends Controller $leftToSpendAmount = bcadd($totalAvailableSum, $spentAmount); app('log')->debug(sprintf('So left to spend is %s', $leftToSpendAmount)); if (1 === bccomp($leftToSpendAmount, '0')) { - app('log')->debug(sprintf('Left to spend is positive!')); + app('log')->debug('Left to spend is positive!'); $boxTitle = (string)trans('firefly.left_to_spend'); $days = $today->diffInDays($end) + 1; $display = 1; // not overspent @@ -255,7 +255,7 @@ class BoxController extends Controller // filter list on preference of being included. $filtered = $allAccounts->filter( - function (Account $account) use ($accountRepository) { + static function (Account $account) use ($accountRepository) { $includeNetWorth = $accountRepository->getMetaValue($account, 'include_net_worth'); $result = null === $includeNetWorth ? true : '1' === $includeNetWorth; if (false === $result) { diff --git a/app/Http/Controllers/PreferencesController.php b/app/Http/Controllers/PreferencesController.php index f14b554f39..e112c3b8eb 100644 --- a/app/Http/Controllers/PreferencesController.php +++ b/app/Http/Controllers/PreferencesController.php @@ -53,7 +53,7 @@ class PreferencesController extends Controller parent::__construct(); $this->middleware( - function ($request, $next) { + static function ($request, $next) { app('view')->share('title', (string)trans('firefly.preferences')); app('view')->share('mainTitleIcon', 'fa-gear'); diff --git a/app/Http/Controllers/Rule/CreateController.php b/app/Http/Controllers/Rule/CreateController.php index eb42aa0b03..9268c3f2b7 100644 --- a/app/Http/Controllers/Rule/CreateController.php +++ b/app/Http/Controllers/Rule/CreateController.php @@ -45,8 +45,8 @@ use Illuminate\View\View; */ class CreateController extends Controller { - use RuleManagement; use ModelInformation; + use RuleManagement; private RuleRepositoryInterface $ruleRepos; diff --git a/app/Http/Controllers/Rule/EditController.php b/app/Http/Controllers/Rule/EditController.php index 29962e0aae..87fd751ce2 100644 --- a/app/Http/Controllers/Rule/EditController.php +++ b/app/Http/Controllers/Rule/EditController.php @@ -44,8 +44,8 @@ use Throwable; */ class EditController extends Controller { - use RuleManagement; use RenderPartialViews; + use RuleManagement; private RuleRepositoryInterface $ruleRepos; diff --git a/app/Http/Controllers/Rule/SelectController.php b/app/Http/Controllers/Rule/SelectController.php index 5a79336a7c..11d68f5b36 100644 --- a/app/Http/Controllers/Rule/SelectController.php +++ b/app/Http/Controllers/Rule/SelectController.php @@ -57,7 +57,7 @@ class SelectController extends Controller parent::__construct(); $this->middleware( - function ($request, $next) { + static function ($request, $next) { app('view')->share('title', (string)trans('firefly.rules')); app('view')->share('mainTitleIcon', 'fa-random'); diff --git a/app/Http/Controllers/TransactionCurrency/IndexController.php b/app/Http/Controllers/TransactionCurrency/IndexController.php index d3e00e8952..1aa032d016 100644 --- a/app/Http/Controllers/TransactionCurrency/IndexController.php +++ b/app/Http/Controllers/TransactionCurrency/IndexController.php @@ -84,7 +84,7 @@ class IndexController extends Controller // order so default is on top: $collection = $collection->sortBy( - function (TransactionCurrency $currency) { + static function (TransactionCurrency $currency) { $default = true === $currency->userDefault ? 0 : 1; $enabled = true === $currency->userEnabled ? 0 : 1; return sprintf('%s-%s-%s', $default, $enabled, $currency->code); diff --git a/app/Http/Controllers/Webhooks/CreateController.php b/app/Http/Controllers/Webhooks/CreateController.php index 4bf123ef0b..bae29cbffb 100644 --- a/app/Http/Controllers/Webhooks/CreateController.php +++ b/app/Http/Controllers/Webhooks/CreateController.php @@ -42,7 +42,7 @@ class CreateController extends Controller // translations: $this->middleware( - function ($request, $next) { + static function ($request, $next) { app('view')->share('mainTitleIcon', 'fa-bolt'); app('view')->share('subTitleIcon', 'fa-plus'); app('view')->share('title', (string)trans('firefly.webhooks')); diff --git a/app/Http/Controllers/Webhooks/DeleteController.php b/app/Http/Controllers/Webhooks/DeleteController.php index 7d0cd15ae7..4ad1173cfd 100644 --- a/app/Http/Controllers/Webhooks/DeleteController.php +++ b/app/Http/Controllers/Webhooks/DeleteController.php @@ -45,7 +45,7 @@ class DeleteController extends Controller // translations: $this->middleware( - function ($request, $next) { + static function ($request, $next) { app('view')->share('mainTitleIcon', 'fa-bolt'); app('view')->share('subTitleIcon', 'fa-trash'); app('view')->share('title', (string)trans('firefly.webhooks')); diff --git a/app/Http/Controllers/Webhooks/EditController.php b/app/Http/Controllers/Webhooks/EditController.php index 01a028334c..12c0e9816d 100644 --- a/app/Http/Controllers/Webhooks/EditController.php +++ b/app/Http/Controllers/Webhooks/EditController.php @@ -45,7 +45,7 @@ class EditController extends Controller // translations: $this->middleware( - function ($request, $next) { + static function ($request, $next) { app('view')->share('mainTitleIcon', 'fa-bolt'); app('view')->share('subTitleIcon', 'fa-pencil'); app('view')->share('title', (string)trans('firefly.webhooks')); diff --git a/app/Http/Controllers/Webhooks/IndexController.php b/app/Http/Controllers/Webhooks/IndexController.php index fb5067aa21..eafc423f32 100644 --- a/app/Http/Controllers/Webhooks/IndexController.php +++ b/app/Http/Controllers/Webhooks/IndexController.php @@ -43,7 +43,7 @@ class IndexController extends Controller // translations: $this->middleware( - function ($request, $next) { + static function ($request, $next) { app('view')->share('mainTitleIcon', 'fa-bolt'); app('view')->share('title', (string)trans('firefly.webhooks')); diff --git a/app/Http/Controllers/Webhooks/ShowController.php b/app/Http/Controllers/Webhooks/ShowController.php index 233523f96f..f6fe12c778 100644 --- a/app/Http/Controllers/Webhooks/ShowController.php +++ b/app/Http/Controllers/Webhooks/ShowController.php @@ -45,7 +45,7 @@ class ShowController extends Controller // translations: $this->middleware( - function ($request, $next) { + static function ($request, $next) { app('view')->share('mainTitleIcon', 'fa-bolt'); app('view')->share('subTitleIcon', 'fa-bolt'); app('view')->share('title', (string)trans('firefly.webhooks')); diff --git a/app/Http/Requests/AccountFormRequest.php b/app/Http/Requests/AccountFormRequest.php index 9301910560..f39eb03e28 100644 --- a/app/Http/Requests/AccountFormRequest.php +++ b/app/Http/Requests/AccountFormRequest.php @@ -37,9 +37,9 @@ use Illuminate\Foundation\Http\FormRequest; */ class AccountFormRequest extends FormRequest { - use ConvertsDataTypes; use AppendsLocationData; use ChecksLogin; + use ConvertsDataTypes; protected array $acceptedRoles = [UserRoleEnum::MANAGE_TRANSACTIONS]; diff --git a/app/Http/Requests/AttachmentFormRequest.php b/app/Http/Requests/AttachmentFormRequest.php index c09915b069..3df4d8da60 100644 --- a/app/Http/Requests/AttachmentFormRequest.php +++ b/app/Http/Requests/AttachmentFormRequest.php @@ -34,8 +34,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class AttachmentFormRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Returns the data required by the controller. diff --git a/app/Http/Requests/BillStoreRequest.php b/app/Http/Requests/BillStoreRequest.php index 8b2ef19b54..1061e7d0d5 100644 --- a/app/Http/Requests/BillStoreRequest.php +++ b/app/Http/Requests/BillStoreRequest.php @@ -32,8 +32,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class BillStoreRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Returns the data required by the controller. @@ -74,7 +74,7 @@ class BillStoreRequest extends FormRequest 'date' => 'required|date', 'bill_end_date' => 'nullable|date', 'extension_date' => 'nullable|date', - 'repeat_freq' => sprintf('required|in:%s', join(',', config('firefly.bill_periods'))), + 'repeat_freq' => sprintf('required|in:%s', implode(',', config('firefly.bill_periods'))), 'skip' => 'required|integer|gte:0|lte:31', 'active' => 'boolean', ]; diff --git a/app/Http/Requests/BillUpdateRequest.php b/app/Http/Requests/BillUpdateRequest.php index 89ffa5b0a7..7d84ef2c2c 100644 --- a/app/Http/Requests/BillUpdateRequest.php +++ b/app/Http/Requests/BillUpdateRequest.php @@ -33,8 +33,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class BillUpdateRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Returns the data required by the controller. @@ -78,7 +78,7 @@ class BillUpdateRequest extends FormRequest 'date' => 'required|date', 'bill_end_date' => 'nullable|date', 'extension_date' => 'nullable|date', - 'repeat_freq' => sprintf('required|in:%s', join(',', config('firefly.bill_periods'))), + 'repeat_freq' => sprintf('required|in:%s', implode(',', config('firefly.bill_periods'))), 'skip' => 'required|integer|gte:0|lte:31', 'active' => 'boolean', 'notes' => 'between:1,65536|nullable', diff --git a/app/Http/Requests/BudgetFormStoreRequest.php b/app/Http/Requests/BudgetFormStoreRequest.php index 3165ee7e78..1cd04340e5 100644 --- a/app/Http/Requests/BudgetFormStoreRequest.php +++ b/app/Http/Requests/BudgetFormStoreRequest.php @@ -34,9 +34,9 @@ use Illuminate\Validation\Validator; */ class BudgetFormStoreRequest extends FormRequest { + use ChecksLogin; use ConvertsDataTypes; use ValidatesAutoBudgetRequest; - use ChecksLogin; /** * Returns the data required by the controller. diff --git a/app/Http/Requests/BudgetFormUpdateRequest.php b/app/Http/Requests/BudgetFormUpdateRequest.php index ab61f774f5..91d7d479aa 100644 --- a/app/Http/Requests/BudgetFormUpdateRequest.php +++ b/app/Http/Requests/BudgetFormUpdateRequest.php @@ -35,9 +35,9 @@ use Illuminate\Validation\Validator; */ class BudgetFormUpdateRequest extends FormRequest { + use ChecksLogin; use ConvertsDataTypes; use ValidatesAutoBudgetRequest; - use ChecksLogin; /** * Returns the data required by the controller. diff --git a/app/Http/Requests/BulkEditJournalRequest.php b/app/Http/Requests/BulkEditJournalRequest.php index 1f8c04074e..1598e22a79 100644 --- a/app/Http/Requests/BulkEditJournalRequest.php +++ b/app/Http/Requests/BulkEditJournalRequest.php @@ -32,8 +32,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class BulkEditJournalRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Rules for this request. diff --git a/app/Http/Requests/CategoryFormRequest.php b/app/Http/Requests/CategoryFormRequest.php index 0e3c309d36..79b3977eea 100644 --- a/app/Http/Requests/CategoryFormRequest.php +++ b/app/Http/Requests/CategoryFormRequest.php @@ -33,8 +33,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class CategoryFormRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Get information for the controller. diff --git a/app/Http/Requests/CurrencyFormRequest.php b/app/Http/Requests/CurrencyFormRequest.php index b0048f8496..228b0538ea 100644 --- a/app/Http/Requests/CurrencyFormRequest.php +++ b/app/Http/Requests/CurrencyFormRequest.php @@ -33,8 +33,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class CurrencyFormRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Returns the data required by the controller. diff --git a/app/Http/Requests/InviteUserFormRequest.php b/app/Http/Requests/InviteUserFormRequest.php index d751e26f54..23cdfe9300 100644 --- a/app/Http/Requests/InviteUserFormRequest.php +++ b/app/Http/Requests/InviteUserFormRequest.php @@ -33,8 +33,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class InviteUserFormRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Rules for this request. diff --git a/app/Http/Requests/JournalLinkRequest.php b/app/Http/Requests/JournalLinkRequest.php index 7eb14cbee6..68f2f53d42 100644 --- a/app/Http/Requests/JournalLinkRequest.php +++ b/app/Http/Requests/JournalLinkRequest.php @@ -33,8 +33,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class JournalLinkRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Returns the data required by the controller. diff --git a/app/Http/Requests/NewUserFormRequest.php b/app/Http/Requests/NewUserFormRequest.php index a09ba41480..5a3f4b4380 100644 --- a/app/Http/Requests/NewUserFormRequest.php +++ b/app/Http/Requests/NewUserFormRequest.php @@ -34,8 +34,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class NewUserFormRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Rules for this request. diff --git a/app/Http/Requests/ObjectGroupFormRequest.php b/app/Http/Requests/ObjectGroupFormRequest.php index cabec0d41d..cdf90b70e0 100644 --- a/app/Http/Requests/ObjectGroupFormRequest.php +++ b/app/Http/Requests/ObjectGroupFormRequest.php @@ -33,8 +33,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class ObjectGroupFormRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Returns the data required by the controller. diff --git a/app/Http/Requests/PiggyBankStoreRequest.php b/app/Http/Requests/PiggyBankStoreRequest.php index b4baa67c46..9cb20e0467 100644 --- a/app/Http/Requests/PiggyBankStoreRequest.php +++ b/app/Http/Requests/PiggyBankStoreRequest.php @@ -32,8 +32,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class PiggyBankStoreRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Returns the data required by the controller. diff --git a/app/Http/Requests/PiggyBankUpdateRequest.php b/app/Http/Requests/PiggyBankUpdateRequest.php index 4f7558689c..34389570e4 100644 --- a/app/Http/Requests/PiggyBankUpdateRequest.php +++ b/app/Http/Requests/PiggyBankUpdateRequest.php @@ -33,8 +33,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class PiggyBankUpdateRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Returns the data required by the controller. diff --git a/app/Http/Requests/ReconciliationStoreRequest.php b/app/Http/Requests/ReconciliationStoreRequest.php index 126cdbd10d..ac7215592e 100644 --- a/app/Http/Requests/ReconciliationStoreRequest.php +++ b/app/Http/Requests/ReconciliationStoreRequest.php @@ -33,8 +33,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class ReconciliationStoreRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Returns the data required by the controller. diff --git a/app/Http/Requests/RecurrenceFormRequest.php b/app/Http/Requests/RecurrenceFormRequest.php index 2a4a1778ab..7c086d3f56 100644 --- a/app/Http/Requests/RecurrenceFormRequest.php +++ b/app/Http/Requests/RecurrenceFormRequest.php @@ -40,8 +40,8 @@ use Illuminate\Validation\Validator; */ class RecurrenceFormRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Get the data required by the controller. diff --git a/app/Http/Requests/RuleFormRequest.php b/app/Http/Requests/RuleFormRequest.php index d27371e4d7..ecd433cfaf 100644 --- a/app/Http/Requests/RuleFormRequest.php +++ b/app/Http/Requests/RuleFormRequest.php @@ -34,9 +34,9 @@ use Illuminate\Foundation\Http\FormRequest; */ class RuleFormRequest extends FormRequest { + use ChecksLogin; use ConvertsDataTypes; use GetRuleConfiguration; - use ChecksLogin; /** * Get all data for controller. diff --git a/app/Http/Requests/RuleGroupFormRequest.php b/app/Http/Requests/RuleGroupFormRequest.php index 91da192e06..635bac67b3 100644 --- a/app/Http/Requests/RuleGroupFormRequest.php +++ b/app/Http/Requests/RuleGroupFormRequest.php @@ -34,8 +34,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class RuleGroupFormRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Get all data for controller. diff --git a/app/Http/Requests/TagFormRequest.php b/app/Http/Requests/TagFormRequest.php index c006faaef7..8e04f69211 100644 --- a/app/Http/Requests/TagFormRequest.php +++ b/app/Http/Requests/TagFormRequest.php @@ -35,9 +35,9 @@ use Illuminate\Foundation\Http\FormRequest; */ class TagFormRequest extends FormRequest { - use ConvertsDataTypes; use AppendsLocationData; use ChecksLogin; + use ConvertsDataTypes; /** * Get all data for controller. diff --git a/app/Http/Requests/TestRuleFormRequest.php b/app/Http/Requests/TestRuleFormRequest.php index 39b7cc62d3..b5166f1eea 100644 --- a/app/Http/Requests/TestRuleFormRequest.php +++ b/app/Http/Requests/TestRuleFormRequest.php @@ -34,8 +34,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class TestRuleFormRequest extends FormRequest { - use GetRuleConfiguration; use ChecksLogin; + use GetRuleConfiguration; /** * Rules for this request. diff --git a/app/Http/Requests/TriggerRecurrenceRequest.php b/app/Http/Requests/TriggerRecurrenceRequest.php index 205141f368..640c338570 100644 --- a/app/Http/Requests/TriggerRecurrenceRequest.php +++ b/app/Http/Requests/TriggerRecurrenceRequest.php @@ -34,8 +34,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class TriggerRecurrenceRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Returns the data required by the controller. diff --git a/app/Http/Requests/UserFormRequest.php b/app/Http/Requests/UserFormRequest.php index 1305bda1fc..4aaa03d224 100644 --- a/app/Http/Requests/UserFormRequest.php +++ b/app/Http/Requests/UserFormRequest.php @@ -34,8 +34,8 @@ use Illuminate\Foundation\Http\FormRequest; */ class UserFormRequest extends FormRequest { - use ConvertsDataTypes; use ChecksLogin; + use ConvertsDataTypes; /** * Get data for controller. diff --git a/app/Jobs/MailError.php b/app/Jobs/MailError.php index d5e59a080f..47ad86903b 100644 --- a/app/Jobs/MailError.php +++ b/app/Jobs/MailError.php @@ -79,18 +79,18 @@ class MailError extends Job implements ShouldQueue $args['user'] = $this->userData; $args['ip'] = $this->ipAddress; $args['token'] = config('firefly.ipinfo_token'); - if ($this->attempts() < 3 && strlen($email) > 0) { + if ($this->attempts() < 3 && $email !== '') { try { Mail::send( ['emails.error-html', 'emails.error-text'], $args, - function (Message $message) use ($email) { + static function (Message $message) use ($email) { if ('mail@example.com' !== $email) { $message->to($email, $email)->subject((string)trans('email.error_subject')); } } ); - } catch (Exception | TransportException $e) { // @phpstan-ignore-line + } catch (Exception | TransportException $e) { /** @phpstan-ignore-line */ $message = $e->getMessage(); if (str_contains($message, 'Bcc')) { app('log')->warning('[Bcc] Could not email or log the error. Please validate your email settings, use the .env.example file as a guide.'); diff --git a/app/Models/Account.php b/app/Models/Account.php index 40578e52d7..3dfd789981 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -108,8 +108,8 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; */ class Account extends Model { - use SoftDeletes; use HasFactory; + use SoftDeletes; /** * The attributes that should be casted to native types. @@ -139,7 +139,7 @@ class Account extends Model * @return Account * @throws NotFoundHttpException */ - public static function routeBinder(string $value): Account + public static function routeBinder(string $value): self { if (auth()->check()) { $accountId = (int)$value; @@ -300,7 +300,7 @@ class Account extends Model protected function virtualBalance(): Attribute { return Attribute::make( - get: fn ($value) => (string)$value, + get: static fn ($value) => (string)$value, ); } } diff --git a/app/Models/Attachment.php b/app/Models/Attachment.php index 71b7da418a..d293b492c0 100644 --- a/app/Models/Attachment.php +++ b/app/Models/Attachment.php @@ -109,7 +109,7 @@ class Attachment extends Model * @return Attachment * @throws NotFoundHttpException */ - public static function routeBinder(string $value): Attachment + public static function routeBinder(string $value): self { if (auth()->check()) { $attachmentId = (int)$value; diff --git a/app/Models/AutoBudget.php b/app/Models/AutoBudget.php index 7f41e43db9..186323eb16 100644 --- a/app/Models/AutoBudget.php +++ b/app/Models/AutoBudget.php @@ -94,7 +94,7 @@ class AutoBudget extends Model protected function amount(): Attribute { return Attribute::make( - get: fn ($value) => (string)$value, + get: static fn ($value) => (string)$value, ); } } diff --git a/app/Models/AvailableBudget.php b/app/Models/AvailableBudget.php index 897380870f..874710f830 100644 --- a/app/Models/AvailableBudget.php +++ b/app/Models/AvailableBudget.php @@ -95,7 +95,7 @@ class AvailableBudget extends Model * @return AvailableBudget * @throws NotFoundHttpException */ - public static function routeBinder(string $value): AvailableBudget + public static function routeBinder(string $value): self { if (auth()->check()) { $availableBudgetId = (int)$value; @@ -132,7 +132,7 @@ class AvailableBudget extends Model protected function amount(): Attribute { return Attribute::make( - get: fn ($value) => (string)$value, + get: static fn ($value) => (string)$value, ); } } diff --git a/app/Models/Bill.php b/app/Models/Bill.php index ab17abbb30..f0cf315990 100644 --- a/app/Models/Bill.php +++ b/app/Models/Bill.php @@ -154,7 +154,7 @@ class Bill extends Model * @return Bill * @throws NotFoundHttpException */ - public static function routeBinder(string $value): Bill + public static function routeBinder(string $value): self { if (auth()->check()) { $billId = (int)$value; @@ -244,7 +244,7 @@ class Bill extends Model protected function amountMax(): Attribute { return Attribute::make( - get: fn ($value) => (string)$value, + get: static fn ($value) => (string)$value, ); } @@ -256,7 +256,7 @@ class Bill extends Model protected function amountMin(): Attribute { return Attribute::make( - get: fn ($value) => (string)$value, + get: static fn ($value) => (string)$value, ); } } diff --git a/app/Models/Budget.php b/app/Models/Budget.php index df9dc5f460..4819f84fb2 100644 --- a/app/Models/Budget.php +++ b/app/Models/Budget.php @@ -111,7 +111,7 @@ class Budget extends Model * @return Budget * @throws NotFoundHttpException */ - public static function routeBinder(string $value): Budget + public static function routeBinder(string $value): self { if (auth()->check()) { $budgetId = (int)$value; diff --git a/app/Models/BudgetLimit.php b/app/Models/BudgetLimit.php index 2a26b8bde5..10d45c81d4 100644 --- a/app/Models/BudgetLimit.php +++ b/app/Models/BudgetLimit.php @@ -97,7 +97,7 @@ class BudgetLimit extends Model * @return BudgetLimit * @throws NotFoundHttpException */ - public static function routeBinder(string $value): BudgetLimit + public static function routeBinder(string $value): self { if (auth()->check()) { $budgetLimitId = (int)$value; @@ -136,7 +136,7 @@ class BudgetLimit extends Model protected function amount(): Attribute { return Attribute::make( - get: fn ($value) => (string)$value, + get: static fn ($value) => (string)$value, ); } } diff --git a/app/Models/Category.php b/app/Models/Category.php index 7c709b40e3..c50159d905 100644 --- a/app/Models/Category.php +++ b/app/Models/Category.php @@ -101,7 +101,7 @@ class Category extends Model * @return Category * @throws NotFoundHttpException */ - public static function routeBinder(string $value): Category + public static function routeBinder(string $value): self { if (auth()->check()) { $categoryId = (int)$value; diff --git a/app/Models/CurrencyExchangeRate.php b/app/Models/CurrencyExchangeRate.php index da9a213139..981930d745 100644 --- a/app/Models/CurrencyExchangeRate.php +++ b/app/Models/CurrencyExchangeRate.php @@ -114,7 +114,7 @@ class CurrencyExchangeRate extends Model protected function rate(): Attribute { return Attribute::make( - get: fn ($value) => (string)$value, + get: static fn ($value) => (string)$value, ); } @@ -124,7 +124,7 @@ class CurrencyExchangeRate extends Model protected function userRate(): Attribute { return Attribute::make( - get: fn ($value) => (string)$value, + get: static fn ($value) => (string)$value, ); } } diff --git a/app/Models/InvitedUser.php b/app/Models/InvitedUser.php index b0203f49f3..ee9d3509a8 100644 --- a/app/Models/InvitedUser.php +++ b/app/Models/InvitedUser.php @@ -73,7 +73,7 @@ class InvitedUser extends Model * * @return InvitedUser */ - public static function routeBinder(string $value): InvitedUser + public static function routeBinder(string $value): self { if (auth()->check()) { $attemptId = (int)$value; diff --git a/app/Models/LinkType.php b/app/Models/LinkType.php index bf8bac28b5..e6e9efa155 100644 --- a/app/Models/LinkType.php +++ b/app/Models/LinkType.php @@ -91,7 +91,7 @@ class LinkType extends Model * * @throws NotFoundHttpException */ - public static function routeBinder(string $value): LinkType + public static function routeBinder(string $value): self { if (auth()->check()) { $linkTypeId = (int)$value; diff --git a/app/Models/ObjectGroup.php b/app/Models/ObjectGroup.php index 9574018a5d..fc140e0736 100644 --- a/app/Models/ObjectGroup.php +++ b/app/Models/ObjectGroup.php @@ -89,7 +89,7 @@ class ObjectGroup extends Model * @return ObjectGroup * @throws NotFoundHttpException */ - public static function routeBinder(string $value): ObjectGroup + public static function routeBinder(string $value): self { if (auth()->check()) { $objectGroupId = (int)$value; diff --git a/app/Models/PiggyBank.php b/app/Models/PiggyBank.php index b037720b67..d86627039a 100644 --- a/app/Models/PiggyBank.php +++ b/app/Models/PiggyBank.php @@ -115,7 +115,7 @@ class PiggyBank extends Model * @return PiggyBank * @throws NotFoundHttpException */ - public static function routeBinder(string $value): PiggyBank + public static function routeBinder(string $value): self { if (auth()->check()) { $piggyBankId = (int)$value; @@ -194,7 +194,7 @@ class PiggyBank extends Model protected function targetamount(): Attribute { return Attribute::make( - get: fn ($value) => (string)$value, + get: static fn ($value) => (string)$value, ); } } diff --git a/app/Models/PiggyBankEvent.php b/app/Models/PiggyBankEvent.php index 5cddd23b8a..42356087ce 100644 --- a/app/Models/PiggyBankEvent.php +++ b/app/Models/PiggyBankEvent.php @@ -105,7 +105,7 @@ class PiggyBankEvent extends Model protected function amount(): Attribute { return Attribute::make( - get: fn ($value) => (string)$value, + get: static fn ($value) => (string)$value, ); } } diff --git a/app/Models/PiggyBankRepetition.php b/app/Models/PiggyBankRepetition.php index a7f1572fb5..19b7ee58d3 100644 --- a/app/Models/PiggyBankRepetition.php +++ b/app/Models/PiggyBankRepetition.php @@ -103,13 +103,13 @@ class PiggyBankRepetition extends Model public function scopeRelevantOnDate(EloquentBuilder $query, Carbon $date) { return $query->where( - function (EloquentBuilder $q) use ($date) { + static function (EloquentBuilder $q) use ($date) { $q->where('startdate', '<=', $date->format('Y-m-d 00:00:00')); $q->orWhereNull('startdate'); } ) ->where( - function (EloquentBuilder $q) use ($date) { + static function (EloquentBuilder $q) use ($date) { $q->where('targetdate', '>=', $date->format('Y-m-d 00:00:00')); $q->orWhereNull('targetdate'); } @@ -133,7 +133,7 @@ class PiggyBankRepetition extends Model protected function currentamount(): Attribute { return Attribute::make( - get: fn ($value) => (string)$value, + get: static fn ($value) => (string)$value, ); } } diff --git a/app/Models/Preference.php b/app/Models/Preference.php index 0728f8e1cb..80e45b3e00 100644 --- a/app/Models/Preference.php +++ b/app/Models/Preference.php @@ -77,7 +77,7 @@ class Preference extends Model * @return Preference * @throws NotFoundHttpException */ - public static function routeBinder(string $value): Preference + public static function routeBinder(string $value): self { if (auth()->check()) { /** @var User $user */ @@ -92,7 +92,7 @@ class Preference extends Model } $default = config('firefly.default_preferences'); if (array_key_exists($value, $default)) { - $preference = new Preference(); + $preference = new self(); $preference->name = $value; $preference->data = $default[$value]; $preference->user_id = $user->id; diff --git a/app/Models/Recurrence.php b/app/Models/Recurrence.php index f269480bcf..f9e08c32d8 100644 --- a/app/Models/Recurrence.php +++ b/app/Models/Recurrence.php @@ -127,7 +127,7 @@ class Recurrence extends Model * @return Recurrence * @throws NotFoundHttpException */ - public static function routeBinder(string $value): Recurrence + public static function routeBinder(string $value): self { if (auth()->check()) { $recurrenceId = (int)$value; diff --git a/app/Models/RecurrenceTransaction.php b/app/Models/RecurrenceTransaction.php index 54db032bb8..d84770fd55 100644 --- a/app/Models/RecurrenceTransaction.php +++ b/app/Models/RecurrenceTransaction.php @@ -173,7 +173,7 @@ class RecurrenceTransaction extends Model protected function amount(): Attribute { return Attribute::make( - get: fn ($value) => (string)$value, + get: static fn ($value) => (string)$value, ); } @@ -183,7 +183,7 @@ class RecurrenceTransaction extends Model protected function foreignAmount(): Attribute { return Attribute::make( - get: fn ($value) => (string)$value, + get: static fn ($value) => (string)$value, ); } } diff --git a/app/Models/Rule.php b/app/Models/Rule.php index c3fc8bcf04..84d7f83981 100644 --- a/app/Models/Rule.php +++ b/app/Models/Rule.php @@ -110,7 +110,7 @@ class Rule extends Model * @return Rule * @throws NotFoundHttpException */ - public static function routeBinder(string $value): Rule + public static function routeBinder(string $value): self { if (auth()->check()) { $ruleId = (int)$value; diff --git a/app/Models/RuleGroup.php b/app/Models/RuleGroup.php index 14768e34fb..9de7a2ebde 100644 --- a/app/Models/RuleGroup.php +++ b/app/Models/RuleGroup.php @@ -100,7 +100,7 @@ class RuleGroup extends Model * @return RuleGroup * @throws NotFoundHttpException */ - public static function routeBinder(string $value): RuleGroup + public static function routeBinder(string $value): self { if (auth()->check()) { $ruleGroupId = (int)$value; diff --git a/app/Models/Tag.php b/app/Models/Tag.php index 95f8709ff7..52c3f8bc43 100644 --- a/app/Models/Tag.php +++ b/app/Models/Tag.php @@ -111,7 +111,7 @@ class Tag extends Model * @return Tag * @throws NotFoundHttpException */ - public static function routeBinder(string $value): Tag + public static function routeBinder(string $value): self { if (auth()->check()) { $tagId = (int)$value; diff --git a/app/Models/Transaction.php b/app/Models/Transaction.php index 4fd6421cf0..18bbc9d76c 100644 --- a/app/Models/Transaction.php +++ b/app/Models/Transaction.php @@ -89,8 +89,8 @@ use Illuminate\Database\Eloquent\SoftDeletes; */ class Transaction extends Model { - use SoftDeletes; use HasFactory; + use SoftDeletes; /** * The attributes that should be casted to native types. @@ -264,7 +264,7 @@ class Transaction extends Model protected function amount(): Attribute { return Attribute::make( - get: fn ($value) => (string)$value, + get: static fn ($value) => (string)$value, ); } @@ -276,7 +276,7 @@ class Transaction extends Model protected function foreignAmount(): Attribute { return Attribute::make( - get: fn ($value) => (string)$value, + get: static fn ($value) => (string)$value, ); } } diff --git a/app/Models/TransactionCurrency.php b/app/Models/TransactionCurrency.php index a55a0bd923..7aa407fe5c 100644 --- a/app/Models/TransactionCurrency.php +++ b/app/Models/TransactionCurrency.php @@ -103,7 +103,7 @@ class TransactionCurrency extends Model * @return TransactionCurrency * @throws NotFoundHttpException */ - public static function routeBinder(string $value): TransactionCurrency + public static function routeBinder(string $value): self { if (auth()->check()) { $currencyId = (int)$value; diff --git a/app/Models/TransactionGroup.php b/app/Models/TransactionGroup.php index 8280932837..bc636840f9 100644 --- a/app/Models/TransactionGroup.php +++ b/app/Models/TransactionGroup.php @@ -93,7 +93,7 @@ class TransactionGroup extends Model * @return TransactionGroup * @throws NotFoundHttpException */ - public static function routeBinder(string $value): TransactionGroup + public static function routeBinder(string $value): self { app('log')->debug(sprintf('Now in %s("%s")', __METHOD__, $value)); if (auth()->check()) { diff --git a/app/Models/TransactionJournal.php b/app/Models/TransactionJournal.php index 721772a52c..d18f269d25 100644 --- a/app/Models/TransactionJournal.php +++ b/app/Models/TransactionJournal.php @@ -123,8 +123,8 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; */ class TransactionJournal extends Model { - use SoftDeletes; use HasFactory; + use SoftDeletes; /** * The attributes that should be casted to native types. @@ -171,7 +171,7 @@ class TransactionJournal extends Model * @return TransactionJournal * @throws NotFoundHttpException */ - public static function routeBinder(string $value): TransactionJournal + public static function routeBinder(string $value): self { if (auth()->check()) { $journalId = (int)$value; diff --git a/app/Models/TransactionJournalLink.php b/app/Models/TransactionJournalLink.php index f393689427..fc8b977ade 100644 --- a/app/Models/TransactionJournalLink.php +++ b/app/Models/TransactionJournalLink.php @@ -85,7 +85,7 @@ class TransactionJournalLink extends Model * * @throws NotFoundHttpException */ - public static function routeBinder(string $value): TransactionJournalLink + public static function routeBinder(string $value): self { if (auth()->check()) { $linkId = (int)$value; diff --git a/app/Models/TransactionType.php b/app/Models/TransactionType.php index ec99eccf9f..82ff538f16 100644 --- a/app/Models/TransactionType.php +++ b/app/Models/TransactionType.php @@ -83,7 +83,7 @@ class TransactionType extends Model * @return TransactionType * @throws NotFoundHttpException */ - public static function routeBinder(string $type): TransactionType + public static function routeBinder(string $type): self { if (!auth()->check()) { throw new NotFoundHttpException(); diff --git a/app/Models/UserGroup.php b/app/Models/UserGroup.php index 52abf6dfe9..35700a0657 100644 --- a/app/Models/UserGroup.php +++ b/app/Models/UserGroup.php @@ -102,14 +102,14 @@ class UserGroup extends Model * @return UserGroup * @throws NotFoundHttpException */ - public static function routeBinder(string $value): UserGroup + public static function routeBinder(string $value): self { if (auth()->check()) { $userGroupId = (int)$value; /** @var User $user */ $user = auth()->user(); /** @var UserGroup|null $userGroup */ - $userGroup = UserGroup::find($userGroupId); + $userGroup = self::find($userGroupId); if (null === $userGroup) { throw new NotFoundHttpException(); } diff --git a/app/Models/Webhook.php b/app/Models/Webhook.php index 8df214cade..ca0c52a372 100644 --- a/app/Models/Webhook.php +++ b/app/Models/Webhook.php @@ -179,7 +179,7 @@ class Webhook extends Model * @return Webhook * @throws NotFoundHttpException */ - public static function routeBinder(string $value): Webhook + public static function routeBinder(string $value): self { if (auth()->check()) { $webhookId = (int)$value; diff --git a/app/Models/WebhookAttempt.php b/app/Models/WebhookAttempt.php index 7e6bda4a60..780176bebb 100644 --- a/app/Models/WebhookAttempt.php +++ b/app/Models/WebhookAttempt.php @@ -72,7 +72,7 @@ class WebhookAttempt extends Model * @return WebhookAttempt * @throws NotFoundHttpException */ - public static function routeBinder(string $value): WebhookAttempt + public static function routeBinder(string $value): self { if (auth()->check()) { $attemptId = (int)$value; diff --git a/app/Models/WebhookMessage.php b/app/Models/WebhookMessage.php index 1330396d4d..ef0b198059 100644 --- a/app/Models/WebhookMessage.php +++ b/app/Models/WebhookMessage.php @@ -86,7 +86,7 @@ class WebhookMessage extends Model * @return WebhookMessage * @throws NotFoundHttpException */ - public static function routeBinder(string $value): WebhookMessage + public static function routeBinder(string $value): self { if (auth()->check()) { $messageId = (int)$value; @@ -125,7 +125,7 @@ class WebhookMessage extends Model protected function sent(): Attribute { return Attribute::make( - get: fn ($value) => (bool)$value, + get: static fn ($value) => (bool)$value, ); } } diff --git a/app/Notifications/Admin/VersionCheckResult.php b/app/Notifications/Admin/VersionCheckResult.php index ac0c195457..a4cf00e1b0 100644 --- a/app/Notifications/Admin/VersionCheckResult.php +++ b/app/Notifications/Admin/VersionCheckResult.php @@ -88,7 +88,7 @@ class VersionCheckResult extends Notification public function toSlack($notifiable) { return (new SlackMessage())->content($this->message) - ->attachment(function ($attachment) { + ->attachment(static function ($attachment) { $attachment->title('Firefly III @ GitHub', 'https://github.com/firefly-iii/firefly-iii/releases'); }); } diff --git a/app/Notifications/User/BillReminder.php b/app/Notifications/User/BillReminder.php index d3824aca52..c049d48726 100644 --- a/app/Notifications/User/BillReminder.php +++ b/app/Notifications/User/BillReminder.php @@ -105,7 +105,7 @@ class BillReminder extends Notification $url = route('bills.show', [$bill->id]); return (new SlackMessage()) ->warning() - ->attachment(function ($attachment) use ($bill, $url) { + ->attachment(static function ($attachment) use ($bill, $url) { $attachment->title((string)trans('firefly.visit_bill', ['name' => $bill->name]), $url); }) ->content($message); diff --git a/app/Notifications/User/RuleActionFailed.php b/app/Notifications/User/RuleActionFailed.php index caeef8a5b4..fff1ec6192 100644 --- a/app/Notifications/User/RuleActionFailed.php +++ b/app/Notifications/User/RuleActionFailed.php @@ -88,9 +88,9 @@ class RuleActionFailed extends Notification $ruleTitle = $this->ruleTitle; $ruleLink = $this->ruleLink; - return (new SlackMessage())->content($this->message)->attachment(function ($attachment) use ($groupTitle, $groupLink) { + return (new SlackMessage())->content($this->message)->attachment(static function ($attachment) use ($groupTitle, $groupLink) { $attachment->title((string)trans('rules.inspect_transaction', ['title' => $groupTitle]), $groupLink); - })->attachment(function ($attachment) use ($ruleTitle, $ruleLink) { + })->attachment(static function ($attachment) use ($ruleTitle, $ruleLink) { $attachment->title((string)trans('rules.inspect_rule', ['title' => $ruleTitle]), $ruleLink); }); } diff --git a/app/Providers/AccountServiceProvider.php b/app/Providers/AccountServiceProvider.php index e0e40daea8..a9f799e60d 100644 --- a/app/Providers/AccountServiceProvider.php +++ b/app/Providers/AccountServiceProvider.php @@ -62,7 +62,7 @@ class AccountServiceProvider extends ServiceProvider { $this->app->bind( AccountRepositoryInterface::class, - function (Application $app) { + static function (Application $app) { /** @var AccountRepositoryInterface $repository */ $repository = app(AccountRepository::class); @@ -77,7 +77,7 @@ class AccountServiceProvider extends ServiceProvider $this->app->bind( AdminAccountRepositoryInterface::class, - function (Application $app) { + static function (Application $app) { /** @var AdminAccountRepositoryInterface $repository */ $repository = app(AdminAccountRepository::class); @@ -113,7 +113,7 @@ class AccountServiceProvider extends ServiceProvider { $this->app->bind( AccountTaskerInterface::class, - function (Application $app) { + static function (Application $app) { /** @var AccountTaskerInterface $tasker */ $tasker = app(AccountTasker::class); diff --git a/app/Providers/AdminServiceProvider.php b/app/Providers/AdminServiceProvider.php index baa781b603..d882159e4e 100644 --- a/app/Providers/AdminServiceProvider.php +++ b/app/Providers/AdminServiceProvider.php @@ -55,7 +55,7 @@ class AdminServiceProvider extends ServiceProvider { $this->app->bind( LinkTypeRepositoryInterface::class, - function (Application $app) { + static function (Application $app) { /** @var LinkTypeRepository $repository */ $repository = app(LinkTypeRepository::class); // reference to auth is not understood by phpstan. diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 5094305b08..92439eb191 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -42,7 +42,7 @@ class AppServiceProvider extends ServiceProvider public function boot(): void { Schema::defaultStringLength(191); - Response::macro('api', function (array $value) { + Response::macro('api', static function (array $value) { $headers = [ 'Cache-Control' => 'no-store', ]; diff --git a/app/Providers/AttachmentServiceProvider.php b/app/Providers/AttachmentServiceProvider.php index c6ba8cae34..56d0574b14 100644 --- a/app/Providers/AttachmentServiceProvider.php +++ b/app/Providers/AttachmentServiceProvider.php @@ -47,7 +47,7 @@ class AttachmentServiceProvider extends ServiceProvider { $this->app->bind( AttachmentRepositoryInterface::class, - function (Application $app) { + static function (Application $app) { /** @var AttachmentRepositoryInterface $repository */ $repository = app(AttachmentRepository::class); // reference to auth is not understood by phpstan. diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index 331499dab6..c2c87177bb 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -53,7 +53,7 @@ class AuthServiceProvider extends ServiceProvider { Auth::provider( 'remote_user_provider', - function ($app, array $config) { + static function ($app, array $config) { return new RemoteUserProvider(); } ); diff --git a/app/Providers/BillServiceProvider.php b/app/Providers/BillServiceProvider.php index dac9f83a73..2c903fac5a 100644 --- a/app/Providers/BillServiceProvider.php +++ b/app/Providers/BillServiceProvider.php @@ -49,7 +49,7 @@ class BillServiceProvider extends ServiceProvider { $this->app->bind( BillRepositoryInterface::class, - function (Application $app) { + static function (Application $app) { /** @var BillRepositoryInterface $repository */ $repository = app(BillRepository::class); @@ -65,7 +65,7 @@ class BillServiceProvider extends ServiceProvider // administration variant $this->app->bind( AdminBillRepositoryInterface::class, - function (Application $app) { + static function (Application $app) { /** @var AdminBillRepositoryInterface $repository */ $repository = app(AdminBillRepository::class); diff --git a/app/Providers/CurrencyServiceProvider.php b/app/Providers/CurrencyServiceProvider.php index 47b9070c33..7fbad5ddb6 100644 --- a/app/Providers/CurrencyServiceProvider.php +++ b/app/Providers/CurrencyServiceProvider.php @@ -49,7 +49,7 @@ class CurrencyServiceProvider extends ServiceProvider { $this->app->bind( CurrencyRepositoryInterface::class, - function (Application $app) { + static function (Application $app) { /** @var CurrencyRepository $repository */ $repository = app(CurrencyRepository::class); // phpstan does not get the reference to auth @@ -62,7 +62,7 @@ class CurrencyServiceProvider extends ServiceProvider ); $this->app->bind( GroupCurrencyRepositoryInterface::class, - function (Application $app) { + static function (Application $app) { /** @var GroupCurrencyRepository $repository */ $repository = app(GroupCurrencyRepository::class); // phpstan does not get the reference to auth diff --git a/app/Providers/FireflySessionProvider.php b/app/Providers/FireflySessionProvider.php index f07474003c..3ffeb23a0d 100644 --- a/app/Providers/FireflySessionProvider.php +++ b/app/Providers/FireflySessionProvider.php @@ -51,7 +51,7 @@ class FireflySessionProvider extends ServiceProvider { $this->app->singleton( 'session', - function ($app) { + static function ($app) { return new SessionManager($app); } ); @@ -64,7 +64,7 @@ class FireflySessionProvider extends ServiceProvider { $this->app->singleton( 'session.store', - function ($app) { + static function ($app) { // First, we will create the session manager which is responsible for the // creation of the various session drivers when they are needed by the // application instance, and will resolve them on a lazy load basis. diff --git a/app/Providers/PiggyBankServiceProvider.php b/app/Providers/PiggyBankServiceProvider.php index 4c60ba9ff5..0fecc55bd2 100644 --- a/app/Providers/PiggyBankServiceProvider.php +++ b/app/Providers/PiggyBankServiceProvider.php @@ -49,7 +49,7 @@ class PiggyBankServiceProvider extends ServiceProvider { $this->app->bind( PiggyBankRepositoryInterface::class, - function (Application $app) { + static function (Application $app) { /** @var PiggyBankRepository $repository */ $repository = app(PiggyBankRepository::class); if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth) @@ -62,7 +62,7 @@ class PiggyBankServiceProvider extends ServiceProvider $this->app->bind( AdminPiggyBankRepositoryInterface::class, - function (Application $app) { + static function (Application $app) { /** @var AdminPiggyBankRepository $repository */ $repository = app(AdminPiggyBankRepository::class); if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth) diff --git a/app/Providers/RecurringServiceProvider.php b/app/Providers/RecurringServiceProvider.php index b954885476..01c929165d 100644 --- a/app/Providers/RecurringServiceProvider.php +++ b/app/Providers/RecurringServiceProvider.php @@ -47,7 +47,7 @@ class RecurringServiceProvider extends ServiceProvider { $this->app->bind( RecurringRepositoryInterface::class, - function (Application $app) { + static function (Application $app) { /** @var RecurringRepositoryInterface $repository */ $repository = app(RecurringRepository::class); diff --git a/app/Providers/RuleGroupServiceProvider.php b/app/Providers/RuleGroupServiceProvider.php index 01297995ae..b63226cac3 100644 --- a/app/Providers/RuleGroupServiceProvider.php +++ b/app/Providers/RuleGroupServiceProvider.php @@ -47,7 +47,7 @@ class RuleGroupServiceProvider extends ServiceProvider { $this->app->bind( RuleGroupRepositoryInterface::class, - function (Application $app) { + static function (Application $app) { /** @var RuleGroupRepository $repository */ $repository = app(RuleGroupRepository::class); if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth) diff --git a/app/Providers/RuleServiceProvider.php b/app/Providers/RuleServiceProvider.php index 62dfb0e3e7..47545abdc1 100644 --- a/app/Providers/RuleServiceProvider.php +++ b/app/Providers/RuleServiceProvider.php @@ -47,7 +47,7 @@ class RuleServiceProvider extends ServiceProvider { $this->app->bind( RuleRepositoryInterface::class, - function (Application $app) { + static function (Application $app) { /** @var RuleRepository $repository */ $repository = app(RuleRepository::class); if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth) diff --git a/app/Providers/SearchServiceProvider.php b/app/Providers/SearchServiceProvider.php index 3bdbcdf5e6..6d63d0afe8 100644 --- a/app/Providers/SearchServiceProvider.php +++ b/app/Providers/SearchServiceProvider.php @@ -47,7 +47,7 @@ class SearchServiceProvider extends ServiceProvider { $this->app->bind( SearchInterface::class, - function (Application $app) { + static function (Application $app) { /** @var OperatorQuerySearch $search */ $search = app(OperatorQuerySearch::class); if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth) diff --git a/app/Providers/TagServiceProvider.php b/app/Providers/TagServiceProvider.php index 17f5e107d2..ecbea3ff80 100644 --- a/app/Providers/TagServiceProvider.php +++ b/app/Providers/TagServiceProvider.php @@ -49,7 +49,7 @@ class TagServiceProvider extends ServiceProvider { $this->app->bind( TagRepositoryInterface::class, - function (Application $app) { + static function (Application $app) { /** @var TagRepository $repository */ $repository = app(TagRepository::class); @@ -63,7 +63,7 @@ class TagServiceProvider extends ServiceProvider $this->app->bind( OperationsRepositoryInterface::class, - function (Application $app) { + static function (Application $app) { /** @var OperationsRepository $repository */ $repository = app(OperationsRepository::class); diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php index b05a653e46..52111fb3ee 100644 --- a/app/Repositories/Account/AccountRepository.php +++ b/app/Repositories/Account/AccountRepository.php @@ -116,7 +116,7 @@ class AccountRepository implements AccountRepositoryInterface ->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id') ->where('accounts.active', true) ->where( - function (EloquentBuilder $q1) use ($number) { // @phpstan-ignore-line + static function (EloquentBuilder $q1) use ($number) { /** @phpstan-ignore-line */ $json = json_encode($number); $q1->where('account_meta.name', '=', 'account_number'); $q1->where('account_meta.data', '=', $json); @@ -219,7 +219,7 @@ class AccountRepository implements AccountRepositoryInterface { $query = $this->user->accounts()->with( [ - 'accountmeta' => function (HasMany $query) { + 'accountmeta' => static function (HasMany $query) { $query->where('name', 'account_role'); }, 'attachments', @@ -305,7 +305,7 @@ class AccountRepository implements AccountRepositoryInterface { $query = $this->user->accounts()->with( [ - 'accountmeta' => function (HasMany $query) { + 'accountmeta' => static function (HasMany $query) { $query->where('name', 'account_role'); }, ] @@ -493,7 +493,7 @@ class AccountRepository implements AccountRepositoryInterface public function getMetaValue(Account $account, string $field): ?string { $result = $account->accountMeta->filter( - function (AccountMeta $meta) use ($field) { + static function (AccountMeta $meta) use ($field) { return strtolower($meta->name) === strtolower($field); } ); @@ -728,10 +728,10 @@ class AccountRepository implements AccountRepositoryInterface foreach ($parts as $part) { $search = sprintf('%%%s%%', $part); $dbQuery->where( - function (EloquentBuilder $q1) use ($search) { // @phpstan-ignore-line + static function (EloquentBuilder $q1) use ($search) { // @phpstan-ignore-line $q1->where('accounts.iban', 'LIKE', $search); $q1->orWhere( - function (EloquentBuilder $q2) use ($search) { + static function (EloquentBuilder $q2) use ($search) { $q2->where('account_meta.name', '=', 'account_number'); $q2->where('account_meta.data', 'LIKE', $search); } diff --git a/app/Repositories/Journal/JournalAPIRepository.php b/app/Repositories/Journal/JournalAPIRepository.php index 9aea1b3128..b3d6e43710 100644 --- a/app/Repositories/Journal/JournalAPIRepository.php +++ b/app/Repositories/Journal/JournalAPIRepository.php @@ -102,7 +102,7 @@ class JournalAPIRepository implements JournalAPIRepositoryInterface { $events = $journal->piggyBankEvents()->get(); $events->each( - function (PiggyBankEvent $event) { + static function (PiggyBankEvent $event) { $event->piggyBank = $event->piggyBank()->withTrashed()->first(); } ); diff --git a/app/Repositories/LinkType/LinkTypeRepository.php b/app/Repositories/LinkType/LinkTypeRepository.php index 71bb0989f1..98b0f05fcc 100644 --- a/app/Repositories/LinkType/LinkTypeRepository.php +++ b/app/Repositories/LinkType/LinkTypeRepository.php @@ -198,7 +198,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface $merged = $outward->merge($inward); return $merged->filter( - function (TransactionJournalLink $link) { + static function (TransactionJournalLink $link) { return null !== $link->source && null !== $link->destination; } ); diff --git a/app/Repositories/Recurring/RecurringRepository.php b/app/Repositories/Recurring/RecurringRepository.php index f49c7d1b92..4ee6747606 100644 --- a/app/Repositories/Recurring/RecurringRepository.php +++ b/app/Repositories/Recurring/RecurringRepository.php @@ -68,14 +68,14 @@ class RecurringRepository implements RecurringRepositoryInterface { // if not, loop set and try to read the recurrence_date. If it matches start or end, return it as well. $set - = TransactionJournalMeta::where(function (Builder $q1) use ($recurrence) { + = TransactionJournalMeta::where(static function (Builder $q1) use ($recurrence) { $q1->where('name', 'recurrence_id'); $q1->where('data', json_encode((string)$recurrence->id)); })->get(['journal_meta.transaction_journal_id']); // there are X journals made for this recurrence. Any of them meant for today? foreach ($set as $journalMeta) { - $count = TransactionJournalMeta::where(function (Builder $q2) use ($date) { + $count = TransactionJournalMeta::where(static function (Builder $q2) use ($date) { $string = (string)$date; app('log')->debug(sprintf('Search for date: %s', json_encode($string))); $q2->where('name', 'recurrence_date'); diff --git a/app/Repositories/RuleGroup/RuleGroupRepository.php b/app/Repositories/RuleGroup/RuleGroupRepository.php index 9ff584e7e7..c3e42d60b3 100644 --- a/app/Repositories/RuleGroup/RuleGroupRepository.php +++ b/app/Repositories/RuleGroup/RuleGroupRepository.php @@ -321,11 +321,11 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface app('log')->debug(sprintf('Will filter getRuleGroupsWithRules on "%s".', $filter)); return $groups->map( - function (RuleGroup $group) use ($filter) { + static function (RuleGroup $group) use ($filter) { app('log')->debug(sprintf('Now filtering group #%d', $group->id)); // filter the rules in the rule group: $group->rules = $group->rules->filter( - function (Rule $rule) use ($filter) { + static function (Rule $rule) use ($filter) { app('log')->debug(sprintf('Now filtering rule #%d', $rule->id)); foreach ($rule->ruleTriggers as $trigger) { if ('user_action' === $trigger->trigger_type && $filter === $trigger->trigger_value) { @@ -384,11 +384,11 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface app('log')->debug(sprintf('Will filter getRuleGroupsWithRules on "%s".', $filter)); return $groups->map( - function (RuleGroup $group) use ($filter) { + static function (RuleGroup $group) use ($filter) { app('log')->debug(sprintf('Now filtering group #%d', $group->id)); // filter the rules in the rule group: $group->rules = $group->rules->filter( - function (Rule $rule) use ($filter) { + static function (Rule $rule) use ($filter) { app('log')->debug(sprintf('Now filtering rule #%d', $rule->id)); foreach ($rule->ruleTriggers as $trigger) { if ('user_action' === $trigger->trigger_type && $filter === $trigger->trigger_value) { diff --git a/app/Repositories/UserGroup/UserGroupRepository.php b/app/Repositories/UserGroup/UserGroupRepository.php index b7483e0528..3a3faa6e5f 100644 --- a/app/Repositories/UserGroup/UserGroupRepository.php +++ b/app/Repositories/UserGroup/UserGroupRepository.php @@ -277,11 +277,11 @@ class UserGroupRepository implements UserGroupRepositoryInterface private function simplifyListByName(array $roles): array { if (in_array(UserRoleEnum::OWNER->value, $roles, true)) { - app('log')->debug(sprintf('List of roles is [%1$s] but this includes "%2$s", so return [%2$s]', join(',', $roles), UserRoleEnum::OWNER->value)); + app('log')->debug(sprintf('List of roles is [%1$s] but this includes "%2$s", so return [%2$s]', implode(',', $roles), UserRoleEnum::OWNER->value)); return [UserRoleEnum::OWNER->value]; } if (in_array(UserRoleEnum::FULL->value, $roles, true)) { - app('log')->debug(sprintf('List of roles is [%1$s] but this includes "%2$s", so return [%2$s]', join(',', $roles), UserRoleEnum::FULL->value)); + app('log')->debug(sprintf('List of roles is [%1$s] but this includes "%2$s", so return [%2$s]', implode(',', $roles), UserRoleEnum::FULL->value)); return [UserRoleEnum::FULL->value]; } return $roles; diff --git a/app/Repositories/UserGroups/Account/AccountRepository.php b/app/Repositories/UserGroups/Account/AccountRepository.php index 968bb5519a..770d8a0481 100644 --- a/app/Repositories/UserGroups/Account/AccountRepository.php +++ b/app/Repositories/UserGroups/Account/AccountRepository.php @@ -98,7 +98,7 @@ class AccountRepository implements AccountRepositoryInterface public function getMetaValue(Account $account, string $field): ?string { $result = $account->accountMeta->filter( - function (AccountMeta $meta) use ($field) { + static function (AccountMeta $meta) use ($field) { return strtolower($meta->name) === strtolower($field); } ); diff --git a/app/Repositories/UserGroups/Currency/CurrencyRepository.php b/app/Repositories/UserGroups/Currency/CurrencyRepository.php index 7f25a5fa0a..8e89532f60 100644 --- a/app/Repositories/UserGroups/Currency/CurrencyRepository.php +++ b/app/Repositories/UserGroups/Currency/CurrencyRepository.php @@ -179,11 +179,11 @@ class CurrencyRepository implements CurrencyRepositoryInterface { $all = TransactionCurrency::orderBy('code', 'ASC')->get(); $local = $this->get(); - return $all->map(function (TransactionCurrency $current) use ($local) { - $hasId = $local->contains(function (TransactionCurrency $entry) use ($current) { + return $all->map(static function (TransactionCurrency $current) use ($local) { + $hasId = $local->contains(static function (TransactionCurrency $entry) use ($current) { return (int)$entry->id === (int)$current->id; }); - $isDefault = $local->contains(function (TransactionCurrency $entry) use ($current) { + $isDefault = $local->contains(static function (TransactionCurrency $entry) use ($current) { return 1 === (int)$entry->pivot->group_default && (int)$entry->id === (int)$current->id; }); $current->userEnabled = $hasId; @@ -200,7 +200,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface public function get(): Collection { $all = $this->userGroup->currencies()->orderBy('code', 'ASC')->withPivot(['group_default'])->get(); - $all->map(function (TransactionCurrency $current) { + $all->map(static function (TransactionCurrency $current) { $current->userEnabled = true; $current->userDefault = 1 === (int)$current->pivot->group_default; return $current; diff --git a/app/Repositories/Webhook/WebhookRepository.php b/app/Repositories/Webhook/WebhookRepository.php index 12a28bf15d..9bd15a33fb 100644 --- a/app/Repositories/Webhook/WebhookRepository.php +++ b/app/Repositories/Webhook/WebhookRepository.php @@ -98,7 +98,7 @@ class WebhookRepository implements WebhookRepositoryInterface ->where('webhook_messages.errored', 0) ->get(['webhook_messages.*']) ->filter( - function (WebhookMessage $message) { + static function (WebhookMessage $message) { return $message->webhookAttempts()->count() <= 2; } )->splice(0, 3); diff --git a/app/Rules/IsValidBulkClause.php b/app/Rules/IsValidBulkClause.php index 83c7479d37..6cde1386a0 100644 --- a/app/Rules/IsValidBulkClause.php +++ b/app/Rules/IsValidBulkClause.php @@ -107,7 +107,7 @@ class IsValidBulkClause implements ValidationRule 'value' => $this->rules[$clause][$arrayKey], ]); if ($validator->fails()) { - $this->error = sprintf('%s: %s: %s', $clause, $arrayKey, join(', ', ($validator->errors()->get('value')))); + $this->error = sprintf('%s: %s: %s', $clause, $arrayKey, implode(', ', ($validator->errors()->get('value')))); return false; } diff --git a/app/Rules/UniqueIban.php b/app/Rules/UniqueIban.php index 729b7423af..836aa7eb0f 100644 --- a/app/Rules/UniqueIban.php +++ b/app/Rules/UniqueIban.php @@ -116,7 +116,7 @@ class UniqueIban implements ValidationRule $value, $count, $type, - join(', ', $this->expectedTypes) + implode(', ', $this->expectedTypes) ) ); diff --git a/app/Services/Internal/Update/CurrencyUpdateService.php b/app/Services/Internal/Update/CurrencyUpdateService.php index 01fe1692f6..9271b13981 100644 --- a/app/Services/Internal/Update/CurrencyUpdateService.php +++ b/app/Services/Internal/Update/CurrencyUpdateService.php @@ -57,8 +57,8 @@ class CurrencyUpdateService if (array_key_exists('decimal_places', $data) && is_int($data['decimal_places'])) { $currency->decimal_places = (int)$data['decimal_places']; } - unset($currency->userEnabled); - unset($currency->userDefault); + $currency->userEnabled = null; + $currency->userDefault = null; $currency->save(); return $currency; diff --git a/app/Services/Internal/Update/GroupUpdateService.php b/app/Services/Internal/Update/GroupUpdateService.php index 627963eff6..d4546ea22b 100644 --- a/app/Services/Internal/Update/GroupUpdateService.php +++ b/app/Services/Internal/Update/GroupUpdateService.php @@ -242,7 +242,7 @@ class GroupUpdateService ); } $collection->each( - function (TransactionJournal $journal) use ($transactionGroup) { + static function (TransactionJournal $journal) use ($transactionGroup) { $transactionGroup->transactionJournals()->save($journal); } ); diff --git a/app/Services/Internal/Update/RecurrenceUpdateService.php b/app/Services/Internal/Update/RecurrenceUpdateService.php index 95f5ab6188..078f76d906 100644 --- a/app/Services/Internal/Update/RecurrenceUpdateService.php +++ b/app/Services/Internal/Update/RecurrenceUpdateService.php @@ -41,8 +41,8 @@ use JsonException; */ class RecurrenceUpdateService { - use TransactionTypeTrait; use RecurringTransactionTrait; + use TransactionTypeTrait; private User $user; diff --git a/app/Support/Authentication/RemoteUserGuard.php b/app/Support/Authentication/RemoteUserGuard.php index 8dc0640a3a..441d8766de 100644 --- a/app/Support/Authentication/RemoteUserGuard.php +++ b/app/Support/Authentication/RemoteUserGuard.php @@ -129,7 +129,7 @@ class RemoteUserGuard implements Guard public function check(): bool { app('log')->debug(sprintf('Now at %s', __METHOD__)); - return !is_null($this->user()); + return null !== $this->user(); } /** diff --git a/app/Support/Binder/Date.php b/app/Support/Binder/Date.php index 11f65ee027..f05028d998 100644 --- a/app/Support/Binder/Date.php +++ b/app/Support/Binder/Date.php @@ -71,7 +71,7 @@ class Date implements BinderInterface try { $result = new Carbon($value); - } catch (InvalidDateException $e) { // @phpstan-ignore-line + } catch (InvalidDateException $e) { /** @phpstan-ignore-line */ $message = sprintf('Could not parse date "%s" for user #%d: %s', $value, auth()->user()->id, $e->getMessage()); app('log')->error($message); throw new NotFoundHttpException($message, $e); diff --git a/app/Support/Calendar/Calculator.php b/app/Support/Calendar/Calculator.php index 7cbebb670f..5e67b7ecfa 100644 --- a/app/Support/Calendar/Calculator.php +++ b/app/Support/Calendar/Calculator.php @@ -83,7 +83,7 @@ class Calculator */ private static function loadIntervalMap(): SplObjectStorage { - if (self::$intervalMap != null) { + if (self::$intervalMap !== null) { return self::$intervalMap; } self::$intervalMap = new SplObjectStorage(); diff --git a/app/Support/ExpandedForm.php b/app/Support/ExpandedForm.php index edd4be4ba1..4895db91f3 100644 --- a/app/Support/ExpandedForm.php +++ b/app/Support/ExpandedForm.php @@ -226,7 +226,7 @@ class ExpandedForm /** @var Eloquent $entry */ foreach ($set as $entry) { // All Eloquent models have an ID - $entryId = (int)$entry->id; // @phpstan-ignore-line + $entryId = (int)$entry->id; /** @phpstan-ignore-line */ $current = $entry->toArray(); $title = null; foreach ($fields as $field) { diff --git a/app/Support/Navigation.php b/app/Support/Navigation.php index f9a43667c0..4f39d5f5aa 100644 --- a/app/Support/Navigation.php +++ b/app/Support/Navigation.php @@ -91,7 +91,7 @@ class Navigation Log::error(sprintf( 'The periodicity %s is unknown. Choose one of available periodicity: %s', $repeatFreq, - join(', ', array_keys($functionMap)) + implode(', ', array_keys($functionMap)) )); return $theDate; } diff --git a/app/Support/NullArrayObject.php b/app/Support/NullArrayObject.php index 4685abb517..36a4d4da48 100644 --- a/app/Support/NullArrayObject.php +++ b/app/Support/NullArrayObject.php @@ -41,7 +41,7 @@ class NullArrayObject extends ArrayObject * @param array $array * @param null $default */ - /* @phpstan-ignore-next-line */ + /** @phpstan-ignore-next-line */ public function __construct(array $array, $default = null) { parent::__construct($array); diff --git a/app/Support/Search/AccountSearch.php b/app/Support/Search/AccountSearch.php index 6ab13e967f..404f79efb6 100644 --- a/app/Support/Search/AccountSearch.php +++ b/app/Support/Search/AccountSearch.php @@ -77,7 +77,7 @@ class AccountSearch implements GenericSearchInterface ); // meta data: $searchQuery->orWhere( - static function (Builder $q) use ($originalQuery) { // @phpstan-ignore-line + static function (Builder $q) use ($originalQuery) { /** @phpstan-ignore-line */ $json = json_encode($originalQuery, JSON_THROW_ON_ERROR); $q->where('account_meta.name', '=', 'account_number'); $q->where('account_meta.data', 'LIKE', $json); @@ -96,7 +96,7 @@ class AccountSearch implements GenericSearchInterface case self::SEARCH_NUMBER: // meta data: $searchQuery->Where( - static function (Builder $q) use ($originalQuery) { // @phpstan-ignore-line + static function (Builder $q) use ($originalQuery) { /** @phpstan-ignore-line */ $json = json_encode($originalQuery, JSON_THROW_ON_ERROR); $q->where('account_meta.name', 'account_number'); $q->where('account_meta.data', $json); diff --git a/app/Support/Search/OperatorQuerySearch.php b/app/Support/Search/OperatorQuerySearch.php index 211ad4d559..e4a6386362 100644 --- a/app/Support/Search/OperatorQuerySearch.php +++ b/app/Support/Search/OperatorQuerySearch.php @@ -1410,7 +1410,7 @@ class OperatorQuerySearch implements SearchInterface } app('log')->debug(sprintf('Found %d accounts, will filter.', $accounts->count())); $filtered = $accounts->filter( - function (Account $account) use ($value, $stringMethod) { + static function (Account $account) use ($value, $stringMethod) { return $stringMethod(strtolower($account->name), strtolower($value)); } ); @@ -1490,7 +1490,7 @@ class OperatorQuerySearch implements SearchInterface // if found, do filter app('log')->debug(sprintf('Found %d accounts, will filter.', $accounts->count())); $filtered = $accounts->filter( - function (Account $account) use ($value, $stringMethod) { + static function (Account $account) use ($value, $stringMethod) { // either IBAN or account number $ibanMatch = $stringMethod(strtolower((string)$account->iban), strtolower((string)$value)); $accountNrMatch = false; diff --git a/app/Support/Twig/General.php b/app/Support/Twig/General.php index 4281ff1539..6cf083aa93 100644 --- a/app/Support/Twig/General.php +++ b/app/Support/Twig/General.php @@ -357,7 +357,7 @@ class General extends AbstractExtension { return new TwigFunction( 'formatDate', - function (string $date, string $format): string { + static function (string $date, string $format): string { $carbon = new Carbon($date); return $carbon->isoFormat($format); diff --git a/app/TransactionRules/Engine/SearchRuleEngine.php b/app/TransactionRules/Engine/SearchRuleEngine.php index 90095a9c7a..ff24071dce 100644 --- a/app/TransactionRules/Engine/SearchRuleEngine.php +++ b/app/TransactionRules/Engine/SearchRuleEngine.php @@ -290,7 +290,7 @@ class SearchRuleEngine implements RuleEngineInterface // make collection unique $unique = $total->unique( - function (array $group) { + static function (array $group) { $str = ''; foreach ($group['transactions'] as $transaction) { $str = sprintf('%s%d', $str, $transaction['transaction_journal_id']); diff --git a/app/User.php b/app/User.php index de4e8640b3..e10efc3c5a 100644 --- a/app/User.php +++ b/app/User.php @@ -173,8 +173,8 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; */ class User extends Authenticatable { - use Notifiable; use HasApiTokens; + use Notifiable; /** * The attributes that should be cast to native types. @@ -212,7 +212,7 @@ class User extends Authenticatable * @return User * @throws NotFoundHttpException */ - public static function routeBinder(string $value): User + public static function routeBinder(string $value): self { if (auth()->check()) { $userId = (int)$value; @@ -405,11 +405,11 @@ class User extends Authenticatable $roles[] = UserRoleEnum::OWNER->value; $roles[] = UserRoleEnum::FULL->value; } - app('log')->debug(sprintf('in hasRoleInGroup(%s)', join(', ', $roles))); + app('log')->debug(sprintf('in hasRoleInGroup(%s)', implode(', ', $roles))); /** @var Collection $dbRoles */ $dbRoles = UserRole::whereIn('title', $roles)->get(); if (0 === $dbRoles->count()) { - app('log')->error(sprintf('Could not find role(s): %s. Probably migration mishap.', join(', ', $roles))); + app('log')->error(sprintf('Could not find role(s): %s. Probably migration mishap.', implode(', ', $roles))); return false; } $dbRolesIds = $dbRoles->pluck('id')->toArray(); @@ -424,7 +424,7 @@ class User extends Authenticatable 'User #%d "%s" does not have roles %s in user group #%d "%s"', $this->id, $this->email, - join(', ', $roles), + implode(', ', $roles), $userGroup->id, $userGroup->title )); @@ -448,7 +448,7 @@ class User extends Authenticatable 'User #%d "%s" does not have roles %s in user group #%d "%s"', $this->id, $this->email, - join(', ', $roles), + implode(', ', $roles), $userGroup->id, $userGroup->title )); diff --git a/app/Validation/AccountValidator.php b/app/Validation/AccountValidator.php index 62376016f5..04f06b2b31 100644 --- a/app/Validation/AccountValidator.php +++ b/app/Validation/AccountValidator.php @@ -42,12 +42,12 @@ use FireflyIII\Validation\Account\WithdrawalValidation; */ class AccountValidator { - use WithdrawalValidation; use DepositValidation; - use TransferValidation; - use ReconciliationValidation; - use OBValidation; use LiabilityValidation; + use OBValidation; + use ReconciliationValidation; + use TransferValidation; + use WithdrawalValidation; public bool $createMode; public string $destError; diff --git a/app/Validation/FireflyValidator.php b/app/Validation/FireflyValidator.php index c980bb6d22..c5c52e0afd 100644 --- a/app/Validation/FireflyValidator.php +++ b/app/Validation/FireflyValidator.php @@ -220,12 +220,12 @@ class FireflyValidator extends Validator $last = substr($value, 4); $iban = $last . $first; $iban = trim(str_replace($search, $replace, $iban)); - if (0 === strlen($iban)) { + if ('' === $iban) { return false; } try { $checksum = bcmod($iban, '97'); - } catch (ValueError $e) { // @phpstan-ignore-line + } catch (ValueError $e) { /** @phpstan-ignore-line */ $message = sprintf('Could not validate IBAN check value "%s" (IBAN "%s")', $iban, $value); app('log')->error($message); app('log')->error($e->getTraceAsString()); diff --git a/database/migrations/2020_07_24_162820_changes_for_v540.php b/database/migrations/2020_07_24_162820_changes_for_v540.php index 55f025a56c..cf195dd551 100644 --- a/database/migrations/2020_07_24_162820_changes_for_v540.php +++ b/database/migrations/2020_07_24_162820_changes_for_v540.php @@ -152,7 +152,7 @@ class ChangesForV540 extends Migration try { Schema::table( 'oauth_clients', - function (Blueprint $table) { + static function (Blueprint $table) { $table->string('secret', 100)->nullable()->change(); } ); diff --git a/database/migrations/2020_11_12_070604_changes_for_v550.php b/database/migrations/2020_11_12_070604_changes_for_v550.php index 0e4292a1ec..75dc90884d 100644 --- a/database/migrations/2020_11_12_070604_changes_for_v550.php +++ b/database/migrations/2020_11_12_070604_changes_for_v550.php @@ -71,7 +71,7 @@ class ChangesForV550 extends Migration try { Schema::table( 'budget_transaction_journal', - function (Blueprint $table) { + static function (Blueprint $table) { if ('sqlite' !== config('database.default')) { $table->dropForeign('budget_id_foreign'); } @@ -136,7 +136,7 @@ class ChangesForV550 extends Migration try { Schema::create( 'jobs', - function (Blueprint $table) { + static function (Blueprint $table) { $table->bigIncrements('id'); $table->string('queue')->index(); $table->longText('payload'); @@ -159,7 +159,7 @@ class ChangesForV550 extends Migration try { Schema::create( 'failed_jobs', - function (Blueprint $table) { + static function (Blueprint $table) { $table->bigIncrements('id'); $table->string('uuid')->unique(); $table->text('connection'); @@ -180,7 +180,7 @@ class ChangesForV550 extends Migration try { Schema::table( 'budget_transaction_journal', - function (Blueprint $table) { + static function (Blueprint $table) { if (!Schema::hasColumn('budget_transaction_journal', 'budget_limit_id')) { $table->integer('budget_limit_id', false, true)->nullable()->default(null)->after('budget_id'); $table->foreign('budget_limit_id', 'budget_id_foreign')->references('id')->on('budget_limits')->onDelete('set null'); diff --git a/database/migrations/2021_03_12_061213_changes_for_v550b2.php b/database/migrations/2021_03_12_061213_changes_for_v550b2.php index d3364a7b84..1fc8ff7457 100644 --- a/database/migrations/2021_03_12_061213_changes_for_v550b2.php +++ b/database/migrations/2021_03_12_061213_changes_for_v550b2.php @@ -44,7 +44,7 @@ class ChangesForV550b2 extends Migration try { Schema::table( 'recurrences_transactions', - function (Blueprint $table) { + static function (Blueprint $table) { if ('sqlite' !== config('database.default')) { $table->dropForeign('type_foreign'); } @@ -72,7 +72,7 @@ class ChangesForV550b2 extends Migration try { Schema::table( 'recurrences_transactions', - function (Blueprint $table) { + static function (Blueprint $table) { if (!Schema::hasColumn('recurrences_transactions', 'transaction_type_id')) { $table->integer('transaction_type_id', false, true)->nullable()->after('transaction_currency_id'); $table->foreign('transaction_type_id', 'type_foreign')->references('id')->on('transaction_types')->onDelete('set null'); diff --git a/database/migrations/2021_05_09_064644_add_ldap_columns_to_users_table.php b/database/migrations/2021_05_09_064644_add_ldap_columns_to_users_table.php index 330f76bf5f..424725295f 100644 --- a/database/migrations/2021_05_09_064644_add_ldap_columns_to_users_table.php +++ b/database/migrations/2021_05_09_064644_add_ldap_columns_to_users_table.php @@ -39,7 +39,7 @@ class AddLdapColumnsToUsersTable extends Migration try { Schema::table( 'users', - function (Blueprint $table) { + static function (Blueprint $table) { $table->dropColumn(['domain']); } ); @@ -59,7 +59,7 @@ class AddLdapColumnsToUsersTable extends Migration try { Schema::table( 'users', - function (Blueprint $table) { + static function (Blueprint $table) { $table->string('domain')->nullable(); } ); diff --git a/database/migrations/2021_05_13_053836_extend_currency_info.php b/database/migrations/2021_05_13_053836_extend_currency_info.php index 962016e894..8b41a79a42 100644 --- a/database/migrations/2021_05_13_053836_extend_currency_info.php +++ b/database/migrations/2021_05_13_053836_extend_currency_info.php @@ -52,7 +52,7 @@ class ExtendCurrencyInfo extends Migration try { Schema::table( 'transaction_currencies', - function (Blueprint $table) { + static function (Blueprint $table) { $table->string('code', 51)->change(); $table->string('symbol', 51)->change(); } diff --git a/database/migrations/2021_08_28_073733_user_groups.php b/database/migrations/2021_08_28_073733_user_groups.php index 761eac84c0..055efbee45 100644 --- a/database/migrations/2021_08_28_073733_user_groups.php +++ b/database/migrations/2021_08_28_073733_user_groups.php @@ -65,7 +65,7 @@ class UserGroups extends Migration try { Schema::table( $tableName, - function (Blueprint $table) use ($tableName) { + static function (Blueprint $table) use ($tableName) { if ('sqlite' !== config('database.default')) { $table->dropForeign(sprintf('%s_to_ugi', $tableName)); } @@ -85,7 +85,7 @@ class UserGroups extends Migration try { Schema::table( 'users', - function (Blueprint $table) { + static function (Blueprint $table) { if ('sqlite' !== config('database.default')) { $table->dropForeign('type_user_group_id'); } @@ -178,7 +178,7 @@ class UserGroups extends Migration try { Schema::table( 'users', - function (Blueprint $table) { + static function (Blueprint $table) { if (!Schema::hasColumn('users', 'user_group_id')) { $table->bigInteger('user_group_id', false, true)->nullable(); $table->foreign('user_group_id', 'type_user_group_id')->references('id')->on('user_groups')->onDelete('set null')->onUpdate( @@ -197,7 +197,7 @@ class UserGroups extends Migration try { Schema::table( $tableName, - function (Blueprint $table) use ($tableName) { + static function (Blueprint $table) use ($tableName) { if (!Schema::hasColumn($tableName, 'user_group_id')) { $table->bigInteger('user_group_id', false, true)->nullable()->after('user_id'); $table->foreign('user_group_id', sprintf('%s_to_ugi', $tableName))->references('id')->on('user_groups')->onDelete( diff --git a/database/migrations/2021_12_27_000001_create_local_personal_access_tokens_table.php b/database/migrations/2021_12_27_000001_create_local_personal_access_tokens_table.php index 2e012562f8..9c5bee0f7c 100644 --- a/database/migrations/2021_12_27_000001_create_local_personal_access_tokens_table.php +++ b/database/migrations/2021_12_27_000001_create_local_personal_access_tokens_table.php @@ -51,7 +51,7 @@ class CreateLocalPersonalAccessTokensTable extends Migration { if (!Schema::hasTable('personal_access_tokens')) { try { - Schema::create('personal_access_tokens', function (Blueprint $table) { + Schema::create('personal_access_tokens', static function (Blueprint $table) { $table->bigIncrements('id'); $table->morphs('tokenable'); $table->string('name'); diff --git a/database/migrations/2022_08_21_104626_add_user_groups.php b/database/migrations/2022_08_21_104626_add_user_groups.php index 236db80847..377fe6f350 100644 --- a/database/migrations/2022_08_21_104626_add_user_groups.php +++ b/database/migrations/2022_08_21_104626_add_user_groups.php @@ -42,7 +42,7 @@ return new class () extends Migration { try { Schema::table( 'currency_exchange_rates', - function (Blueprint $table) { + static function (Blueprint $table) { if (!Schema::hasColumn('currency_exchange_rates', 'user_group_id')) { $table->bigInteger('user_group_id', false, true)->nullable()->after('user_id'); $table->foreign('user_group_id', 'cer_to_ugi')->references('id')->on('user_groups')->onDelete('set null')->onUpdate('cascade'); @@ -65,7 +65,7 @@ return new class () extends Migration { try { Schema::table( 'currency_exchange_rates', - function (Blueprint $table) { + static function (Blueprint $table) { if ('sqlite' !== config('database.default')) { $table->dropForeign('cer_to_ugi'); } diff --git a/database/migrations/2022_09_18_123911_create_notifications_table.php b/database/migrations/2022_09_18_123911_create_notifications_table.php index c5a4fd1599..b1b9c3baee 100644 --- a/database/migrations/2022_09_18_123911_create_notifications_table.php +++ b/database/migrations/2022_09_18_123911_create_notifications_table.php @@ -37,7 +37,7 @@ return new class () extends Migration { { if (!Schema::hasTable('notifications')) { try { - Schema::create('notifications', function (Blueprint $table) { + Schema::create('notifications', static function (Blueprint $table) { $table->uuid('id')->primary(); $table->string('type'); $table->morphs('notifiable'); diff --git a/database/migrations/2022_10_01_074908_invited_users.php b/database/migrations/2022_10_01_074908_invited_users.php index 4a6246d4e5..a2725157c5 100644 --- a/database/migrations/2022_10_01_074908_invited_users.php +++ b/database/migrations/2022_10_01_074908_invited_users.php @@ -37,7 +37,7 @@ return new class () extends Migration { { if (!Schema::hasTable('invited_users')) { try { - Schema::create('invited_users', function (Blueprint $table) { + Schema::create('invited_users', static function (Blueprint $table) { $table->id(); $table->timestamps(); $table->integer('user_id', false, true); diff --git a/database/migrations/2022_10_01_210238_audit_log_entries.php b/database/migrations/2022_10_01_210238_audit_log_entries.php index 98d8170e72..66cb8ff62b 100644 --- a/database/migrations/2022_10_01_210238_audit_log_entries.php +++ b/database/migrations/2022_10_01_210238_audit_log_entries.php @@ -37,7 +37,7 @@ return new class () extends Migration { { if (!Schema::hasTable('audit_log_entries')) { try { - Schema::create('audit_log_entries', function (Blueprint $table) { + Schema::create('audit_log_entries', static function (Blueprint $table) { $table->id(); $table->timestamps(); $table->softDeletes(); diff --git a/database/migrations/2023_08_11_192521_upgrade_og_table.php b/database/migrations/2023_08_11_192521_upgrade_og_table.php index 1285607771..2b5205bc74 100644 --- a/database/migrations/2023_08_11_192521_upgrade_og_table.php +++ b/database/migrations/2023_08_11_192521_upgrade_og_table.php @@ -41,7 +41,7 @@ return new class () extends Migration { try { Schema::table( 'object_groups', - function (Blueprint $table) { + static function (Blueprint $table) { if (!Schema::hasColumn('object_groups', 'user_group_id')) { $table->bigInteger('user_group_id', false, true)->nullable()->after('user_id'); $table->foreign('user_group_id', sprintf('%s_to_ugi', 'object_groups'))->references('id')->on('user_groups')->onDelete( @@ -64,7 +64,7 @@ return new class () extends Migration { try { Schema::table( 'object_groups', - function (Blueprint $table) { + static function (Blueprint $table) { if ('sqlite' !== config('database.default')) { $table->dropForeign(sprintf('%s_to_ugi', 'object_groups')); } diff --git a/database/migrations/2023_10_21_113213_add_currency_pivot_tables.php b/database/migrations/2023_10_21_113213_add_currency_pivot_tables.php index ae1325870a..ee486af825 100644 --- a/database/migrations/2023_10_21_113213_add_currency_pivot_tables.php +++ b/database/migrations/2023_10_21_113213_add_currency_pivot_tables.php @@ -37,7 +37,7 @@ return new class () extends Migration { // transaction_currency_user if (!Schema::hasTable('transaction_currency_user')) { try { - Schema::create('transaction_currency_user', function (Blueprint $table) { + Schema::create('transaction_currency_user', static function (Blueprint $table) { $table->id(); $table->timestamps(); $table->integer('user_id', false, true); @@ -56,7 +56,7 @@ return new class () extends Migration { // transaction_currency_user_group if (!Schema::hasTable('transaction_currency_user_group')) { try { - Schema::create('transaction_currency_user_group', function (Blueprint $table) { + Schema::create('transaction_currency_user_group', static function (Blueprint $table) { $table->id(); $table->timestamps(); $table->bigInteger('user_group_id', false, true); diff --git a/routes/web.php b/routes/web.php index 21c83f3676..f3f7ecc124 100644 --- a/routes/web.php +++ b/routes/web.php @@ -47,7 +47,7 @@ Route::group( Route::group( ['middleware' => 'binders-only', 'namespace' => 'FireflyIII\Http\Controllers\System'], static function () { - Route::get('offline', fn () => view('errors.offline')); + Route::get('offline', static fn () => view('errors.offline')); Route::get('health', ['uses' => 'HealthcheckController@check', 'as' => 'healthcheck']); } );