From 3589c9f60f6bac13e8ec21dc91f351dac6e65c9c Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 18 Sep 2021 10:20:19 +0200 Subject: [PATCH] Various code cleanup. --- .../Data/Export/ExportController.php | 2 - .../Models/Account/ListController.php | 2 +- .../Models/Account/ShowController.php | 3 +- .../Models/Bill/DestroyController.php | 1 - .../Models/Bill/ListController.php | 7 ++-- .../Models/Bill/ShowController.php | 4 +- .../Models/Bill/StoreController.php | 1 - .../Models/Bill/UpdateController.php | 1 - .../Models/Budget/ListController.php | 7 ++-- .../Models/Budget/ShowController.php | 3 +- .../Models/BudgetLimit/ListController.php | 3 +- .../Models/BudgetLimit/StoreController.php | 1 - .../Models/Category/DestroyController.php | 1 - .../Models/Category/ListController.php | 5 ++- .../Models/Category/ShowController.php | 4 +- .../Models/Category/StoreController.php | 1 - .../Models/Category/UpdateController.php | 1 - .../Models/ObjectGroup/ListController.php | 5 ++- .../Models/ObjectGroup/ShowController.php | 3 +- .../Models/PiggyBank/ListController.php | 5 ++- .../Models/PiggyBank/ShowController.php | 3 +- .../Models/Recurrence/DestroyController.php | 1 - .../Models/Recurrence/ListController.php | 3 +- .../Models/Recurrence/ShowController.php | 4 +- .../Models/Recurrence/StoreController.php | 1 - .../Models/Recurrence/UpdateController.php | 1 - .../Models/Rule/ShowController.php | 3 +- .../Models/RuleGroup/ListController.php | 3 +- .../Models/RuleGroup/ShowController.php | 3 +- .../Models/RuleGroup/TriggerController.php | 1 - .../Controllers/Models/Tag/ListController.php | 5 ++- .../Controllers/Models/Tag/ShowController.php | 3 +- .../Models/Transaction/ListController.php | 7 ++-- .../Models/Transaction/ShowController.php | 3 +- .../TransactionCurrency/ListController.php | 15 ++++---- .../TransactionCurrency/ShowController.php | 4 +- .../TransactionCurrency/StoreController.php | 1 - .../TransactionCurrency/UpdateController.php | 4 +- .../Models/TransactionLink/ShowController.php | 3 +- .../TransactionLinkType/ListController.php | 3 +- .../TransactionLinkType/ShowController.php | 3 +- .../Search/TransactionController.php | 3 +- .../System/ConfigurationController.php | 9 +++-- .../User/PreferencesController.php | 1 + .../Controllers/Webhook/AttemptController.php | 1 - .../Controllers/Webhook/DestroyController.php | 1 - .../Controllers/Webhook/MessageController.php | 1 - .../V1/Controllers/Webhook/ShowController.php | 4 +- .../Controllers/Webhook/StoreController.php | 1 - .../Controllers/Webhook/UpdateController.php | 1 - .../V1/Requests/Insight/GenericRequest.php | 4 +- .../Models/Recurrence/StoreRequest.php | 1 - .../Models/Transaction/UpdateRequest.php | 1 + .../CorrectOpeningBalanceCurrencies.php | 2 +- .../Commands/Correction/DeleteZeroAmount.php | 1 - app/Console/Commands/Export/ExportData.php | 3 -- .../Commands/Upgrade/AccountCurrencies.php | 6 ++- .../Upgrade/AppendBudgetLimitPeriods.php | 4 +- .../Commands/Upgrade/BackToJournals.php | 6 ++- .../Commands/Upgrade/BudgetLimitCurrency.php | 6 ++- .../Commands/Upgrade/CCLiabilities.php | 6 ++- .../Upgrade/CreateGroupMemberships.php | 1 + .../Commands/Upgrade/MigrateAttachments.php | 4 +- .../Commands/Upgrade/MigrateJournalNotes.php | 4 +- .../Upgrade/MigrateRecurrenceMeta.php | 10 +++-- .../Upgrade/MigrateRecurrenceType.php | 4 +- .../Commands/Upgrade/MigrateTagLocations.php | 4 +- .../Commands/Upgrade/MigrateToGroups.php | 3 +- .../Upgrade/OtherCurrenciesCorrections.php | 4 +- .../Commands/Upgrade/RenameAccountMeta.php | 4 +- .../Upgrade/TransactionIdentifier.php | 4 +- .../Upgrade/TransferCurrenciesCorrections.php | 7 ++-- .../Commands/Upgrade/UpgradeLiabilities.php | 4 +- .../Commands/UpgradeFireflyInstructions.php | 2 - app/Console/Commands/VerifySecurityAlerts.php | 1 + app/Events/RequestedReportOnJournals.php | 1 - app/Events/StoredTransactionGroup.php | 1 + app/Events/UpdatedTransactionGroup.php | 1 + app/Exceptions/GracefulNotFoundHandler.php | 5 ++- app/Factory/AccountFactory.php | 8 +++- app/Factory/RecurrenceFactory.php | 6 +-- app/Factory/TransactionJournalFactory.php | 7 ++-- app/Handlers/Events/APIEventHandler.php | 3 +- app/Handlers/Events/AdminEventHandler.php | 3 +- app/Handlers/Events/AutomationHandler.php | 3 +- .../Events/VersionCheckEventHandler.php | 5 ++- app/Helpers/Help/Help.php | 3 +- app/Helpers/Update/UpdateTrait.php | 3 +- .../Controllers/Account/EditController.php | 1 + .../Admin/ConfigurationController.php | 3 +- app/Http/Controllers/AttachmentController.php | 3 +- app/Http/Controllers/Auth/LoginController.php | 12 +++--- .../Controllers/Auth/RegisterController.php | 3 +- .../Controllers/Auth/TwoFactorController.php | 4 +- .../Controllers/Budget/CreateController.php | 3 +- .../Controllers/Category/CreateController.php | 3 +- .../Controllers/Export/IndexController.php | 6 ++- .../ObjectGroup/DeleteController.php | 4 +- .../ObjectGroup/EditController.php | 10 ++++- .../ObjectGroup/IndexController.php | 3 +- .../PiggyBank/CreateController.php | 3 +- .../Controllers/PiggyBank/EditController.php | 8 +--- app/Http/Controllers/ProfileController.php | 12 ++++-- .../Controllers/Report/BillController.php | 3 +- app/Http/Controllers/ReportController.php | 3 +- .../Controllers/System/CronController.php | 5 ++- app/Http/Controllers/TagController.php | 3 +- .../Transaction/BulkController.php | 5 ++- .../Transaction/DeleteController.php | 4 +- .../Transaction/MassController.php | 9 +++-- app/Jobs/CreateRecurringTransactions.php | 6 ++- app/Models/GroupMembership.php | 29 ++++++++------- app/Models/UserGroup.php | 28 ++++++++------ app/Models/UserRole.php | 28 ++++++++------ .../Account/AccountRepository.php | 8 +--- .../Journal/JournalRepository.php | 4 +- .../LinkType/LinkTypeRepository.php | 2 +- .../PiggyBank/ModifiesPiggyBanks.php | 4 +- .../Recurring/RecurringRepository.php | 3 +- app/Repositories/User/UserRepository.php | 3 +- app/Rules/BelongsUser.php | 37 +++++++------------ .../Support/RecurringTransactionTrait.php | 2 +- .../Internal/Update/AccountUpdateService.php | 5 ++- .../Internal/Update/GroupUpdateService.php | 3 +- .../Internal/Update/JournalUpdateService.php | 2 +- .../Authentication/RemoteUserGuard.php | 2 +- app/Support/Binder/CLIToken.php | 3 +- app/Support/Export/ExportDataGenerator.php | 20 +++++----- app/Support/ParseDateString.php | 8 ++-- app/Support/Search/AccountSearch.php | 3 +- app/Support/Search/OperatorQuerySearch.php | 13 +++---- app/Support/Steam.php | 6 ++- app/Transformers/PiggyBankTransformer.php | 4 +- app/Transformers/RecurrenceTransformer.php | 4 +- app/Transformers/TagTransformer.php | 2 +- .../TransactionGroupTransformer.php | 2 +- app/Validation/FireflyValidator.php | 9 +++-- 137 files changed, 369 insertions(+), 282 deletions(-) diff --git a/app/Api/V1/Controllers/Data/Export/ExportController.php b/app/Api/V1/Controllers/Data/Export/ExportController.php index 4eb6343b41..781f118768 100644 --- a/app/Api/V1/Controllers/Data/Export/ExportController.php +++ b/app/Api/V1/Controllers/Data/Export/ExportController.php @@ -29,8 +29,6 @@ use FireflyIII\Api\V1\Requests\Data\Export\ExportRequest; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Support\Export\ExportDataGenerator; use Illuminate\Http\Response as LaravelResponse; -use League\Csv\CannotInsertRecord; -use League\Csv\Exception; /** * Class ExportController diff --git a/app/Api/V1/Controllers/Models/Account/ListController.php b/app/Api/V1/Controllers/Models/Account/ListController.php index 4af6ff0e74..9731129957 100644 --- a/app/Api/V1/Controllers/Models/Account/ListController.php +++ b/app/Api/V1/Controllers/Models/Account/ListController.php @@ -152,7 +152,7 @@ class ListController extends Controller * @param Account $account * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException */ public function transactions(Request $request, Account $account): JsonResponse { diff --git a/app/Api/V1/Controllers/Models/Account/ShowController.php b/app/Api/V1/Controllers/Models/Account/ShowController.php index 21558e14a1..71d3c53803 100644 --- a/app/Api/V1/Controllers/Models/Account/ShowController.php +++ b/app/Api/V1/Controllers/Models/Account/ShowController.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Api\V1\Controllers\Models\Account; use FireflyIII\Api\V1\Controllers\Controller; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Account; use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Support\Http\Api\AccountFilter; @@ -73,7 +74,7 @@ class ShowController extends Controller * @param Request $request * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function index(Request $request): JsonResponse diff --git a/app/Api/V1/Controllers/Models/Bill/DestroyController.php b/app/Api/V1/Controllers/Models/Bill/DestroyController.php index 7e5c0ac4d8..271c593d1f 100644 --- a/app/Api/V1/Controllers/Models/Bill/DestroyController.php +++ b/app/Api/V1/Controllers/Models/Bill/DestroyController.php @@ -26,7 +26,6 @@ namespace FireflyIII\Api\V1\Controllers\Models\Bill; use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Models\Bill; use FireflyIII\Repositories\Bill\BillRepositoryInterface; -use FireflyIII\User; use Illuminate\Http\JsonResponse; /** diff --git a/app/Api/V1/Controllers/Models/Bill/ListController.php b/app/Api/V1/Controllers/Models/Bill/ListController.php index d5c7973532..e9f5996fae 100644 --- a/app/Api/V1/Controllers/Models/Bill/ListController.php +++ b/app/Api/V1/Controllers/Models/Bill/ListController.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Api\V1\Controllers\Models\Bill; use FireflyIII\Api\V1\Controllers\Controller; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Helpers\Collector\GroupCollectorInterface; use FireflyIII\Models\Bill; use FireflyIII\Repositories\Bill\BillRepositoryInterface; @@ -71,7 +72,7 @@ class ListController extends Controller * @param Bill $bill * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function attachments(Bill $bill): JsonResponse @@ -103,7 +104,7 @@ class ListController extends Controller * @param Bill $bill * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function rules(Bill $bill): JsonResponse @@ -140,7 +141,7 @@ class ListController extends Controller * @param Bill $bill * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function transactions(Request $request, Bill $bill): JsonResponse diff --git a/app/Api/V1/Controllers/Models/Bill/ShowController.php b/app/Api/V1/Controllers/Models/Bill/ShowController.php index ed085f4e66..58b0de32b4 100644 --- a/app/Api/V1/Controllers/Models/Bill/ShowController.php +++ b/app/Api/V1/Controllers/Models/Bill/ShowController.php @@ -24,10 +24,10 @@ declare(strict_types=1); namespace FireflyIII\Api\V1\Controllers\Models\Bill; use FireflyIII\Api\V1\Controllers\Controller; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Bill; use FireflyIII\Repositories\Bill\BillRepositoryInterface; use FireflyIII\Transformers\BillTransformer; -use FireflyIII\User; use Illuminate\Http\JsonResponse; use Illuminate\Pagination\LengthAwarePaginator; use League\Fractal\Pagination\IlluminatePaginatorAdapter; @@ -63,7 +63,7 @@ class ShowController extends Controller * Display a listing of the resource. * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function index(): JsonResponse diff --git a/app/Api/V1/Controllers/Models/Bill/StoreController.php b/app/Api/V1/Controllers/Models/Bill/StoreController.php index 5ef3bc4bb5..4383e8279c 100644 --- a/app/Api/V1/Controllers/Models/Bill/StoreController.php +++ b/app/Api/V1/Controllers/Models/Bill/StoreController.php @@ -29,7 +29,6 @@ use FireflyIII\Exceptions\FireflyException; use FireflyIII\Repositories\Bill\BillRepositoryInterface; use FireflyIII\Support\Http\Api\TransactionFilter; use FireflyIII\Transformers\BillTransformer; -use FireflyIII\User; use Illuminate\Http\JsonResponse; use League\Fractal\Resource\Item; diff --git a/app/Api/V1/Controllers/Models/Bill/UpdateController.php b/app/Api/V1/Controllers/Models/Bill/UpdateController.php index 2240463648..f61e6e3b28 100644 --- a/app/Api/V1/Controllers/Models/Bill/UpdateController.php +++ b/app/Api/V1/Controllers/Models/Bill/UpdateController.php @@ -28,7 +28,6 @@ use FireflyIII\Api\V1\Requests\Models\Bill\UpdateRequest; use FireflyIII\Models\Bill; use FireflyIII\Repositories\Bill\BillRepositoryInterface; use FireflyIII\Transformers\BillTransformer; -use FireflyIII\User; use Illuminate\Http\JsonResponse; use League\Fractal\Resource\Item; diff --git a/app/Api/V1/Controllers/Models/Budget/ListController.php b/app/Api/V1/Controllers/Models/Budget/ListController.php index 2b34ffa094..3130c016f6 100644 --- a/app/Api/V1/Controllers/Models/Budget/ListController.php +++ b/app/Api/V1/Controllers/Models/Budget/ListController.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Api\V1\Controllers\Models\Budget; use FireflyIII\Api\V1\Controllers\Controller; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Helpers\Collector\GroupCollectorInterface; use FireflyIII\Models\Budget; use FireflyIII\Repositories\Budget\BudgetLimitRepositoryInterface; @@ -73,7 +74,7 @@ class ListController extends Controller * @param Budget $budget * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function attachments(Budget $budget): JsonResponse @@ -105,7 +106,7 @@ class ListController extends Controller * @param Budget $budget * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function budgetLimits(Budget $budget): JsonResponse @@ -136,7 +137,7 @@ class ListController extends Controller * @param Budget $budget * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function transactions(Request $request, Budget $budget): JsonResponse diff --git a/app/Api/V1/Controllers/Models/Budget/ShowController.php b/app/Api/V1/Controllers/Models/Budget/ShowController.php index 414abb658e..e6a9020fb6 100644 --- a/app/Api/V1/Controllers/Models/Budget/ShowController.php +++ b/app/Api/V1/Controllers/Models/Budget/ShowController.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Api\V1\Controllers\Models\Budget; use FireflyIII\Api\V1\Controllers\Controller; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Budget; use FireflyIII\Repositories\Budget\BudgetLimitRepositoryInterface; use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; @@ -66,7 +67,7 @@ class ShowController extends Controller * Display a listing of the resource. * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function index(): JsonResponse diff --git a/app/Api/V1/Controllers/Models/BudgetLimit/ListController.php b/app/Api/V1/Controllers/Models/BudgetLimit/ListController.php index 4f49b8beaa..4ac3877315 100644 --- a/app/Api/V1/Controllers/Models/BudgetLimit/ListController.php +++ b/app/Api/V1/Controllers/Models/BudgetLimit/ListController.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Api\V1\Controllers\Models\BudgetLimit; use FireflyIII\Api\V1\Controllers\Controller; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Helpers\Collector\GroupCollectorInterface; use FireflyIII\Models\Budget; use FireflyIII\Models\BudgetLimit; @@ -73,7 +74,7 @@ class ListController extends Controller * @param BudgetLimit $budgetLimit * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function transactions(Request $request, Budget $budget, BudgetLimit $budgetLimit): JsonResponse diff --git a/app/Api/V1/Controllers/Models/BudgetLimit/StoreController.php b/app/Api/V1/Controllers/Models/BudgetLimit/StoreController.php index 801c8a1684..697c950aeb 100644 --- a/app/Api/V1/Controllers/Models/BudgetLimit/StoreController.php +++ b/app/Api/V1/Controllers/Models/BudgetLimit/StoreController.php @@ -25,7 +25,6 @@ namespace FireflyIII\Api\V1\Controllers\Models\BudgetLimit; use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Api\V1\Requests\Models\BudgetLimit\StoreRequest; -use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Budget; use FireflyIII\Repositories\Budget\BudgetLimitRepositoryInterface; use FireflyIII\Transformers\BudgetLimitTransformer; diff --git a/app/Api/V1/Controllers/Models/Category/DestroyController.php b/app/Api/V1/Controllers/Models/Category/DestroyController.php index 4e609fdb5e..2890584cbb 100644 --- a/app/Api/V1/Controllers/Models/Category/DestroyController.php +++ b/app/Api/V1/Controllers/Models/Category/DestroyController.php @@ -26,7 +26,6 @@ namespace FireflyIII\Api\V1\Controllers\Models\Category; use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Models\Category; use FireflyIII\Repositories\Category\CategoryRepositoryInterface; -use FireflyIII\User; use Illuminate\Http\JsonResponse; /** diff --git a/app/Api/V1/Controllers/Models/Category/ListController.php b/app/Api/V1/Controllers/Models/Category/ListController.php index 980859926a..d4be312707 100644 --- a/app/Api/V1/Controllers/Models/Category/ListController.php +++ b/app/Api/V1/Controllers/Models/Category/ListController.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Api\V1\Controllers\Models\Category; use FireflyIII\Api\V1\Controllers\Controller; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Helpers\Collector\GroupCollectorInterface; use FireflyIII\Models\Category; use FireflyIII\Repositories\Category\CategoryRepositoryInterface; @@ -68,7 +69,7 @@ class ListController extends Controller * @param Category $category * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function attachments(Category $category): JsonResponse @@ -102,7 +103,7 @@ class ListController extends Controller * @param Category $category * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function transactions(Request $request, Category $category): JsonResponse diff --git a/app/Api/V1/Controllers/Models/Category/ShowController.php b/app/Api/V1/Controllers/Models/Category/ShowController.php index b4731864d6..3b4d6418b2 100644 --- a/app/Api/V1/Controllers/Models/Category/ShowController.php +++ b/app/Api/V1/Controllers/Models/Category/ShowController.php @@ -24,10 +24,10 @@ declare(strict_types=1); namespace FireflyIII\Api\V1\Controllers\Models\Category; use FireflyIII\Api\V1\Controllers\Controller; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Category; use FireflyIII\Repositories\Category\CategoryRepositoryInterface; use FireflyIII\Transformers\CategoryTransformer; -use FireflyIII\User; use Illuminate\Http\JsonResponse; use Illuminate\Pagination\LengthAwarePaginator; use League\Fractal\Pagination\IlluminatePaginatorAdapter; @@ -63,7 +63,7 @@ class ShowController extends Controller * Display a listing of the resource. * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function index(): JsonResponse diff --git a/app/Api/V1/Controllers/Models/Category/StoreController.php b/app/Api/V1/Controllers/Models/Category/StoreController.php index c799d9eee7..161987545d 100644 --- a/app/Api/V1/Controllers/Models/Category/StoreController.php +++ b/app/Api/V1/Controllers/Models/Category/StoreController.php @@ -28,7 +28,6 @@ use FireflyIII\Api\V1\Requests\Models\Category\StoreRequest; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Repositories\Category\CategoryRepositoryInterface; use FireflyIII\Transformers\CategoryTransformer; -use FireflyIII\User; use Illuminate\Http\JsonResponse; use League\Fractal\Resource\Item; diff --git a/app/Api/V1/Controllers/Models/Category/UpdateController.php b/app/Api/V1/Controllers/Models/Category/UpdateController.php index bcab8b0778..ddfdf9f653 100644 --- a/app/Api/V1/Controllers/Models/Category/UpdateController.php +++ b/app/Api/V1/Controllers/Models/Category/UpdateController.php @@ -28,7 +28,6 @@ use FireflyIII\Api\V1\Requests\Models\Category\UpdateRequest; use FireflyIII\Models\Category; use FireflyIII\Repositories\Category\CategoryRepositoryInterface; use FireflyIII\Transformers\CategoryTransformer; -use FireflyIII\User; use Illuminate\Http\JsonResponse; use League\Fractal\Resource\Item; diff --git a/app/Api/V1/Controllers/Models/ObjectGroup/ListController.php b/app/Api/V1/Controllers/Models/ObjectGroup/ListController.php index e9f1c27c87..b3c3f8e603 100644 --- a/app/Api/V1/Controllers/Models/ObjectGroup/ListController.php +++ b/app/Api/V1/Controllers/Models/ObjectGroup/ListController.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Api\V1\Controllers\Models\ObjectGroup; use FireflyIII\Api\V1\Controllers\Controller; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\ObjectGroup; use FireflyIII\Repositories\ObjectGroup\ObjectGroupRepositoryInterface; use FireflyIII\Transformers\BillTransformer; @@ -67,7 +68,7 @@ class ListController extends Controller * @param ObjectGroup $objectGroup * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function bills(ObjectGroup $objectGroup): JsonResponse @@ -100,7 +101,7 @@ class ListController extends Controller * @param ObjectGroup $objectGroup * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function piggyBanks(ObjectGroup $objectGroup): JsonResponse diff --git a/app/Api/V1/Controllers/Models/ObjectGroup/ShowController.php b/app/Api/V1/Controllers/Models/ObjectGroup/ShowController.php index 4ca72304a3..15e97c5798 100644 --- a/app/Api/V1/Controllers/Models/ObjectGroup/ShowController.php +++ b/app/Api/V1/Controllers/Models/ObjectGroup/ShowController.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Api\V1\Controllers\Models\ObjectGroup; use FireflyIII\Api\V1\Controllers\Controller; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\ObjectGroup; use FireflyIII\Repositories\ObjectGroup\ObjectGroupRepositoryInterface; use FireflyIII\Transformers\ObjectGroupTransformer; @@ -68,7 +69,7 @@ class ShowController extends Controller * @param Request $request * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function index(Request $request): JsonResponse diff --git a/app/Api/V1/Controllers/Models/PiggyBank/ListController.php b/app/Api/V1/Controllers/Models/PiggyBank/ListController.php index d5bf62d9eb..a4d771e8de 100644 --- a/app/Api/V1/Controllers/Models/PiggyBank/ListController.php +++ b/app/Api/V1/Controllers/Models/PiggyBank/ListController.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Api\V1\Controllers\Models\PiggyBank; use FireflyIII\Api\V1\Controllers\Controller; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\PiggyBank; use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface; use FireflyIII\Transformers\AttachmentTransformer; @@ -62,7 +63,7 @@ class ListController extends Controller * @param PiggyBank $piggyBank * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function attachments(PiggyBank $piggyBank): JsonResponse @@ -94,7 +95,7 @@ class ListController extends Controller * @param PiggyBank $piggyBank * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function piggyBankEvents(PiggyBank $piggyBank): JsonResponse diff --git a/app/Api/V1/Controllers/Models/PiggyBank/ShowController.php b/app/Api/V1/Controllers/Models/PiggyBank/ShowController.php index bdd6ef2637..24b9e5b1ab 100644 --- a/app/Api/V1/Controllers/Models/PiggyBank/ShowController.php +++ b/app/Api/V1/Controllers/Models/PiggyBank/ShowController.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Api\V1\Controllers\Models\PiggyBank; use FireflyIII\Api\V1\Controllers\Controller; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\PiggyBank; use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface; use FireflyIII\Transformers\PiggyBankTransformer; @@ -62,7 +63,7 @@ class ShowController extends Controller * List all of them. * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function index(): JsonResponse diff --git a/app/Api/V1/Controllers/Models/Recurrence/DestroyController.php b/app/Api/V1/Controllers/Models/Recurrence/DestroyController.php index 6c44dd1e60..59ebdf7b0c 100644 --- a/app/Api/V1/Controllers/Models/Recurrence/DestroyController.php +++ b/app/Api/V1/Controllers/Models/Recurrence/DestroyController.php @@ -26,7 +26,6 @@ namespace FireflyIII\Api\V1\Controllers\Models\Recurrence; use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Models\Recurrence; use FireflyIII\Repositories\Recurring\RecurringRepositoryInterface; -use FireflyIII\User; use Illuminate\Http\JsonResponse; /** diff --git a/app/Api/V1/Controllers/Models/Recurrence/ListController.php b/app/Api/V1/Controllers/Models/Recurrence/ListController.php index 0205632fc9..6e96436048 100644 --- a/app/Api/V1/Controllers/Models/Recurrence/ListController.php +++ b/app/Api/V1/Controllers/Models/Recurrence/ListController.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Api\V1\Controllers\Models\Recurrence; use FireflyIII\Api\V1\Controllers\Controller; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Helpers\Collector\GroupCollectorInterface; use FireflyIII\Models\Recurrence; use FireflyIII\Repositories\Recurring\RecurringRepositoryInterface; @@ -69,7 +70,7 @@ class ListController extends Controller * @param Recurrence $recurrence * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function transactions(Request $request, Recurrence $recurrence): JsonResponse diff --git a/app/Api/V1/Controllers/Models/Recurrence/ShowController.php b/app/Api/V1/Controllers/Models/Recurrence/ShowController.php index 33375d56c5..71a66bca59 100644 --- a/app/Api/V1/Controllers/Models/Recurrence/ShowController.php +++ b/app/Api/V1/Controllers/Models/Recurrence/ShowController.php @@ -24,10 +24,10 @@ declare(strict_types=1); namespace FireflyIII\Api\V1\Controllers\Models\Recurrence; use FireflyIII\Api\V1\Controllers\Controller; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Recurrence; use FireflyIII\Repositories\Recurring\RecurringRepositoryInterface; use FireflyIII\Transformers\RecurrenceTransformer; -use FireflyIII\User; use Illuminate\Http\JsonResponse; use Illuminate\Pagination\LengthAwarePaginator; use League\Fractal\Pagination\IlluminatePaginatorAdapter; @@ -63,7 +63,7 @@ class ShowController extends Controller * List all of them. * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function index(): JsonResponse diff --git a/app/Api/V1/Controllers/Models/Recurrence/StoreController.php b/app/Api/V1/Controllers/Models/Recurrence/StoreController.php index 2c53478ec3..7573abedd2 100644 --- a/app/Api/V1/Controllers/Models/Recurrence/StoreController.php +++ b/app/Api/V1/Controllers/Models/Recurrence/StoreController.php @@ -28,7 +28,6 @@ use FireflyIII\Api\V1\Requests\Models\Recurrence\StoreRequest; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Repositories\Recurring\RecurringRepositoryInterface; use FireflyIII\Transformers\RecurrenceTransformer; -use FireflyIII\User; use Illuminate\Http\JsonResponse; use League\Fractal\Resource\Item; diff --git a/app/Api/V1/Controllers/Models/Recurrence/UpdateController.php b/app/Api/V1/Controllers/Models/Recurrence/UpdateController.php index 2f15eb071f..b67a34b634 100644 --- a/app/Api/V1/Controllers/Models/Recurrence/UpdateController.php +++ b/app/Api/V1/Controllers/Models/Recurrence/UpdateController.php @@ -28,7 +28,6 @@ use FireflyIII\Api\V1\Requests\Models\Recurrence\UpdateRequest; use FireflyIII\Models\Recurrence; use FireflyIII\Repositories\Recurring\RecurringRepositoryInterface; use FireflyIII\Transformers\RecurrenceTransformer; -use FireflyIII\User; use Illuminate\Http\JsonResponse; use League\Fractal\Resource\Item; diff --git a/app/Api/V1/Controllers/Models/Rule/ShowController.php b/app/Api/V1/Controllers/Models/Rule/ShowController.php index a47ee76d23..38e6e60cbc 100644 --- a/app/Api/V1/Controllers/Models/Rule/ShowController.php +++ b/app/Api/V1/Controllers/Models/Rule/ShowController.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Api\V1\Controllers\Models\Rule; use FireflyIII\Api\V1\Controllers\Controller; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Rule; use FireflyIII\Repositories\Rule\RuleRepositoryInterface; use FireflyIII\Transformers\RuleTransformer; @@ -66,7 +67,7 @@ class ShowController extends Controller * List all of them. * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function index(): JsonResponse diff --git a/app/Api/V1/Controllers/Models/RuleGroup/ListController.php b/app/Api/V1/Controllers/Models/RuleGroup/ListController.php index 52fea146e0..73b8780155 100644 --- a/app/Api/V1/Controllers/Models/RuleGroup/ListController.php +++ b/app/Api/V1/Controllers/Models/RuleGroup/ListController.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Api\V1\Controllers\Models\RuleGroup; use FireflyIII\Api\V1\Controllers\Controller; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\RuleGroup; use FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface; use FireflyIII\Transformers\RuleTransformer; @@ -65,7 +66,7 @@ class ListController extends Controller * @param RuleGroup $group * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function rules(RuleGroup $group): JsonResponse diff --git a/app/Api/V1/Controllers/Models/RuleGroup/ShowController.php b/app/Api/V1/Controllers/Models/RuleGroup/ShowController.php index a8e75734a1..3f053495a9 100644 --- a/app/Api/V1/Controllers/Models/RuleGroup/ShowController.php +++ b/app/Api/V1/Controllers/Models/RuleGroup/ShowController.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Api\V1\Controllers\Models\RuleGroup; use FireflyIII\Api\V1\Controllers\Controller; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\RuleGroup; use FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface; use FireflyIII\Transformers\RuleGroupTransformer; @@ -66,7 +67,7 @@ class ShowController extends Controller * List all of them. * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function index(): JsonResponse diff --git a/app/Api/V1/Controllers/Models/RuleGroup/TriggerController.php b/app/Api/V1/Controllers/Models/RuleGroup/TriggerController.php index 88bba7205c..8b332a0e79 100644 --- a/app/Api/V1/Controllers/Models/RuleGroup/TriggerController.php +++ b/app/Api/V1/Controllers/Models/RuleGroup/TriggerController.php @@ -34,7 +34,6 @@ use FireflyIII\Transformers\TransactionGroupTransformer; use FireflyIII\User; use Illuminate\Http\JsonResponse; use Illuminate\Pagination\LengthAwarePaginator; -use Illuminate\Support\Collection; use League\Fractal\Pagination\IlluminatePaginatorAdapter; use League\Fractal\Resource\Collection as FractalCollection; use Exception; diff --git a/app/Api/V1/Controllers/Models/Tag/ListController.php b/app/Api/V1/Controllers/Models/Tag/ListController.php index 2dde4bfee8..3bde6c175b 100644 --- a/app/Api/V1/Controllers/Models/Tag/ListController.php +++ b/app/Api/V1/Controllers/Models/Tag/ListController.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Api\V1\Controllers\Models\Tag; use FireflyIII\Api\V1\Controllers\Controller; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Helpers\Collector\GroupCollectorInterface; use FireflyIII\Models\Tag; use FireflyIII\Repositories\Tag\TagRepositoryInterface; @@ -71,7 +72,7 @@ class ListController extends Controller * @param Tag $tag * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function attachments(Tag $tag): JsonResponse @@ -104,7 +105,7 @@ class ListController extends Controller * @param Tag $tag * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function transactions(Request $request, Tag $tag): JsonResponse diff --git a/app/Api/V1/Controllers/Models/Tag/ShowController.php b/app/Api/V1/Controllers/Models/Tag/ShowController.php index 0e42eab15d..162936208f 100644 --- a/app/Api/V1/Controllers/Models/Tag/ShowController.php +++ b/app/Api/V1/Controllers/Models/Tag/ShowController.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Api\V1\Controllers\Models\Tag; use FireflyIII\Api\V1\Controllers\Controller; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Tag; use FireflyIII\Repositories\Tag\TagRepositoryInterface; use FireflyIII\Transformers\TagTransformer; @@ -66,7 +67,7 @@ class ShowController extends Controller * List all of them. * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function index(): JsonResponse diff --git a/app/Api/V1/Controllers/Models/Transaction/ListController.php b/app/Api/V1/Controllers/Models/Transaction/ListController.php index 3ecd73aba4..2903499ebe 100644 --- a/app/Api/V1/Controllers/Models/Transaction/ListController.php +++ b/app/Api/V1/Controllers/Models/Transaction/ListController.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Api\V1\Controllers\Models\Transaction; use FireflyIII\Api\V1\Controllers\Controller; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\TransactionGroup; use FireflyIII\Models\TransactionJournal; use FireflyIII\Repositories\Journal\JournalAPIRepositoryInterface; @@ -69,7 +70,7 @@ class ListController extends Controller * @param TransactionGroup $transactionGroup * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function attachments(TransactionGroup $transactionGroup): JsonResponse @@ -102,7 +103,7 @@ class ListController extends Controller * @param TransactionGroup $transactionGroup * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function piggyBankEvents(TransactionGroup $transactionGroup): JsonResponse @@ -138,7 +139,7 @@ class ListController extends Controller * @param TransactionJournal $transactionJournal * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function transactionLinks(TransactionJournal $transactionJournal): JsonResponse diff --git a/app/Api/V1/Controllers/Models/Transaction/ShowController.php b/app/Api/V1/Controllers/Models/Transaction/ShowController.php index 9007e8fb30..d14e6245f7 100644 --- a/app/Api/V1/Controllers/Models/Transaction/ShowController.php +++ b/app/Api/V1/Controllers/Models/Transaction/ShowController.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Api\V1\Controllers\Models\Transaction; use FireflyIII\Api\V1\Controllers\Controller; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Helpers\Collector\GroupCollectorInterface; use FireflyIII\Models\TransactionGroup; use FireflyIII\Models\TransactionJournal; @@ -50,7 +51,7 @@ class ShowController extends Controller * @param Request $request * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function index(Request $request): JsonResponse diff --git a/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php b/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php index c175c11044..c782690af0 100644 --- a/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php +++ b/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php @@ -25,6 +25,7 @@ declare(strict_types=1); namespace FireflyIII\Api\V1\Controllers\Models\TransactionCurrency; use FireflyIII\Api\V1\Controllers\Controller; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Helpers\Collector\GroupCollectorInterface; use FireflyIII\Models\Account; use FireflyIII\Models\Bill; @@ -93,7 +94,7 @@ class ListController extends Controller * @param TransactionCurrency $currency * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function accounts(Request $request, TransactionCurrency $currency): JsonResponse @@ -144,7 +145,7 @@ class ListController extends Controller * @param TransactionCurrency $currency * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function availableBudgets(TransactionCurrency $currency): JsonResponse @@ -180,7 +181,7 @@ class ListController extends Controller * @param TransactionCurrency $currency * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function bills(TransactionCurrency $currency): JsonResponse @@ -221,7 +222,7 @@ class ListController extends Controller * @param TransactionCurrency $currency * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function budgetLimits(TransactionCurrency $currency): JsonResponse @@ -253,7 +254,7 @@ class ListController extends Controller * @param TransactionCurrency $currency * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function recurrences(TransactionCurrency $currency): JsonResponse @@ -304,7 +305,7 @@ class ListController extends Controller * @param TransactionCurrency $currency * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function rules(TransactionCurrency $currency): JsonResponse @@ -356,7 +357,7 @@ class ListController extends Controller * @param TransactionCurrency $currency * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function transactions(Request $request, TransactionCurrency $currency): JsonResponse diff --git a/app/Api/V1/Controllers/Models/TransactionCurrency/ShowController.php b/app/Api/V1/Controllers/Models/TransactionCurrency/ShowController.php index 2f89446932..bdf8630082 100644 --- a/app/Api/V1/Controllers/Models/TransactionCurrency/ShowController.php +++ b/app/Api/V1/Controllers/Models/TransactionCurrency/ShowController.php @@ -25,12 +25,12 @@ declare(strict_types=1); namespace FireflyIII\Api\V1\Controllers\Models\TransactionCurrency; use FireflyIII\Api\V1\Controllers\Controller; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\TransactionCurrency; use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Support\Http\Api\AccountFilter; use FireflyIII\Support\Http\Api\TransactionFilter; use FireflyIII\Transformers\CurrencyTransformer; -use FireflyIII\User; use Illuminate\Http\JsonResponse; use Illuminate\Pagination\LengthAwarePaginator; use League\Fractal\Pagination\IlluminatePaginatorAdapter; @@ -68,7 +68,7 @@ class ShowController extends Controller * Display a listing of the resource. * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function index(): JsonResponse diff --git a/app/Api/V1/Controllers/Models/TransactionCurrency/StoreController.php b/app/Api/V1/Controllers/Models/TransactionCurrency/StoreController.php index 16ef964dfc..bbab73e2e1 100644 --- a/app/Api/V1/Controllers/Models/TransactionCurrency/StoreController.php +++ b/app/Api/V1/Controllers/Models/TransactionCurrency/StoreController.php @@ -32,7 +32,6 @@ use FireflyIII\Repositories\User\UserRepositoryInterface; use FireflyIII\Support\Http\Api\AccountFilter; use FireflyIII\Support\Http\Api\TransactionFilter; use FireflyIII\Transformers\CurrencyTransformer; -use FireflyIII\User; use Illuminate\Http\JsonResponse; use League\Fractal\Resource\Item; diff --git a/app/Api/V1/Controllers/Models/TransactionCurrency/UpdateController.php b/app/Api/V1/Controllers/Models/TransactionCurrency/UpdateController.php index 219620621f..0a7f12f85e 100644 --- a/app/Api/V1/Controllers/Models/TransactionCurrency/UpdateController.php +++ b/app/Api/V1/Controllers/Models/TransactionCurrency/UpdateController.php @@ -32,7 +32,6 @@ use FireflyIII\Repositories\User\UserRepositoryInterface; use FireflyIII\Support\Http\Api\AccountFilter; use FireflyIII\Support\Http\Api\TransactionFilter; use FireflyIII\Transformers\CurrencyTransformer; -use FireflyIII\User; use Illuminate\Http\JsonResponse; use League\Fractal\Resource\Item; @@ -127,6 +126,7 @@ class UpdateController extends Controller * @param TransactionCurrency $currency * * @return JsonResponse + * @throws \FireflyIII\Exceptions\FireflyException * @codeCoverageIgnore */ public function makeDefault(TransactionCurrency $currency): JsonResponse @@ -157,6 +157,8 @@ class UpdateController extends Controller * @param TransactionCurrency $currency * * @return JsonResponse + * @throws \FireflyIII\Exceptions\FireflyException + * @throws \JsonException */ public function update(UpdateRequest $request, TransactionCurrency $currency): JsonResponse { diff --git a/app/Api/V1/Controllers/Models/TransactionLink/ShowController.php b/app/Api/V1/Controllers/Models/TransactionLink/ShowController.php index 781e34ab2c..7eb31482f6 100644 --- a/app/Api/V1/Controllers/Models/TransactionLink/ShowController.php +++ b/app/Api/V1/Controllers/Models/TransactionLink/ShowController.php @@ -25,6 +25,7 @@ declare(strict_types=1); namespace FireflyIII\Api\V1\Controllers\Models\TransactionLink; use FireflyIII\Api\V1\Controllers\Controller; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\TransactionJournalLink; use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface; use FireflyIII\Transformers\TransactionLinkTransformer; @@ -68,7 +69,7 @@ class ShowController extends Controller * @param Request $request * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function index(Request $request): JsonResponse diff --git a/app/Api/V1/Controllers/Models/TransactionLinkType/ListController.php b/app/Api/V1/Controllers/Models/TransactionLinkType/ListController.php index bf5579d716..0964dbd90d 100644 --- a/app/Api/V1/Controllers/Models/TransactionLinkType/ListController.php +++ b/app/Api/V1/Controllers/Models/TransactionLinkType/ListController.php @@ -25,6 +25,7 @@ declare(strict_types=1); namespace FireflyIII\Api\V1\Controllers\Models\TransactionLinkType; use FireflyIII\Api\V1\Controllers\Controller; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Helpers\Collector\GroupCollectorInterface; use FireflyIII\Models\LinkType; use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface; @@ -75,7 +76,7 @@ class ListController extends Controller * @param LinkType $linkType * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function transactions(Request $request, LinkType $linkType): JsonResponse diff --git a/app/Api/V1/Controllers/Models/TransactionLinkType/ShowController.php b/app/Api/V1/Controllers/Models/TransactionLinkType/ShowController.php index 23ecd14e8e..081eff43f6 100644 --- a/app/Api/V1/Controllers/Models/TransactionLinkType/ShowController.php +++ b/app/Api/V1/Controllers/Models/TransactionLinkType/ShowController.php @@ -25,6 +25,7 @@ declare(strict_types=1); namespace FireflyIII\Api\V1\Controllers\Models\TransactionLinkType; use FireflyIII\Api\V1\Controllers\Controller; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\LinkType; use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface; use FireflyIII\Repositories\User\UserRepositoryInterface; @@ -72,7 +73,7 @@ class ShowController extends Controller * List all of them. * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function index(): JsonResponse diff --git a/app/Api/V1/Controllers/Search/TransactionController.php b/app/Api/V1/Controllers/Search/TransactionController.php index 210e8f311c..1916b8ba31 100644 --- a/app/Api/V1/Controllers/Search/TransactionController.php +++ b/app/Api/V1/Controllers/Search/TransactionController.php @@ -25,6 +25,7 @@ declare(strict_types=1); namespace FireflyIII\Api\V1\Controllers\Search; use FireflyIII\Api\V1\Controllers\Controller; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Support\Search\SearchInterface; use FireflyIII\Transformers\TransactionGroupTransformer; use Illuminate\Http\JsonResponse; @@ -42,7 +43,7 @@ class TransactionController extends Controller * @param SearchInterface $searcher * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException */ public function search(Request $request, SearchInterface $searcher): JsonResponse { diff --git a/app/Api/V1/Controllers/System/ConfigurationController.php b/app/Api/V1/Controllers/System/ConfigurationController.php index 0ffbb1fc04..c15d499943 100644 --- a/app/Api/V1/Controllers/System/ConfigurationController.php +++ b/app/Api/V1/Controllers/System/ConfigurationController.php @@ -100,10 +100,10 @@ class ConfigurationController extends Controller $singleUser = app('fireflyconfig')->get('single_user_mode'); return [ - 'is_demo_site' => null === $isDemoSite ? null : $isDemoSite->data, + 'is_demo_site' => $isDemoSite?->data, 'permission_update_check' => null === $updateCheck ? null : (int)$updateCheck->data, 'last_update_check' => null === $lastCheck ? null : (int)$lastCheck->data, - 'single_user_mode' => null === $singleUser ? null : $singleUser->data, + 'single_user_mode' => $singleUser?->data, ]; } @@ -132,14 +132,14 @@ class ConfigurationController extends Controller $data = []; $dynamic = $this->getDynamicConfiguration(); $shortKey = str_replace('configuration.', '', $configKey); - if ('configuration.' === substr($configKey, 0, 14)) { + if (str_starts_with($configKey, 'configuration.')) { $data = [ 'title' => $configKey, 'value' => $dynamic[$shortKey], 'editable' => true, ]; } - if ('configuration.' !== substr($configKey, 0, 14)) { + if (!str_starts_with($configKey, 'configuration.')) { $data = [ 'title' => $configKey, 'value' => config($configKey), @@ -157,6 +157,7 @@ class ConfigurationController extends Controller * @param string $name * * @return JsonResponse + * @throws FireflyException */ public function update(UpdateRequest $request, string $name): JsonResponse { diff --git a/app/Api/V1/Controllers/User/PreferencesController.php b/app/Api/V1/Controllers/User/PreferencesController.php index 5c7b1df7c7..f9cced2fe4 100644 --- a/app/Api/V1/Controllers/User/PreferencesController.php +++ b/app/Api/V1/Controllers/User/PreferencesController.php @@ -98,6 +98,7 @@ class PreferencesController extends Controller * @param PreferenceStoreRequest $request * * @return JsonResponse + * @throws FireflyException */ public function store(PreferenceStoreRequest $request): JsonResponse { diff --git a/app/Api/V1/Controllers/Webhook/AttemptController.php b/app/Api/V1/Controllers/Webhook/AttemptController.php index 24797c6b38..775821dbbd 100644 --- a/app/Api/V1/Controllers/Webhook/AttemptController.php +++ b/app/Api/V1/Controllers/Webhook/AttemptController.php @@ -30,7 +30,6 @@ use FireflyIII\Models\WebhookAttempt; use FireflyIII\Models\WebhookMessage; use FireflyIII\Repositories\Webhook\WebhookRepositoryInterface; use FireflyIII\Transformers\WebhookAttemptTransformer; -use FireflyIII\User; use Illuminate\Http\JsonResponse; use Illuminate\Pagination\LengthAwarePaginator; use League\Fractal\Pagination\IlluminatePaginatorAdapter; diff --git a/app/Api/V1/Controllers/Webhook/DestroyController.php b/app/Api/V1/Controllers/Webhook/DestroyController.php index f989821351..8832c342ea 100644 --- a/app/Api/V1/Controllers/Webhook/DestroyController.php +++ b/app/Api/V1/Controllers/Webhook/DestroyController.php @@ -30,7 +30,6 @@ use FireflyIII\Models\Webhook; use FireflyIII\Models\WebhookAttempt; use FireflyIII\Models\WebhookMessage; use FireflyIII\Repositories\Webhook\WebhookRepositoryInterface; -use FireflyIII\User; use Illuminate\Http\JsonResponse; /** diff --git a/app/Api/V1/Controllers/Webhook/MessageController.php b/app/Api/V1/Controllers/Webhook/MessageController.php index 68d1df03f8..e98d9a05a5 100644 --- a/app/Api/V1/Controllers/Webhook/MessageController.php +++ b/app/Api/V1/Controllers/Webhook/MessageController.php @@ -29,7 +29,6 @@ use FireflyIII\Models\Webhook; use FireflyIII\Models\WebhookMessage; use FireflyIII\Repositories\Webhook\WebhookRepositoryInterface; use FireflyIII\Transformers\WebhookMessageTransformer; -use FireflyIII\User; use Illuminate\Http\JsonResponse; use Illuminate\Pagination\LengthAwarePaginator; use League\Fractal\Pagination\IlluminatePaginatorAdapter; diff --git a/app/Api/V1/Controllers/Webhook/ShowController.php b/app/Api/V1/Controllers/Webhook/ShowController.php index bb52400725..9707cc326b 100644 --- a/app/Api/V1/Controllers/Webhook/ShowController.php +++ b/app/Api/V1/Controllers/Webhook/ShowController.php @@ -24,10 +24,10 @@ declare(strict_types=1); namespace FireflyIII\Api\V1\Controllers\Webhook; use FireflyIII\Api\V1\Controllers\Controller; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Webhook; use FireflyIII\Repositories\Webhook\WebhookRepositoryInterface; use FireflyIII\Transformers\WebhookTransformer; -use FireflyIII\User; use Illuminate\Http\JsonResponse; use Illuminate\Pagination\LengthAwarePaginator; use League\Fractal\Pagination\IlluminatePaginatorAdapter; @@ -62,7 +62,7 @@ class ShowController extends Controller * Display a listing of the webhooks of the user. * * @return JsonResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @codeCoverageIgnore */ public function index(): JsonResponse diff --git a/app/Api/V1/Controllers/Webhook/StoreController.php b/app/Api/V1/Controllers/Webhook/StoreController.php index f61620e769..9db3f162c7 100644 --- a/app/Api/V1/Controllers/Webhook/StoreController.php +++ b/app/Api/V1/Controllers/Webhook/StoreController.php @@ -27,7 +27,6 @@ use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Api\V1\Requests\Models\Webhook\CreateRequest; use FireflyIII\Repositories\Webhook\WebhookRepositoryInterface; use FireflyIII\Transformers\WebhookTransformer; -use FireflyIII\User; use Illuminate\Http\JsonResponse; use League\Fractal\Resource\Item; diff --git a/app/Api/V1/Controllers/Webhook/UpdateController.php b/app/Api/V1/Controllers/Webhook/UpdateController.php index d69dccf7b7..bb245102e7 100644 --- a/app/Api/V1/Controllers/Webhook/UpdateController.php +++ b/app/Api/V1/Controllers/Webhook/UpdateController.php @@ -28,7 +28,6 @@ use FireflyIII\Api\V1\Requests\Models\Webhook\UpdateRequest; use FireflyIII\Models\Webhook; use FireflyIII\Repositories\Webhook\WebhookRepositoryInterface; use FireflyIII\Transformers\WebhookTransformer; -use FireflyIII\User; use Illuminate\Http\JsonResponse; use League\Fractal\Resource\Item; diff --git a/app/Api/V1/Requests/Insight/GenericRequest.php b/app/Api/V1/Requests/Insight/GenericRequest.php index 26f8135e53..8583d837b3 100644 --- a/app/Api/V1/Requests/Insight/GenericRequest.php +++ b/app/Api/V1/Requests/Insight/GenericRequest.php @@ -220,7 +220,7 @@ class GenericRequest extends FormRequest /** @var Account $account */ foreach ($this->accounts as $account) { $type = $account->accountType->type; - if (in_array($type, [AccountType::EXPENSE])) { + if ($type === AccountType::EXPENSE) { $return->push($account); } } @@ -238,7 +238,7 @@ class GenericRequest extends FormRequest /** @var Account $account */ foreach ($this->accounts as $account) { $type = $account->accountType->type; - if (in_array($type, [AccountType::REVENUE])) { + if ($type === AccountType::REVENUE) { $return->push($account); } } diff --git a/app/Api/V1/Requests/Models/Recurrence/StoreRequest.php b/app/Api/V1/Requests/Models/Recurrence/StoreRequest.php index 6432808af9..1d0c7f3aa1 100644 --- a/app/Api/V1/Requests/Models/Recurrence/StoreRequest.php +++ b/app/Api/V1/Requests/Models/Recurrence/StoreRequest.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace FireflyIII\Api\V1\Requests\Models\Recurrence; -use Carbon\Carbon; use FireflyIII\Rules\BelongsUser; use FireflyIII\Rules\IsBoolean; use FireflyIII\Support\Request\ChecksLogin; diff --git a/app/Api/V1/Requests/Models/Transaction/UpdateRequest.php b/app/Api/V1/Requests/Models/Transaction/UpdateRequest.php index 23e775bf87..25e274634b 100644 --- a/app/Api/V1/Requests/Models/Transaction/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/Transaction/UpdateRequest.php @@ -173,6 +173,7 @@ class UpdateRequest extends FormRequest * For each field, add it to the array if a reference is present in the request: * * @param array $current + * @param array $transaction * * @return array */ diff --git a/app/Console/Commands/Correction/CorrectOpeningBalanceCurrencies.php b/app/Console/Commands/Correction/CorrectOpeningBalanceCurrencies.php index 7d8a31ddfd..b34bf0f296 100644 --- a/app/Console/Commands/Correction/CorrectOpeningBalanceCurrencies.php +++ b/app/Console/Commands/Correction/CorrectOpeningBalanceCurrencies.php @@ -57,6 +57,7 @@ class CorrectOpeningBalanceCurrencies extends Command * Execute the console command. * * @return int + * @throws JsonException */ public function handle(): int { @@ -96,7 +97,6 @@ class CorrectOpeningBalanceCurrencies extends Command * @param TransactionJournal $journal * * @return int - * @throws JsonException */ private function correctJournal(TransactionJournal $journal): int { diff --git a/app/Console/Commands/Correction/DeleteZeroAmount.php b/app/Console/Commands/Correction/DeleteZeroAmount.php index 60a26160bf..28ff944370 100644 --- a/app/Console/Commands/Correction/DeleteZeroAmount.php +++ b/app/Console/Commands/Correction/DeleteZeroAmount.php @@ -27,7 +27,6 @@ use Exception; use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; use Illuminate\Console\Command; -use Illuminate\Support\Collection; /** * Class DeleteZeroAmount diff --git a/app/Console/Commands/Export/ExportData.php b/app/Console/Commands/Export/ExportData.php index 547b225125..9d5f2b9d74 100644 --- a/app/Console/Commands/Export/ExportData.php +++ b/app/Console/Commands/Export/ExportData.php @@ -33,7 +33,6 @@ use FireflyIII\Models\AccountType; use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\Journal\JournalRepositoryInterface; use FireflyIII\Support\Export\ExportDataGenerator; -use FireflyIII\User; use Illuminate\Console\Command; use Illuminate\Support\Collection; use InvalidArgumentException; @@ -82,9 +81,7 @@ class ExportData extends Command * Execute the console command. * * @return int - * @throws CannotInsertRecord * @throws FireflyException - * @throws \League\Csv\Exception */ public function handle(): int { diff --git a/app/Console/Commands/Upgrade/AccountCurrencies.php b/app/Console/Commands/Upgrade/AccountCurrencies.php index 81151a2b0b..4cad1423e6 100644 --- a/app/Console/Commands/Upgrade/AccountCurrencies.php +++ b/app/Console/Commands/Upgrade/AccountCurrencies.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace FireflyIII\Console\Commands\Upgrade; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Account; use FireflyIII\Models\AccountMeta; use FireflyIII\Models\AccountType; @@ -63,6 +64,7 @@ class AccountCurrencies extends Command * Each (asset) account must have a reference to a preferred currency. If the account does not have one, it's forced upon the account. * * @return int + * @throws FireflyException */ public function handle(): int { @@ -106,7 +108,7 @@ class AccountCurrencies extends Command /** * @return bool - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException */ private function isExecuted(): bool { @@ -136,7 +138,7 @@ class AccountCurrencies extends Command * @param User $user * @param string $systemCurrencyCode * - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException */ private function updateCurrenciesForUser(User $user, string $systemCurrencyCode): void { diff --git a/app/Console/Commands/Upgrade/AppendBudgetLimitPeriods.php b/app/Console/Commands/Upgrade/AppendBudgetLimitPeriods.php index 5ea5705b65..e4e15ac63a 100644 --- a/app/Console/Commands/Upgrade/AppendBudgetLimitPeriods.php +++ b/app/Console/Commands/Upgrade/AppendBudgetLimitPeriods.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace FireflyIII\Console\Commands\Upgrade; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\BudgetLimit; use Illuminate\Console\Command; use Log; @@ -47,6 +48,7 @@ class AppendBudgetLimitPeriods extends Command * Execute the console command. * * @return int + * @throws FireflyException */ public function handle(): int { @@ -69,7 +71,7 @@ class AppendBudgetLimitPeriods extends Command /** * @return bool - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException */ private function isExecuted(): bool { diff --git a/app/Console/Commands/Upgrade/BackToJournals.php b/app/Console/Commands/Upgrade/BackToJournals.php index 45fca43d34..ab66fda7b7 100644 --- a/app/Console/Commands/Upgrade/BackToJournals.php +++ b/app/Console/Commands/Upgrade/BackToJournals.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Console\Commands\Upgrade; use DB; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Budget; use FireflyIII\Models\Category; use FireflyIII\Models\Transaction; @@ -55,6 +56,7 @@ class BackToJournals extends Command * Execute the console command. * * @return int + * @throws FireflyException */ public function handle(): int { @@ -83,7 +85,7 @@ class BackToJournals extends Command /** * @return bool - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException */ private function isMigrated(): bool { @@ -94,7 +96,7 @@ class BackToJournals extends Command /** * @return bool - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException */ private function isExecuted(): bool { diff --git a/app/Console/Commands/Upgrade/BudgetLimitCurrency.php b/app/Console/Commands/Upgrade/BudgetLimitCurrency.php index 6620861e1b..d849f5c02c 100644 --- a/app/Console/Commands/Upgrade/BudgetLimitCurrency.php +++ b/app/Console/Commands/Upgrade/BudgetLimitCurrency.php @@ -23,7 +23,7 @@ declare(strict_types=1); namespace FireflyIII\Console\Commands\Upgrade; -use FireflyIII\Models\Budget; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\BudgetLimit; use Illuminate\Console\Command; @@ -50,6 +50,8 @@ class BudgetLimitCurrency extends Command * Execute the console command. * * @return int + * @throws FireflyException + * @throws \JsonException */ public function handle(): int { @@ -95,7 +97,7 @@ class BudgetLimitCurrency extends Command /** * @return bool - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException */ private function isExecuted(): bool { diff --git a/app/Console/Commands/Upgrade/CCLiabilities.php b/app/Console/Commands/Upgrade/CCLiabilities.php index 6637c2292c..4b3fb4028e 100644 --- a/app/Console/Commands/Upgrade/CCLiabilities.php +++ b/app/Console/Commands/Upgrade/CCLiabilities.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace FireflyIII\Console\Commands\Upgrade; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Account; use FireflyIII\Models\AccountType; use Illuminate\Console\Command; @@ -51,6 +52,7 @@ class CCLiabilities extends Command * Execute the console command. * * @return int + * @throws FireflyException */ public function handle(): int { @@ -79,7 +81,7 @@ class CCLiabilities extends Command $this->line(sprintf('Converted credit card liability account "%s" (#%d) to generic debt liability.', $account->name, $account->id)); } if ($accounts->count() > 0) { - $this->info('Credit card liability types are no longer supported and have been converted to generic debts. See: http://bit.ly/FF3-credit-cards'); + $this->info('Credit card liability types are no longer supported and have been converted to generic debts. See: https://bit.ly/FF3-credit-cards'); } if (0 === $accounts->count()) { $this->info('No incorrectly stored credit card liabilities.'); @@ -93,7 +95,7 @@ class CCLiabilities extends Command /** * @return bool - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException */ private function isExecuted(): bool { diff --git a/app/Console/Commands/Upgrade/CreateGroupMemberships.php b/app/Console/Commands/Upgrade/CreateGroupMemberships.php index 491a640faf..43cbc71429 100644 --- a/app/Console/Commands/Upgrade/CreateGroupMemberships.php +++ b/app/Console/Commands/Upgrade/CreateGroupMemberships.php @@ -76,6 +76,7 @@ class CreateGroupMemberships extends Command /** * @return bool + * @throws FireflyException */ private function isExecuted(): bool { diff --git a/app/Console/Commands/Upgrade/MigrateAttachments.php b/app/Console/Commands/Upgrade/MigrateAttachments.php index 2e4edc48e4..2776779fc8 100644 --- a/app/Console/Commands/Upgrade/MigrateAttachments.php +++ b/app/Console/Commands/Upgrade/MigrateAttachments.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace FireflyIII\Console\Commands\Upgrade; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Attachment; use FireflyIII\Models\Note; use Illuminate\Console\Command; @@ -51,6 +52,7 @@ class MigrateAttachments extends Command * Execute the console command. * * @return int + * @throws FireflyException */ public function handle(): int { @@ -105,7 +107,7 @@ class MigrateAttachments extends Command /** * @return bool - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException */ private function isExecuted(): bool { diff --git a/app/Console/Commands/Upgrade/MigrateJournalNotes.php b/app/Console/Commands/Upgrade/MigrateJournalNotes.php index 54d27a70c0..93534d2a92 100644 --- a/app/Console/Commands/Upgrade/MigrateJournalNotes.php +++ b/app/Console/Commands/Upgrade/MigrateJournalNotes.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Console\Commands\Upgrade; use Exception; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Note; use FireflyIII\Models\TransactionJournalMeta; use Illuminate\Console\Command; @@ -52,6 +53,7 @@ class MigrateJournalNotes extends Command * Execute the console command. * * @return int + * @throws FireflyException */ public function handle(): int { @@ -103,7 +105,7 @@ class MigrateJournalNotes extends Command /** * @return bool - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException */ private function isExecuted(): bool { diff --git a/app/Console/Commands/Upgrade/MigrateRecurrenceMeta.php b/app/Console/Commands/Upgrade/MigrateRecurrenceMeta.php index 2fc939b958..2980cc2a17 100644 --- a/app/Console/Commands/Upgrade/MigrateRecurrenceMeta.php +++ b/app/Console/Commands/Upgrade/MigrateRecurrenceMeta.php @@ -24,9 +24,11 @@ declare(strict_types=1); namespace FireflyIII\Console\Commands\Upgrade; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\RecurrenceMeta; use FireflyIII\Models\RecurrenceTransactionMeta; use Illuminate\Console\Command; +use JsonException; /** * Class MigrateRecurrenceMeta @@ -51,6 +53,8 @@ class MigrateRecurrenceMeta extends Command * Execute the console command. * * @return int + * @throws FireflyException + * @throws JsonException */ public function handle(): int { @@ -79,7 +83,7 @@ class MigrateRecurrenceMeta extends Command /** * @return bool - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException */ private function isExecuted(): bool { @@ -93,7 +97,7 @@ class MigrateRecurrenceMeta extends Command /** * @return int - * @throws \JsonException + * @throws JsonException */ private function migrateMetaData(): int { @@ -112,7 +116,7 @@ class MigrateRecurrenceMeta extends Command * @param RecurrenceMeta $meta * * @return int - * @throws \JsonException + * @throws JsonException */ private function migrateEntry(RecurrenceMeta $meta): int { diff --git a/app/Console/Commands/Upgrade/MigrateRecurrenceType.php b/app/Console/Commands/Upgrade/MigrateRecurrenceType.php index 3e956f417b..3f30915260 100644 --- a/app/Console/Commands/Upgrade/MigrateRecurrenceType.php +++ b/app/Console/Commands/Upgrade/MigrateRecurrenceType.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Console\Commands\Upgrade; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Recurrence; use FireflyIII\Models\RecurrenceTransaction; use FireflyIII\Models\TransactionType; @@ -52,6 +53,7 @@ class MigrateRecurrenceType extends Command * Execute the console command. * * @return int + * @throws FireflyException */ public function handle(): int { @@ -74,7 +76,7 @@ class MigrateRecurrenceType extends Command /** * @return bool - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException */ private function isExecuted(): bool { diff --git a/app/Console/Commands/Upgrade/MigrateTagLocations.php b/app/Console/Commands/Upgrade/MigrateTagLocations.php index 67633f3b49..765f0f874b 100644 --- a/app/Console/Commands/Upgrade/MigrateTagLocations.php +++ b/app/Console/Commands/Upgrade/MigrateTagLocations.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Console\Commands\Upgrade; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Location; use FireflyIII\Models\Tag; use Illuminate\Console\Command; @@ -52,6 +53,7 @@ class MigrateTagLocations extends Command * Execute the console command. * * @return int + * @throws FireflyException */ public function handle(): int { @@ -72,7 +74,7 @@ class MigrateTagLocations extends Command /** * @return bool - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException */ private function isExecuted(): bool { diff --git a/app/Console/Commands/Upgrade/MigrateToGroups.php b/app/Console/Commands/Upgrade/MigrateToGroups.php index 4e04318156..8f537ecdf8 100644 --- a/app/Console/Commands/Upgrade/MigrateToGroups.php +++ b/app/Console/Commands/Upgrade/MigrateToGroups.php @@ -25,6 +25,7 @@ namespace FireflyIII\Console\Commands\Upgrade; use DB; use Exception; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Factory\TransactionGroupFactory; use FireflyIII\Models\Budget; use FireflyIII\Models\Category; @@ -127,7 +128,7 @@ class MigrateToGroups extends Command /** * @return bool - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException */ private function isMigrated(): bool { diff --git a/app/Console/Commands/Upgrade/OtherCurrenciesCorrections.php b/app/Console/Commands/Upgrade/OtherCurrenciesCorrections.php index 07118054ce..30fc3efe17 100644 --- a/app/Console/Commands/Upgrade/OtherCurrenciesCorrections.php +++ b/app/Console/Commands/Upgrade/OtherCurrenciesCorrections.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace FireflyIII\Console\Commands\Upgrade; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Account; use FireflyIII\Models\AccountType; use FireflyIII\Models\Transaction; @@ -70,6 +71,7 @@ class OtherCurrenciesCorrections extends Command * Execute the console command. * * @return int + * @throws FireflyException */ public function handle(): int { @@ -112,7 +114,7 @@ class OtherCurrenciesCorrections extends Command /** * @return bool - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException */ private function isExecuted(): bool { diff --git a/app/Console/Commands/Upgrade/RenameAccountMeta.php b/app/Console/Commands/Upgrade/RenameAccountMeta.php index 9e7f6cd172..c1a6aee640 100644 --- a/app/Console/Commands/Upgrade/RenameAccountMeta.php +++ b/app/Console/Commands/Upgrade/RenameAccountMeta.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace FireflyIII\Console\Commands\Upgrade; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\AccountMeta; use Illuminate\Console\Command; @@ -49,6 +50,7 @@ class RenameAccountMeta extends Command * Execute the console command. * * @return int + * @throws FireflyException */ public function handle(): int { @@ -96,7 +98,7 @@ class RenameAccountMeta extends Command /** * @return bool - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException */ private function isExecuted(): bool { diff --git a/app/Console/Commands/Upgrade/TransactionIdentifier.php b/app/Console/Commands/Upgrade/TransactionIdentifier.php index f3fbb06409..90634bf560 100644 --- a/app/Console/Commands/Upgrade/TransactionIdentifier.php +++ b/app/Console/Commands/Upgrade/TransactionIdentifier.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace FireflyIII\Console\Commands\Upgrade; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; use FireflyIII\Repositories\Journal\JournalCLIRepositoryInterface; @@ -67,6 +68,7 @@ class TransactionIdentifier extends Command * think. So each set gets a number (1,2,3) to keep them apart. * * @return int + * @throws FireflyException */ public function handle(): int { @@ -120,7 +122,7 @@ class TransactionIdentifier extends Command /** * @return bool - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException */ private function isExecuted(): bool { diff --git a/app/Console/Commands/Upgrade/TransferCurrenciesCorrections.php b/app/Console/Commands/Upgrade/TransferCurrenciesCorrections.php index 777b671b1b..37f94051a4 100644 --- a/app/Console/Commands/Upgrade/TransferCurrenciesCorrections.php +++ b/app/Console/Commands/Upgrade/TransferCurrenciesCorrections.php @@ -132,6 +132,7 @@ class TransferCurrenciesCorrections extends Command /** * @return bool + * @throws \FireflyIII\Exceptions\FireflyException */ private function isExecuted(): bool { @@ -169,7 +170,7 @@ class TransferCurrenciesCorrections extends Command if ($this->isSplitJournal($transfer)) { - $this->line(sprintf(sprintf('Transaction journal #%d is a split journal. Cannot continue.', $transfer->id))); + $this->line(sprintf('Transaction journal #%d is a split journal. Cannot continue.', $transfer->id)); return; } @@ -246,7 +247,7 @@ class TransferCurrenciesCorrections extends Command private function getSourceInformation(TransactionJournal $journal): void { $this->sourceTransaction = $this->getSourceTransaction($journal); - $this->sourceAccount = null === $this->sourceTransaction ? null : $this->sourceTransaction->account; + $this->sourceAccount = $this->sourceTransaction?->account; $this->sourceCurrency = null === $this->sourceAccount ? null : $this->getCurrency($this->sourceAccount); } @@ -298,7 +299,7 @@ class TransferCurrenciesCorrections extends Command private function getDestinationInformation(TransactionJournal $journal): void { $this->destinationTransaction = $this->getDestinationTransaction($journal); - $this->destinationAccount = null === $this->destinationTransaction ? null : $this->destinationTransaction->account; + $this->destinationAccount = $this->destinationTransaction?->account; $this->destinationCurrency = null === $this->destinationAccount ? null : $this->getCurrency($this->destinationAccount); } diff --git a/app/Console/Commands/Upgrade/UpgradeLiabilities.php b/app/Console/Commands/Upgrade/UpgradeLiabilities.php index 87b72a934a..da7eeb5cea 100644 --- a/app/Console/Commands/Upgrade/UpgradeLiabilities.php +++ b/app/Console/Commands/Upgrade/UpgradeLiabilities.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Console\Commands\Upgrade; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Factory\AccountMetaFactory; use FireflyIII\Models\Account; use FireflyIII\Models\Transaction; @@ -57,6 +58,7 @@ class UpgradeLiabilities extends Command * Execute the console command. * * @return int + * @throws FireflyException */ public function handle(): int { @@ -78,7 +80,7 @@ class UpgradeLiabilities extends Command /** * @return bool - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException */ private function isExecuted(): bool { diff --git a/app/Console/Commands/UpgradeFireflyInstructions.php b/app/Console/Commands/UpgradeFireflyInstructions.php index 98cb37688d..2257339e50 100644 --- a/app/Console/Commands/UpgradeFireflyInstructions.php +++ b/app/Console/Commands/UpgradeFireflyInstructions.php @@ -24,9 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Console\Commands; use FireflyIII\Support\System\GeneratesInstallationId; -use FireflyIII\User; use Illuminate\Console\Command; -use Illuminate\Database\QueryException; /** * Class UpgradeFireflyInstructions. diff --git a/app/Console/Commands/VerifySecurityAlerts.php b/app/Console/Commands/VerifySecurityAlerts.php index 4d4bdd33bf..e49872b909 100644 --- a/app/Console/Commands/VerifySecurityAlerts.php +++ b/app/Console/Commands/VerifySecurityAlerts.php @@ -51,6 +51,7 @@ class VerifySecurityAlerts extends Command * Execute the console command. * * @return int + * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ public function handle(): int { diff --git a/app/Events/RequestedReportOnJournals.php b/app/Events/RequestedReportOnJournals.php index 3152c9b969..8790d696aa 100644 --- a/app/Events/RequestedReportOnJournals.php +++ b/app/Events/RequestedReportOnJournals.php @@ -24,7 +24,6 @@ declare(strict_types=1); namespace FireflyIII\Events; -use Illuminate\Broadcasting\Channel; use Illuminate\Broadcasting\InteractsWithSockets; use Illuminate\Broadcasting\PrivateChannel; use Illuminate\Foundation\Events\Dispatchable; diff --git a/app/Events/StoredTransactionGroup.php b/app/Events/StoredTransactionGroup.php index 3c497e37bd..880c6b8de7 100644 --- a/app/Events/StoredTransactionGroup.php +++ b/app/Events/StoredTransactionGroup.php @@ -45,6 +45,7 @@ class StoredTransactionGroup extends Event * * @param TransactionGroup $transactionGroup * @param bool $applyRules + * @param bool $fireWebhooks */ public function __construct(TransactionGroup $transactionGroup, bool $applyRules = true, bool $fireWebhooks = true) { diff --git a/app/Events/UpdatedTransactionGroup.php b/app/Events/UpdatedTransactionGroup.php index 0f5e00f6fa..89ba4e1378 100644 --- a/app/Events/UpdatedTransactionGroup.php +++ b/app/Events/UpdatedTransactionGroup.php @@ -45,6 +45,7 @@ class UpdatedTransactionGroup extends Event * * @param TransactionGroup $transactionGroup * @param bool $applyRules + * @param bool $fireWebhooks */ public function __construct(TransactionGroup $transactionGroup, bool $applyRules = true, bool $fireWebhooks = true) { diff --git a/app/Exceptions/GracefulNotFoundHandler.php b/app/Exceptions/GracefulNotFoundHandler.php index a5d5a0b71b..ae3f64868c 100644 --- a/app/Exceptions/GracefulNotFoundHandler.php +++ b/app/Exceptions/GracefulNotFoundHandler.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace FireflyIII\Exceptions; -use Exception; use FireflyIII\Models\Account; use FireflyIII\Models\Attachment; use FireflyIII\Models\Bill; @@ -31,7 +30,9 @@ use FireflyIII\Models\TransactionGroup; use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionType; use FireflyIII\User; +use Illuminate\Contracts\Foundation\Application; use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; +use Illuminate\Http\JsonResponse; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Illuminate\Routing\Redirector; @@ -50,7 +51,7 @@ class GracefulNotFoundHandler extends ExceptionHandler * @param Request $request * @param Throwable $e * - * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Http\JsonResponse|\Illuminate\Http\Response|Redirector|RedirectResponse|Response + * @return Application|JsonResponse|\Illuminate\Http\Response|Redirector|RedirectResponse|Response * @throws Throwable */ public function render($request, Throwable $e) diff --git a/app/Factory/AccountFactory.php b/app/Factory/AccountFactory.php index f506f96233..990631364a 100644 --- a/app/Factory/AccountFactory.php +++ b/app/Factory/AccountFactory.php @@ -33,6 +33,7 @@ use FireflyIII\Services\Internal\Support\AccountServiceTrait; use FireflyIII\Services\Internal\Support\LocationServiceTrait; use FireflyIII\Services\Internal\Update\AccountUpdateService; use FireflyIII\User; +use JsonException; use Log; /** @@ -107,6 +108,7 @@ class AccountFactory * * @return Account * @throws FireflyException + * @throws JsonException */ public function create(array $data): Account { @@ -180,7 +182,7 @@ class AccountFactory * @param array $data * * @return Account - * @throws \JsonException + * @throws JsonException */ private function createAccount(AccountType $type, array $data): Account { @@ -247,7 +249,6 @@ class AccountFactory * @param array $data * * @return array - * @throws \JsonException */ private function cleanMetaDataArray(Account $account, array $data): array { @@ -358,6 +359,9 @@ class AccountFactory /** * @param Account $account * @param array $data + * + * @throws FireflyException + * @throws JsonException */ private function storeOrder(Account $account, array $data): void { diff --git a/app/Factory/RecurrenceFactory.php b/app/Factory/RecurrenceFactory.php index 5622cfafcc..3de96669e5 100644 --- a/app/Factory/RecurrenceFactory.php +++ b/app/Factory/RecurrenceFactory.php @@ -101,9 +101,7 @@ class RecurrenceFactory if (array_key_exists('active', $data['recurrence'])) { $active = $data['recurrence']['active']; } - if (null !== $repeatUntil) { - $repeatUntilString = $repeatUntil->format('Y-m-d'); - } + $repeatUntilString = $repeatUntil?->format('Y-m-d'); $recurrence = new Recurrence( [ @@ -111,7 +109,7 @@ class RecurrenceFactory 'transaction_type_id' => $type->id, 'title' => $title, 'description' => $description, - 'first_date' => $firstDate ? $firstDate->format('Y-m-d') : null, + 'first_date' => $firstDate?->format('Y-m-d'), 'repeat_until' => $repetitions > 0 ? null : $repeatUntilString, 'latest_date' => null, 'repetitions' => $repetitions, diff --git a/app/Factory/TransactionJournalFactory.php b/app/Factory/TransactionJournalFactory.php index 8937adec07..3c893a9839 100644 --- a/app/Factory/TransactionJournalFactory.php +++ b/app/Factory/TransactionJournalFactory.php @@ -46,6 +46,7 @@ use FireflyIII\Support\NullArrayObject; use FireflyIII\User; use FireflyIII\Validation\AccountValidator; use Illuminate\Support\Collection; +use JsonException; use Log; /** @@ -146,7 +147,7 @@ class TransactionJournalFactory * @return TransactionJournal|null * @throws DuplicateTransactionException * @throws FireflyException - * @throws \JsonException + * @throws JsonException */ private function createJournal(NullArrayObject $row): ?TransactionJournal { @@ -295,7 +296,7 @@ class TransactionJournalFactory * @param NullArrayObject $row * * @return string - * @throws \JsonException + * @throws JsonException */ private function hashArray(NullArrayObject $row): string { @@ -321,7 +322,7 @@ class TransactionJournalFactory * @param string $hash * * @throws DuplicateTransactionException - * @throws \JsonException + * @throws JsonException */ private function errorIfDuplicate(string $hash): void { diff --git a/app/Handlers/Events/APIEventHandler.php b/app/Handlers/Events/APIEventHandler.php index c775b37b0c..e871fd26cb 100644 --- a/app/Handlers/Events/APIEventHandler.php +++ b/app/Handlers/Events/APIEventHandler.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Handlers\Events; use Exception; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Mail\AccessTokenCreatedMail; use FireflyIII\Repositories\User\UserRepositoryInterface; use Laravel\Passport\Events\AccessTokenCreated; @@ -43,7 +44,7 @@ class APIEventHandler * @param AccessTokenCreated $event * * @return bool - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException */ public function accessTokenCreated(AccessTokenCreated $event): bool { diff --git a/app/Handlers/Events/AdminEventHandler.php b/app/Handlers/Events/AdminEventHandler.php index 22d8036175..5ed7953a67 100644 --- a/app/Handlers/Events/AdminEventHandler.php +++ b/app/Handlers/Events/AdminEventHandler.php @@ -24,6 +24,7 @@ namespace FireflyIII\Handlers\Events; use Exception; use FireflyIII\Events\AdminRequestedTestMessage; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Mail\AdminTestMail; use FireflyIII\Repositories\User\UserRepositoryInterface; use Log; @@ -41,7 +42,7 @@ class AdminEventHandler * @param AdminRequestedTestMessage $event * * @return bool - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException */ public function sendTestMessage(AdminRequestedTestMessage $event): bool { diff --git a/app/Handlers/Events/AutomationHandler.php b/app/Handlers/Events/AutomationHandler.php index 5c6361c096..463b5681a1 100644 --- a/app/Handlers/Events/AutomationHandler.php +++ b/app/Handlers/Events/AutomationHandler.php @@ -25,6 +25,7 @@ namespace FireflyIII\Handlers\Events; use Exception; use FireflyIII\Events\RequestedReportOnJournals; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Mail\ReportNewJournalsMail; use FireflyIII\Repositories\User\UserRepositoryInterface; use Log; @@ -42,7 +43,7 @@ class AutomationHandler * @param RequestedReportOnJournals $event * * @return bool - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException */ public function reportJournals(RequestedReportOnJournals $event): bool { diff --git a/app/Handlers/Events/VersionCheckEventHandler.php b/app/Handlers/Events/VersionCheckEventHandler.php index 5cd4b62e40..2fd9f6558f 100644 --- a/app/Handlers/Events/VersionCheckEventHandler.php +++ b/app/Handlers/Events/VersionCheckEventHandler.php @@ -25,6 +25,7 @@ declare(strict_types=1); namespace FireflyIII\Handlers\Events; use FireflyIII\Events\RequestedVersionCheckStatus; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Helpers\Update\UpdateTrait; use FireflyIII\Models\Configuration; use FireflyIII\Repositories\User\UserRepositoryInterface; @@ -43,7 +44,7 @@ class VersionCheckEventHandler * * @param RequestedVersionCheckStatus $event * - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException */ public function checkForUpdates(RequestedVersionCheckStatus $event): void { @@ -88,7 +89,7 @@ class VersionCheckEventHandler /** * @param RequestedVersionCheckStatus $event - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException */ protected function warnToCheckForUpdates(RequestedVersionCheckStatus $event): void { diff --git a/app/Helpers/Help/Help.php b/app/Helpers/Help/Help.php index 163995d6a5..30f21d68a1 100644 --- a/app/Helpers/Help/Help.php +++ b/app/Helpers/Help/Help.php @@ -25,6 +25,7 @@ namespace FireflyIII\Helpers\Help; use Cache; use Exception; use GuzzleHttp\Client; +use GuzzleHttp\Exception\GuzzleException; use League\CommonMark\CommonMarkConverter; use Log; use Route; @@ -71,7 +72,7 @@ class Help implements HelpInterface * @param string $language * * @return string - * @throws \GuzzleHttp\Exception\GuzzleException + * @throws GuzzleException */ public function getFromGitHub(string $route, string $language): string { diff --git a/app/Helpers/Update/UpdateTrait.php b/app/Helpers/Update/UpdateTrait.php index 8f72da4775..fc144807eb 100644 --- a/app/Helpers/Update/UpdateTrait.php +++ b/app/Helpers/Update/UpdateTrait.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace FireflyIII\Helpers\Update; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Services\FireflyIIIOrg\Update\UpdateRequestInterface; use Log; @@ -38,7 +39,7 @@ trait UpdateTrait * 'level' => 'info' / 'success' / 'error' * * @return array - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException */ public function getLatestRelease(): array { diff --git a/app/Http/Controllers/Account/EditController.php b/app/Http/Controllers/Account/EditController.php index 16e02e6403..78acef21d2 100644 --- a/app/Http/Controllers/Account/EditController.php +++ b/app/Http/Controllers/Account/EditController.php @@ -194,6 +194,7 @@ class EditController extends Controller $request->session()->flash('success', (string)trans('firefly.updated_account', ['name' => $account->name])); // store new attachment(s): + $files = $request->hasFile('attachments') ? $request->file('attachments') : null; if (null !== $files && !auth()->user()->hasRole('demo')) { $this->attachments->saveAttachmentsForModel($account, $files); diff --git a/app/Http/Controllers/Admin/ConfigurationController.php b/app/Http/Controllers/Admin/ConfigurationController.php index bcd31ac1ee..f4dac83d88 100644 --- a/app/Http/Controllers/Admin/ConfigurationController.php +++ b/app/Http/Controllers/Admin/ConfigurationController.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace FireflyIII\Http\Controllers\Admin; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Http\Middleware\IsDemoUser; use FireflyIII\Http\Requests\ConfigurationRequest; @@ -59,7 +60,7 @@ class ConfigurationController extends Controller * Show configuration index. * * @return Factory|View - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException */ public function index() { diff --git a/app/Http/Controllers/AttachmentController.php b/app/Http/Controllers/AttachmentController.php index 27a146bf5e..5def400852 100644 --- a/app/Http/Controllers/AttachmentController.php +++ b/app/Http/Controllers/AttachmentController.php @@ -26,6 +26,7 @@ use FireflyIII\Exceptions\FireflyException; use FireflyIII\Http\Requests\AttachmentFormRequest; use FireflyIII\Models\Attachment; use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface; +use Illuminate\Contracts\Container\BindingResolutionException; use Illuminate\Contracts\View\Factory; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; @@ -216,7 +217,7 @@ class AttachmentController extends Controller * * @return LaravelResponse * @throws FireflyException - * @throws \Illuminate\Contracts\Container\BindingResolutionException + * @throws BindingResolutionException */ public function view(Request $request, Attachment $attachment): LaravelResponse { diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 27a8cb866d..5ef0774785 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -25,6 +25,7 @@ namespace FireflyIII\Http\Controllers\Auth; use Adldap; use Cookie; use DB; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Providers\RouteServiceProvider; use Illuminate\Contracts\View\Factory; @@ -33,6 +34,7 @@ use Illuminate\Foundation\Auth\ThrottlesLogins; use Illuminate\Http\JsonResponse; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; +use Illuminate\Http\Response; use Illuminate\Validation\ValidationException; use Illuminate\View\View; use Log; @@ -83,7 +85,7 @@ class LoginController extends Controller public function login(Request $request) { Log::channel('audit')->info(sprintf('User is trying to login using "%s"', $request->get('email'))); - Log::info(sprintf('User is trying to login.')); + Log::info('User is trying to login.'); $guard = config('auth.defaults.guard'); @@ -134,7 +136,7 @@ class LoginController extends Controller * * @param Request $request * - * @return \Illuminate\Http\Response + * @return Response */ public function logout(Request $request) { @@ -162,7 +164,7 @@ class LoginController extends Controller } return $request->wantsJson() - ? new \Illuminate\Http\Response('', 204) + ? new Response('', 204) : redirect('/'); } @@ -192,8 +194,8 @@ class LoginController extends Controller * * @param Request $request * - * @return Factory|\Illuminate\Http\Response|View - * @throws \FireflyIII\Exceptions\FireflyException + * @return Factory|Response|View + * @throws FireflyException */ public function showLoginForm(Request $request) { diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 22e49777ee..c41172d317 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -32,6 +32,7 @@ use Illuminate\Foundation\Auth\RegistersUsers; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Illuminate\Routing\Redirector; +use Illuminate\Validation\ValidationException; use Illuminate\View\View; use Log; @@ -79,7 +80,7 @@ class RegisterController extends Controller * * @return Factory|RedirectResponse|Redirector|View * @throws FireflyException - * @throws \Illuminate\Validation\ValidationException + * @throws ValidationException */ public function register(Request $request) { diff --git a/app/Http/Controllers/Auth/TwoFactorController.php b/app/Http/Controllers/Auth/TwoFactorController.php index 7b7f104223..f574a0978e 100644 --- a/app/Http/Controllers/Auth/TwoFactorController.php +++ b/app/Http/Controllers/Auth/TwoFactorController.php @@ -24,6 +24,8 @@ namespace FireflyIII\Http\Controllers\Auth; use FireflyIII\Http\Controllers\Controller; use FireflyIII\User; +use Illuminate\Contracts\View\Factory; +use Illuminate\Contracts\View\View; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Illuminate\Routing\Redirector; @@ -38,7 +40,7 @@ class TwoFactorController extends Controller /** * What to do if 2FA lost? * - * @return \Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View + * @return Factory|View */ public function lostTwoFactor() { diff --git a/app/Http/Controllers/Budget/CreateController.php b/app/Http/Controllers/Budget/CreateController.php index 03c6fd26e6..557f5ce739 100644 --- a/app/Http/Controllers/Budget/CreateController.php +++ b/app/Http/Controllers/Budget/CreateController.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace FireflyIII\Http\Controllers\Budget; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Helpers\Attachments\AttachmentHelperInterface; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Http\Requests\BudgetFormStoreRequest; @@ -111,7 +112,7 @@ class CreateController extends Controller * @param BudgetFormStoreRequest $request * * @return RedirectResponse - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException */ public function store(BudgetFormStoreRequest $request): RedirectResponse { diff --git a/app/Http/Controllers/Category/CreateController.php b/app/Http/Controllers/Category/CreateController.php index 8ef6825105..678509283c 100644 --- a/app/Http/Controllers/Category/CreateController.php +++ b/app/Http/Controllers/Category/CreateController.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace FireflyIII\Http\Controllers\Category; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Helpers\Attachments\AttachmentHelperInterface; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Http\Requests\CategoryFormRequest; @@ -86,7 +87,7 @@ class CreateController extends Controller * @param CategoryFormRequest $request * * @return $this|RedirectResponse|Redirector - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException */ public function store(CategoryFormRequest $request) { diff --git a/app/Http/Controllers/Export/IndexController.php b/app/Http/Controllers/Export/IndexController.php index cb7e570c4b..8e8b201e0e 100644 --- a/app/Http/Controllers/Export/IndexController.php +++ b/app/Http/Controllers/Export/IndexController.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Http\Controllers\Export; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Http\Middleware\IsDemoUser; use FireflyIII\Repositories\Journal\JournalRepositoryInterface; @@ -32,6 +33,7 @@ use Illuminate\Contracts\View\Factory; use Illuminate\Http\Response as LaravelResponse; use Illuminate\View\View; use League\Csv\CannotInsertRecord; +use League\Csv\Exception; /** * Class IndexController @@ -66,8 +68,8 @@ class IndexController extends Controller /** * @return LaravelResponse * @throws CannotInsertRecord - * @throws \FireflyIII\Exceptions\FireflyException - * @throws \League\Csv\Exception + * @throws FireflyException + * @throws Exception */ public function export(): LaravelResponse { diff --git a/app/Http/Controllers/ObjectGroup/DeleteController.php b/app/Http/Controllers/ObjectGroup/DeleteController.php index e5efc8b58c..16af643222 100644 --- a/app/Http/Controllers/ObjectGroup/DeleteController.php +++ b/app/Http/Controllers/ObjectGroup/DeleteController.php @@ -27,6 +27,8 @@ namespace FireflyIII\Http\Controllers\ObjectGroup; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Models\ObjectGroup; use FireflyIII\Repositories\ObjectGroup\ObjectGroupRepositoryInterface; +use Illuminate\Contracts\View\Factory; +use Illuminate\Contracts\View\View; use Illuminate\Http\RedirectResponse; /** @@ -62,7 +64,7 @@ class DeleteController extends Controller * * @param ObjectGroup $objectGroup * - * @return \Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View + * @return Factory|View */ public function delete(ObjectGroup $objectGroup) { diff --git a/app/Http/Controllers/ObjectGroup/EditController.php b/app/Http/Controllers/ObjectGroup/EditController.php index 397dfc0437..d4e866ee52 100644 --- a/app/Http/Controllers/ObjectGroup/EditController.php +++ b/app/Http/Controllers/ObjectGroup/EditController.php @@ -28,6 +28,11 @@ use FireflyIII\Http\Controllers\Controller; use FireflyIII\Http\Requests\ObjectGroupFormRequest; use FireflyIII\Models\ObjectGroup; use FireflyIII\Repositories\ObjectGroup\ObjectGroupRepositoryInterface; +use Illuminate\Contracts\Foundation\Application; +use Illuminate\Contracts\View\Factory; +use Illuminate\Contracts\View\View; +use Illuminate\Http\RedirectResponse; +use Illuminate\Routing\Redirector; /** * Class EditController @@ -62,7 +67,7 @@ class EditController extends Controller * * @param ObjectGroup $objectGroup * - * @return \Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View + * @return Factory|View */ public function edit(ObjectGroup $objectGroup) { @@ -82,7 +87,8 @@ class EditController extends Controller * * @param ObjectGroupFormRequest $request * @param ObjectGroup $objectGroup - * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector + * + * @return Application|RedirectResponse|Redirector */ public function update(ObjectGroupFormRequest $request, ObjectGroup $objectGroup) { diff --git a/app/Http/Controllers/ObjectGroup/IndexController.php b/app/Http/Controllers/ObjectGroup/IndexController.php index dafa324fb9..0d159d4754 100644 --- a/app/Http/Controllers/ObjectGroup/IndexController.php +++ b/app/Http/Controllers/ObjectGroup/IndexController.php @@ -29,6 +29,7 @@ use FireflyIII\Models\ObjectGroup; use FireflyIII\Repositories\ObjectGroup\ObjectGroupRepositoryInterface; use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\View\Factory; +use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; use Illuminate\View\View; use Log; @@ -78,7 +79,7 @@ class IndexController extends Controller * @param Request $request * @param ObjectGroup $objectGroup * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse */ public function setOrder(Request $request, ObjectGroup $objectGroup) { diff --git a/app/Http/Controllers/PiggyBank/CreateController.php b/app/Http/Controllers/PiggyBank/CreateController.php index 7d888b0f75..6ac60fc4da 100644 --- a/app/Http/Controllers/PiggyBank/CreateController.php +++ b/app/Http/Controllers/PiggyBank/CreateController.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Http\Controllers\PiggyBank; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Helpers\Attachments\AttachmentHelperInterface; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Http\Requests\PiggyBankStoreRequest; @@ -88,7 +89,7 @@ class CreateController extends Controller * @param PiggyBankStoreRequest $request * * @return RedirectResponse|Redirector - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException */ public function store(PiggyBankStoreRequest $request) { diff --git a/app/Http/Controllers/PiggyBank/EditController.php b/app/Http/Controllers/PiggyBank/EditController.php index 783a6b1b78..e160a74f7f 100644 --- a/app/Http/Controllers/PiggyBank/EditController.php +++ b/app/Http/Controllers/PiggyBank/EditController.php @@ -79,12 +79,8 @@ class EditController extends Controller $startDate = null; $note = $piggyBank->notes()->first(); // Flash some data to fill the form. - if (null !== $piggyBank->targetdate) { - $targetDate = $piggyBank->targetdate->format('Y-m-d'); - } - if (null !== $piggyBank->startdate) { - $startDate = $piggyBank->startdate->format('Y-m-d'); - } + $targetDate = $piggyBank->targetdate?->format('Y-m-d'); + $startDate = $piggyBank->startdate?->format('Y-m-d'); $preFilled = ['name' => $piggyBank->name, 'account_id' => $piggyBank->account_id, diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index 49df2a6b08..890708eb06 100644 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -38,6 +38,7 @@ use FireflyIII\Support\Http\Controllers\CreateStuff; use FireflyIII\User; use Google2FA; use Hash; +use Illuminate\Auth\AuthenticationException; use Illuminate\Contracts\Auth\Guard; use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\View\Factory; @@ -48,6 +49,9 @@ use Illuminate\Support\Collection; use Illuminate\View\View; use Laravel\Passport\ClientRepository; use Log; +use PragmaRX\Google2FA\Exceptions\IncompatibleWithGoogleAuthenticatorException; +use PragmaRX\Google2FA\Exceptions\InvalidCharactersException; +use PragmaRX\Google2FA\Exceptions\SecretKeyTooShortException; use PragmaRX\Recovery\Recovery; /** @@ -107,7 +111,7 @@ class ProfileController extends Controller * @param Request $request * * @return Application|RedirectResponse|Redirector - * @throws \Illuminate\Auth\AuthenticationException + * @throws AuthenticationException */ public function postLogoutOtherSessions(Request $request) { @@ -183,9 +187,9 @@ class ProfileController extends Controller * @param Request $request * * @return Factory|View - * @throws \PragmaRX\Google2FA\Exceptions\IncompatibleWithGoogleAuthenticatorException - * @throws \PragmaRX\Google2FA\Exceptions\InvalidCharactersException - * @throws \PragmaRX\Google2FA\Exceptions\SecretKeyTooShortException + * @throws IncompatibleWithGoogleAuthenticatorException + * @throws InvalidCharactersException + * @throws SecretKeyTooShortException */ public function code(Request $request) { diff --git a/app/Http/Controllers/Report/BillController.php b/app/Http/Controllers/Report/BillController.php index 6663b071ae..961dadd074 100644 --- a/app/Http/Controllers/Report/BillController.php +++ b/app/Http/Controllers/Report/BillController.php @@ -28,6 +28,7 @@ use FireflyIII\Helpers\Report\ReportHelperInterface; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Support\CacheProperties; use Illuminate\Support\Collection; +use JsonException; use Log; use Throwable; @@ -42,7 +43,7 @@ class BillController extends Controller * @param Carbon $end * * @return mixed|string - * @throws \JsonException + * @throws JsonException */ public function overview(Collection $accounts, Carbon $start, Carbon $end) { // chart properties for cache: diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.php index 174ab8ac34..ad67bb0ede 100644 --- a/app/Http/Controllers/ReportController.php +++ b/app/Http/Controllers/ReportController.php @@ -34,6 +34,7 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; use FireflyIII\Support\Http\Controllers\RenderPartialViews; use Illuminate\Contracts\View\Factory; +use Illuminate\Http\JsonResponse; use Illuminate\Http\RedirectResponse; use Illuminate\Routing\Redirector; use Illuminate\Support\Collection; @@ -299,7 +300,7 @@ class ReportController extends Controller * * @param string $reportType * - * @return \Illuminate\Http\JsonResponse + * @return JsonResponse * */ public function options(string $reportType) diff --git a/app/Http/Controllers/System/CronController.php b/app/Http/Controllers/System/CronController.php index e75f33f836..fe711c5844 100644 --- a/app/Http/Controllers/System/CronController.php +++ b/app/Http/Controllers/System/CronController.php @@ -23,6 +23,9 @@ declare(strict_types=1); namespace FireflyIII\Http\Controllers\System; +use Illuminate\Contracts\Foundation\Application; +use Illuminate\Contracts\Routing\ResponseFactory; +use Illuminate\Http\Response; use Log; /** @@ -31,7 +34,7 @@ use Log; class CronController { /** - * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Http\Response + * @return Application|ResponseFactory|Response */ public function cron() { diff --git a/app/Http/Controllers/TagController.php b/app/Http/Controllers/TagController.php index 61c21aba75..50d03d9407 100644 --- a/app/Http/Controllers/TagController.php +++ b/app/Http/Controllers/TagController.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace FireflyIII\Http\Controllers; use Carbon\Carbon; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Helpers\Attachments\AttachmentHelperInterface; use FireflyIII\Helpers\Collector\GroupCollectorInterface; use FireflyIII\Http\Requests\TagFormRequest; @@ -228,7 +229,7 @@ class TagController extends Controller * @param Carbon|null $end * * @return Factory|View - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException */ public function show(Request $request, Tag $tag, Carbon $start = null, Carbon $end = null) { diff --git a/app/Http/Controllers/Transaction/BulkController.php b/app/Http/Controllers/Transaction/BulkController.php index 550f9f2d6d..8eee5404e5 100644 --- a/app/Http/Controllers/Transaction/BulkController.php +++ b/app/Http/Controllers/Transaction/BulkController.php @@ -28,7 +28,10 @@ use FireflyIII\Http\Requests\BulkEditJournalRequest; use FireflyIII\Models\TransactionJournal; use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; use FireflyIII\Repositories\Journal\JournalRepositoryInterface; +use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\View\Factory; +use Illuminate\Http\RedirectResponse; +use Illuminate\Routing\Redirector; use Illuminate\View\View; use Log; @@ -90,7 +93,7 @@ class BulkController extends Controller * * @param BulkEditJournalRequest $request * - * @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector + * @return Application|RedirectResponse|Redirector */ public function update(BulkEditJournalRequest $request) { diff --git a/app/Http/Controllers/Transaction/DeleteController.php b/app/Http/Controllers/Transaction/DeleteController.php index 1ee1b81a90..24f0bb1e47 100644 --- a/app/Http/Controllers/Transaction/DeleteController.php +++ b/app/Http/Controllers/Transaction/DeleteController.php @@ -26,6 +26,8 @@ namespace FireflyIII\Http\Controllers\Transaction; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Models\TransactionGroup; use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepositoryInterface; +use Illuminate\Contracts\View\Factory; +use Illuminate\Contracts\View\View; use Illuminate\Http\RedirectResponse; use Illuminate\Routing\Redirector; use Log; @@ -66,7 +68,7 @@ class DeleteController extends Controller * * @param TransactionGroup $group * - * @return \Illuminate\Contracts\View\Factory|\Illuminate\Contracts\View\View|Redirector|RedirectResponse + * @return Factory|View|Redirector|RedirectResponse */ public function delete(TransactionGroup $group) { diff --git a/app/Http/Controllers/Transaction/MassController.php b/app/Http/Controllers/Transaction/MassController.php index f17684bcd4..6a616aa312 100644 --- a/app/Http/Controllers/Transaction/MassController.php +++ b/app/Http/Controllers/Transaction/MassController.php @@ -35,6 +35,7 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; use FireflyIII\Repositories\Journal\JournalRepositoryInterface; use FireflyIII\Services\Internal\Update\JournalUpdateService; +use Illuminate\Contracts\Foundation\Application; use Illuminate\Http\RedirectResponse; use Illuminate\Routing\Redirector; use Illuminate\View\View as IlluminateView; @@ -91,7 +92,7 @@ class MassController extends Controller * * @param MassDeleteJournalRequest $request * - * @return \Illuminate\Contracts\Foundation\Application|Redirector|RedirectResponse + * @return Application|Redirector|RedirectResponse * */ public function destroy(MassDeleteJournalRequest $request) @@ -229,14 +230,14 @@ class MassController extends Controller /** * @param MassEditJournalRequest $request * @param int $journalId - * @param string $string + * @param string $key * * @return Carbon|null * @codeCoverageIgnore */ - private function getDateFromRequest(MassEditJournalRequest $request, int $journalId, string $string): ?Carbon + private function getDateFromRequest(MassEditJournalRequest $request, int $journalId, string $key): ?Carbon { - $value = $request->get($string); + $value = $request->get($key); if (!is_array($value)) { return null; } diff --git a/app/Jobs/CreateRecurringTransactions.php b/app/Jobs/CreateRecurringTransactions.php index c72079e99f..86254f57eb 100644 --- a/app/Jobs/CreateRecurringTransactions.php +++ b/app/Jobs/CreateRecurringTransactions.php @@ -27,6 +27,8 @@ namespace FireflyIII\Jobs; use Carbon\Carbon; use FireflyIII\Events\RequestedReportOnJournals; use FireflyIII\Events\StoredTransactionGroup; +use FireflyIII\Exceptions\DuplicateTransactionException; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Recurrence; use FireflyIII\Models\RecurrenceRepetition; use FireflyIII\Models\RecurrenceTransaction; @@ -347,8 +349,8 @@ class CreateRecurringTransactions implements ShouldQueue * @param Carbon $date * * @return TransactionGroup|null - * @throws \FireflyIII\Exceptions\DuplicateTransactionException - * @throws \FireflyIII\Exceptions\FireflyException + * @throws DuplicateTransactionException + * @throws FireflyException */ private function handleOccurrence(Recurrence $recurrence, RecurrenceRepetition $repetition, Carbon $date): ?TransactionGroup { diff --git a/app/Models/GroupMembership.php b/app/Models/GroupMembership.php index 4f328ba998..93ab42b00d 100644 --- a/app/Models/GroupMembership.php +++ b/app/Models/GroupMembership.php @@ -24,16 +24,19 @@ declare(strict_types=1); namespace FireflyIII\Models; +use Eloquent; use FireflyIII\User; +use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Support\Carbon; /** * Class GroupMembership * * @property int $id - * @property \Illuminate\Support\Carbon|null $created_at - * @property \Illuminate\Support\Carbon|null $updated_at + * @property Carbon|null $created_at + * @property Carbon|null $updated_at * @property string|null $deleted_at * @property int $user_id * @property int $user_group_id @@ -41,17 +44,17 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo; * @property-read User $user * @property-read \FireflyIII\Models\UserGroup $userGroup * @property-read \FireflyIII\Models\UserRole $userRole - * @method static \Illuminate\Database\Eloquent\Builder|GroupMembership newModelQuery() - * @method static \Illuminate\Database\Eloquent\Builder|GroupMembership newQuery() - * @method static \Illuminate\Database\Eloquent\Builder|GroupMembership query() - * @method static \Illuminate\Database\Eloquent\Builder|GroupMembership whereCreatedAt($value) - * @method static \Illuminate\Database\Eloquent\Builder|GroupMembership whereDeletedAt($value) - * @method static \Illuminate\Database\Eloquent\Builder|GroupMembership whereId($value) - * @method static \Illuminate\Database\Eloquent\Builder|GroupMembership whereUpdatedAt($value) - * @method static \Illuminate\Database\Eloquent\Builder|GroupMembership whereUserGroupId($value) - * @method static \Illuminate\Database\Eloquent\Builder|GroupMembership whereUserId($value) - * @method static \Illuminate\Database\Eloquent\Builder|GroupMembership whereUserRoleId($value) - * @mixin \Eloquent + * @method static Builder|GroupMembership newModelQuery() + * @method static Builder|GroupMembership newQuery() + * @method static Builder|GroupMembership query() + * @method static Builder|GroupMembership whereCreatedAt($value) + * @method static Builder|GroupMembership whereDeletedAt($value) + * @method static Builder|GroupMembership whereId($value) + * @method static Builder|GroupMembership whereUpdatedAt($value) + * @method static Builder|GroupMembership whereUserGroupId($value) + * @method static Builder|GroupMembership whereUserId($value) + * @method static Builder|GroupMembership whereUserRoleId($value) + * @mixin Eloquent */ class GroupMembership extends Model { diff --git a/app/Models/UserGroup.php b/app/Models/UserGroup.php index f47d81c061..f5d247c6f8 100644 --- a/app/Models/UserGroup.php +++ b/app/Models/UserGroup.php @@ -24,28 +24,32 @@ declare(strict_types=1); namespace FireflyIII\Models; +use Eloquent; +use Illuminate\Database\Eloquent\Builder; +use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\HasMany; +use Illuminate\Support\Carbon; /** * Class UserGroup * * @property int $id - * @property \Illuminate\Support\Carbon|null $created_at - * @property \Illuminate\Support\Carbon|null $updated_at + * @property Carbon|null $created_at + * @property Carbon|null $updated_at * @property string|null $deleted_at * @property string $title - * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\GroupMembership[] $groupMemberships + * @property-read Collection|\FireflyIII\Models\GroupMembership[] $groupMemberships * @property-read int|null $group_memberships_count - * @method static \Illuminate\Database\Eloquent\Builder|UserGroup newModelQuery() - * @method static \Illuminate\Database\Eloquent\Builder|UserGroup newQuery() - * @method static \Illuminate\Database\Eloquent\Builder|UserGroup query() - * @method static \Illuminate\Database\Eloquent\Builder|UserGroup whereCreatedAt($value) - * @method static \Illuminate\Database\Eloquent\Builder|UserGroup whereDeletedAt($value) - * @method static \Illuminate\Database\Eloquent\Builder|UserGroup whereId($value) - * @method static \Illuminate\Database\Eloquent\Builder|UserGroup whereTitle($value) - * @method static \Illuminate\Database\Eloquent\Builder|UserGroup whereUpdatedAt($value) - * @mixin \Eloquent + * @method static Builder|UserGroup newModelQuery() + * @method static Builder|UserGroup newQuery() + * @method static Builder|UserGroup query() + * @method static Builder|UserGroup whereCreatedAt($value) + * @method static Builder|UserGroup whereDeletedAt($value) + * @method static Builder|UserGroup whereId($value) + * @method static Builder|UserGroup whereTitle($value) + * @method static Builder|UserGroup whereUpdatedAt($value) + * @mixin Eloquent */ class UserGroup extends Model { diff --git a/app/Models/UserRole.php b/app/Models/UserRole.php index d4be7c292f..b8e49ad67b 100644 --- a/app/Models/UserRole.php +++ b/app/Models/UserRole.php @@ -24,28 +24,32 @@ declare(strict_types=1); namespace FireflyIII\Models; +use Eloquent; +use Illuminate\Database\Eloquent\Builder; +use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\HasMany; +use Illuminate\Support\Carbon; /** * Class UserRole * * @property int $id - * @property \Illuminate\Support\Carbon|null $created_at - * @property \Illuminate\Support\Carbon|null $updated_at + * @property Carbon|null $created_at + * @property Carbon|null $updated_at * @property string|null $deleted_at * @property string $title - * @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\GroupMembership[] $groupMemberships + * @property-read Collection|\FireflyIII\Models\GroupMembership[] $groupMemberships * @property-read int|null $group_memberships_count - * @method static \Illuminate\Database\Eloquent\Builder|UserRole newModelQuery() - * @method static \Illuminate\Database\Eloquent\Builder|UserRole newQuery() - * @method static \Illuminate\Database\Eloquent\Builder|UserRole query() - * @method static \Illuminate\Database\Eloquent\Builder|UserRole whereCreatedAt($value) - * @method static \Illuminate\Database\Eloquent\Builder|UserRole whereDeletedAt($value) - * @method static \Illuminate\Database\Eloquent\Builder|UserRole whereId($value) - * @method static \Illuminate\Database\Eloquent\Builder|UserRole whereTitle($value) - * @method static \Illuminate\Database\Eloquent\Builder|UserRole whereUpdatedAt($value) - * @mixin \Eloquent + * @method static Builder|UserRole newModelQuery() + * @method static Builder|UserRole newQuery() + * @method static Builder|UserRole query() + * @method static Builder|UserRole whereCreatedAt($value) + * @method static Builder|UserRole whereDeletedAt($value) + * @method static Builder|UserRole whereId($value) + * @method static Builder|UserRole whereTitle($value) + * @method static Builder|UserRole whereUpdatedAt($value) + * @mixin Eloquent */ class UserRole extends Model { diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php index f36ce1636e..096545ff0d 100644 --- a/app/Repositories/Account/AccountRepository.php +++ b/app/Repositories/Account/AccountRepository.php @@ -452,9 +452,7 @@ class AccountRepository implements AccountRepositoryInterface { $journal = $this->getOpeningBalance($account); $group = null; - if (null !== $journal) { - $group = $journal->transactionGroup; - } + $group = $journal?->transactionGroup; return $group; } @@ -598,9 +596,7 @@ class AccountRepository implements AccountRepositoryInterface { $result = null; $journal = $this->oldestJournal($account); - if (null !== $journal) { - $result = $journal->date; - } + $result = $journal?->date; return $result; } diff --git a/app/Repositories/Journal/JournalRepository.php b/app/Repositories/Journal/JournalRepository.php index db2586aba2..8bb0e7c0a2 100644 --- a/app/Repositories/Journal/JournalRepository.php +++ b/app/Repositories/Journal/JournalRepository.php @@ -228,9 +228,7 @@ class JournalRepository implements JournalRepositoryInterface { /** @var TransactionJournal $journal */ $journal = $this->user->transactionJournals()->find($journalId); - if (null !== $journal) { - $journal->transactions()->update(['reconciled' => true]); - } + $journal?->transactions()->update(['reconciled' => true]); } /** diff --git a/app/Repositories/LinkType/LinkTypeRepository.php b/app/Repositories/LinkType/LinkTypeRepository.php index c2196efa41..9f19877476 100644 --- a/app/Repositories/LinkType/LinkTypeRepository.php +++ b/app/Repositories/LinkType/LinkTypeRepository.php @@ -331,7 +331,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface public function updateLink(TransactionJournalLink $journalLink, array $data): TransactionJournalLink { $journalLink->source_id = $data['inward_id'] ?: $journalLink->source_id; - $journalLink->destination_id = $data['outward_id'] ? $data['outward_id'] : $journalLink->destination_id; + $journalLink->destination_id = $data['outward_id'] ?: $journalLink->destination_id; $journalLink->save(); if (array_key_exists('link_type_name', $data)) { $linkType = LinkType::whereName($data['link_type_name'])->first(); diff --git a/app/Repositories/PiggyBank/ModifiesPiggyBanks.php b/app/Repositories/PiggyBank/ModifiesPiggyBanks.php index d5ee174820..94056fc3ae 100644 --- a/app/Repositories/PiggyBank/ModifiesPiggyBanks.php +++ b/app/Repositories/PiggyBank/ModifiesPiggyBanks.php @@ -267,7 +267,7 @@ trait ModifiesPiggyBanks if ($newOrder > $oldOrder) { $this->user->piggyBanks()->where('piggy_banks.order', '<=', $newOrder)->where('piggy_banks.order', '>', $oldOrder) ->where('piggy_banks.id', '!=', $piggyBank->id) - ->decrement('piggy_banks.order', 1); + ->decrement('piggy_banks.order'); $piggyBank->order = $newOrder; Log::debug(sprintf('Order of piggy #%d ("%s") is now %d', $piggyBank->id, $piggyBank->name, $newOrder)); $piggyBank->save(); @@ -277,7 +277,7 @@ trait ModifiesPiggyBanks $this->user->piggyBanks()->where('piggy_banks.order', '>=', $newOrder)->where('piggy_banks.order', '<', $oldOrder) ->where('piggy_banks.id', '!=', $piggyBank->id) - ->increment('piggy_banks.order', 1); + ->increment('piggy_banks.order'); $piggyBank->order = $newOrder; Log::debug(sprintf('Order of piggy #%d ("%s") is now %d', $piggyBank->id, $piggyBank->name, $newOrder)); $piggyBank->save(); diff --git a/app/Repositories/Recurring/RecurringRepository.php b/app/Repositories/Recurring/RecurringRepository.php index b9709176ee..7cddb6a474 100644 --- a/app/Repositories/Recurring/RecurringRepository.php +++ b/app/Repositories/Recurring/RecurringRepository.php @@ -45,6 +45,7 @@ use FireflyIII\Support\Repositories\Recurring\FiltersWeekends; use FireflyIII\User; use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Support\Collection; +use JsonException; use Log; /** @@ -290,7 +291,7 @@ class RecurringRepository implements RecurringRepositoryInterface * @param RecurrenceTransaction $transaction * * @return array - * @throws \JsonException + * @throws JsonException */ public function getTags(RecurrenceTransaction $transaction): array { diff --git a/app/Repositories/User/UserRepository.php b/app/Repositories/User/UserRepository.php index 1e22c24e06..7eb42fe1e6 100644 --- a/app/Repositories/User/UserRepository.php +++ b/app/Repositories/User/UserRepository.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace FireflyIII\Repositories\User; use Exception; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\BudgetLimit; use FireflyIII\Models\Role; use FireflyIII\User; @@ -375,7 +376,7 @@ class UserRepository implements UserRepositoryInterface * @param string $newEmail * * @return bool - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException * @see changeEmail */ public function updateEmail(User $user, string $newEmail): bool diff --git a/app/Rules/BelongsUser.php b/app/Rules/BelongsUser.php index cc71d832dd..f740aab087 100644 --- a/app/Rules/BelongsUser.php +++ b/app/Rules/BelongsUser.php @@ -74,31 +74,22 @@ class BelongsUser implements Rule { $attribute = $this->parseAttribute($attribute); if (!auth()->check()) { - return true; + return true; } $attribute = (string)$attribute; Log::debug(sprintf('Going to validate %s', $attribute)); - switch ($attribute) { - case 'piggy_bank_id': - return $this->validatePiggyBankId((int)$value); - case 'piggy_bank_name': - return $this->validatePiggyBankName($value); - case 'bill_id': - return $this->validateBillId((int)$value); - case 'bill_name': - return $this->validateBillName($value); - case 'budget_id': - return $this->validateBudgetId((int)$value); - case 'category_id': - return $this->validateCategoryId((int)$value); - case 'budget_name': - return $this->validateBudgetName($value); - case 'source_id': - case 'destination_id': - return $this->validateAccountId((int)$value); - default: - throw new FireflyException(sprintf('Rule BelongUser cannot handle "%s"', $attribute)); - } + + return match ($attribute) { + 'piggy_bank_id' => $this->validatePiggyBankId((int)$value), + 'piggy_bank_name' => $this->validatePiggyBankName($value), + 'bill_id' => $this->validateBillId((int)$value), + 'bill_name' => $this->validateBillName($value), + 'budget_id' => $this->validateBudgetId((int)$value), + 'category_id' => $this->validateCategoryId((int)$value), + 'budget_name' => $this->validateBudgetName($value), + 'source_id', 'destination_id' => $this->validateAccountId((int)$value), + default => throw new FireflyException(sprintf('Rule BelongUser cannot handle "%s"', $attribute)), + }; } /** @@ -116,7 +107,7 @@ class BelongsUser implements Rule return $parts[2]; } - return $attribute; + return $attribute; } /** diff --git a/app/Services/Internal/Support/RecurringTransactionTrait.php b/app/Services/Internal/Support/RecurringTransactionTrait.php index 433111735f..316ada2b88 100644 --- a/app/Services/Internal/Support/RecurringTransactionTrait.php +++ b/app/Services/Internal/Support/RecurringTransactionTrait.php @@ -151,7 +151,7 @@ trait RecurringTransactionTrait [ 'recurrence_id' => $recurrence->id, 'transaction_currency_id' => $currency->id, - 'foreign_currency_id' => null === $foreignCurrency ? null : $foreignCurrency->id, + 'foreign_currency_id' => $foreignCurrency?->id, 'source_id' => $source->id, 'destination_id' => $destination->id, 'amount' => $array['amount'], diff --git a/app/Services/Internal/Update/AccountUpdateService.php b/app/Services/Internal/Update/AccountUpdateService.php index bc9b9fbe31..e9341d8f7b 100644 --- a/app/Services/Internal/Update/AccountUpdateService.php +++ b/app/Services/Internal/Update/AccountUpdateService.php @@ -31,6 +31,7 @@ use FireflyIII\Models\Location; use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Services\Internal\Support\AccountServiceTrait; use FireflyIII\User; +use JsonException; use Log; /** @@ -78,7 +79,7 @@ class AccountUpdateService * * @return Account * @throws FireflyException - * @throws \JsonException + * @throws JsonException */ public function update(Account $account, array $data): Account { @@ -215,7 +216,7 @@ class AccountUpdateService $newOrder = $data['order']; Log::debug(sprintf('Order is set to be updated from %s to %s', $oldOrder, $newOrder)); $list = $this->getTypeIds([AccountType::MORTGAGE, AccountType::LOAN, AccountType::DEBT]); - if (in_array($type, [AccountType::ASSET], true)) { + if ($type === AccountType::ASSET) { $list = $this->getTypeIds([AccountType::ASSET]); } diff --git a/app/Services/Internal/Update/GroupUpdateService.php b/app/Services/Internal/Update/GroupUpdateService.php index 9648b38c22..d15c4c5984 100644 --- a/app/Services/Internal/Update/GroupUpdateService.php +++ b/app/Services/Internal/Update/GroupUpdateService.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace FireflyIII\Services\Internal\Update; +use FireflyIII\Exceptions\DuplicateTransactionException; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Factory\TransactionJournalFactory; use FireflyIII\Models\TransactionGroup; @@ -168,7 +169,7 @@ class GroupUpdateService * @param array $data * * @throws FireflyException - * @throws \FireflyIII\Exceptions\DuplicateTransactionException + * @throws DuplicateTransactionException */ private function createTransactionJournal(TransactionGroup $transactionGroup, array $data): void { diff --git a/app/Services/Internal/Update/JournalUpdateService.php b/app/Services/Internal/Update/JournalUpdateService.php index 0a18d2f21e..021690345e 100644 --- a/app/Services/Internal/Update/JournalUpdateService.php +++ b/app/Services/Internal/Update/JournalUpdateService.php @@ -475,7 +475,7 @@ class JournalUpdateService $billId = (int)($this->data['bill_id'] ?? 0); $billName = (string)($this->data['bill_name'] ?? ''); $bill = $this->billRepository->findBill($billId, $billName); - $this->transactionJournal->bill_id = null === $bill ? null : $bill->id; + $this->transactionJournal->bill_id = $bill?->id; Log::debug('Updated bill ID'); } } diff --git a/app/Support/Authentication/RemoteUserGuard.php b/app/Support/Authentication/RemoteUserGuard.php index c2adae662c..61fda41a26 100644 --- a/app/Support/Authentication/RemoteUserGuard.php +++ b/app/Support/Authentication/RemoteUserGuard.php @@ -82,7 +82,7 @@ class RemoteUserGuard implements Guard if (null !== $header) { $emailAddress = (string)(request()->server($header) ?? null); - $preference = app('preferences')->getForUser($retrievedUser, 'remote_guard_alt_email', null); + $preference = app('preferences')->getForUser($retrievedUser, 'remote_guard_alt_email'); if (null !== $emailAddress && null === $preference && $emailAddress !== $userID) { app('preferences')->setForUser($retrievedUser, 'remote_guard_alt_email', $emailAddress); diff --git a/app/Support/Binder/CLIToken.php b/app/Support/Binder/CLIToken.php index 1ec5574fd6..4e14c59d0f 100644 --- a/app/Support/Binder/CLIToken.php +++ b/app/Support/Binder/CLIToken.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace FireflyIII\Support\Binder; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Repositories\User\UserRepositoryInterface; use Illuminate\Routing\Route; use Log; @@ -39,7 +40,7 @@ class CLIToken implements BinderInterface * @param Route $route * * @return mixed - * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException */ public static function routeBinder(string $value, Route $route) { diff --git a/app/Support/Export/ExportDataGenerator.php b/app/Support/Export/ExportDataGenerator.php index 3035e458b5..4ccc0be661 100644 --- a/app/Support/Export/ExportDataGenerator.php +++ b/app/Support/Export/ExportDataGenerator.php @@ -160,7 +160,7 @@ class ExportDataGenerator $account->iban, $account->account_number, $account->active, - $currency ? $currency->code : null, + $currency?->code, $repository->getMetaValue($account, 'account_role'), $repository->getMetaValue($account, 'cc_type'), $repository->getMetaValue($account, 'cc_monthly_payment_date'), @@ -391,11 +391,11 @@ class ExportDataGenerator $piggy->account->name, $piggy->account->accountType->type, $piggy->name, - $currency ? $currency->code : null, + $currency?->code, $piggy->targetamount, - $repetition ? $repetition->currentamount : null, - $piggy->startdate ? $piggy->startdate->format('Y-m-d') : null, - $piggy->targetdate ? $piggy->targetdate->format('Y-m-d') : null, + $repetition?->currentamount, + $piggy->startdate?->format('Y-m-d'), + $piggy->targetdate?->format('Y-m-d'), $piggy->order, $piggy->active, ]; @@ -457,9 +457,9 @@ class ExportDataGenerator $recurrence->transactionType->type, $recurrence->title, $recurrence->description, - null !== $recurrence->first_date ? $recurrence->first_date->format('Y-m-d') : null, - $recurrence->repeat_until ? $recurrence->repeat_until->format('Y-m-d') : null, - $recurrence->latest_date ? $recurrence->latest_date->format('Y-m-d') : null, + $recurrence->first_date?->format('Y-m-d'), + $recurrence->repeat_until?->format('Y-m-d'), + $recurrence->latest_date?->format('Y-m-d'), $recurrence->repetitions, $recurrence->apply_rules, $recurrence->active, @@ -492,7 +492,7 @@ class ExportDataGenerator null, null, null, null, // transaction: - $transaction->transactionCurrency->code, $transaction->foreignCurrency ? $transaction->foreignCurrency->code : null, + $transaction->transactionCurrency->code, $transaction->foreignCurrency?->code, $transaction->sourceAccount->name, $transaction->sourceAccount->accountType->type, $transaction->destinationAccount->name, $transaction->destinationAccount->accountType->type, $transaction->amount, $transaction->foreign_amount, $categoryName, $budgetId, $piggyBankId, implode(',', $tags), @@ -608,7 +608,7 @@ class ExportDataGenerator $tag->created_at->toAtomString(), $tag->updated_at->toAtomString(), $tag->tag, - $tag->date ? $tag->date->format('Y-m-d') : null, + $tag->date?->format('Y-m-d'), $tag->description, $tag->latitude, $tag->longitude, diff --git a/app/Support/ParseDateString.php b/app/Support/ParseDateString.php index ae1f566064..3fd64fe68c 100644 --- a/app/Support/ParseDateString.php +++ b/app/Support/ParseDateString.php @@ -67,7 +67,7 @@ class ParseDateString } // if + or -: - if (0 === strpos($date, '+') || 0 === strpos($date, '-')) { + if (str_starts_with($date, '+') || str_starts_with($date, '-')) { return $this->parseRelativeDate($date); } @@ -81,7 +81,7 @@ class ParseDateString } // maybe a date range - if (10 === strlen($date) && (false !== strpos($date, 'xx') || false !== strpos($date, 'xxxx'))) { + if (10 === strlen($date) && (str_contains($date, 'xx') || str_contains($date, 'xxxx'))) { Log::debug(sprintf('[c]Detected a date range ("%s"), return a fake date.', $date)); // very lazy way to parse the date without parsing it, because this specific function // cant handle date ranges. @@ -112,7 +112,7 @@ class ParseDateString return false; } // no x'es - if (false === strpos($date, 'xx') && false === strpos($date, 'xxxx')) { + if (!str_contains($date, 'xx') && !str_contains($date, 'xxxx')) { return false; } @@ -383,7 +383,7 @@ class ParseDateString Log::error(sprintf('Part "%s" does not match regular expression. Will be skipped.', $part)); continue; } - $direction = 0 === strpos($part, '+') ? 1 : 0; + $direction = str_starts_with($part, '+') ? 1 : 0; $period = $part[strlen($part) - 1]; $number = (int) substr($part, 1, -1); if (!array_key_exists($period, $functions[$direction])) { diff --git a/app/Support/Search/AccountSearch.php b/app/Support/Search/AccountSearch.php index 66e8a7074d..62b4c9a3bd 100644 --- a/app/Support/Search/AccountSearch.php +++ b/app/Support/Search/AccountSearch.php @@ -26,6 +26,7 @@ namespace FireflyIII\Support\Search; use FireflyIII\User; use Illuminate\Database\Eloquent\Builder; use Illuminate\Support\Collection; +use JsonException; /** * Class AccountSearch @@ -55,7 +56,7 @@ class AccountSearch implements GenericSearchInterface /** * @return Collection - * @throws \JsonException + * @throws JsonException */ public function search(): Collection { diff --git a/app/Support/Search/OperatorQuerySearch.php b/app/Support/Search/OperatorQuerySearch.php index 8238c104d6..6a11e6a14a 100644 --- a/app/Support/Search/OperatorQuerySearch.php +++ b/app/Support/Search/OperatorQuerySearch.php @@ -71,10 +71,8 @@ class OperatorQuerySearch implements SearchInterface private int $limit; private Collection $operators; private int $page; - private ParsedQuery $query; private float $startTime; private TagRepositoryInterface $tagRepository; - private User $user; private array $validOperators; private array $words; private array $invalidOperators; @@ -146,11 +144,11 @@ class OperatorQuerySearch implements SearchInterface public function parseQuery(string $query) { Log::debug(sprintf('Now in parseQuery(%s)', $query)); - $parser = new QueryParser(); - $this->query = $parser->parse($query); + $parser = new QueryParser(); + $query1 = $parser->parse($query); - Log::debug(sprintf('Found %d node(s)', count($this->query->getNodes()))); - foreach ($this->query->getNodes() as $searchNode) { + Log::debug(sprintf('Found %d node(s)', count($query1->getNodes()))); + foreach ($query1->getNodes() as $searchNode) { $this->handleSearchNode($searchNode); } @@ -220,14 +218,13 @@ class OperatorQuerySearch implements SearchInterface */ public function setUser(User $user): void { - $this->user = $user; $this->accountRepository->setUser($user); $this->billRepository->setUser($user); $this->categoryRepository->setUser($user); $this->budgetRepository->setUser($user); $this->tagRepository->setUser($user); $this->collector = app(GroupCollectorInterface::class); - $this->collector->setUser($this->user); + $this->collector->setUser($user); $this->collector->withAccountInformation()->withCategoryInformation()->withBudgetInformation(); $this->setLimit((int)app('preferences')->getForUser($user, 'listPageSize', 50)->data); diff --git a/app/Support/Steam.php b/app/Support/Steam.php index 9ed9edecc9..62a0108b63 100644 --- a/app/Support/Steam.php +++ b/app/Support/Steam.php @@ -24,11 +24,13 @@ namespace FireflyIII\Support; use Carbon\Carbon; use DB; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Account; use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionCurrency; use FireflyIII\Repositories\Account\AccountRepositoryInterface; use Illuminate\Support\Collection; +use JsonException; use stdClass; /** @@ -47,8 +49,8 @@ class Steam * @param TransactionCurrency|null $currency * * @return string - * @throws \FireflyIII\Exceptions\FireflyException - * @throws \JsonException + * @throws FireflyException + * @throws JsonException */ public function balance(Account $account, Carbon $date, ?TransactionCurrency $currency = null): string { diff --git a/app/Transformers/PiggyBankTransformer.php b/app/Transformers/PiggyBankTransformer.php index a82dc61320..b1bc03a70b 100644 --- a/app/Transformers/PiggyBankTransformer.php +++ b/app/Transformers/PiggyBankTransformer.php @@ -89,8 +89,8 @@ class PiggyBankTransformer extends AbstractTransformer // left to save: $leftToSave = bcsub($piggyBank->targetamount, $currentAmountStr); - $startDate = null === $piggyBank->startdate ? null : $piggyBank->startdate->toAtomString(); - $targetDate = null === $piggyBank->targetdate ? null : $piggyBank->targetdate->toAtomString(); + $startDate = $piggyBank->startdate?->toAtomString(); + $targetDate = $piggyBank->targetdate?->toAtomString(); // target and percentage: $targetAmount = $piggyBank->targetamount; diff --git a/app/Transformers/RecurrenceTransformer.php b/app/Transformers/RecurrenceTransformer.php index 19a14d4a98..77c4394dc3 100644 --- a/app/Transformers/RecurrenceTransformer.php +++ b/app/Transformers/RecurrenceTransformer.php @@ -94,8 +94,8 @@ class RecurrenceTransformer extends AbstractTransformer 'title' => $recurrence->title, 'description' => $recurrence->description, 'first_date' => $recurrence->first_date->toAtomString(), - 'latest_date' => null === $recurrence->latest_date ? null : $recurrence->latest_date->toAtomString(), - 'repeat_until' => null === $recurrence->repeat_until ? null : $recurrence->repeat_until->toAtomString(), + 'latest_date' => $recurrence->latest_date?->toAtomString(), + 'repeat_until' => $recurrence->repeat_until?->toAtomString(), 'apply_rules' => $recurrence->apply_rules, 'active' => $recurrence->active, 'nr_of_repetitions' => $reps, diff --git a/app/Transformers/TagTransformer.php b/app/Transformers/TagTransformer.php index b65ca5e461..0f3e00d862 100644 --- a/app/Transformers/TagTransformer.php +++ b/app/Transformers/TagTransformer.php @@ -42,7 +42,7 @@ class TagTransformer extends AbstractTransformer */ public function transform(Tag $tag): array { - $date = null === $tag->date ? null : $tag->date->toAtomString(); + $date = $tag->date?->toAtomString(); /** @var Location $location */ $location = $tag->locations()->first(); $latitude = null; diff --git a/app/Transformers/TransactionGroupTransformer.php b/app/Transformers/TransactionGroupTransformer.php index 2429718425..60795e2e8d 100644 --- a/app/Transformers/TransactionGroupTransformer.php +++ b/app/Transformers/TransactionGroupTransformer.php @@ -138,7 +138,7 @@ class TransactionGroupTransformer extends AbstractTransformer return [ 'user' => (string)$row['user_id'], - 'transaction_journal_id' => (int)$row['transaction_journal_id'], + 'transaction_journal_id' => (string)$row['transaction_journal_id'], 'type' => strtolower($type), 'date' => $row['date']->toAtomString(), 'order' => $row['order'], diff --git a/app/Validation/FireflyValidator.php b/app/Validation/FireflyValidator.php index 49404c9320..a20be34865 100644 --- a/app/Validation/FireflyValidator.php +++ b/app/Validation/FireflyValidator.php @@ -42,6 +42,9 @@ use Google2FA; use Illuminate\Support\Collection; use Illuminate\Validation\Validator; use Log; +use PragmaRX\Google2FA\Exceptions\IncompatibleWithGoogleAuthenticatorException; +use PragmaRX\Google2FA\Exceptions\InvalidCharactersException; +use PragmaRX\Google2FA\Exceptions\SecretKeyTooShortException; use ValueError; use function is_string; @@ -55,9 +58,9 @@ class FireflyValidator extends Validator * @param mixed $value * * @return bool - * @throws \PragmaRX\Google2FA\Exceptions\IncompatibleWithGoogleAuthenticatorException - * @throws \PragmaRX\Google2FA\Exceptions\InvalidCharactersException - * @throws \PragmaRX\Google2FA\Exceptions\SecretKeyTooShortException + * @throws IncompatibleWithGoogleAuthenticatorException + * @throws InvalidCharactersException + * @throws SecretKeyTooShortException */ public function validate2faCode($attribute, $value): bool {