Skip to content

Firefly III: a personal finances manager

Various code cleanup.

James Cole6341743cf91a
diff --git a/app/Api/V1/Controllers/Data/Export/ExportController.php b/app/Api/V1/Controllers/Data/Export/ExportController.php
index f65e23dfc0..f578b7b050 100644
--- a/app/Api/V1/Controllers/Data/Export/ExportController.php
+++ b/app/Api/V1/Controllers/Data/Export/ExportController.php
@@ -61,8 +61,11 @@ class ExportController extends Controller
}
/**
- * @throws FireflyException
+ * @param ExportRequest $request
*
+ * @return LaravelResponse
+ * @throws DatetimeException
+ * @throws FireflyException
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function accounts(ExportRequest $request): LaravelResponse
@@ -100,8 +103,11 @@ class ExportController extends Controller
}
/**
- * @throws FireflyException
+ * @param ExportRequest $request
*
+ * @return LaravelResponse
+ * @throws DatetimeException
+ * @throws FireflyException
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function bills(ExportRequest $request): LaravelResponse
@@ -112,8 +118,11 @@ class ExportController extends Controller
}
/**
- * @throws FireflyException
+ * @param ExportRequest $request
*
+ * @return LaravelResponse
+ * @throws DatetimeException
+ * @throws FireflyException
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function budgets(ExportRequest $request): LaravelResponse
@@ -124,8 +133,11 @@ class ExportController extends Controller
}
/**
- * @throws FireflyException
+ * @param ExportRequest $request
*
+ * @return LaravelResponse
+ * @throws DatetimeException
+ * @throws FireflyException
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function categories(ExportRequest $request): LaravelResponse
@@ -136,8 +148,11 @@ class ExportController extends Controller
}
/**
- * @throws FireflyException
+ * @param ExportRequest $request
*
+ * @return LaravelResponse
+ * @throws DatetimeException
+ * @throws FireflyException
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function piggyBanks(ExportRequest $request): LaravelResponse
@@ -148,8 +163,11 @@ class ExportController extends Controller
}
/**
- * @throws FireflyException
+ * @param ExportRequest $request
*
+ * @return LaravelResponse
+ * @throws DatetimeException
+ * @throws FireflyException
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function recurring(ExportRequest $request): LaravelResponse
@@ -160,8 +178,11 @@ class ExportController extends Controller
}
/**
- * @throws FireflyException
+ * @param ExportRequest $request
*
+ * @return LaravelResponse
+ * @throws DatetimeException
+ * @throws FireflyException
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function rules(ExportRequest $request): LaravelResponse
@@ -172,8 +193,11 @@ class ExportController extends Controller
}
/**
- * @throws FireflyException
+ * @param ExportRequest $request
*
+ * @return LaravelResponse
+ * @throws DatetimeException
+ * @throws FireflyException
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function tags(ExportRequest $request): LaravelResponse
@@ -184,6 +208,10 @@ class ExportController extends Controller
}
/**
+ * @param ExportRequest $request
+ *
+ * @return LaravelResponse
+ * @throws DatetimeException
* @throws FireflyException
*/
public function transactions(ExportRequest $request): LaravelResponse
diff --git a/app/Api/V1/Controllers/Models/Account/ListController.php b/app/Api/V1/Controllers/Models/Account/ListController.php
index eacc1824f1..1d646a0388 100644
--- a/app/Api/V1/Controllers/Models/Account/ListController.php
+++ b/app/Api/V1/Controllers/Models/Account/ListController.php
@@ -71,7 +71,6 @@ class ListController extends Controller
}
/**
- * @throws FireflyException
*/
public function attachments(Account $account): JsonResponse
{
@@ -97,7 +96,6 @@ class ListController extends Controller
}
/**
- * @throws FireflyException
*/
public function piggyBanks(Account $account): JsonResponse
{
@@ -136,7 +134,6 @@ class ListController extends Controller
/**
* Show all transaction groups related to the account.
*
- * @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 d2d02ac82a..5ef0363961 100644
--- a/app/Api/V1/Controllers/Models/Account/ShowController.php
+++ b/app/Api/V1/Controllers/Models/Account/ShowController.php
@@ -69,7 +69,6 @@ class ShowController extends Controller
/**
* Display a listing of the resource.
*
- * @throws FireflyException
*/
public function index(ShowRequest $request): JsonResponse
{
diff --git a/app/Api/V1/Controllers/Models/Attachment/ShowController.php b/app/Api/V1/Controllers/Models/Attachment/ShowController.php
index bb8e267a11..3785d30b35 100644
--- a/app/Api/V1/Controllers/Models/Attachment/ShowController.php
+++ b/app/Api/V1/Controllers/Models/Attachment/ShowController.php
@@ -120,7 +120,6 @@ class ShowController extends Controller
*
* Display a listing of the resource.
*
- * @throws FireflyException
*/
public function index(): JsonResponse
{
diff --git a/app/Api/V1/Controllers/Models/AvailableBudget/ShowController.php b/app/Api/V1/Controllers/Models/AvailableBudget/ShowController.php
index 1fa1ed692d..c9693643eb 100644
--- a/app/Api/V1/Controllers/Models/AvailableBudget/ShowController.php
+++ b/app/Api/V1/Controllers/Models/AvailableBudget/ShowController.php
@@ -68,7 +68,6 @@ class ShowController extends Controller
*
* Display a listing of the resource.
*
- * @throws FireflyException
*/
public function index(): JsonResponse
{
diff --git a/app/Api/V1/Controllers/Models/Bill/ListController.php b/app/Api/V1/Controllers/Models/Bill/ListController.php
index e0e21e01cc..24f27edb1e 100644
--- a/app/Api/V1/Controllers/Models/Bill/ListController.php
+++ b/app/Api/V1/Controllers/Models/Bill/ListController.php
@@ -72,7 +72,6 @@ class ListController extends Controller
*
* Display a listing of the resource.
*
- * @throws FireflyException
*/
public function attachments(Bill $bill): JsonResponse
{
@@ -103,7 +102,6 @@ class ListController extends Controller
*
* List all of them.
*
- * @throws FireflyException
*/
public function rules(Bill $bill): JsonResponse
{
@@ -136,7 +134,6 @@ class ListController extends Controller
*
* Show all transactions.
*
- * @throws FireflyException
*/
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 6c767f16a6..380d86ef76 100644
--- a/app/Api/V1/Controllers/Models/Bill/ShowController.php
+++ b/app/Api/V1/Controllers/Models/Bill/ShowController.php
@@ -66,7 +66,6 @@ class ShowController extends Controller
*
* Display a listing of the resource.
*
- * @throws FireflyException
*/
public function index(): JsonResponse
{
diff --git a/app/Api/V1/Controllers/Models/Budget/ListController.php b/app/Api/V1/Controllers/Models/Budget/ListController.php
index 036fa6d4ec..72a9cae8fb 100644
--- a/app/Api/V1/Controllers/Models/Budget/ListController.php
+++ b/app/Api/V1/Controllers/Models/Budget/ListController.php
@@ -74,7 +74,6 @@ class ListController extends Controller
* This endpoint is documented at:
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/budgets/listAttachmentByBudget
*
- * @throws FireflyException
*/
public function attachments(Budget $budget): JsonResponse
{
@@ -105,7 +104,6 @@ class ListController extends Controller
*
* Display a listing of the resource.
*
- * @throws FireflyException
*/
public function budgetLimits(Budget $budget): JsonResponse
{
@@ -141,7 +139,6 @@ class ListController extends Controller
*
* Show all transactions.
*
- * @throws FireflyException
*/
public function transactions(Request $request, Budget $budget): JsonResponse
{
@@ -203,7 +200,6 @@ class ListController extends Controller
*
* Show all transactions.
*
- * @throws FireflyException
*/
public function withoutBudget(Request $request): JsonResponse
{
diff --git a/app/Api/V1/Controllers/Models/Budget/ShowController.php b/app/Api/V1/Controllers/Models/Budget/ShowController.php
index e5062863b1..8d9314b85f 100644
--- a/app/Api/V1/Controllers/Models/Budget/ShowController.php
+++ b/app/Api/V1/Controllers/Models/Budget/ShowController.php
@@ -70,7 +70,6 @@ class ShowController extends Controller
*
* Display a listing of the resource.
*
- * @throws FireflyException
*/
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 ee987eae8a..0b66da5487 100644
--- a/app/Api/V1/Controllers/Models/BudgetLimit/ListController.php
+++ b/app/Api/V1/Controllers/Models/BudgetLimit/ListController.php
@@ -50,7 +50,6 @@ class ListController extends Controller
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/budgets/listTransactionByBudgetLimit
* Show all transactions.
*
- * @throws FireflyException
*/
public function transactions(Request $request, Budget $budget, BudgetLimit $budgetLimit): JsonResponse
{
diff --git a/app/Api/V1/Controllers/Models/Category/ListController.php b/app/Api/V1/Controllers/Models/Category/ListController.php
index 04af2f2c6c..b89fc38bae 100644
--- a/app/Api/V1/Controllers/Models/Category/ListController.php
+++ b/app/Api/V1/Controllers/Models/Category/ListController.php
@@ -69,7 +69,6 @@ class ListController extends Controller
* This endpoint is documented at:
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/categories/listAttachmentByCategory
*
- * @throws FireflyException
*/
public function attachments(Category $category): JsonResponse
{
@@ -100,7 +99,6 @@ class ListController extends Controller
*
* Show all transactions.
*
- * @throws FireflyException
*/
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 9022eed9f9..0d19bb5b77 100644
--- a/app/Api/V1/Controllers/Models/Category/ShowController.php
+++ b/app/Api/V1/Controllers/Models/Category/ShowController.php
@@ -66,7 +66,6 @@ class ShowController extends Controller
*
* Display a listing of the resource.
*
- * @throws FireflyException
*/
public function index(): JsonResponse
{
diff --git a/app/Api/V1/Controllers/Models/ObjectGroup/ListController.php b/app/Api/V1/Controllers/Models/ObjectGroup/ListController.php
index 78dab17658..81fcc0679a 100644
--- a/app/Api/V1/Controllers/Models/ObjectGroup/ListController.php
+++ b/app/Api/V1/Controllers/Models/ObjectGroup/ListController.php
@@ -69,7 +69,6 @@ class ListController extends Controller
*
* List all bills in this object group
*
- * @throws FireflyException
*/
public function bills(ObjectGroup $objectGroup): JsonResponse
{
@@ -110,7 +109,6 @@ class ListController extends Controller
*
* List all piggies under the object group.
*
- * @throws FireflyException
*/
public function piggyBanks(ObjectGroup $objectGroup): JsonResponse
{
diff --git a/app/Api/V1/Controllers/Models/PiggyBank/ListController.php b/app/Api/V1/Controllers/Models/PiggyBank/ListController.php
index 558255ceb4..5d4181a425 100644
--- a/app/Api/V1/Controllers/Models/PiggyBank/ListController.php
+++ b/app/Api/V1/Controllers/Models/PiggyBank/ListController.php
@@ -68,7 +68,6 @@ class ListController extends Controller
*
* List single resource.
*
- * @throws FireflyException
*/
public function accounts(PiggyBank $piggyBank): JsonResponse
{
@@ -106,7 +105,6 @@ class ListController extends Controller
* This endpoint is documented at:
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/piggy_banks/listAttachmentByPiggyBank
*
- * @throws FireflyException
*/
public function attachments(PiggyBank $piggyBank): JsonResponse
{
@@ -137,7 +135,6 @@ class ListController extends Controller
*
* List single resource.
*
- * @throws FireflyException
*/
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 c81d49bea5..570947db73 100644
--- a/app/Api/V1/Controllers/Models/PiggyBank/ShowController.php
+++ b/app/Api/V1/Controllers/Models/PiggyBank/ShowController.php
@@ -66,7 +66,6 @@ class ShowController extends Controller
*
* List all of them.
*
- * @throws FireflyException
*/
public function index(): JsonResponse
{
diff --git a/app/Api/V1/Controllers/Models/Recurrence/ListController.php b/app/Api/V1/Controllers/Models/Recurrence/ListController.php
index 867dc46e33..deb46548a3 100644
--- a/app/Api/V1/Controllers/Models/Recurrence/ListController.php
+++ b/app/Api/V1/Controllers/Models/Recurrence/ListController.php
@@ -69,7 +69,6 @@ class ListController extends Controller
*
* Show transactions for this recurrence.
*
- * @throws FireflyException
*/
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 74f29cface..1be11a85f8 100644
--- a/app/Api/V1/Controllers/Models/Recurrence/ShowController.php
+++ b/app/Api/V1/Controllers/Models/Recurrence/ShowController.php
@@ -66,7 +66,6 @@ class ShowController extends Controller
*
* List all of them.
*
- * @throws FireflyException
*/
public function index(): JsonResponse
{
diff --git a/app/Api/V1/Controllers/Models/Recurrence/TriggerController.php b/app/Api/V1/Controllers/Models/Recurrence/TriggerController.php
index b00aa9767b..e9662efaf1 100644
--- a/app/Api/V1/Controllers/Models/Recurrence/TriggerController.php
+++ b/app/Api/V1/Controllers/Models/Recurrence/TriggerController.php
@@ -87,9 +87,7 @@ class TriggerController extends Controller
// enrich groups and return them:
- if (0 === $groups->count()) {
- $paginator = new LengthAwarePaginator(new Collection(), 0, 1);
- }
+ $paginator = new LengthAwarePaginator(new Collection(), 0, 1);
if ($groups->count() > 0) {
/** @var User $admin */
$admin = auth()->user();
diff --git a/app/Api/V1/Controllers/Models/Rule/ShowController.php b/app/Api/V1/Controllers/Models/Rule/ShowController.php
index d6ad0db7a5..e659f2e8c4 100644
--- a/app/Api/V1/Controllers/Models/Rule/ShowController.php
+++ b/app/Api/V1/Controllers/Models/Rule/ShowController.php
@@ -68,7 +68,6 @@ class ShowController extends Controller
*
* List all of them.
*
- * @throws FireflyException
*/
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 af419528a1..6c7b614c03 100644
--- a/app/Api/V1/Controllers/Models/RuleGroup/ListController.php
+++ b/app/Api/V1/Controllers/Models/RuleGroup/ListController.php
@@ -65,7 +65,6 @@ class ListController extends Controller
* This endpoint is documented at:
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/rule_groups/listRuleByGroup
*
- * @throws FireflyException
*/
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 a906227340..2cf7833853 100644
--- a/app/Api/V1/Controllers/Models/RuleGroup/ShowController.php
+++ b/app/Api/V1/Controllers/Models/RuleGroup/ShowController.php
@@ -67,7 +67,6 @@ class ShowController extends Controller
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/rule_groups/listRuleGroup
* List all of them.
*
- * @throws FireflyException
*/
public function index(): JsonResponse
{
diff --git a/app/Api/V1/Controllers/Models/Tag/ListController.php b/app/Api/V1/Controllers/Models/Tag/ListController.php
index 1fc4629b05..a29b3a016b 100644
--- a/app/Api/V1/Controllers/Models/Tag/ListController.php
+++ b/app/Api/V1/Controllers/Models/Tag/ListController.php
@@ -72,7 +72,6 @@ class ListController extends Controller
* This endpoint is documented at:
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/tags/listAttachmentByTag
*
- * @throws FireflyException
*/
public function attachments(Tag $tag): JsonResponse
{
@@ -103,7 +102,6 @@ class ListController extends Controller
*
* Show all transactions.
*
- * @throws FireflyException
*/
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 5e59c4bf11..b9daf868dc 100644
--- a/app/Api/V1/Controllers/Models/Tag/ShowController.php
+++ b/app/Api/V1/Controllers/Models/Tag/ShowController.php
@@ -68,7 +68,6 @@ class ShowController extends Controller
*
* List all of them.
*
- * @throws FireflyException
*/
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 560324e7ff..a7e0649017 100644
--- a/app/Api/V1/Controllers/Models/Transaction/ListController.php
+++ b/app/Api/V1/Controllers/Models/Transaction/ListController.php
@@ -70,7 +70,6 @@ class ListController extends Controller
* This endpoint is documented at:
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/transactions/listAttachmentByTransaction
*
- * @throws FireflyException
*/
public function attachments(TransactionGroup $transactionGroup): JsonResponse
{
@@ -102,7 +101,6 @@ class ListController extends Controller
* This endpoint is documented at:
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/transactions/listEventByTransaction
*
- * @throws FireflyException
*/
public function piggyBankEvents(TransactionGroup $transactionGroup): JsonResponse
{
@@ -145,7 +143,6 @@ class ListController extends Controller
* This endpoint is documented at:
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/transactions/listLinksByJournal
*
- * @throws FireflyException
*/
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 b20fab792d..f16b37b81a 100644
--- a/app/Api/V1/Controllers/Models/Transaction/ShowController.php
+++ b/app/Api/V1/Controllers/Models/Transaction/ShowController.php
@@ -53,7 +53,6 @@ class ShowController extends Controller
*
* Show all transactions.
*
- * @throws FireflyException
*/
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 67a6486487..cd8363c8fe 100644
--- a/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php
+++ b/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php
@@ -72,7 +72,6 @@ class ListController extends Controller
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/currencies/listAccountByCurrency
* Display a list of accounts.
*
- * @throws FireflyException
*/
public function accounts(Request $request, TransactionCurrency $currency): JsonResponse
{
@@ -130,7 +129,6 @@ class ListController extends Controller
*
* Display a listing of the resource.
*
- * @throws FireflyException
*/
public function availableBudgets(TransactionCurrency $currency): JsonResponse
{
@@ -165,7 +163,6 @@ class ListController extends Controller
*
* List all bills
*
- * @throws FireflyException
*/
public function bills(TransactionCurrency $currency): JsonResponse
{
@@ -212,7 +209,6 @@ class ListController extends Controller
*
* List all budget limits
*
- * @throws FireflyException
*/
public function budgetLimits(TransactionCurrency $currency): JsonResponse
{
@@ -250,7 +246,6 @@ class ListController extends Controller
*
* List all recurring transactions.
*
- * @throws FireflyException
*/
public function recurrences(TransactionCurrency $currency): JsonResponse
{
@@ -303,7 +298,6 @@ class ListController extends Controller
*
* List all of them.
*
- * @throws FireflyException
*/
public function rules(TransactionCurrency $currency): JsonResponse
{
@@ -348,7 +342,6 @@ class ListController extends Controller
*
* Show all transactions.
*
- * @throws FireflyException
*/
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 481896505c..9fd407ccf4 100644
--- a/app/Api/V1/Controllers/Models/TransactionCurrency/ShowController.php
+++ b/app/Api/V1/Controllers/Models/TransactionCurrency/ShowController.php
@@ -70,7 +70,6 @@ class ShowController extends Controller
*
* Display a listing of the resource.
*
- * @throws FireflyException
*/
public function index(): JsonResponse
{
@@ -100,7 +99,6 @@ class ShowController extends Controller
*
* Show a currency.
*
- * @throws FireflyException
*/
public function show(TransactionCurrency $currency): JsonResponse
{
@@ -124,7 +122,6 @@ class ShowController extends Controller
/**
* Show a currency.
*
- * @throws FireflyException
*/
public function showPrimary(): JsonResponse
{
diff --git a/app/Api/V1/Controllers/Models/TransactionCurrency/StoreController.php b/app/Api/V1/Controllers/Models/TransactionCurrency/StoreController.php
index 5e4364043f..01aad04665 100644
--- a/app/Api/V1/Controllers/Models/TransactionCurrency/StoreController.php
+++ b/app/Api/V1/Controllers/Models/TransactionCurrency/StoreController.php
@@ -67,7 +67,6 @@ class StoreController extends Controller
*
* Store new currency.
*
- * @throws FireflyException
*/
public function store(StoreRequest $request): JsonResponse
{
diff --git a/app/Api/V1/Controllers/Models/TransactionCurrency/UpdateController.php b/app/Api/V1/Controllers/Models/TransactionCurrency/UpdateController.php
index f9a45ffdee..eca115a7d8 100644
--- a/app/Api/V1/Controllers/Models/TransactionCurrency/UpdateController.php
+++ b/app/Api/V1/Controllers/Models/TransactionCurrency/UpdateController.php
@@ -99,7 +99,6 @@ class UpdateController extends Controller
}
/**
- * @throws FireflyException
*/
public function makePrimary(TransactionCurrency $currency): JsonResponse
{
@@ -128,7 +127,6 @@ class UpdateController extends Controller
*
* Enable a currency.
*
- * @throws FireflyException
*/
public function enable(TransactionCurrency $currency): JsonResponse
{
diff --git a/app/Api/V1/Controllers/Models/TransactionLink/ShowController.php b/app/Api/V1/Controllers/Models/TransactionLink/ShowController.php
index f5874f90ae..1f812f2b18 100644
--- a/app/Api/V1/Controllers/Models/TransactionLink/ShowController.php
+++ b/app/Api/V1/Controllers/Models/TransactionLink/ShowController.php
@@ -70,7 +70,6 @@ class ShowController extends Controller
*
* List all transaction links there are.
*
- * @throws FireflyException
*/
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 0cbaae2bea..6ba4e25c4c 100644
--- a/app/Api/V1/Controllers/Models/TransactionLinkType/ListController.php
+++ b/app/Api/V1/Controllers/Models/TransactionLinkType/ListController.php
@@ -69,7 +69,6 @@ class ListController extends Controller
* This endpoint is documented at:
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/links/listTransactionByLinkType
*
- * @throws FireflyException
*/
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 9fa5e2e497..ded5d53f8f 100644
--- a/app/Api/V1/Controllers/Models/TransactionLinkType/ShowController.php
+++ b/app/Api/V1/Controllers/Models/TransactionLinkType/ShowController.php
@@ -68,7 +68,6 @@ class ShowController extends Controller
* This endpoint is documented at:
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/links/listLinkType
*
- * @throws FireflyException
*/
public function index(): JsonResponse
{
diff --git a/app/Api/V1/Controllers/Search/TransactionController.php b/app/Api/V1/Controllers/Search/TransactionController.php
index a68f44d8a6..10d754891a 100644
--- a/app/Api/V1/Controllers/Search/TransactionController.php
+++ b/app/Api/V1/Controllers/Search/TransactionController.php
@@ -43,7 +43,6 @@ class TransactionController extends Controller
* This endpoint is documented at:
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/search/searchTransactions
*
- * @throws FireflyException
*/
public function search(Request $request, SearchInterface $searcher): JsonResponse
{
diff --git a/app/Api/V1/Controllers/System/UserController.php b/app/Api/V1/Controllers/System/UserController.php
index 0928c041a9..edffb84c44 100644
--- a/app/Api/V1/Controllers/System/UserController.php
+++ b/app/Api/V1/Controllers/System/UserController.php
@@ -91,7 +91,6 @@ class UserController extends Controller
*
* Display a listing of the resource.
*
- * @throws FireflyException
*/
public function index(): JsonResponse
{
diff --git a/app/Api/V1/Controllers/User/PreferencesController.php b/app/Api/V1/Controllers/User/PreferencesController.php
index d2040588e3..552d10c8e0 100644
--- a/app/Api/V1/Controllers/User/PreferencesController.php
+++ b/app/Api/V1/Controllers/User/PreferencesController.php
@@ -50,7 +50,6 @@ class PreferencesController extends Controller
*
* List all of them.
*
- * @throws FireflyException
*/
public function index(): JsonResponse
{
diff --git a/app/Api/V1/Controllers/Webhook/MessageController.php b/app/Api/V1/Controllers/Webhook/MessageController.php
index 6e14814f6f..a5426ca91d 100644
--- a/app/Api/V1/Controllers/Webhook/MessageController.php
+++ b/app/Api/V1/Controllers/Webhook/MessageController.php
@@ -63,7 +63,6 @@ class MessageController extends Controller
* This endpoint is documented at:
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/webhooks/getWebhookMessages
*
- * @throws FireflyException
*/
public function index(Webhook $webhook): JsonResponse
{
diff --git a/app/Api/V1/Controllers/Webhook/ShowController.php b/app/Api/V1/Controllers/Webhook/ShowController.php
index 03249281c3..b4728e2dee 100644
--- a/app/Api/V1/Controllers/Webhook/ShowController.php
+++ b/app/Api/V1/Controllers/Webhook/ShowController.php
@@ -71,7 +71,6 @@ class ShowController extends Controller
*
* Display a listing of the webhooks of the user.
*
- * @throws FireflyException
*/
public function index(): JsonResponse
{
diff --git a/app/Console/Commands/Correction/ConvertsDatesToUTC.php b/app/Console/Commands/Correction/ConvertsDatesToUTC.php
index 63457c65f3..657d8a0a83 100644
--- a/app/Console/Commands/Correction/ConvertsDatesToUTC.php
+++ b/app/Console/Commands/Correction/ConvertsDatesToUTC.php
@@ -92,7 +92,6 @@ class ConvertsDatesToUTC extends Command
$this->friendlyInfo(sprintf('Converting field "%s" of model "%s" to UTC.', $field, $shortModel));
$items->each(
function ($item) use ($field, $timezoneField): void {
- /** @var Carbon $date */
$date = Carbon::parse($item->{$field}, $item->{$timezoneField}); // @phpstan-ignore-line
$date->setTimezone('UTC');
$item->{$field} = $date->format('Y-m-d H:i:s'); // @phpstan-ignore-line
diff --git a/app/Console/Commands/Correction/RemovesOrphanedTransactions.php b/app/Console/Commands/Correction/RemovesOrphanedTransactions.php
index f44ee5fb0d..86eadad492 100644
--- a/app/Console/Commands/Correction/RemovesOrphanedTransactions.php
+++ b/app/Console/Commands/Correction/RemovesOrphanedTransactions.php
@@ -135,9 +135,7 @@ class RemovesOrphanedTransactions extends Command
// delete journals
/** @var null|TransactionJournal $journal */
$journal = TransactionJournal::find($transaction->transaction_journal_id);
- if (null !== $journal) {
- $journal->delete();
- }
+ $journal?->delete();
Transaction::where('transaction_journal_id', $transaction->transaction_journal_id)->delete();
$this->friendlyWarning(
sprintf(
diff --git a/app/Console/Commands/Export/ExportsData.php b/app/Console/Commands/Export/ExportsData.php
index cce69d8e45..18b1df5a34 100644
--- a/app/Console/Commands/Export/ExportsData.php
+++ b/app/Console/Commands/Export/ExportsData.php
@@ -40,6 +40,7 @@ use Exception;
use Illuminate\Support\Facades\Log;
use InvalidArgumentException;
+use Safe\Exceptions\FilesystemException;
use function Safe\file_put_contents;
class ExportsData extends Command
@@ -275,7 +276,11 @@ class ExportsData extends Command
}
/**
+ * @param array $options
+ * @param array $data
+ *
* @throws FireflyException
+ * @throws FilesystemException
*/
private function exportData(array $options, array $data): void
{
diff --git a/app/Console/Commands/System/CallsLaravelPassportKeys.php b/app/Console/Commands/System/CallsLaravelPassportKeys.php
index 22e1ebddd3..2d48051fe2 100644
--- a/app/Console/Commands/System/CallsLaravelPassportKeys.php
+++ b/app/Console/Commands/System/CallsLaravelPassportKeys.php
@@ -42,7 +42,7 @@ class CallsLaravelPassportKeys extends Command
*/
public function handle(): int
{
- Artisan::call('passport:keys --no-interaction', []);
+ Artisan::call('passport:keys --no-interaction');
$result = Artisan::output();
if (str_contains($result, 'Encryption keys already exist')) {
$this->friendlyInfo('Encryption keys exist already.');
diff --git a/app/Console/Commands/System/ForcesDecimalSize.php b/app/Console/Commands/System/ForcesDecimalSize.php
index b96ace66da..4f1ec2164e 100644
--- a/app/Console/Commands/System/ForcesDecimalSize.php
+++ b/app/Console/Commands/System/ForcesDecimalSize.php
@@ -156,7 +156,6 @@ class ForcesDecimalSize extends Command
*/
private function correctAmountsByCurrency(): void
{
- /** @var Collection $enabled */
$enabled = TransactionCurrency::whereEnabled(1)->get();
/** @var TransactionCurrency $currency */
@@ -301,7 +300,7 @@ class ForcesDecimalSize extends Command
}
);
- $result = $query->get(['*']);
+ $result = $query->get();
if (0 === $result->count()) {
$this->friendlyPositive(sprintf('All %s in %s are OK', $table, $currency->code));
@@ -533,7 +532,7 @@ class ForcesDecimalSize extends Command
DB::raw(sprintf($this->regularExpression, $currency->decimal_places))
);
- $result = $query->get(['*']);
+ $result = $query->get();
if (0 === $result->count()) {
$this->friendlyPositive(sprintf('All transactions in foreign currency %s are OK', $currency->code));
diff --git a/app/Console/Commands/System/VerifySecurityAlerts.php b/app/Console/Commands/System/VerifySecurityAlerts.php
index 75b7f85b10..ee739ef9a3 100644
--- a/app/Console/Commands/System/VerifySecurityAlerts.php
+++ b/app/Console/Commands/System/VerifySecurityAlerts.php
@@ -31,6 +31,7 @@ use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use League\Flysystem\FilesystemException;
+use Safe\Exceptions\JsonException;
use function Safe\json_decode;
class VerifySecurityAlerts extends Command
@@ -44,7 +45,9 @@ class VerifySecurityAlerts extends Command
/**
* Execute the console command.
*
+ * @return int
* @throws FilesystemException
+ * @throws JsonException
*/
public function handle(): int
{
diff --git a/app/Console/Commands/Upgrade/AddsTransactionIdentifiers.php b/app/Console/Commands/Upgrade/AddsTransactionIdentifiers.php
index ebcc347d0a..4ffa9a2981 100644
--- a/app/Console/Commands/Upgrade/AddsTransactionIdentifiers.php
+++ b/app/Console/Commands/Upgrade/AddsTransactionIdentifiers.php
@@ -54,7 +54,6 @@ class AddsTransactionIdentifiers extends Command
* When either of these are the same amount, FF3 can't keep them apart: +3/-3, +3/-3, +3/-3. This happens more
* often than you would think. So each set gets a number (1,2,3) to keep them apart.
*
- * @throws FireflyException
*/
public function handle(): int
{
@@ -101,11 +100,8 @@ class AddsTransactionIdentifiers extends Command
private function isExecuted(): bool
{
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
- if (null !== $configVar) {
- return (bool) $configVar->data;
- }
+ return (bool)$configVar?->data;
- return false;
}
/**
diff --git a/app/Console/Commands/Upgrade/RemovesDatabaseDecryption.php b/app/Console/Commands/Upgrade/RemovesDatabaseDecryption.php
index 57463c5d8d..22b335f8d2 100644
--- a/app/Console/Commands/Upgrade/RemovesDatabaseDecryption.php
+++ b/app/Console/Commands/Upgrade/RemovesDatabaseDecryption.php
@@ -99,11 +99,8 @@ class RemovesDatabaseDecryption extends Command
} catch (FireflyException $e) {
Log::error($e->getMessage());
}
- if (null !== $configVar) {
- return (bool) $configVar->data;
- }
+ return (bool)$configVar?->data;
- return false;
}
private function decryptField(string $table, string $field): void
diff --git a/app/Console/Commands/Upgrade/UpgradesAccountCurrencies.php b/app/Console/Commands/Upgrade/UpgradesAccountCurrencies.php
index eef26f8608..c67aae9280 100644
--- a/app/Console/Commands/Upgrade/UpgradesAccountCurrencies.php
+++ b/app/Console/Commands/Upgrade/UpgradesAccountCurrencies.php
@@ -100,7 +100,6 @@ class UpgradesAccountCurrencies extends Command
}
/**
- * @throws FireflyException
*/
private function updateCurrenciesForUser(User $user): void
{
diff --git a/app/Console/Commands/Upgrade/UpgradesAccountMetaData.php b/app/Console/Commands/Upgrade/UpgradesAccountMetaData.php
index d181e41e22..7e8f6168cc 100644
--- a/app/Console/Commands/Upgrade/UpgradesAccountMetaData.php
+++ b/app/Console/Commands/Upgrade/UpgradesAccountMetaData.php
@@ -83,11 +83,8 @@ class UpgradesAccountMetaData extends Command
private function isExecuted(): bool
{
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
- if (null !== $configVar) {
- return (bool) $configVar->data;
- }
+ return (bool)$configVar?->data;
- return false;
}
private function markAsExecuted(): void
diff --git a/app/Console/Commands/Upgrade/UpgradesAttachments.php b/app/Console/Commands/Upgrade/UpgradesAttachments.php
index 06f8175e08..b9cfea1ed6 100644
--- a/app/Console/Commands/Upgrade/UpgradesAttachments.php
+++ b/app/Console/Commands/Upgrade/UpgradesAttachments.php
@@ -93,11 +93,8 @@ class UpgradesAttachments extends Command
private function isExecuted(): bool
{
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
- if (null !== $configVar) {
- return (bool) $configVar->data;
- }
+ return (bool)$configVar?->data;
- return false;
}
private function markAsExecuted(): void
diff --git a/app/Console/Commands/Upgrade/UpgradesBillsToRules.php b/app/Console/Commands/Upgrade/UpgradesBillsToRules.php
index b146f11e8b..62d43c1889 100644
--- a/app/Console/Commands/Upgrade/UpgradesBillsToRules.php
+++ b/app/Console/Commands/Upgrade/UpgradesBillsToRules.php
@@ -99,17 +99,13 @@ class UpgradesBillsToRules extends Command
private function isExecuted(): bool
{
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
- if (null !== $configVar) {
- return (bool) $configVar->data;
- }
+ return (bool)$configVar?->data;
- return false;
}
/**
* Migrate bills to new rule structure for a specific user.
*
- * @throws FireflyException
*/
private function migrateUser(User $user): void
{
diff --git a/app/Console/Commands/Upgrade/UpgradesBudgetLimits.php b/app/Console/Commands/Upgrade/UpgradesBudgetLimits.php
index 473247de6f..6430407ea4 100644
--- a/app/Console/Commands/Upgrade/UpgradesBudgetLimits.php
+++ b/app/Console/Commands/Upgrade/UpgradesBudgetLimits.php
@@ -85,11 +85,8 @@ class UpgradesBudgetLimits extends Command
private function isExecuted(): bool
{
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
- if (null !== $configVar) {
- return (bool) $configVar->data;
- }
+ return (bool)$configVar?->data;
- return false;
}
private function markAsExecuted(): void
diff --git a/app/Console/Commands/Upgrade/UpgradesCurrencyPreferences.php b/app/Console/Commands/Upgrade/UpgradesCurrencyPreferences.php
index 6e2527c8f4..ddecd04fef 100644
--- a/app/Console/Commands/Upgrade/UpgradesCurrencyPreferences.php
+++ b/app/Console/Commands/Upgrade/UpgradesCurrencyPreferences.php
@@ -66,11 +66,8 @@ class UpgradesCurrencyPreferences extends Command
private function isExecuted(): bool
{
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
- if (null !== $configVar) {
- return (bool)$configVar->data;
- }
+ return (bool)$configVar?->data;
- return false;
}
private function runUpgrade(): void
diff --git a/app/Console/Commands/Upgrade/UpgradesJournalNotes.php b/app/Console/Commands/Upgrade/UpgradesJournalNotes.php
index 5a3390e3d6..6ae07abb09 100644
--- a/app/Console/Commands/Upgrade/UpgradesJournalNotes.php
+++ b/app/Console/Commands/Upgrade/UpgradesJournalNotes.php
@@ -87,11 +87,8 @@ class UpgradesJournalNotes extends Command
private function isExecuted(): bool
{
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
- if (null !== $configVar) {
- return (bool) $configVar->data;
- }
+ return (bool)$configVar?->data;
- return false;
}
private function markAsExecuted(): void
diff --git a/app/Console/Commands/Upgrade/UpgradesLiabilities.php b/app/Console/Commands/Upgrade/UpgradesLiabilities.php
index 4a4074b1fb..aaf5f7b221 100644
--- a/app/Console/Commands/Upgrade/UpgradesLiabilities.php
+++ b/app/Console/Commands/Upgrade/UpgradesLiabilities.php
@@ -62,11 +62,8 @@ class UpgradesLiabilities extends Command
private function isExecuted(): bool
{
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
- if (null !== $configVar) {
- return (bool) $configVar->data;
- }
+ return (bool)$configVar?->data;
- return false;
}
private function upgradeLiabilities(): void
diff --git a/app/Console/Commands/Upgrade/UpgradesLiabilitiesEight.php b/app/Console/Commands/Upgrade/UpgradesLiabilitiesEight.php
index 072c48ca08..571fb94ec8 100644
--- a/app/Console/Commands/Upgrade/UpgradesLiabilitiesEight.php
+++ b/app/Console/Commands/Upgrade/UpgradesLiabilitiesEight.php
@@ -64,11 +64,8 @@ class UpgradesLiabilitiesEight extends Command
private function isExecuted(): bool
{
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
- if (null !== $configVar) {
- return (bool) $configVar->data;
- }
+ return (bool)$configVar?->data;
- return false;
}
private function upgradeLiabilities(): void
diff --git a/app/Console/Commands/Upgrade/UpgradesMultiPiggyBanks.php b/app/Console/Commands/Upgrade/UpgradesMultiPiggyBanks.php
index d155510181..ecceb1a085 100644
--- a/app/Console/Commands/Upgrade/UpgradesMultiPiggyBanks.php
+++ b/app/Console/Commands/Upgrade/UpgradesMultiPiggyBanks.php
@@ -65,11 +65,8 @@ class UpgradesMultiPiggyBanks extends Command
private function isExecuted(): bool
{
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
- if (null !== $configVar) {
- return (bool) $configVar->data;
- }
+ return (bool)$configVar?->data;
- return false;
}
private function upgradePiggyBanks(): void
diff --git a/app/Console/Commands/Upgrade/UpgradesPrimaryCurrencyAmounts.php b/app/Console/Commands/Upgrade/UpgradesPrimaryCurrencyAmounts.php
index 9cb26669ee..c233272cba 100644
--- a/app/Console/Commands/Upgrade/UpgradesPrimaryCurrencyAmounts.php
+++ b/app/Console/Commands/Upgrade/UpgradesPrimaryCurrencyAmounts.php
@@ -61,11 +61,8 @@ class UpgradesPrimaryCurrencyAmounts extends Command
private function isExecuted(): bool
{
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
- if (null !== $configVar) {
- return (bool) $configVar->data;
- }
+ return (bool)$configVar?->data;
- return false;
}
private function markAsExecuted(): void
diff --git a/app/Console/Commands/Upgrade/UpgradesRecurrenceMetaData.php b/app/Console/Commands/Upgrade/UpgradesRecurrenceMetaData.php
index d40f566a4c..82dcb3d160 100644
--- a/app/Console/Commands/Upgrade/UpgradesRecurrenceMetaData.php
+++ b/app/Console/Commands/Upgrade/UpgradesRecurrenceMetaData.php
@@ -66,11 +66,8 @@ class UpgradesRecurrenceMetaData extends Command
private function isExecuted(): bool
{
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
- if (null !== $configVar) {
- return (bool) $configVar->data;
- }
+ return (bool)$configVar?->data;
- return false;
}
private function migrateMetaData(): int
diff --git a/app/Console/Commands/Upgrade/UpgradesRuleActions.php b/app/Console/Commands/Upgrade/UpgradesRuleActions.php
index c3619be8f9..7baeb2cbe2 100644
--- a/app/Console/Commands/Upgrade/UpgradesRuleActions.php
+++ b/app/Console/Commands/Upgrade/UpgradesRuleActions.php
@@ -64,11 +64,8 @@ class UpgradesRuleActions extends Command
private function isExecuted(): bool
{
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
- if (null !== $configVar) {
- return (bool) $configVar->data;
- }
+ return (bool)$configVar?->data;
- return false;
}
private function replaceEqualSign(): void
diff --git a/app/Console/Commands/Upgrade/UpgradesTagLocations.php b/app/Console/Commands/Upgrade/UpgradesTagLocations.php
index a6fe336a49..cd60c5b825 100644
--- a/app/Console/Commands/Upgrade/UpgradesTagLocations.php
+++ b/app/Console/Commands/Upgrade/UpgradesTagLocations.php
@@ -58,11 +58,8 @@ class UpgradesTagLocations extends Command
private function isExecuted(): bool
{
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
- if (null !== $configVar) {
- return (bool) $configVar->data;
- }
+ return (bool)$configVar?->data;
- return false;
}
private function migrateTagLocations(): void
diff --git a/app/Console/Commands/Upgrade/UpgradesToGroups.php b/app/Console/Commands/Upgrade/UpgradesToGroups.php
index 3ceee64711..875df04cc4 100644
--- a/app/Console/Commands/Upgrade/UpgradesToGroups.php
+++ b/app/Console/Commands/Upgrade/UpgradesToGroups.php
@@ -98,11 +98,8 @@ class UpgradesToGroups extends Command
private function isMigrated(): bool
{
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
- if (null !== $configVar) {
- return (bool) $configVar->data;
- }
+ return (bool)$configVar?->data;
- return false;
}
/**
diff --git a/app/Console/Commands/Upgrade/UpgradesTransferCurrencies.php b/app/Console/Commands/Upgrade/UpgradesTransferCurrencies.php
index fee9fde03d..1aced94507 100644
--- a/app/Console/Commands/Upgrade/UpgradesTransferCurrencies.php
+++ b/app/Console/Commands/Upgrade/UpgradesTransferCurrencies.php
@@ -106,11 +106,8 @@ class UpgradesTransferCurrencies extends Command
private function isExecuted(): bool
{
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
- if (null !== $configVar) {
- return (bool) $configVar->data;
- }
+ return (bool)$configVar?->data;
- return false;
}
/**
diff --git a/app/Console/Commands/Upgrade/UpgradesVariousCurrencyInformation.php b/app/Console/Commands/Upgrade/UpgradesVariousCurrencyInformation.php
index 648b34ed5e..49c4e0cf28 100644
--- a/app/Console/Commands/Upgrade/UpgradesVariousCurrencyInformation.php
+++ b/app/Console/Commands/Upgrade/UpgradesVariousCurrencyInformation.php
@@ -87,11 +87,8 @@ class UpgradesVariousCurrencyInformation extends Command
private function isExecuted(): bool
{
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
- if (null !== $configVar) {
- return (bool) $configVar->data;
- }
+ return (bool)$configVar?->data;
- return false;
}
/**
diff --git a/app/Console/Commands/Upgrade/UpgradesWebhooks.php b/app/Console/Commands/Upgrade/UpgradesWebhooks.php
index 46e39e11e7..6dd824473a 100644
--- a/app/Console/Commands/Upgrade/UpgradesWebhooks.php
+++ b/app/Console/Commands/Upgrade/UpgradesWebhooks.php
@@ -64,11 +64,8 @@ class UpgradesWebhooks extends Command
private function isExecuted(): bool
{
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
- if (null !== $configVar) {
- return (bool)$configVar->data;
- }
+ return (bool)$configVar?->data;
- return false;
}
private function upgradeWebhooks(): void
diff --git a/app/Console/Commands/VerifiesAccessToken.php b/app/Console/Commands/VerifiesAccessToken.php
index b591978e4a..2dcb004d35 100644
--- a/app/Console/Commands/VerifiesAccessToken.php
+++ b/app/Console/Commands/VerifiesAccessToken.php
@@ -65,7 +65,6 @@ trait VerifiesAccessToken
/**
* Returns false when given token does not match given user token.
*
- * @throws FireflyException
*/
protected function verifyAccessToken(): bool
{
diff --git a/app/Factory/AccountFactory.php b/app/Factory/AccountFactory.php
index 3ea9d77a49..ce47fd2e35 100644
--- a/app/Factory/AccountFactory.php
+++ b/app/Factory/AccountFactory.php
@@ -83,7 +83,6 @@ class AccountFactory
if (null === $return) {
Log::debug('Found nothing. Will create a new one.');
- /** @var Account $return */
$return = $this->create(
[
'user_id' => $this->user->id,
diff --git a/app/Factory/TransactionJournalFactory.php b/app/Factory/TransactionJournalFactory.php
index dd2d9e6830..1c7f354c34 100644
--- a/app/Factory/TransactionJournalFactory.php
+++ b/app/Factory/TransactionJournalFactory.php
@@ -343,7 +343,11 @@ class TransactionJournalFactory
/**
* If this transaction already exists, throw an error.
*
+ * @param string $hash
+ *
* @throws DuplicateTransactionException
+ * @throws JsonException
+ * @throws \Safe\Exceptions\JsonException
*/
private function errorIfDuplicate(string $hash): void
{
@@ -478,7 +482,6 @@ class TransactionJournalFactory
}
/**
- * @throws FireflyException
*/
private function getCurrency(?TransactionCurrency $currency, Account $account): TransactionCurrency
{
diff --git a/app/Handlers/Events/UserEventHandler.php b/app/Handlers/Events/UserEventHandler.php
index 991f7751d9..775cdc878e 100644
--- a/app/Handlers/Events/UserEventHandler.php
+++ b/app/Handlers/Events/UserEventHandler.php
@@ -165,7 +165,6 @@ class UserEventHandler
/**
* Set the demo user back to English.
*
- * @throws FireflyException
*/
public function demoUserBackToEnglish(Login $event): void
{
@@ -183,7 +182,6 @@ class UserEventHandler
}
/**
- * @throws FireflyException
*/
public function notifyNewIPAddress(DetectedNewIPAddress $event): void
{
@@ -448,7 +446,6 @@ class UserEventHandler
}
/**
- * @throws FireflyException
*/
public function storeUserIPAddress(ActuallyLoggedIn $event): void
{
diff --git a/app/Handlers/Events/VersionCheckEventHandler.php b/app/Handlers/Events/VersionCheckEventHandler.php
index a7ac2c62c3..1d663855b0 100644
--- a/app/Handlers/Events/VersionCheckEventHandler.php
+++ b/app/Handlers/Events/VersionCheckEventHandler.php
@@ -31,6 +31,8 @@ use FireflyIII\Helpers\Update\UpdateTrait;
use FireflyIII\Models\Configuration;
use FireflyIII\Repositories\User\UserRepositoryInterface;
use Illuminate\Support\Facades\Log;
+use Psr\Container\ContainerExceptionInterface;
+use Psr\Container\NotFoundExceptionInterface;
/**
* Class VersionCheckEventHandler
@@ -42,7 +44,11 @@ class VersionCheckEventHandler
/**
* Checks with GitHub to see if there is a new version.
*
+ * @param RequestedVersionCheckStatus $event
+ *
+ * @throws ContainerExceptionInterface
* @throws FireflyException
+ * @throws NotFoundExceptionInterface
*/
#[Deprecated(message: '?')]
public function checkForUpdates(RequestedVersionCheckStatus $event): void
@@ -87,7 +93,11 @@ class VersionCheckEventHandler
}
/**
+ * @param RequestedVersionCheckStatus $event
+ *
* @throws FireflyException
+ * @throws ContainerExceptionInterface
+ * @throws NotFoundExceptionInterface
*/
protected function warnToCheckForUpdates(RequestedVersionCheckStatus $event): void
{
diff --git a/app/Helpers/Attachments/AttachmentHelper.php b/app/Helpers/Attachments/AttachmentHelper.php
index 145d39063a..846be0c312 100644
--- a/app/Helpers/Attachments/AttachmentHelper.php
+++ b/app/Helpers/Attachments/AttachmentHelper.php
@@ -37,6 +37,7 @@ use Illuminate\Support\Facades\Storage;
use Illuminate\Support\MessageBag;
use Safe\Exceptions\FileinfoException;
use Safe\Exceptions\FilesystemException;
+use Safe\Exceptions\StringsException;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use function Safe\tmpfile;
@@ -222,8 +223,11 @@ class AttachmentHelper implements AttachmentHelperInterface
/**
* Process the upload of a file.
*
- * @throws FireflyException
- * @throws EncryptException
+ * @param UploadedFile $file
+ * @param Model $model
+ *
+ * @return Attachment|null
+ * @throws StringsException
*/
protected function processFile(UploadedFile $file, Model $model): ?Attachment
{
diff --git a/app/Helpers/Collector/Extensions/AccountCollection.php b/app/Helpers/Collector/Extensions/AccountCollection.php
index 2328b5dabc..d56ee1de4b 100644
--- a/app/Helpers/Collector/Extensions/AccountCollection.php
+++ b/app/Helpers/Collector/Extensions/AccountCollection.php
@@ -43,7 +43,6 @@ trait AccountCollection
Log::warning(sprintf('GroupCollector will be SLOW: accountBalanceIs: "%s" "%s" "%s"', $direction, $operator, $value));
/**
- * @param int $index
* @param array $object
*
* @return bool
diff --git a/app/Helpers/Collector/Extensions/AttachmentCollection.php b/app/Helpers/Collector/Extensions/AttachmentCollection.php
index f4993d2d18..b2b3ed0103 100644
--- a/app/Helpers/Collector/Extensions/AttachmentCollection.php
+++ b/app/Helpers/Collector/Extensions/AttachmentCollection.php
@@ -41,7 +41,6 @@ trait AttachmentCollection
$this->withAttachmentInformation();
/**
- * @param int $index
* @param array $object
*
* @return bool
@@ -120,7 +119,6 @@ trait AttachmentCollection
$this->withAttachmentInformation();
/**
- * @param int $index
* @param array $object
*
* @return bool
@@ -155,7 +153,6 @@ trait AttachmentCollection
$this->withAttachmentInformation();
/**
- * @param int $index
* @param array $object
*
* @return bool
@@ -190,7 +187,6 @@ trait AttachmentCollection
$this->withAttachmentInformation();
/**
- * @param int $index
* @param array $object
*
* @return bool
diff --git a/app/Helpers/Collector/GroupCollector.php b/app/Helpers/Collector/GroupCollector.php
index 0d12819740..0dd40ee445 100644
--- a/app/Helpers/Collector/GroupCollector.php
+++ b/app/Helpers/Collector/GroupCollector.php
@@ -48,6 +48,7 @@ use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Override;
+use Safe\Exceptions\JsonException;
use function Safe\json_decode;
/**
@@ -564,7 +565,11 @@ class GroupCollector implements GroupCollectorInterface
}
/**
+ * @param TransactionJournal $augumentedJournal
+ *
+ * @return array
* @throws FireflyException
+ * @throws JsonException
*/
private function parseAugmentedJournal(TransactionJournal $augumentedJournal): array
{
diff --git a/app/Helpers/Fiscal/FiscalHelper.php b/app/Helpers/Fiscal/FiscalHelper.php
index 13c9d14bdc..ae7ebc752b 100644
--- a/app/Helpers/Fiscal/FiscalHelper.php
+++ b/app/Helpers/Fiscal/FiscalHelper.php
@@ -24,6 +24,8 @@ declare(strict_types=1);
namespace FireflyIII\Helpers\Fiscal;
use Carbon\Carbon;
+use Psr\Container\ContainerExceptionInterface;
+use Psr\Container\NotFoundExceptionInterface;
/**
* Class FiscalHelper.
@@ -62,7 +64,11 @@ class FiscalHelper implements FiscalHelperInterface
}
/**
+ * @param Carbon $date
+ *
* @return Carbon date object
+ * @throws ContainerExceptionInterface
+ * @throws NotFoundExceptionInterface
*/
public function startOfFiscalYear(Carbon $date): Carbon
{
diff --git a/app/Helpers/Webhook/Sha3SignatureGenerator.php b/app/Helpers/Webhook/Sha3SignatureGenerator.php
index 6d42a4ac56..06967cff04 100644
--- a/app/Helpers/Webhook/Sha3SignatureGenerator.php
+++ b/app/Helpers/Webhook/Sha3SignatureGenerator.php
@@ -68,7 +68,7 @@ class Sha3SignatureGenerator implements SignatureGeneratorInterface
// The actual JSON payload (i.e., the request body)
$timestamp = Carbon::now()->getTimestamp();
$payload = sprintf('%s.%s', $timestamp, $json);
- $signature = hash_hmac('sha3-256', $payload, (string) $message->webhook->secret, false);
+ $signature = hash_hmac('sha3-256', $payload, (string) $message->webhook->secret);
// signature string:
// header included in each signed event contains a timestamp and one or more signatures.
diff --git a/app/Http/Controllers/Account/CreateController.php b/app/Http/Controllers/Account/CreateController.php
index 743c2fdc7a..e0cb55afc7 100644
--- a/app/Http/Controllers/Account/CreateController.php
+++ b/app/Http/Controllers/Account/CreateController.php
@@ -37,6 +37,8 @@ use Illuminate\Http\Request;
use Illuminate\Routing\Redirector;
use Illuminate\Support\Facades\Log;
use Illuminate\View\View;
+use Psr\Container\ContainerExceptionInterface;
+use Psr\Container\NotFoundExceptionInterface;
/**
* Class CreateController
@@ -131,9 +133,12 @@ class CreateController extends Controller
/**
* Store the new account.
*
+ * @param AccountFormRequest $request
+ *
* @return Redirector|RedirectResponse
*
- * @throws FireflyException
+ * @throws ContainerExceptionInterface
+ * @throws NotFoundExceptionInterface
*/
public function store(AccountFormRequest $request)
{
diff --git a/app/Http/Controllers/Account/IndexController.php b/app/Http/Controllers/Account/IndexController.php
index 1ee5f5cccf..66844d8ad2 100644
--- a/app/Http/Controllers/Account/IndexController.php
+++ b/app/Http/Controllers/Account/IndexController.php
@@ -35,6 +35,8 @@ use Illuminate\Http\Request;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Facades\Log;
use Illuminate\View\View;
+use Psr\Container\ContainerExceptionInterface;
+use Psr\Container\NotFoundExceptionInterface;
/**
* Class IndexController
@@ -66,10 +68,14 @@ class IndexController extends Controller
}
/**
+ * @param Request $request
+ * @param string $objectType
+ *
* @return Factory|View
*
- * @throws FireflyException
- * */
+ * @throws ContainerExceptionInterface
+ * @throws NotFoundExceptionInterface
+ */
public function inactive(Request $request, string $objectType)
{
$inactivePage = true;
@@ -136,10 +142,14 @@ class IndexController extends Controller
/**
* Show list of accounts.
*
+ * @param Request $request
+ * @param string $objectType
+ *
* @return Factory|View
*
- * @throws FireflyException
- * */
+ * @throws ContainerExceptionInterface
+ * @throws NotFoundExceptionInterface
+ */
public function index(Request $request, string $objectType)
{
app('log')->debug(sprintf('Now at %s', __METHOD__));
diff --git a/app/Http/Controllers/Account/ShowController.php b/app/Http/Controllers/Account/ShowController.php
index 8c9ac76727..8181e0ff80 100644
--- a/app/Http/Controllers/Account/ShowController.php
+++ b/app/Http/Controllers/Account/ShowController.php
@@ -40,6 +40,8 @@ use Illuminate\Routing\Redirector;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Illuminate\View\View;
+use Psr\Container\ContainerExceptionInterface;
+use Psr\Container\NotFoundExceptionInterface;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
@@ -76,10 +78,17 @@ class ShowController extends Controller
/**
* Show an account.
*
+ * @param Request $request
+ * @param Account $account
+ * @param Carbon|null $start
+ * @param Carbon|null $end
+ *
* @return Factory|Redirector|RedirectResponse|View
*
+ * @throws ContainerExceptionInterface
* @throws FireflyException
- * */
+ * @throws NotFoundExceptionInterface
+ */
public function show(Request $request, Account $account, ?Carbon $start = null, ?Carbon $end = null)
{
if (0 === $account->id) {
@@ -193,10 +202,14 @@ class ShowController extends Controller
/**
* Show an account.
*
+ * @param Request $request
+ * @param Account $account
+ *
* @return Factory|Redirector|RedirectResponse|View
*
- * @throws FireflyException
- * */
+ * @throws ContainerExceptionInterface
+ * @throws NotFoundExceptionInterface
+ */
public function showAll(Request $request, Account $account)
{
if (!$this->isEditableAccount($account)) {
diff --git a/app/Http/Controllers/Admin/HomeController.php b/app/Http/Controllers/Admin/HomeController.php
index 6f4fc059f2..264d79158d 100644
--- a/app/Http/Controllers/Admin/HomeController.php
+++ b/app/Http/Controllers/Admin/HomeController.php
@@ -28,6 +28,8 @@ use FireflyIII\Http\Middleware\IsDemoUser;
use Illuminate\Contracts\View\Factory;
use Illuminate\Support\Facades\Log;
use Illuminate\View\View;
+use Psr\Container\ContainerExceptionInterface;
+use Psr\Container\NotFoundExceptionInterface;
/**
* Class HomeController.
@@ -47,6 +49,8 @@ class HomeController extends Controller
* Index of the admin.
*
* @return Factory|View
+ * @throws ContainerExceptionInterface
+ * @throws NotFoundExceptionInterface
*/
public function index()
{
diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php
index 07abf76b4d..54ad535864 100644
--- a/app/Http/Controllers/Admin/UserController.php
+++ b/app/Http/Controllers/Admin/UserController.php
@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Controllers\Admin;
use FireflyIII\Events\Admin\InvitationCreated;
+use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Http\Middleware\IsDemoUser;
use FireflyIII\Http\Requests\InviteUserFormRequest;
@@ -37,6 +38,8 @@ use Illuminate\Http\JsonResponse;
use Illuminate\Http\RedirectResponse;
use Illuminate\Routing\Redirector;
use Illuminate\View\View;
+use Psr\Container\ContainerExceptionInterface;
+use Psr\Container\NotFoundExceptionInterface;
/**
* Class UserController.
@@ -151,6 +154,9 @@ class UserController extends Controller
* Show index of user manager.
*
* @return Factory|View
+ * @throws ContainerExceptionInterface
+ * @throws FireflyException
+ * @throws NotFoundExceptionInterface
*/
public function index()
{
diff --git a/app/Http/Controllers/AttachmentController.php b/app/Http/Controllers/AttachmentController.php
index c45b947126..b06fc9a007 100644
--- a/app/Http/Controllers/AttachmentController.php
+++ b/app/Http/Controllers/AttachmentController.php
@@ -194,7 +194,6 @@ class AttachmentController extends Controller
* View attachment in browser.
*
* @throws FireflyException
- * @throws BindingResolutionException
*/
public function view(Attachment $attachment): LaravelResponse
{
diff --git a/app/Http/Controllers/Auth/ForgotPasswordController.php b/app/Http/Controllers/Auth/ForgotPasswordController.php
index 78fcc649db..1b3607259c 100644
--- a/app/Http/Controllers/Auth/ForgotPasswordController.php
+++ b/app/Http/Controllers/Auth/ForgotPasswordController.php
@@ -33,6 +33,8 @@ use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use Illuminate\View\View;
+use Psr\Container\ContainerExceptionInterface;
+use Psr\Container\NotFoundExceptionInterface;
use Safe\Exceptions\UrlException;
use function Safe\parse_url;
@@ -60,7 +62,11 @@ class ForgotPasswordController extends Controller
/**
* Send a reset link to the given user.
*
+ * @param Request $request
+ * @param UserRepositoryInterface $repository
+ *
* @return Factory|RedirectResponse|View
+ * @throws FireflyException
*/
public function sendResetLinkEmail(Request $request, UserRepositoryInterface $repository)
{
@@ -126,6 +132,8 @@ class ForgotPasswordController extends Controller
* @return Factory|View
*
* @throws FireflyException
+ * @throws ContainerExceptionInterface
+ * @throws NotFoundExceptionInterface
*/
public function showLinkRequestForm()
{
diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php
index c1566b5ed1..01b25bbd19 100644
--- a/app/Http/Controllers/Auth/LoginController.php
+++ b/app/Http/Controllers/Auth/LoginController.php
@@ -46,6 +46,8 @@ use Illuminate\Routing\Redirector;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Validation\ValidationException;
+use Psr\Container\ContainerExceptionInterface;
+use Psr\Container\NotFoundExceptionInterface;
use Symfony\Component\HttpFoundation\Response as ResponseAlias;
/**
@@ -151,7 +153,7 @@ class LoginController extends Controller
$this->sendFailedLoginResponse($request);
// @noinspection PhpUnreachableStatementInspection
- return response()->json([]);
+ return response()->json();
}
/**
@@ -219,9 +221,13 @@ class LoginController extends Controller
/**
* Show the application's login form.
*
+ * @param Request $request
+ *
* @return Application|Factory|Redirector|RedirectResponse|View
*
* @throws FireflyException
+ * @throws ContainerExceptionInterface
+ * @throws NotFoundExceptionInterface
*/
public function showLoginForm(Request $request)
{
diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php
index 79701fe3f7..4122f3fa5a 100644
--- a/app/Http/Controllers/Auth/RegisterController.php
+++ b/app/Http/Controllers/Auth/RegisterController.php
@@ -140,9 +140,14 @@ class RegisterController extends Controller
/**
* Show the application registration form if the invitation code is valid.
*
+ * @param Request $request
+ * @param string $code
+ *
* @return Factory|View
*
+ * @throws ContainerExceptionInterface
* @throws FireflyException
+ * @throws NotFoundExceptionInterface
*/
public function showInviteForm(Request $request, string $code)
{
@@ -172,9 +177,13 @@ class RegisterController extends Controller
/**
* Show the application registration form.
*
+ * @param Request|null $request
+ *
* @return Factory|View
*
+ * @throws ContainerExceptionInterface
* @throws FireflyException
+ * @throws NotFoundExceptionInterface
*/
public function showRegistrationForm(?Request $request = null)
{
diff --git a/app/Http/Controllers/Auth/ResetPasswordController.php b/app/Http/Controllers/Auth/ResetPasswordController.php
index 442d4956b4..7ff28e0264 100644
--- a/app/Http/Controllers/Auth/ResetPasswordController.php
+++ b/app/Http/Controllers/Auth/ResetPasswordController.php
@@ -34,6 +34,8 @@ use Illuminate\Http\Request;
use Illuminate\Support\Facades\Password;
use Illuminate\Validation\ValidationException;
use Illuminate\View\View;
+use Psr\Container\ContainerExceptionInterface;
+use Psr\Container\NotFoundExceptionInterface;
/**
* Class ResetPasswordController
@@ -112,11 +114,14 @@ class ResetPasswordController extends Controller
*
* If no token is present, display the link request form.
*
- * @param null $token
+ * @param Request $request
+ * @param null $token
*
* @return Factory|View
*
* @throws FireflyException
+ * @throws ContainerExceptionInterface
+ * @throws NotFoundExceptionInterface
*/
public function showResetForm(Request $request, $token = null)
{
diff --git a/app/Http/Controllers/Auth/TwoFactorController.php b/app/Http/Controllers/Auth/TwoFactorController.php
index 1ebce31552..d9cd52c035 100644
--- a/app/Http/Controllers/Auth/TwoFactorController.php
+++ b/app/Http/Controllers/Auth/TwoFactorController.php
@@ -37,6 +37,8 @@ use Illuminate\Http\Request;
use Illuminate\Routing\Redirector;
use Illuminate\Support\Facades\Log;
use PragmaRX\Google2FALaravel\Support\Authenticator;
+use Psr\Container\ContainerExceptionInterface;
+use Psr\Container\NotFoundExceptionInterface;
/**
* Class TwoFactorController.
@@ -59,7 +61,11 @@ class TwoFactorController extends Controller
}
/**
+ * @param Request $request
+ *
* @return Redirector|RedirectResponse
+ * @throws ContainerExceptionInterface
+ * @throws NotFoundExceptionInterface
*/
public function submitMFA(Request $request)
{
diff --git a/app/Http/Controllers/Bill/IndexController.php b/app/Http/Controllers/Bill/IndexController.php
index 46f8514f14..1725bad953 100644
--- a/app/Http/Controllers/Bill/IndexController.php
+++ b/app/Http/Controllers/Bill/IndexController.php
@@ -149,7 +149,6 @@ class IndexController extends Controller
}
/**
- * @throws FireflyException
*/
private function getSums(array $bills): array
{
diff --git a/app/Http/Controllers/Bill/ShowController.php b/app/Http/Controllers/Bill/ShowController.php
index acfb3ab3aa..ef004709f5 100644
--- a/app/Http/Controllers/Bill/ShowController.php
+++ b/app/Http/Controllers/Bill/ShowController.php
@@ -44,6 +44,8 @@ use Illuminate\View\View;
use League\Fractal\Manager;
use League\Fractal\Resource\Item;
use League\Fractal\Serializer\DataArraySerializer;
+use Psr\Container\ContainerExceptionInterface;
+use Psr\Container\NotFoundExceptionInterface;
use Symfony\Component\HttpFoundation\ParameterBag;
/**
@@ -113,7 +115,12 @@ class ShowController extends Controller
/**
* Show a bill.
*
+ * @param Request $request
+ * @param Bill $bill
+ *
* @return Factory|View
+ * @throws ContainerExceptionInterface
+ * @throws NotFoundExceptionInterface
*/
public function show(Request $request, Bill $bill)
{
diff --git a/app/Http/Controllers/Budget/BudgetLimitController.php b/app/Http/Controllers/Budget/BudgetLimitController.php
index 63e0c93e7e..81087328c4 100644
--- a/app/Http/Controllers/Budget/BudgetLimitController.php
+++ b/app/Http/Controllers/Budget/BudgetLimitController.php
@@ -150,7 +150,7 @@ class BudgetLimitController extends Controller
$end = Carbon::createFromFormat('Y-m-d', $request->get('end'));
if (!$start instanceof Carbon || !$end instanceof Carbon) {
- return response()->json([]);
+ return response()->json();
}
$amount = (string) $request->get('amount');
@@ -158,7 +158,7 @@ class BudgetLimitController extends Controller
$end->startOfDay();
if ('' === $amount) {
- return response()->json([]);
+ return response()->json();
}
app('log')->debug(sprintf('Start: %s, end: %s', $start->format('Y-m-d'), $end->format('Y-m-d')));
@@ -172,7 +172,7 @@ class BudgetLimitController extends Controller
}
// return empty=ish array:
- return response()->json([]);
+ return response()->json();
}
if ((int) $amount > 268435456) { // intentional cast to integer
$amount = '268435456';
diff --git a/app/Http/Controllers/Budget/IndexController.php b/app/Http/Controllers/Budget/IndexController.php
index 2ba33347a1..08631b6bd3 100644
--- a/app/Http/Controllers/Budget/IndexController.php
+++ b/app/Http/Controllers/Budget/IndexController.php
@@ -174,7 +174,7 @@ class IndexController extends Controller
$array['end_date'] = $entry->end_date;
// spent in period:
- $spentArr = $this->opsRepository->sumExpenses($entry->start_date, $entry->end_date, null, null, $entry->transactionCurrency, false);
+ $spentArr = $this->opsRepository->sumExpenses($entry->start_date, $entry->end_date, null, null, $entry->transactionCurrency);
$array['spent'] = $spentArr[$entry->transaction_currency_id]['sum'] ?? '0';
$array['pc_spent'] = $this->convertToPrimary && $entry->transaction_currency_id !== $this->primaryCurrency->id ? $converter->convert($entry->transactionCurrency, $this->primaryCurrency, $entry->start_date, $array['spent']) : null;
// budgeted in period:
@@ -235,7 +235,7 @@ class IndexController extends Controller
/** @var TransactionCurrency $currency */
foreach ($currencies as $currency) {
- $spentArr = $this->opsRepository->sumExpenses($start, $end, null, new Collection()->push($current), $currency, false);
+ $spentArr = $this->opsRepository->sumExpenses($start, $end, null, new Collection()->push($current), $currency);
if (array_key_exists($currency->id, $spentArr) && array_key_exists('sum', $spentArr[$currency->id])) {
$array['spent'][$currency->id]['spent'] = $spentArr[$currency->id]['sum'];
$array['spent'][$currency->id]['currency_id'] = $currency->id;
diff --git a/app/Http/Controllers/Budget/ShowController.php b/app/Http/Controllers/Budget/ShowController.php
index ce344f13e8..c28e7455e8 100644
--- a/app/Http/Controllers/Budget/ShowController.php
+++ b/app/Http/Controllers/Budget/ShowController.php
@@ -39,6 +39,8 @@ use FireflyIII\Support\Http\Controllers\PeriodOverview;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\Request;
use Illuminate\View\View;
+use Psr\Container\ContainerExceptionInterface;
+use Psr\Container\NotFoundExceptionInterface;
/**
* Class ShowController
@@ -73,9 +75,15 @@ class ShowController extends Controller
/**
* Show transactions without a budget.
*
+ * @param Request $request
+ * @param Carbon|null $start
+ * @param Carbon|null $end
+ *
* @return Factory|View
*
+ * @throws ContainerExceptionInterface
* @throws FireflyException
+ * @throws NotFoundExceptionInterface
*/
public function noBudget(Request $request, ?Carbon $start = null, ?Carbon $end = null)
{
@@ -110,7 +118,11 @@ class ShowController extends Controller
/**
* Shows ALL transactions without a budget.
*
+ * @param Request $request
+ *
* @return Factory|View
+ * @throws ContainerExceptionInterface
+ * @throws NotFoundExceptionInterface
*/
public function noBudgetAll(Request $request)
{
@@ -135,7 +147,12 @@ class ShowController extends Controller
/**
* Show a single budget.
*
+ * @param Request $request
+ * @param Budget $budget
+ *
* @return Factory|View
+ * @throws ContainerExceptionInterface
+ * @throws NotFoundExceptionInterface
*/
public function show(Request $request, Budget $budget)
{
@@ -166,9 +183,15 @@ class ShowController extends Controller
/**
* Show a single budget by a budget limit.
*
+ * @param Request $request
+ * @param Budget $budget
+ * @param BudgetLimit $budgetLimit
+ *
* @return Factory|View
*
* @throws FireflyException
+ * @throws ContainerExceptionInterface
+ * @throws NotFoundExceptionInterface
*/
public function showByBudgetLimit(Request $request, Budget $budget, BudgetLimit $budgetLimit)
{
diff --git a/app/Http/Controllers/Category/IndexController.php b/app/Http/Controllers/Category/IndexController.php
index 41b85c87a7..ecd406df91 100644
--- a/app/Http/Controllers/Category/IndexController.php
+++ b/app/Http/Controllers/Category/IndexController.php
@@ -32,6 +32,8 @@ use Illuminate\Http\Request;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection;
use Illuminate\View\View;
+use Psr\Container\ContainerExceptionInterface;
+use Psr\Container\NotFoundExceptionInterface;
/**
* Class IndexController
@@ -62,7 +64,11 @@ class IndexController extends Controller
/**
* Show all categories.
*
+ * @param Request $request
+ *
* @return Factory|View
+ * @throws ContainerExceptionInterface
+ * @throws NotFoundExceptionInterface
*/
public function index(Request $request)
{
diff --git a/app/Http/Controllers/Category/NoCategoryController.php b/app/Http/Controllers/Category/NoCategoryController.php
index 11f6ade3a9..609f351a46 100644
--- a/app/Http/Controllers/Category/NoCategoryController.php
+++ b/app/Http/Controllers/Category/NoCategoryController.php
@@ -37,6 +37,8 @@ use Illuminate\Http\Request;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Illuminate\View\View;
+use Psr\Container\ContainerExceptionInterface;
+use Psr\Container\NotFoundExceptionInterface;
/**
* Class NoCategoryController
@@ -69,9 +71,15 @@ class NoCategoryController extends Controller
/**
* Show transactions without a category.
*
+ * @param Request $request
+ * @param Carbon|null $start
+ * @param Carbon|null $end
+ *
* @return Factory|View
*
+ * @throws ContainerExceptionInterface
* @throws FireflyException
+ * @throws NotFoundExceptionInterface
*/
public function show(Request $request, ?Carbon $start = null, ?Carbon $end = null)
{
@@ -106,7 +114,11 @@ class NoCategoryController extends Controller
/**
* Show all transactions without a category.
*
+ * @param Request $request
+ *
* @return Factory|View
+ * @throws ContainerExceptionInterface
+ * @throws NotFoundExceptionInterface
*/
public function showAll(Request $request)
{
diff --git a/app/Http/Controllers/Category/ShowController.php b/app/Http/Controllers/Category/ShowController.php
index d9a03f2f4a..c9ca74b93c 100644
--- a/app/Http/Controllers/Category/ShowController.php
+++ b/app/Http/Controllers/Category/ShowController.php
@@ -35,6 +35,8 @@ use Illuminate\Contracts\View\Factory;
use Illuminate\Http\Request;
use Illuminate\Support\Collection;
use Illuminate\View\View;
+use Psr\Container\ContainerExceptionInterface;
+use Psr\Container\NotFoundExceptionInterface;
/**
* Class ShowController
@@ -68,9 +70,16 @@ class ShowController extends Controller
/**
* Show a single category.
*
+ * @param Request $request
+ * @param Category $category
+ * @param Carbon|null $start
+ * @param Carbon|null $end
+ *
* @return Factory|View
*
+ * @throws ContainerExceptionInterface
* @throws FireflyException
+ * @throws NotFoundExceptionInterface
*/
public function show(Request $request, Category $category, ?Carbon $start = null, ?Carbon $end = null)
{
@@ -111,7 +120,12 @@ class ShowController extends Controller
/**
* Show all transactions within a category.
*
+ * @param Request $request
+ * @param Category $category
+ *
* @return Factory|View
+ * @throws ContainerExceptionInterface
+ * @throws NotFoundExceptionInterface
*/
public function showAll(Request $request, Category $category)
{
diff --git a/app/Http/Controllers/Chart/AccountController.php b/app/Http/Controllers/Chart/AccountController.php
index 1e48b0d65f..632589163f 100644
--- a/app/Http/Controllers/Chart/AccountController.php
+++ b/app/Http/Controllers/Chart/AccountController.php
@@ -45,6 +45,7 @@ use Illuminate\Http\JsonResponse;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
+use Safe\Exceptions\JsonException;
use function Safe\json_encode;
/**
@@ -482,7 +483,13 @@ class AccountController extends Controller
/**
* Shows overview of account during a single period.
*
+ * @param Account $account
+ * @param Carbon $start
+ * @param Carbon $end
+ *
+ * @return JsonResponse
* @throws FireflyException
+ * @throws JsonException
*/
public function period(Account $account, Carbon $start, Carbon $end): JsonResponse
{
@@ -571,7 +578,7 @@ class AccountController extends Controller
$label = $current->isoFormat($format);
$return[$key]['entries'][$label] = $amount;
}
- $current = app('navigation')->addPeriod($current, $step, 0);
+ $current = app('navigation')->addPeriod($current, $step);
// here too, to fix #8041, the data is corrected to the end of the period.
$current = app('navigation')->endOfX($current, $step, null);
}
diff --git a/app/Http/Controllers/Chart/CategoryController.php b/app/Http/Controllers/Chart/CategoryController.php
index e22a6bd4d5..d79700c4a2 100644
--- a/app/Http/Controllers/Chart/CategoryController.php
+++ b/app/Http/Controllers/Chart/CategoryController.php
@@ -40,6 +40,8 @@ use FireflyIII\Support\Http\Controllers\ChartGeneration;
use FireflyIII\Support\Http\Controllers\DateCalculation;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Collection;
+use Psr\Container\ContainerExceptionInterface;
+use Psr\Container\NotFoundExceptionInterface;
/**
* Class CategoryController.
@@ -66,7 +68,6 @@ class CategoryController extends Controller
* Show an overview for a category for all time, per month/week/year.
* TODO test method, for category refactor.
*
- * @throws FireflyException
*/
public function all(Category $category): JsonResponse
{
@@ -256,7 +257,12 @@ class CategoryController extends Controller
* Chart for a specific period.
* TODO test me, for category refactor.
*
- * @throws FireflyException
+ * @param Category $category
+ * @param Carbon $date
+ *
+ * @return JsonResponse
+ * @throws ContainerExceptionInterface
+ * @throws NotFoundExceptionInterface
*/
public function specificPeriod(Category $category, Carbon $date): JsonResponse
{
diff --git a/app/Http/Controllers/Chart/PiggyBankController.php b/app/Http/Controllers/Chart/PiggyBankController.php
index 920c3a9301..1321de9eea 100644
--- a/app/Http/Controllers/Chart/PiggyBankController.php
+++ b/app/Http/Controllers/Chart/PiggyBankController.php
@@ -59,7 +59,6 @@ class PiggyBankController extends Controller
*
* TODO this chart is not multi currency aware.
*
- * @throws FireflyException
*/
public function history(PiggyBankRepositoryInterface $repository, PiggyBank $piggyBank): JsonResponse
{
@@ -95,7 +94,7 @@ class PiggyBankController extends Controller
$currentSum = $filtered->sum('amount');
$label = $oldest->isoFormat((string) trans('config.month_and_day_js', [], $locale));
$chartData[$label] = $currentSum;
- $oldest = app('navigation')->addPeriod($oldest, $step, 0);
+ $oldest = app('navigation')->addPeriod($oldest, $step);
}
$finalFiltered = $set->filter(
static fn (PiggyBankEvent $event) => $event->date->lte($today)
diff --git a/app/Http/Controllers/Chart/ReportController.php b/app/Http/Controllers/Chart/ReportController.php
index 9809c24140..4517b002fc 100644
--- a/app/Http/Controllers/Chart/ReportController.php
+++ b/app/Http/Controllers/Chart/ReportController.php
@@ -260,7 +260,7 @@ class ReportController extends Controller
$expense['entries'][$title] = '0';
}
- $currentStart = app('navigation')->addPeriod($currentStart, $preferredRange, 0);
+ $currentStart = app('navigation')->addPeriod($currentStart, $preferredRange);
}
Log::debug('End of sub-loop');
diff --git a/app/Http/Controllers/DebugController.php b/app/Http/Controllers/DebugController.php
index 9138daf037..1ed00b4710 100644
--- a/app/Http/Controllers/DebugController.php
+++ b/app/Http/Controllers/DebugController.php
@@ -49,6 +49,7 @@ use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Route;
use Illuminate\View\View;
use Monolog\Handler\RotatingFileHandler;
+use Safe\Exceptions\FilesystemException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use function Safe\file_get_contents;
@@ -131,7 +132,7 @@ class DebugController extends Controller
*
* @return Factory|View
*
- * @throws FireflyException
+ * @throws FilesystemException
*/
public function index()
{
diff --git a/app/Http/Controllers/JavascriptController.php b/app/Http/Controllers/JavascriptController.php
index bccff306d9..94696f0373 100644
--- a/app/Http/Controllers/JavascriptController.php
+++ b/app/Http/Controllers/JavascriptController.php
@@ -33,6 +33,8 @@ use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Support\Http\Controllers\GetConfigurationData;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
+use Psr\Container\ContainerExceptionInterface;
+use Psr\Container\NotFoundExceptionInterface;
/**
* Class JavascriptController.
@@ -90,8 +92,14 @@ class JavascriptController extends Controller
/**
* Show some common variables to be used in scripts.
*
+ * @param Request $request
+ * @param AccountRepositoryInterface $repository
+ *
+ * @return Response
* @throws FireflyException
- * */
+ * @throws ContainerExceptionInterface
+ * @throws NotFoundExceptionInterface
+ */
public function variables(Request $request, AccountRepositoryInterface $repository): Response
{
$account = $repository->find((int) $request->get('account'));
diff --git a/app/Http/Controllers/Json/BoxController.php b/app/Http/Controllers/Json/BoxController.php
index ce5f520180..cd845df963 100644
--- a/app/Http/Controllers/Json/BoxController.php
+++ b/app/Http/Controllers/Json/BoxController.php
@@ -52,7 +52,7 @@ class BoxController extends Controller
#[Deprecated]
public function available(): JsonResponse
{
- return response()->json([]);
+ return response()->json();
}
/**
diff --git a/app/Http/Controllers/Json/IntroController.php b/app/Http/Controllers/Json/IntroController.php
index f3bd44b660..a08c32b6be 100644
--- a/app/Http/Controllers/Json/IntroController.php
+++ b/app/Http/Controllers/Json/IntroController.php
@@ -89,7 +89,6 @@ class IntroController extends Controller
/**
* Enable the boxes for a specific page again.
*
- * @throws FireflyException
*/
public function postEnable(string $route, ?string $specialPage = null): JsonResponse
{
@@ -109,7 +108,6 @@ class IntroController extends Controller
/**
* Set that you saw them.
*
- * @throws FireflyException
*/
public function postFinished(string $route, ?string $specialPage = null): JsonResponse
{
diff --git a/app/Http/Controllers/NewUserController.php b/app/Http/Controllers/NewUserController.php
index 271c70e692..8350216064 100644
--- a/app/Http/Controllers/NewUserController.php
+++ b/app/Http/Controllers/NewUserController.php
@@ -87,7 +87,6 @@ class NewUserController extends Controller
*
* @return Redirector|RedirectResponse
*
- * @throws FireflyException
*/
public function submit(NewUserFormRequest $request, CurrencyRepositoryInterface $currencyRepository)
{
diff --git a/app/Http/Controllers/ObjectGroup/IndexController.php b/app/Http/Controllers/ObjectGroup/IndexController.php
index 6cddb20792..91fc370f35 100644
--- a/app/Http/Controllers/ObjectGroup/IndexController.php
+++ b/app/Http/Controllers/ObjectGroup/IndexController.php
@@ -80,6 +80,6 @@ class IndexController extends Controller
$newOrder = (int) $request->get('order');
$this->repository->setOrder($objectGroup, $newOrder);
- return response()->json([]);
+ return response()->json();
}
}
diff --git a/app/Http/Controllers/PiggyBank/IndexController.php b/app/Http/Controllers/PiggyBank/IndexController.php
index 64cab7c4ed..69bbd38780 100644
--- a/app/Http/Controllers/PiggyBank/IndexController.php
+++ b/app/Http/Controllers/PiggyBank/IndexController.php
@@ -78,7 +78,6 @@ class IndexController extends Controller
*
* @return Factory|View
*
- * @throws FireflyException
*/
public function index()
{
diff --git a/app/Http/Controllers/PreferencesController.php b/app/Http/Controllers/PreferencesController.php
index d6f0435eed..7a22b91c06 100644
--- a/app/Http/Controllers/PreferencesController.php
+++ b/app/Http/Controllers/PreferencesController.php
@@ -43,6 +43,7 @@ use Illuminate\Routing\Redirector;
use Illuminate\Support\Facades\Log;
use Illuminate\View\View;
+use Safe\Exceptions\FilesystemException;
use function Safe\json_decode;
use function Safe\file_get_contents;
@@ -71,9 +72,12 @@ class PreferencesController extends Controller
/**
* Show overview of preferences.
*
+ * @param AccountRepositoryInterface $repository
+ *
* @return Factory|View
*
* @throws FireflyException
+ * @throws FilesystemException
*/
public function index(AccountRepositoryInterface $repository)
{
diff --git a/app/Http/Controllers/Profile/MfaController.php b/app/Http/Controllers/Profile/MfaController.php
index 333801c380..69537bd12f 100644
--- a/app/Http/Controllers/Profile/MfaController.php
+++ b/app/Http/Controllers/Profile/MfaController.php
@@ -44,6 +44,8 @@ use Illuminate\Routing\Redirector;
use Illuminate\Support\Facades\Log;
use Illuminate\View\View;
use PragmaRX\Recovery\Recovery;
+use Psr\Container\ContainerExceptionInterface;
+use Psr\Container\NotFoundExceptionInterface;
/**
* Class MfaController
@@ -84,7 +86,6 @@ class MfaController extends Controller
}
/**
- * @throws FireflyException
*/
public function backupCodes(Request $request): Factory|RedirectResponse|View
{
@@ -230,9 +231,12 @@ class MfaController extends Controller
/**
* Submit 2FA for the first time.
*
+ * @param TokenFormRequest $request
+ *
* @return Redirector|RedirectResponse
*
- * @throws FireflyException
+ * @throws ContainerExceptionInterface
+ * @throws NotFoundExceptionInterface
*/
public function enableMFAPost(TokenFormRequest $request)
{
@@ -290,7 +294,10 @@ class MfaController extends Controller
/**
* TODO duplicate code.
*
- * @throws FireflyException
+ * @param string $mfaCode
+ *
+ * @throws ContainerExceptionInterface
+ * @throws NotFoundExceptionInterface
*/
private function addToMFAHistory(string $mfaCode): void
{
diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php
index b63ab5d86b..7eb2e745cf 100644
--- a/app/Http/Controllers/ProfileController.php
+++ b/app/Http/Controllers/ProfileController.php
@@ -48,6 +48,8 @@ use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
use Illuminate\View\View;
use Laravel\Passport\ClientRepository;
+use Psr\Container\ContainerExceptionInterface;
+use Psr\Container\NotFoundExceptionInterface;
/**
* Class ProfileController.
@@ -136,7 +138,9 @@ class ProfileController extends Controller
/**
* Index for profile.
*
- * @throws FireflyException
+ * @return Factory|View
+ * @throws ContainerExceptionInterface
+ * @throws NotFoundExceptionInterface
*/
public function index(): Factory|View
{
diff --git a/app/Http/Controllers/Recurring/IndexController.php b/app/Http/Controllers/Recurring/IndexController.php
index d6c7e41d7f..9923a42d0a 100644
--- a/app/Http/Controllers/Recurring/IndexController.php
+++ b/app/Http/Controllers/Recurring/IndexController.php
@@ -36,6 +36,8 @@ use Illuminate\Contracts\View\Factory;
use Illuminate\Http\Request;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\View\View;
+use Psr\Container\ContainerExceptionInterface;
+use Psr\Container\NotFoundExceptionInterface;
use Symfony\Component\HttpFoundation\ParameterBag;
/**
@@ -71,9 +73,13 @@ class IndexController extends Controller
* TODO the notes of a recurrence are pretty pointless at this moment.
* Show all recurring transactions.
*
+ * @param Request $request
+ *
* @return Factory|View
*
* @throws FireflyException
+ * @throws ContainerExceptionInterface
+ * @throws NotFoundExceptionInterface
*/
public function index(Request $request)
{
diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.php
index 017aa4d9fe..126d312f71 100644
--- a/app/Http/Controllers/ReportController.php
+++ b/app/Http/Controllers/ReportController.php
@@ -39,6 +39,8 @@ use Illuminate\Http\RedirectResponse;
use Illuminate\Routing\Redirector;
use Illuminate\Support\Collection;
use Illuminate\View\View;
+use Psr\Container\ContainerExceptionInterface;
+use Psr\Container\NotFoundExceptionInterface;
/**
* Class ReportController.
@@ -225,7 +227,11 @@ class ReportController extends Controller
/**
* Show index.
*
+ * @param AccountRepositoryInterface $repository
+ *
* @return Factory|View
+ * @throws ContainerExceptionInterface
+ * @throws NotFoundExceptionInterface
*/
public function index(AccountRepositoryInterface $repository)
{
diff --git a/app/Http/Controllers/Rule/IndexController.php b/app/Http/Controllers/Rule/IndexController.php
index 5d53c38e9c..7273a72e56 100644
--- a/app/Http/Controllers/Rule/IndexController.php
+++ b/app/Http/Controllers/Rule/IndexController.php
@@ -82,7 +82,7 @@ class IndexController extends Controller
$order = (int) $request->get('order');
$this->ruleRepos->moveRule($rule, $ruleGroup, $order);
- return response()->json([]);
+ return response()->json();
}
public function search(Rule $rule): RedirectResponse
diff --git a/app/Http/Controllers/TagController.php b/app/Http/Controllers/TagController.php
index f69cd62c24..0fd2ef0336 100644
--- a/app/Http/Controllers/TagController.php
+++ b/app/Http/Controllers/TagController.php
@@ -37,6 +37,8 @@ use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
use Illuminate\View\View;
+use Psr\Container\ContainerExceptionInterface;
+use Psr\Container\NotFoundExceptionInterface;
/**
* Class TagController.
@@ -218,9 +220,16 @@ class TagController extends Controller
/**
* Show a single tag.
*
+ * @param Request $request
+ * @param Tag $tag
+ * @param Carbon|null $start
+ * @param Carbon|null $end
+ *
* @return Factory|View
*
+ * @throws ContainerExceptionInterface
* @throws FireflyException
+ * @throws NotFoundExceptionInterface
*/
public function show(Request $request, Tag $tag, ?Carbon $start = null, ?Carbon $end = null)
{
@@ -261,7 +270,12 @@ class TagController extends Controller
/**
* Show a single tag over all time.
*
+ * @param Request $request
+ * @param Tag $tag
+ *
* @return Factory|View
+ * @throws ContainerExceptionInterface
+ * @throws NotFoundExceptionInterface
*/
public function showAll(Request $request, Tag $tag)
{
diff --git a/app/Http/Controllers/Transaction/CreateController.php b/app/Http/Controllers/Transaction/CreateController.php
index c69ddfc2ce..1fc030e5e9 100644
--- a/app/Http/Controllers/Transaction/CreateController.php
+++ b/app/Http/Controllers/Transaction/CreateController.php
@@ -37,6 +37,9 @@ use Illuminate\Contracts\View\View;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
+use Psr\Container\ContainerExceptionInterface;
+use Psr\Container\NotFoundExceptionInterface;
+use Safe\Exceptions\UrlException;
use function Safe\parse_url;
/**
@@ -98,10 +101,14 @@ class CreateController extends Controller
/**
* Create a new transaction group.
*
+ * @param string|null $objectType
+ *
* @return Factory|View
*
- * @throws FireflyException
- * */
+ * @throws ContainerExceptionInterface
+ * @throws NotFoundExceptionInterface
+ * @throws UrlException
+ */
public function create(?string $objectType)
{
Preferences::mark();
diff --git a/app/Http/Controllers/Transaction/EditController.php b/app/Http/Controllers/Transaction/EditController.php
index 5b30ec7a9f..2fa41b6de9 100644
--- a/app/Http/Controllers/Transaction/EditController.php
+++ b/app/Http/Controllers/Transaction/EditController.php
@@ -35,6 +35,9 @@ use Illuminate\Http\RedirectResponse;
use Illuminate\Routing\Redirector;
use Illuminate\View\View;
+use Psr\Container\ContainerExceptionInterface;
+use Psr\Container\NotFoundExceptionInterface;
+use Safe\Exceptions\UrlException;
use function Safe\parse_url;
/**
@@ -65,7 +68,12 @@ class EditController extends Controller
}
/**
+ * @param TransactionGroup $transactionGroup
+ *
* @return Factory|Redirector|RedirectResponse|View
+ * @throws ContainerExceptionInterface
+ * @throws NotFoundExceptionInterface
+ * @throws UrlException
*/
public function edit(TransactionGroup $transactionGroup)
{
diff --git a/app/Http/Controllers/Transaction/IndexController.php b/app/Http/Controllers/Transaction/IndexController.php
index 54e6a6e967..92f67137c6 100644
--- a/app/Http/Controllers/Transaction/IndexController.php
+++ b/app/Http/Controllers/Transaction/IndexController.php
@@ -34,6 +34,8 @@ use FireflyIII\Support\Http\Controllers\PeriodOverview;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\Request;
use Illuminate\View\View;
+use Psr\Container\ContainerExceptionInterface;
+use Psr\Container\NotFoundExceptionInterface;
/**
* Class IndexController
@@ -67,9 +69,16 @@ class IndexController extends Controller
/**
* Index for a range of transactions.
*
+ * @param Request $request
+ * @param string $objectType
+ * @param Carbon|null $start
+ * @param Carbon|null $end
+ *
* @return Factory|View
*
+ * @throws ContainerExceptionInterface
* @throws FireflyException
+ * @throws NotFoundExceptionInterface
*/
public function index(Request $request, string $objectType, ?Carbon $start = null, ?Carbon $end = null)
{
@@ -123,7 +132,12 @@ class IndexController extends Controller
/**
* Index for ALL transactions.
*
+ * @param Request $request
+ * @param string $objectType
+ *
* @return Factory|View
+ * @throws ContainerExceptionInterface
+ * @throws NotFoundExceptionInterface
*/
public function indexAll(Request $request, string $objectType)
{
diff --git a/app/Http/Controllers/TransactionCurrency/DeleteController.php b/app/Http/Controllers/TransactionCurrency/DeleteController.php
index c7cc7fb83a..ca25c9c2e5 100644
--- a/app/Http/Controllers/TransactionCurrency/DeleteController.php
+++ b/app/Http/Controllers/TransactionCurrency/DeleteController.php
@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Controllers\TransactionCurrency;
+use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
@@ -66,7 +67,11 @@ class DeleteController extends Controller
/**
* Deletes a currency.
*
+ * @param Request $request
+ * @param TransactionCurrency $currency
+ *
* @return Factory|Redirector|RedirectResponse|View
+ * @throws FireflyException
*/
public function delete(Request $request, TransactionCurrency $currency)
{
@@ -99,7 +104,11 @@ class DeleteController extends Controller
/**
* Destroys a currency.
*
+ * @param Request $request
+ * @param TransactionCurrency $currency
+ *
* @return Redirector|RedirectResponse
+ * @throws FireflyException
*/
public function destroy(Request $request, TransactionCurrency $currency)
{
diff --git a/app/Http/Controllers/TransactionCurrency/EditController.php b/app/Http/Controllers/TransactionCurrency/EditController.php
index 926e973f44..092b5c623f 100644
--- a/app/Http/Controllers/TransactionCurrency/EditController.php
+++ b/app/Http/Controllers/TransactionCurrency/EditController.php
@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Controllers\TransactionCurrency;
+use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Http\Requests\CurrencyFormRequest;
use FireflyIII\Models\TransactionCurrency;
@@ -106,7 +107,11 @@ class EditController extends Controller
/**
* Updates a currency.
*
+ * @param CurrencyFormRequest $request
+ * @param TransactionCurrency $currency
+ *
* @return Redirector|RedirectResponse
+ * @throws FireflyException
*/
public function update(CurrencyFormRequest $request, TransactionCurrency $currency)
{
diff --git a/app/Http/Controllers/TransactionCurrency/IndexController.php b/app/Http/Controllers/TransactionCurrency/IndexController.php
index d63ffe5897..62566bbd3b 100644
--- a/app/Http/Controllers/TransactionCurrency/IndexController.php
+++ b/app/Http/Controllers/TransactionCurrency/IndexController.php
@@ -33,6 +33,8 @@ use Illuminate\Contracts\View\Factory;
use Illuminate\Http\Request;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\View\View;
+use Psr\Container\ContainerExceptionInterface;
+use Psr\Container\NotFoundExceptionInterface;
class IndexController extends Controller
{
@@ -61,7 +63,11 @@ class IndexController extends Controller
/**
* Show overview of currencies.
*
+ * @param Request $request
+ *
* @return Factory|View
+ * @throws ContainerExceptionInterface
+ * @throws NotFoundExceptionInterface
*/
public function index(Request $request)
{
diff --git a/app/Http/Middleware/AcceptHeaders.php b/app/Http/Middleware/AcceptHeaders.php
index 0f797dea01..d8884aebf3 100644
--- a/app/Http/Middleware/AcceptHeaders.php
+++ b/app/Http/Middleware/AcceptHeaders.php
@@ -27,6 +27,7 @@ namespace FireflyIII\Http\Middleware;
use FireflyIII\Exceptions\BadHttpHeaderException;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
+use Safe\Exceptions\PcreException;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
use function Safe\preg_match;
@@ -36,9 +37,13 @@ class AcceptHeaders
/**
* Handle the incoming requests.
*
+ * @param Request $request
+ * @param callable $next
+ *
* @return Response
*
* @throws BadHttpHeaderException
+ * @throws PcreException
*/
public function handle(Request $request, callable $next): mixed
{
diff --git a/app/Http/Requests/ReportFormRequest.php b/app/Http/Requests/ReportFormRequest.php
index 7a4fcd3cf9..0061ca310a 100644
--- a/app/Http/Requests/ReportFormRequest.php
+++ b/app/Http/Requests/ReportFormRequest.php
@@ -36,6 +36,7 @@ use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
+use Safe\Exceptions\PcreException;
use function Safe\preg_match;
/**
@@ -133,7 +134,9 @@ class ReportFormRequest extends FormRequest
/**
* Validate end date.
*
+ * @return Carbon
* @throws FireflyException
+ * @throws PcreException
*/
public function getEndDate(): Carbon
{
@@ -171,7 +174,9 @@ class ReportFormRequest extends FormRequest
/**
* Validate start date.
*
+ * @return Carbon
* @throws FireflyException
+ * @throws PcreException
*/
public function getStartDate(): Carbon
{
diff --git a/app/Jobs/DownloadExchangeRates.php b/app/Jobs/DownloadExchangeRates.php
index 8d22837468..1bbb3ee10e 100644
--- a/app/Jobs/DownloadExchangeRates.php
+++ b/app/Jobs/DownloadExchangeRates.php
@@ -41,6 +41,7 @@ use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
+use Safe\Exceptions\JsonException;
use function Safe\json_decode;
/**
@@ -94,7 +95,10 @@ class DownloadExchangeRates implements ShouldQueue
}
/**
+ * @param TransactionCurrency $currency
+ *
* @throws GuzzleException
+ * @throws JsonException
*/
private function downloadRates(TransactionCurrency $currency): void
{
diff --git a/app/Mail/ReportNewJournalsMail.php b/app/Mail/ReportNewJournalsMail.php
index e0a492fa47..0fd9ac7127 100644
--- a/app/Mail/ReportNewJournalsMail.php
+++ b/app/Mail/ReportNewJournalsMail.php
@@ -52,6 +52,7 @@ class ReportNewJournalsMail extends Mailable
* Build the message.
*
* @return $this
+ * @throws FireflyException
*/
public function build(): self
{
diff --git a/app/Repositories/Account/AccountTasker.php b/app/Repositories/Account/AccountTasker.php
index 1b3b7ff1ee..a9ca59cb65 100644
--- a/app/Repositories/Account/AccountTasker.php
+++ b/app/Repositories/Account/AccountTasker.php
@@ -144,7 +144,6 @@ class AccountTasker implements AccountTaskerInterface, UserGroupInterface
}
/**
- * @throws FireflyException
*/
private function groupExpenseByDestination(array $array): array
{
@@ -232,7 +231,6 @@ class AccountTasker implements AccountTaskerInterface, UserGroupInterface
}
/**
- * @throws FireflyException
*/
private function groupIncomeBySource(array $array): array
{
diff --git a/app/Repositories/Budget/AvailableBudgetRepository.php b/app/Repositories/Budget/AvailableBudgetRepository.php
index 177900d154..ee9db0ca62 100644
--- a/app/Repositories/Budget/AvailableBudgetRepository.php
+++ b/app/Repositories/Budget/AvailableBudgetRepository.php
@@ -113,6 +113,7 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U
;
}
+ #[\Deprecated]
public function getAvailableBudget(TransactionCurrency $currency, Carbon $start, Carbon $end): string
{
$amount = '0';
diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.php
index 8aaaa40b8a..23cc13e273 100644
--- a/app/Repositories/Budget/BudgetRepository.php
+++ b/app/Repositories/Budget/BudgetRepository.php
@@ -377,9 +377,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface
return;
}
- if (null !== $dbNote) {
- $dbNote->delete();
- }
+ $dbNote?->delete();
}
public function getAutoBudget(Budget $budget): ?AutoBudget
@@ -389,7 +387,6 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface
}
/**
- * @throws FireflyException
*/
private function updateAutoBudget(Budget $budget, array $data): void
{
@@ -527,11 +524,8 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface
public function firstUseDate(Budget $budget): ?Carbon
{
$journal = $budget->transactionJournals()->orderBy('date', 'ASC')->first();
- if (null !== $journal) {
- return $journal->date;
- }
+ return $journal?->date;
- return null;
}
public function getAttachments(Budget $budget): Collection
@@ -570,11 +564,8 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface
public function getNoteText(Budget $budget): ?string
{
$note = $budget->notes()->first();
- if (null === $note) {
- return null;
- }
+ return $note?->text;
- return $note->text;
}
public function searchBudget(string $query, int $limit): Collection
diff --git a/app/Repositories/Budget/NoBudgetRepository.php b/app/Repositories/Budget/NoBudgetRepository.php
index f48176ab9a..8ae96cb192 100644
--- a/app/Repositories/Budget/NoBudgetRepository.php
+++ b/app/Repositories/Budget/NoBudgetRepository.php
@@ -41,6 +41,7 @@ class NoBudgetRepository implements NoBudgetRepositoryInterface, UserGroupInterf
{
use UserGroupTrait;
+ #[\Deprecated]
public function getNoBudgetPeriodReport(Collection $accounts, Carbon $start, Carbon $end): array
{
$carbonFormat = app('navigation')->preferredCarbonFormat($start, $end);
diff --git a/app/Repositories/Category/CategoryRepository.php b/app/Repositories/Category/CategoryRepository.php
index 894690e9e6..6856e3552a 100644
--- a/app/Repositories/Category/CategoryRepository.php
+++ b/app/Repositories/Category/CategoryRepository.php
@@ -213,11 +213,8 @@ class CategoryRepository implements CategoryRepositoryInterface, UserGroupInterf
$query = $category->transactionJournals()->orderBy('date', 'ASC');
$result = $query->first(['transaction_journals.*']);
- if (null !== $result) {
- return $result->date;
- }
+ return $result?->date;
- return null;
}
private function getFirstTransactionDate(Category $category): ?Carbon
@@ -264,11 +261,8 @@ class CategoryRepository implements CategoryRepositoryInterface, UserGroupInterf
public function getNoteText(Category $category): ?string
{
$dbNote = $category->notes()->first();
- if (null === $dbNote) {
- return null;
- }
+ return $dbNote?->text;
- return $dbNote->text;
}
/**
@@ -307,11 +301,8 @@ class CategoryRepository implements CategoryRepositoryInterface, UserGroupInterf
$result = $query->first(['transaction_journals.*']);
- if (null !== $result) {
- return $result->date;
- }
+ return $result?->date;
- return null;
}
/**
diff --git a/app/Repositories/Currency/CurrencyRepository.php b/app/Repositories/Currency/CurrencyRepository.php
index cb5e24858b..c76b5badfb 100644
--- a/app/Repositories/Currency/CurrencyRepository.php
+++ b/app/Repositories/Currency/CurrencyRepository.php
@@ -45,6 +45,7 @@ use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Override;
+use Safe\Exceptions\JsonException;
use function Safe\json_encode;
/**
@@ -65,7 +66,10 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf
}
/**
- * @throws FireflyException
+ * @param TransactionCurrency $currency
+ *
+ * @return string|null
+ * @throws JsonException
*/
public function currencyInUseAt(TransactionCurrency $currency): ?string
{
@@ -234,7 +238,6 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf
/**
* Find by object, ID or code. Returns user default or system default.
*
- * @throws FireflyException
*/
public function findCurrency(?int $currencyId, ?string $currencyCode): TransactionCurrency
{
diff --git a/app/Repositories/Journal/JournalCLIRepository.php b/app/Repositories/Journal/JournalCLIRepository.php
index ea923bfffc..dd47a39323 100644
--- a/app/Repositories/Journal/JournalCLIRepository.php
+++ b/app/Repositories/Journal/JournalCLIRepository.php
@@ -166,11 +166,8 @@ class JournalCLIRepository implements JournalCLIRepositoryInterface, UserGroupIn
public function getNoteText(TransactionJournal $journal): ?string
{
$note = $journal->notes()->first();
- if (null === $note) {
- return null;
- }
+ return $note?->text;
- return $note->text;
}
/**
diff --git a/app/Repositories/Recurring/RecurringRepository.php b/app/Repositories/Recurring/RecurringRepository.php
index c8ee7b89c1..f131b3d1f6 100644
--- a/app/Repositories/Recurring/RecurringRepository.php
+++ b/app/Repositories/Recurring/RecurringRepository.php
@@ -431,7 +431,6 @@ class RecurringRepository implements RecurringRepositoryInterface, UserGroupInte
/**
* Parse the repetition in a string that is user readable.
*
- * @throws FireflyException
*/
public function repetitionDescription(RecurrenceRepetition $repetition): string
{
diff --git a/app/Repositories/TransactionGroup/TransactionGroupRepository.php b/app/Repositories/TransactionGroup/TransactionGroupRepository.php
index c8c03b7a38..78acf6d253 100644
--- a/app/Repositories/TransactionGroup/TransactionGroupRepository.php
+++ b/app/Repositories/TransactionGroup/TransactionGroupRepository.php
@@ -177,11 +177,8 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface,
->where('noteable_type', TransactionJournal::class)
->first()
;
- if (null === $note) {
- return null;
- }
+ return $note?->text;
- return $note->text;
}
/**
diff --git a/app/Repositories/User/UserRepository.php b/app/Repositories/User/UserRepository.php
index e6dbb7ec52..e00b15ba9d 100644
--- a/app/Repositories/User/UserRepository.php
+++ b/app/Repositories/User/UserRepository.php
@@ -161,11 +161,8 @@ class UserRepository implements UserRepositoryInterface
{
/** @var null|Role $role */
$role = $user->roles()->first();
- if (null !== $role) {
- return $role->name;
- }
+ return $role?->name;
- return null;
}
/**
@@ -379,7 +376,6 @@ class UserRepository implements UserRepositoryInterface
* This updates the users email address. Same as changeEmail just without most logging. This makes sure that the
* undo/confirm routine can't catch this one. The user is NOT blocked.
*
- * @throws FireflyException
*
* @see changeEmail
*/
diff --git a/app/Repositories/UserGroup/UserGroupRepository.php b/app/Repositories/UserGroup/UserGroupRepository.php
index 3f9bcdace1..691807110c 100644
--- a/app/Repositories/UserGroup/UserGroupRepository.php
+++ b/app/Repositories/UserGroup/UserGroupRepository.php
@@ -97,7 +97,6 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte
/**
* Returns all groups the user is member in.
*
- * {@inheritDoc}
*/
public function get(): Collection
{
@@ -137,7 +136,6 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte
if (!$existingGroup instanceof UserGroup) {
$exists = false;
- /** @var UserGroup $existingGroup */
$existingGroup = $this->store(['user' => $user, 'title' => $groupName]);
}
$groupName = sprintf('%s-%s', $user->email, substr(sha1(random_int(1000, 9999).microtime()), 0, 4));
@@ -168,7 +166,6 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte
/**
* Returns all groups.
*
- * {@inheritDoc}
*/
public function getAll(): Collection
{
diff --git a/app/Rules/Account/IsValidAccountType.php b/app/Rules/Account/IsValidAccountType.php
index 52042572f1..d2287ff702 100644
--- a/app/Rules/Account/IsValidAccountType.php
+++ b/app/Rules/Account/IsValidAccountType.php
@@ -46,7 +46,6 @@ class IsValidAccountType implements ValidationRule
$filtered = [];
$keys = array_keys($this->types);
- /** @var mixed $entry */
foreach ($value as $entry) {
$entry = (string) $entry;
if (!in_array($entry, $keys, true)) {
diff --git a/app/Services/Internal/Support/AccountServiceTrait.php b/app/Services/Internal/Support/AccountServiceTrait.php
index f3225155c7..5525181b97 100644
--- a/app/Services/Internal/Support/AccountServiceTrait.php
+++ b/app/Services/Internal/Support/AccountServiceTrait.php
@@ -155,9 +155,7 @@ trait AccountServiceTrait
{
$dbNote = $account->notes()->first();
if ('' === $note) {
- if (null !== $dbNote) {
- $dbNote->delete();
- }
+ $dbNote?->delete();
return true;
}
@@ -342,7 +340,6 @@ trait AccountServiceTrait
}
/**
- * @throws FireflyException
*/
protected function getCurrency(int $currencyId, string $currencyCode): TransactionCurrency
{
@@ -377,7 +374,7 @@ trait AccountServiceTrait
throw new FireflyException('Amount for update liability credit/debit was unexpectedly 0.');
}
- // if direction is "debit" (i owe this debt), amount is negative.
+ // if direction is "debit" (I owe this debt), amount is negative.
// which means the liability will have a negative balance which the user must fill.
$openingBalance = app('steam')->negative($openingBalance);
diff --git a/app/Services/Internal/Support/BillServiceTrait.php b/app/Services/Internal/Support/BillServiceTrait.php
index c3a73b1e83..a9217f347d 100644
--- a/app/Services/Internal/Support/BillServiceTrait.php
+++ b/app/Services/Internal/Support/BillServiceTrait.php
@@ -56,9 +56,7 @@ trait BillServiceTrait
{
if ('' === $note) {
$dbNote = $bill->notes()->first();
- if (null !== $dbNote) {
- $dbNote->delete();
- }
+ $dbNote?->delete();
return true;
}
diff --git a/app/Services/Internal/Support/JournalServiceTrait.php b/app/Services/Internal/Support/JournalServiceTrait.php
index 8cd15203ca..abe783365f 100644
--- a/app/Services/Internal/Support/JournalServiceTrait.php
+++ b/app/Services/Internal/Support/JournalServiceTrait.php
@@ -39,6 +39,7 @@ use FireflyIII\Rules\UniqueIban;
use FireflyIII\Support\NullArrayObject;
use Illuminate\Support\Facades\Log;
+use Safe\Exceptions\JsonException;
use function Safe\json_encode;
/**
@@ -265,7 +266,13 @@ trait JournalServiceTrait
}
/**
+ * @param Account|null $account
+ * @param array $data
+ * @param string $preferredType
+ *
+ * @return Account|null
* @throws FireflyException
+ * @throws JsonException
*/
private function createAccount(?Account $account, array $data, string $preferredType): ?Account
{
diff --git a/app/Services/Internal/Support/RecurringTransactionTrait.php b/app/Services/Internal/Support/RecurringTransactionTrait.php
index 6ac399f6e5..ebb7aad99f 100644
--- a/app/Services/Internal/Support/RecurringTransactionTrait.php
+++ b/app/Services/Internal/Support/RecurringTransactionTrait.php
@@ -54,9 +54,7 @@ trait RecurringTransactionTrait
{
if ('' === $note) {
$dbNote = $recurrence->notes()->first();
- if (null !== $dbNote) {
- $dbNote->delete();
- }
+ $dbNote?->delete();
return true;
}
diff --git a/app/Services/Internal/Update/AccountUpdateService.php b/app/Services/Internal/Update/AccountUpdateService.php
index 5e1f230b4d..341e72b33a 100644
--- a/app/Services/Internal/Update/AccountUpdateService.php
+++ b/app/Services/Internal/Update/AccountUpdateService.php
@@ -285,7 +285,6 @@ class AccountUpdateService
}
/**
- * @throws FireflyException
*/
private function updatePreferences(Account $account): void
{
diff --git a/app/Services/Internal/Update/BillUpdateService.php b/app/Services/Internal/Update/BillUpdateService.php
index a4aca38ce4..d71d82a524 100644
--- a/app/Services/Internal/Update/BillUpdateService.php
+++ b/app/Services/Internal/Update/BillUpdateService.php
@@ -47,7 +47,6 @@ class BillUpdateService
protected User $user;
/**
- * @throws FireflyException
*/
public function update(Bill $bill, array $data): Bill
{
diff --git a/app/Services/Internal/Update/CategoryUpdateService.php b/app/Services/Internal/Update/CategoryUpdateService.php
index 28b5f36f00..193a5957b2 100644
--- a/app/Services/Internal/Update/CategoryUpdateService.php
+++ b/app/Services/Internal/Update/CategoryUpdateService.php
@@ -139,9 +139,7 @@ class CategoryUpdateService
}
if ('' === $note) {
$dbNote = $category->notes()->first();
- if (null !== $dbNote) {
- $dbNote->delete();
- }
+ $dbNote?->delete();
return;
}
diff --git a/app/Support/Binder/CLIToken.php b/app/Support/Binder/CLIToken.php
index d55e5dceca..b57ae19261 100644
--- a/app/Support/Binder/CLIToken.php
+++ b/app/Support/Binder/CLIToken.php
@@ -37,7 +37,6 @@ class CLIToken implements BinderInterface
/**
* @return mixed
*
- * @throws FireflyException
*/
public static function routeBinder(string $value, Route $route)
{
diff --git a/app/Support/Chart/Category/WholePeriodChartGenerator.php b/app/Support/Chart/Category/WholePeriodChartGenerator.php
index ce43b1d16e..27d6026c2f 100644
--- a/app/Support/Chart/Category/WholePeriodChartGenerator.php
+++ b/app/Support/Chart/Category/WholePeriodChartGenerator.php
@@ -62,7 +62,7 @@ class WholePeriodChartGenerator
$currentEnd = app('navigation')->endOfPeriod($current, $step);
$spent[$key] = $opsRepository->sumExpenses($current, $currentEnd, $accounts, $collection);
$earned[$key] = $opsRepository->sumIncome($current, $currentEnd, $accounts, $collection);
- $current = app('navigation')->addPeriod($current, $step, 0);
+ $current = app('navigation')->addPeriod($current, $step);
}
$currencies = $this->extractCurrencies($spent) + $this->extractCurrencies($earned);
@@ -104,7 +104,7 @@ class WholePeriodChartGenerator
$chartData[$spentInfoKey]['entries'][$label] = app('steam')->bcround($spentAmount, $currency['currency_decimal_places']);
$chartData[$earnedInfoKey]['entries'][$label] = app('steam')->bcround($earnedAmount, $currency['currency_decimal_places']);
}
- $current = app('navigation')->addPeriod($current, $step, 0);
+ $current = app('navigation')->addPeriod($current, $step);
}
return $chartData;
diff --git a/app/Support/Export/ExportDataGenerator.php b/app/Support/Export/ExportDataGenerator.php
index 926f371108..d1b19bf7e4 100644
--- a/app/Support/Export/ExportDataGenerator.php
+++ b/app/Support/Export/ExportDataGenerator.php
@@ -62,6 +62,8 @@ use Illuminate\Support\Facades\Log;
use League\Csv\CannotInsertRecord;
use League\Csv\Exception;
use League\Csv\Writer;
+use Psr\Container\ContainerExceptionInterface;
+use Psr\Container\NotFoundExceptionInterface;
/**
* Class ExportDataGenerator
@@ -105,7 +107,12 @@ class ExportDataGenerator
}
/**
+ * @return array
+ * @throws CannotInsertRecord
+ * @throws ContainerExceptionInterface
+ * @throws Exception
* @throws FireflyException
+ * @throws NotFoundExceptionInterface
*/
public function export(): array
{
@@ -747,9 +754,12 @@ class ExportDataGenerator
}
/**
+ * @return string
* @throws CannotInsertRecord
* @throws Exception
* @throws FireflyException
+ * @throws ContainerExceptionInterface
+ * @throws NotFoundExceptionInterface
*/
private function exportTags(): string
{
diff --git a/app/Support/Form/CurrencyForm.php b/app/Support/Form/CurrencyForm.php
index bf748c6097..5bf2e0ba77 100644
--- a/app/Support/Form/CurrencyForm.php
+++ b/app/Support/Form/CurrencyForm.php
@@ -165,8 +165,6 @@ class CurrencyForm
}
/**
- * @phpstan-param view-string $view
- *
* @throws FireflyException
*/
protected function currencyField(string $name, string $view, mixed $value = null, ?array $options = null): string
diff --git a/app/Support/Http/Api/ExchangeRateConverter.php b/app/Support/Http/Api/ExchangeRateConverter.php
index d92313907a..6f6728e825 100644
--- a/app/Support/Http/Api/ExchangeRateConverter.php
+++ b/app/Support/Http/Api/ExchangeRateConverter.php
@@ -243,7 +243,7 @@ class ExchangeRateConverter
private function getRate(TransactionCurrency $from, TransactionCurrency $to, Carbon $date): string
{
$key = $this->getCacheKey($from, $to, $date);
- $res = Cache::get($key, null);
+ $res = Cache::get($key);
// find in cache
if (null !== $res) {
diff --git a/app/Support/Http/Controllers/AugumentData.php b/app/Support/Http/Controllers/AugumentData.php
index 2046b7e5b2..d7422f34c2 100644
--- a/app/Support/Http/Controllers/AugumentData.php
+++ b/app/Support/Http/Controllers/AugumentData.php
@@ -219,7 +219,7 @@ trait AugumentData
$entry->pc_spent = $spent;
// normal amount:
- $expenses = $opsRepository->sumExpenses($currentStart, $currentEnd, null, $budgetCollection, $entry->transactionCurrency, false);
+ $expenses = $opsRepository->sumExpenses($currentStart, $currentEnd, null, $budgetCollection, $entry->transactionCurrency);
$spent = $expenses[$entry->transactionCurrency->id]['sum'] ?? '0';
$entry->spent = $spent;
diff --git a/app/Support/Http/Controllers/GetConfigurationData.php b/app/Support/Http/Controllers/GetConfigurationData.php
index b0bb16b3f1..097204bd83 100644
--- a/app/Support/Http/Controllers/GetConfigurationData.php
+++ b/app/Support/Http/Controllers/GetConfigurationData.php
@@ -118,7 +118,7 @@ trait GetConfigurationData
$previousEnd = app('navigation')->endOfPeriod($previousStart, $viewRange);
$ranges[$index] = [$previousStart, $previousEnd];
- $nextDate = app('navigation')->addPeriod($start, $viewRange, 0);
+ $nextDate = app('navigation')->addPeriod($start, $viewRange);
$index = app('navigation')->periodShow($nextDate, $viewRange);
$nextStart = app('navigation')->startOfPeriod($nextDate, $viewRange);
$nextEnd = app('navigation')->endOfPeriod($nextStart, $viewRange);
diff --git a/app/Support/JsonApi/Enrichments/AvailableBudgetEnrichment.php b/app/Support/JsonApi/Enrichments/AvailableBudgetEnrichment.php
index a6a8823368..b794275706 100644
--- a/app/Support/JsonApi/Enrichments/AvailableBudgetEnrichment.php
+++ b/app/Support/JsonApi/Enrichments/AvailableBudgetEnrichment.php
@@ -153,8 +153,8 @@ class AvailableBudgetEnrichment implements EnrichmentInterface
$id = (int)$availableBudget->id;
$currencyId = $this->currencyIds[$id];
$currency = $this->currencies[$currencyId];
- $filteredSpentInBudgets = $this->opsRepository->sumCollectedExpenses($spentInBudgets, $availableBudget->start_date, $availableBudget->end_date, $currency, false);
- $filteredSpentOutsideBudgets = $this->opsRepository->sumCollectedExpenses($spentOutsideBudgets, $availableBudget->start_date, $availableBudget->end_date, $currency, false);
+ $filteredSpentInBudgets = $this->opsRepository->sumCollectedExpenses($spentInBudgets, $availableBudget->start_date, $availableBudget->end_date, $currency);
+ $filteredSpentOutsideBudgets = $this->opsRepository->sumCollectedExpenses($spentOutsideBudgets, $availableBudget->start_date, $availableBudget->end_date, $currency);
$this->spentInBudgets[$id] = array_values($filteredSpentInBudgets);
$this->spentOutsideBudgets[$id] = array_values($filteredSpentOutsideBudgets);
diff --git a/app/Support/JsonApi/Enrichments/BudgetEnrichment.php b/app/Support/JsonApi/Enrichments/BudgetEnrichment.php
index cb875aca78..8d548405d2 100644
--- a/app/Support/JsonApi/Enrichments/BudgetEnrichment.php
+++ b/app/Support/JsonApi/Enrichments/BudgetEnrichment.php
@@ -156,10 +156,10 @@ class BudgetEnrichment implements EnrichmentInterface
$opsRepository->setUserGroup($this->userGroup);
// $spent = $this->beautify();
// $set = $this->opsRepository->sumExpenses($start, $end, null, new Collection()->push($budget))
- $expenses = $opsRepository->collectExpenses($this->start, $this->end, null, $this->collection, null);
+ $expenses = $opsRepository->collectExpenses($this->start, $this->end, null, $this->collection);
foreach ($this->collection as $item) {
$id = (int)$item->id;
- $this->spent[$id] = array_values($opsRepository->sumCollectedExpensesByBudget($expenses, $item, false));
+ $this->spent[$id] = array_values($opsRepository->sumCollectedExpensesByBudget($expenses, $item));
$this->pcSpent[$id] = array_values($opsRepository->sumCollectedExpensesByBudget($expenses, $item, true));
}
}
diff --git a/app/Support/JsonApi/Enrichments/BudgetLimitEnrichment.php b/app/Support/JsonApi/Enrichments/BudgetLimitEnrichment.php
index db1e248708..0df7aea164 100644
--- a/app/Support/JsonApi/Enrichments/BudgetLimitEnrichment.php
+++ b/app/Support/JsonApi/Enrichments/BudgetLimitEnrichment.php
@@ -41,7 +41,7 @@ use Illuminate\Support\Facades\Log;
class BudgetLimitEnrichment implements EnrichmentInterface
{
private Collection $collection;
- private bool $convertToPrimary = true; // @phpstan-ignore-line
+ private bool $convertToPrimary; // @phpstan-ignore-line
private array $currencies = [];
private array $currencyIds = [];
private Carbon $end;
@@ -120,14 +120,14 @@ class BudgetLimitEnrichment implements EnrichmentInterface
$repository = app(OperationsRepository::class);
$repository->setUser($this->user);
- $expenses = $repository->collectExpenses($this->start, $this->end, null, $budgets, null);
+ $expenses = $repository->collectExpenses($this->start, $this->end, null, $budgets);
/** @var BudgetLimit $budgetLimit */
foreach ($this->collection as $budgetLimit) {
Log::debug(sprintf('Filtering expenses for budget limit #%d (budget #%d)', $budgetLimit->id, $budgetLimit->budget_id));
$id = (int)$budgetLimit->id;
$filteredExpenses = $this->filterToBudget($expenses, $budgetLimit->budget_id);
- $filteredExpenses = $repository->sumCollectedExpenses($filteredExpenses, $budgetLimit->start_date, $budgetLimit->end_date, $budgetLimit->transactionCurrency, false);
+ $filteredExpenses = $repository->sumCollectedExpenses($filteredExpenses, $budgetLimit->start_date, $budgetLimit->end_date, $budgetLimit->transactionCurrency);
$this->expenses[$id] = array_values($filteredExpenses);
if (true === $this->convertToPrimary && $budgetLimit->transactionCurrency->id !== $this->primaryCurrency->id) {
diff --git a/app/Support/JsonApi/Enrichments/CategoryEnrichment.php b/app/Support/JsonApi/Enrichments/CategoryEnrichment.php
index b5ddd22c52..f470e1c111 100644
--- a/app/Support/JsonApi/Enrichments/CategoryEnrichment.php
+++ b/app/Support/JsonApi/Enrichments/CategoryEnrichment.php
@@ -145,11 +145,11 @@ class CategoryEnrichment implements EnrichmentInterface
$transfers = $opsRepository->collectTransfers($this->start, $this->end, null, $this->collection);
foreach ($this->collection as $item) {
$id = (int)$item->id;
- $this->spent[$id] = array_values($opsRepository->sumCollectedTransactionsByCategory($expenses, $item, 'negative', false));
+ $this->spent[$id] = array_values($opsRepository->sumCollectedTransactionsByCategory($expenses, $item, 'negative'));
$this->pcSpent[$id] = array_values($opsRepository->sumCollectedTransactionsByCategory($expenses, $item, 'negative', true));
- $this->earned[$id] = array_values($opsRepository->sumCollectedTransactionsByCategory($income, $item, 'positive', false));
+ $this->earned[$id] = array_values($opsRepository->sumCollectedTransactionsByCategory($income, $item, 'positive'));
$this->pcEarned[$id] = array_values($opsRepository->sumCollectedTransactionsByCategory($income, $item, 'positive', true));
- $this->transfers[$id] = array_values($opsRepository->sumCollectedTransactionsByCategory($transfers, $item, 'positive', false));
+ $this->transfers[$id] = array_values($opsRepository->sumCollectedTransactionsByCategory($transfers, $item, 'positive'));
$this->pcTransfers[$id] = array_values($opsRepository->sumCollectedTransactionsByCategory($transfers, $item, 'positive', true));
}
}
diff --git a/app/Support/JsonApi/Enrichments/PiggyBankEnrichment.php b/app/Support/JsonApi/Enrichments/PiggyBankEnrichment.php
index f1a79ad0fc..e51c110078 100644
--- a/app/Support/JsonApi/Enrichments/PiggyBankEnrichment.php
+++ b/app/Support/JsonApi/Enrichments/PiggyBankEnrichment.php
@@ -159,7 +159,9 @@ class PiggyBankEnrichment implements EnrichmentInterface
// get suggested per month.
$meta['save_per_month'] = Steam::bcround($this->getSuggestedMonthlyAmount($this->date, $item->target_date, $meta['target_amount'], $meta['current_amount']), $currency->decimal_places);
- $meta['pc_save_per_month'] = Steam::bcround($this->getSuggestedMonthlyAmount($this->date, $item->target_date, $meta['pc_target_amount'], $meta['pc_current_amount']), $currency->decimal_places);
+ if(null !== $meta['pc_current_amount']) {
+ $meta['pc_save_per_month'] = Steam::bcround($this->getSuggestedMonthlyAmount($this->date, $item->target_date, $meta['pc_target_amount'], $meta['pc_current_amount']), $currency->decimal_places);
+ }
$item->meta = $meta;
diff --git a/app/Support/JsonApi/Enrichments/RecurringEnrichment.php b/app/Support/JsonApi/Enrichments/RecurringEnrichment.php
index 7fdfc1c5dc..1ea71f1dc4 100644
--- a/app/Support/JsonApi/Enrichments/RecurringEnrichment.php
+++ b/app/Support/JsonApi/Enrichments/RecurringEnrichment.php
@@ -60,8 +60,8 @@ class RecurringEnrichment implements EnrichmentInterface
private Collection $collection;
// private array $transactionTypeIds = [];
// private array $transactionTypes = [];
- private bool $convertToPrimary = false;
- private array $currencies = [];
+ private bool $convertToPrimary;
+ private array $currencies = [];
private array $currencyIds = [];
private array $destinationAccountIds = [];
private array $foreignCurrencyIds = [];
diff --git a/app/Support/Models/BillDateCalculator.php b/app/Support/Models/BillDateCalculator.php
index 3d49c867a3..6b7cbd2243 100644
--- a/app/Support/Models/BillDateCalculator.php
+++ b/app/Support/Models/BillDateCalculator.php
@@ -98,7 +98,7 @@ class BillDateCalculator
$diffEOM = $daysUntilEOM - $nextUntilEOM;
if ($diffEOM > 0) {
Log::debug(sprintf('Bill start is %d days from the end of the month. nextExceptedMatch is %d days from the end of the month.', $daysUntilEOM, $nextUntilEOM));
- $nextExpectedMatch->subDays(1);
+ $nextExpectedMatch->subDays();
Log::debug(sprintf('Subtract %d days from next expected match, which is now %s', $diffEOM, $nextExpectedMatch->format('Y-m-d')));
}
}
diff --git a/app/Support/Observers/RecalculatesAvailableBudgetsTrait.php b/app/Support/Observers/RecalculatesAvailableBudgetsTrait.php
index 0c77493667..b4a774ea95 100644
--- a/app/Support/Observers/RecalculatesAvailableBudgetsTrait.php
+++ b/app/Support/Observers/RecalculatesAvailableBudgetsTrait.php
@@ -227,7 +227,7 @@ trait RecalculatesAvailableBudgetsTrait
}
// prep for next loop
- $current = app('navigation')->addPeriod($current, $viewRange, 0);
+ $current = app('navigation')->addPeriod($current, $viewRange);
}
}
}
diff --git a/app/Support/ParseDateString.php b/app/Support/ParseDateString.php
index df60be3d1d..45404e1952 100644
--- a/app/Support/ParseDateString.php
+++ b/app/Support/ParseDateString.php
@@ -30,6 +30,7 @@ use Carbon\Exceptions\InvalidFormatException;
use FireflyIII\Exceptions\FireflyException;
use Illuminate\Support\Facades\Log;
+use Safe\Exceptions\PcreException;
use function Safe\preg_match;
/**
@@ -72,8 +73,11 @@ class ParseDateString
}
/**
- * @throws FireflyException
+ * @param string $date
*
+ * @return Carbon
+ * @throws FireflyException
+ * @throws PcreException
* @SuppressWarnings("PHPMD.NPathComplexity")
*/
public function parseDate(string $date): Carbon
diff --git a/app/Support/Preferences.php b/app/Support/Preferences.php
index d622f1f66f..5f00a32036 100644
--- a/app/Support/Preferences.php
+++ b/app/Support/Preferences.php
@@ -231,7 +231,6 @@ class Preferences
}
/**
- * @throws FireflyException
*/
public function lastActivity(): string
{
diff --git a/app/Support/Report/Budget/BudgetReportGenerator.php b/app/Support/Report/Budget/BudgetReportGenerator.php
index 4de1c9d9a6..1bf9c81b3e 100644
--- a/app/Support/Report/Budget/BudgetReportGenerator.php
+++ b/app/Support/Report/Budget/BudgetReportGenerator.php
@@ -133,7 +133,6 @@ class BudgetReportGenerator
}
/**
- * @throws FireflyException
*/
public function setUser(User $user): void
{
diff --git a/app/Support/Repositories/Recurring/CalculateXOccurrencesSince.php b/app/Support/Repositories/Recurring/CalculateXOccurrencesSince.php
index 2fc216493d..9587ccc0f7 100644
--- a/app/Support/Repositories/Recurring/CalculateXOccurrencesSince.php
+++ b/app/Support/Repositories/Recurring/CalculateXOccurrencesSince.php
@@ -80,7 +80,7 @@ trait CalculateXOccurrencesSince
while ($total < $count) {
$domCorrected = min($dayOfMonth, $mutator->daysInMonth);
$mutator->day = $domCorrected;
- $mutator->setTime(0, 0, 0);
+ $mutator->setTime(0, 0);
if (0 === $attempts % $skipMod && $mutator->gte($afterDate)) {
Log::debug(sprintf('Mutator is now %s and is added to the list.', $mutator->toAtomString()));
$return[] = clone $mutator;
diff --git a/app/Support/Search/OperatorQuerySearch.php b/app/Support/Search/OperatorQuerySearch.php
index 5b2cc0776c..c9368d74af 100644
--- a/app/Support/Search/OperatorQuerySearch.php
+++ b/app/Support/Search/OperatorQuerySearch.php
@@ -370,7 +370,6 @@ class OperatorQuerySearch implements SearchInterface
}
/**
- * @throws FireflyException
*/
private function parseDateRange(string $type, string $value): array
{
diff --git a/app/Support/Search/QueryParser/GdbotsQueryParser.php b/app/Support/Search/QueryParser/GdbotsQueryParser.php
index e532901696..127dc475b5 100644
--- a/app/Support/Search/QueryParser/GdbotsQueryParser.php
+++ b/app/Support/Search/QueryParser/GdbotsQueryParser.php
@@ -31,6 +31,7 @@ use Gdbots\QueryParser\Node as GdbotsNode;
use Gdbots\QueryParser\QueryParser as BaseQueryParser;
use Illuminate\Support\Facades\Log;
use LogicException;
+use Safe\Exceptions\FilesystemException;
use TypeError;
use function Safe\fwrite;
@@ -45,7 +46,11 @@ class GdbotsQueryParser implements QueryParserInterface
}
/**
+ * @param string $query
+ *
+ * @return NodeGroup
* @throws FireflyException
+ * @throws FilesystemException
*/
public function parse(string $query): NodeGroup
{
diff --git a/app/Support/Steam.php b/app/Support/Steam.php
index 71d5e788f3..9488fe36fb 100644
--- a/app/Support/Steam.php
+++ b/app/Support/Steam.php
@@ -37,6 +37,8 @@ use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Str;
+use Psr\Container\ContainerExceptionInterface;
+use Psr\Container\NotFoundExceptionInterface;
use ValueError;
use function Safe\parse_url;
@@ -534,7 +536,6 @@ class Steam
}
/**
- * @throws FireflyException
*/
public function getHostName(string $ipAddress): string
{
@@ -557,7 +558,10 @@ class Steam
/**
* Get user's language.
*
+ * @return string
* @throws FireflyException
+ * @throws ContainerExceptionInterface
+ * @throws NotFoundExceptionInterface
*/
public function getLanguage(): string // get preference
{
diff --git a/app/Support/System/OAuthKeys.php b/app/Support/System/OAuthKeys.php
index 97bd74bd19..e4878d01cf 100644
--- a/app/Support/System/OAuthKeys.php
+++ b/app/Support/System/OAuthKeys.php
@@ -32,6 +32,7 @@ use Laravel\Passport\Console\KeysCommand;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
+use Safe\Exceptions\FilesystemException;
use function Safe\file_get_contents;
use function Safe\file_put_contents;
@@ -79,7 +80,11 @@ class OAuthKeys
}
/**
+ * @return bool
+ * @throws ContainerExceptionInterface
* @throws FireflyException
+ * @throws NotFoundExceptionInterface
+ * @throws FilesystemException
*/
public static function restoreKeysFromDB(): bool
{
diff --git a/app/Transformers/PiggyBankEventTransformer.php b/app/Transformers/PiggyBankEventTransformer.php
index a0a43ecc59..d5097b6136 100644
--- a/app/Transformers/PiggyBankEventTransformer.php
+++ b/app/Transformers/PiggyBankEventTransformer.php
@@ -36,7 +36,7 @@ use FireflyIII\Support\Facades\Steam;
class PiggyBankEventTransformer extends AbstractTransformer
{
private readonly TransactionCurrency $primaryCurrency;
- private bool $convertToPrimary = false;
+ private bool $convertToPrimary;
/**
* PiggyBankEventTransformer constructor.
diff --git a/app/Transformers/PiggyBankTransformer.php b/app/Transformers/PiggyBankTransformer.php
index 10c3379441..ccc7e70b00 100644
--- a/app/Transformers/PiggyBankTransformer.php
+++ b/app/Transformers/PiggyBankTransformer.php
@@ -47,7 +47,6 @@ class PiggyBankTransformer extends AbstractTransformer
/**
* Transform the piggy bank.
*
- * @throws FireflyException
*/
public function transform(PiggyBank $piggyBank): array
{
diff --git a/app/Transformers/RecurrenceTransformer.php b/app/Transformers/RecurrenceTransformer.php
index 9f3ce0c5f0..00c388fdcb 100644
--- a/app/Transformers/RecurrenceTransformer.php
+++ b/app/Transformers/RecurrenceTransformer.php
@@ -41,7 +41,6 @@ class RecurrenceTransformer extends AbstractTransformer
/**
* Transform the recurring transaction.
*
- * @throws FireflyException
*/
public function transform(Recurrence $recurrence): array
{
diff --git a/app/Transformers/UserTransformer.php b/app/Transformers/UserTransformer.php
index 18dc74d4b6..cff73173c2 100644
--- a/app/Transformers/UserTransformer.php
+++ b/app/Transformers/UserTransformer.php
@@ -38,7 +38,6 @@ class UserTransformer extends AbstractTransformer
/**
* Transform user.
*
- * @throws FireflyException
*/
public function transform(User $user): array
{
diff --git a/app/User.php b/app/User.php
index 3e2eccddf0..cc9e4b7d07 100644
--- a/app/User.php
+++ b/app/User.php
@@ -259,7 +259,6 @@ class User extends Authenticatable
$dbRolesIds = $dbRoles->pluck('id')->toArray();
$dbRolesTitles = $dbRoles->pluck('title')->toArray();
- /** @var Collection $groupMemberships */
$groupMemberships = $this->groupMemberships()->whereIn('user_role_id', $dbRolesIds)->where('user_group_id', $userGroup->id)->get();
if (0 === $groupMemberships->count()) {
app('log')->error(sprintf(
diff --git a/app/Validation/FireflyValidator.php b/app/Validation/FireflyValidator.php
index bb9bbd3198..e3d25b33f8 100644
--- a/app/Validation/FireflyValidator.php
+++ b/app/Validation/FireflyValidator.php
@@ -46,6 +46,9 @@ use PragmaRX\Google2FA\Exceptions\InvalidCharactersException;
use PragmaRX\Google2FA\Exceptions\SecretKeyTooShortException;
use PragmaRX\Google2FALaravel\Facade;
use Config;
+use Psr\Container\ContainerExceptionInterface;
+use Psr\Container\NotFoundExceptionInterface;
+use Safe\Exceptions\JsonException;
use ValueError;
use function Safe\preg_match;
@@ -62,10 +65,12 @@ class FireflyValidator extends Validator
* @param mixed $attribute
* @param mixed $value
*
+ * @return bool
* @throws IncompatibleWithGoogleAuthenticatorException
* @throws InvalidCharactersException
* @throws SecretKeyTooShortException
- *
+ * @throws ContainerExceptionInterface
+ * @throws NotFoundExceptionInterface
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function validate2faCode($attribute, $value): bool
@@ -628,6 +633,8 @@ class FireflyValidator extends Validator
* @param mixed $value
* @param mixed $parameters
*
+ * @return bool
+ * @throws JsonException
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function validateUniqueAccountNumberForUser($attribute, $value, $parameters): bool