diff --git a/app/Api/V1/Controllers/Autocomplete/TransactionTypeController.php b/app/Api/V1/Controllers/Autocomplete/TransactionTypeController.php index 36fdc0f296..84b7efc5e4 100644 --- a/app/Api/V1/Controllers/Autocomplete/TransactionTypeController.php +++ b/app/Api/V1/Controllers/Autocomplete/TransactionTypeController.php @@ -58,7 +58,6 @@ class TransactionTypeController extends Controller * @param AutocompleteRequest $request * * @return JsonResponse - */ public function transactionTypes(AutocompleteRequest $request): JsonResponse { diff --git a/app/Api/V1/Controllers/Models/Account/DestroyController.php b/app/Api/V1/Controllers/Models/Account/DestroyController.php index c87276d1ad..a665b0ac50 100644 --- a/app/Api/V1/Controllers/Models/Account/DestroyController.php +++ b/app/Api/V1/Controllers/Models/Account/DestroyController.php @@ -63,7 +63,6 @@ class DestroyController extends Controller * * @param Account $account * - * @return JsonResponse */ public function destroy(Account $account): JsonResponse diff --git a/app/Api/V1/Controllers/Models/Account/ListController.php b/app/Api/V1/Controllers/Models/Account/ListController.php index 63c409b04f..859138c306 100644 --- a/app/Api/V1/Controllers/Models/Account/ListController.php +++ b/app/Api/V1/Controllers/Models/Account/ListController.php @@ -76,7 +76,6 @@ class ListController extends Controller * @param Account $account * * @return JsonResponse - * @throws FireflyException */ public function attachments(Account $account): JsonResponse @@ -110,7 +109,6 @@ class ListController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function piggyBanks(Account $account): JsonResponse { @@ -145,7 +143,6 @@ class ListController extends Controller * * Show all transaction groups related to the account. * - * * @param Request $request * @param Account $account diff --git a/app/Api/V1/Controllers/Models/Account/ShowController.php b/app/Api/V1/Controllers/Models/Account/ShowController.php index b8f53bef12..31dea2c0a2 100644 --- a/app/Api/V1/Controllers/Models/Account/ShowController.php +++ b/app/Api/V1/Controllers/Models/Account/ShowController.php @@ -75,7 +75,6 @@ class ShowController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function index(Request $request): JsonResponse { diff --git a/app/Api/V1/Controllers/Models/Attachment/DestroyController.php b/app/Api/V1/Controllers/Models/Attachment/DestroyController.php index f9a0f3caa7..6037ce9a3f 100644 --- a/app/Api/V1/Controllers/Models/Attachment/DestroyController.php +++ b/app/Api/V1/Controllers/Models/Attachment/DestroyController.php @@ -64,7 +64,6 @@ class DestroyController extends Controller * * Remove the specified resource from storage. * - * * @param Attachment $attachment * diff --git a/app/Api/V1/Controllers/Models/Attachment/ShowController.php b/app/Api/V1/Controllers/Models/Attachment/ShowController.php index 7483eb1829..99ab07dc49 100644 --- a/app/Api/V1/Controllers/Models/Attachment/ShowController.php +++ b/app/Api/V1/Controllers/Models/Attachment/ShowController.php @@ -73,7 +73,6 @@ class ShowController extends Controller * * @param Attachment $attachment * - * @return LaravelResponse * @throws FireflyException */ @@ -118,7 +117,6 @@ class ShowController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function index(): JsonResponse { diff --git a/app/Api/V1/Controllers/Models/Attachment/StoreController.php b/app/Api/V1/Controllers/Models/Attachment/StoreController.php index 179283af43..ff509254ac 100644 --- a/app/Api/V1/Controllers/Models/Attachment/StoreController.php +++ b/app/Api/V1/Controllers/Models/Attachment/StoreController.php @@ -95,7 +95,6 @@ class StoreController extends Controller /** * Upload an attachment. * - * * @param Request $request * @param Attachment $attachment diff --git a/app/Api/V1/Controllers/Models/AvailableBudget/ShowController.php b/app/Api/V1/Controllers/Models/AvailableBudget/ShowController.php index f41fc16b2a..69ad50f904 100644 --- a/app/Api/V1/Controllers/Models/AvailableBudget/ShowController.php +++ b/app/Api/V1/Controllers/Models/AvailableBudget/ShowController.php @@ -70,7 +70,6 @@ class ShowController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function index(): JsonResponse { @@ -110,7 +109,6 @@ class ShowController extends Controller * @param AvailableBudget $availableBudget * * @return JsonResponse - */ public function show(AvailableBudget $availableBudget): JsonResponse { diff --git a/app/Api/V1/Controllers/Models/Bill/DestroyController.php b/app/Api/V1/Controllers/Models/Bill/DestroyController.php index c2e89623ad..7fed9a0d6e 100644 --- a/app/Api/V1/Controllers/Models/Bill/DestroyController.php +++ b/app/Api/V1/Controllers/Models/Bill/DestroyController.php @@ -62,7 +62,6 @@ class DestroyController extends Controller * @param Bill $bill * * @return JsonResponse - */ public function destroy(Bill $bill): JsonResponse { diff --git a/app/Api/V1/Controllers/Models/Bill/ListController.php b/app/Api/V1/Controllers/Models/Bill/ListController.php index 2386e4920d..d4a9702d29 100644 --- a/app/Api/V1/Controllers/Models/Bill/ListController.php +++ b/app/Api/V1/Controllers/Models/Bill/ListController.php @@ -76,7 +76,6 @@ class ListController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function attachments(Bill $bill): JsonResponse { @@ -111,7 +110,6 @@ class ListController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function rules(Bill $bill): JsonResponse { @@ -150,7 +148,6 @@ class ListController extends Controller * * @return JsonResponse * @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 02d9a57f09..f2d68fcdc8 100644 --- a/app/Api/V1/Controllers/Models/Bill/ShowController.php +++ b/app/Api/V1/Controllers/Models/Bill/ShowController.php @@ -67,7 +67,6 @@ class ShowController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function index(): JsonResponse { @@ -98,7 +97,6 @@ class ShowController extends Controller * @param Bill $bill * * @return JsonResponse - */ public function show(Bill $bill): JsonResponse { diff --git a/app/Api/V1/Controllers/Models/Budget/DestroyController.php b/app/Api/V1/Controllers/Models/Budget/DestroyController.php index 5b7313058e..30c3349e3a 100644 --- a/app/Api/V1/Controllers/Models/Budget/DestroyController.php +++ b/app/Api/V1/Controllers/Models/Budget/DestroyController.php @@ -62,7 +62,6 @@ class DestroyController extends Controller * @param Budget $budget * * @return JsonResponse - */ public function destroy(Budget $budget): JsonResponse { diff --git a/app/Api/V1/Controllers/Models/Budget/ListController.php b/app/Api/V1/Controllers/Models/Budget/ListController.php index a6b2cfc73a..9ee4c5a335 100644 --- a/app/Api/V1/Controllers/Models/Budget/ListController.php +++ b/app/Api/V1/Controllers/Models/Budget/ListController.php @@ -78,7 +78,6 @@ class ListController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function attachments(Budget $budget): JsonResponse { @@ -113,7 +112,6 @@ class ListController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function budgetLimits(Budget $budget): JsonResponse { @@ -147,7 +145,6 @@ class ListController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function transactions(Request $request, Budget $budget): JsonResponse { @@ -211,7 +208,6 @@ class ListController extends Controller * * @return JsonResponse * @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 8715fcb8ca..0dd71f0518 100644 --- a/app/Api/V1/Controllers/Models/Budget/ShowController.php +++ b/app/Api/V1/Controllers/Models/Budget/ShowController.php @@ -71,7 +71,6 @@ class ShowController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function index(): JsonResponse { @@ -105,7 +104,6 @@ class ShowController extends Controller * @param Budget $budget * * @return JsonResponse - */ public function show(Budget $budget): JsonResponse { diff --git a/app/Api/V1/Controllers/Models/BudgetLimit/DestroyController.php b/app/Api/V1/Controllers/Models/BudgetLimit/DestroyController.php index e828e9060b..8d71493396 100644 --- a/app/Api/V1/Controllers/Models/BudgetLimit/DestroyController.php +++ b/app/Api/V1/Controllers/Models/BudgetLimit/DestroyController.php @@ -69,7 +69,6 @@ class DestroyController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function destroy(Budget $budget, BudgetLimit $budgetLimit): JsonResponse { diff --git a/app/Api/V1/Controllers/Models/BudgetLimit/ListController.php b/app/Api/V1/Controllers/Models/BudgetLimit/ListController.php index a5933599a6..58041013be 100644 --- a/app/Api/V1/Controllers/Models/BudgetLimit/ListController.php +++ b/app/Api/V1/Controllers/Models/BudgetLimit/ListController.php @@ -77,7 +77,6 @@ class ListController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function transactions(Request $request, Budget $budget, BudgetLimit $budgetLimit): JsonResponse { diff --git a/app/Api/V1/Controllers/Models/BudgetLimit/ShowController.php b/app/Api/V1/Controllers/Models/BudgetLimit/ShowController.php index d1990f5cc0..6f26c13bab 100644 --- a/app/Api/V1/Controllers/Models/BudgetLimit/ShowController.php +++ b/app/Api/V1/Controllers/Models/BudgetLimit/ShowController.php @@ -80,7 +80,6 @@ class ShowController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function index(Request $request, Budget $budget): JsonResponse { @@ -113,7 +112,6 @@ class ShowController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function indexAll(DateRequest $request): JsonResponse { diff --git a/app/Api/V1/Controllers/Models/Category/DestroyController.php b/app/Api/V1/Controllers/Models/Category/DestroyController.php index 84ce43eca9..02952c8697 100644 --- a/app/Api/V1/Controllers/Models/Category/DestroyController.php +++ b/app/Api/V1/Controllers/Models/Category/DestroyController.php @@ -62,7 +62,6 @@ class DestroyController extends Controller * @param Category $category * * @return JsonResponse - */ public function destroy(Category $category): JsonResponse { diff --git a/app/Api/V1/Controllers/Models/Category/ListController.php b/app/Api/V1/Controllers/Models/Category/ListController.php index aca21976c9..1946f25a8d 100644 --- a/app/Api/V1/Controllers/Models/Category/ListController.php +++ b/app/Api/V1/Controllers/Models/Category/ListController.php @@ -73,7 +73,6 @@ class ListController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function attachments(Category $category): JsonResponse { @@ -110,7 +109,6 @@ class ListController extends Controller * * @return JsonResponse * @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 01b36dbe4c..51ddcdbeec 100644 --- a/app/Api/V1/Controllers/Models/Category/ShowController.php +++ b/app/Api/V1/Controllers/Models/Category/ShowController.php @@ -67,7 +67,6 @@ class ShowController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function index(): JsonResponse { @@ -103,7 +102,6 @@ class ShowController extends Controller * @param Category $category * * @return JsonResponse - */ public function show(Category $category): JsonResponse { diff --git a/app/Api/V1/Controllers/Models/ObjectGroup/DestroyController.php b/app/Api/V1/Controllers/Models/ObjectGroup/DestroyController.php index 1cac08ed80..fb31ca6d6d 100644 --- a/app/Api/V1/Controllers/Models/ObjectGroup/DestroyController.php +++ b/app/Api/V1/Controllers/Models/ObjectGroup/DestroyController.php @@ -64,7 +64,6 @@ class DestroyController extends Controller * * @param ObjectGroup $objectGroup * - * @return JsonResponse */ public function destroy(ObjectGroup $objectGroup): JsonResponse diff --git a/app/Api/V1/Controllers/Models/ObjectGroup/ListController.php b/app/Api/V1/Controllers/Models/ObjectGroup/ListController.php index 2e702f457e..09e1e1b68d 100644 --- a/app/Api/V1/Controllers/Models/ObjectGroup/ListController.php +++ b/app/Api/V1/Controllers/Models/ObjectGroup/ListController.php @@ -72,7 +72,6 @@ class ListController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function bills(ObjectGroup $objectGroup): JsonResponse { @@ -108,7 +107,6 @@ class ListController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function piggyBanks(ObjectGroup $objectGroup): JsonResponse { diff --git a/app/Api/V1/Controllers/Models/ObjectGroup/ShowController.php b/app/Api/V1/Controllers/Models/ObjectGroup/ShowController.php index 3f4d8d6e01..a6764b62b3 100644 --- a/app/Api/V1/Controllers/Models/ObjectGroup/ShowController.php +++ b/app/Api/V1/Controllers/Models/ObjectGroup/ShowController.php @@ -73,7 +73,6 @@ class ShowController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function index(Request $request): JsonResponse { diff --git a/app/Api/V1/Controllers/Models/PiggyBank/DestroyController.php b/app/Api/V1/Controllers/Models/PiggyBank/DestroyController.php index d2cc4930ac..d7995df2e4 100644 --- a/app/Api/V1/Controllers/Models/PiggyBank/DestroyController.php +++ b/app/Api/V1/Controllers/Models/PiggyBank/DestroyController.php @@ -62,7 +62,6 @@ class DestroyController extends Controller * @param PiggyBank $piggyBank * * @return JsonResponse - */ public function destroy(PiggyBank $piggyBank): JsonResponse { diff --git a/app/Api/V1/Controllers/Models/PiggyBank/ListController.php b/app/Api/V1/Controllers/Models/PiggyBank/ListController.php index c0bcadf28c..21bff011c3 100644 --- a/app/Api/V1/Controllers/Models/PiggyBank/ListController.php +++ b/app/Api/V1/Controllers/Models/PiggyBank/ListController.php @@ -67,7 +67,6 @@ class ListController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function attachments(PiggyBank $piggyBank): JsonResponse { @@ -102,7 +101,6 @@ class ListController extends Controller * * @return JsonResponse * @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 17539575ec..c2f72e1779 100644 --- a/app/Api/V1/Controllers/Models/PiggyBank/ShowController.php +++ b/app/Api/V1/Controllers/Models/PiggyBank/ShowController.php @@ -67,7 +67,6 @@ class ShowController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function index(): JsonResponse { @@ -103,7 +102,6 @@ class ShowController extends Controller * @param PiggyBank $piggyBank * * @return JsonResponse - */ public function show(PiggyBank $piggyBank): JsonResponse { diff --git a/app/Api/V1/Controllers/Models/Recurrence/DestroyController.php b/app/Api/V1/Controllers/Models/Recurrence/DestroyController.php index 9b0abb146f..48df6cf188 100644 --- a/app/Api/V1/Controllers/Models/Recurrence/DestroyController.php +++ b/app/Api/V1/Controllers/Models/Recurrence/DestroyController.php @@ -62,7 +62,6 @@ class DestroyController extends Controller * @param Recurrence $recurrence * * @return JsonResponse - */ public function destroy(Recurrence $recurrence): JsonResponse { diff --git a/app/Api/V1/Controllers/Models/Recurrence/ListController.php b/app/Api/V1/Controllers/Models/Recurrence/ListController.php index d18fa29d7d..0643229545 100644 --- a/app/Api/V1/Controllers/Models/Recurrence/ListController.php +++ b/app/Api/V1/Controllers/Models/Recurrence/ListController.php @@ -74,7 +74,6 @@ class ListController extends Controller * * @return JsonResponse * @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 ba4536338e..91887a75f4 100644 --- a/app/Api/V1/Controllers/Models/Recurrence/ShowController.php +++ b/app/Api/V1/Controllers/Models/Recurrence/ShowController.php @@ -67,7 +67,6 @@ class ShowController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function index(): JsonResponse { @@ -104,7 +103,6 @@ class ShowController extends Controller * @param Recurrence $recurrence * * @return JsonResponse - */ public function show(Recurrence $recurrence): JsonResponse { diff --git a/app/Api/V1/Controllers/Models/Rule/DestroyController.php b/app/Api/V1/Controllers/Models/Rule/DestroyController.php index bc550bbb41..2b7e606e1a 100644 --- a/app/Api/V1/Controllers/Models/Rule/DestroyController.php +++ b/app/Api/V1/Controllers/Models/Rule/DestroyController.php @@ -66,7 +66,6 @@ class DestroyController extends Controller * @param Rule $rule * * @return JsonResponse - */ public function destroy(Rule $rule): JsonResponse { diff --git a/app/Api/V1/Controllers/Models/Rule/ShowController.php b/app/Api/V1/Controllers/Models/Rule/ShowController.php index 2c60911989..f11bf6199b 100644 --- a/app/Api/V1/Controllers/Models/Rule/ShowController.php +++ b/app/Api/V1/Controllers/Models/Rule/ShowController.php @@ -71,7 +71,6 @@ class ShowController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function index(): JsonResponse { @@ -108,7 +107,6 @@ class ShowController extends Controller * @param Rule $rule * * @return JsonResponse - */ public function show(Rule $rule): JsonResponse { diff --git a/app/Api/V1/Controllers/Models/RuleGroup/DestroyController.php b/app/Api/V1/Controllers/Models/RuleGroup/DestroyController.php index 9312e561f1..d53f488102 100644 --- a/app/Api/V1/Controllers/Models/RuleGroup/DestroyController.php +++ b/app/Api/V1/Controllers/Models/RuleGroup/DestroyController.php @@ -66,7 +66,6 @@ class DestroyController extends Controller * @param RuleGroup $ruleGroup * * @return JsonResponse - */ public function destroy(RuleGroup $ruleGroup): JsonResponse { diff --git a/app/Api/V1/Controllers/Models/RuleGroup/ListController.php b/app/Api/V1/Controllers/Models/RuleGroup/ListController.php index 2145ecb8fc..d549bc841b 100644 --- a/app/Api/V1/Controllers/Models/RuleGroup/ListController.php +++ b/app/Api/V1/Controllers/Models/RuleGroup/ListController.php @@ -70,7 +70,6 @@ class ListController extends Controller * * @return JsonResponse * @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 6a74f88c9e..6d648339ee 100644 --- a/app/Api/V1/Controllers/Models/RuleGroup/ShowController.php +++ b/app/Api/V1/Controllers/Models/RuleGroup/ShowController.php @@ -70,7 +70,6 @@ class ShowController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function index(): JsonResponse { @@ -106,7 +105,6 @@ class ShowController extends Controller * @param RuleGroup $ruleGroup * * @return JsonResponse - */ public function show(RuleGroup $ruleGroup): JsonResponse { diff --git a/app/Api/V1/Controllers/Models/Tag/DestroyController.php b/app/Api/V1/Controllers/Models/Tag/DestroyController.php index fdd6279af5..0ed01b99b0 100644 --- a/app/Api/V1/Controllers/Models/Tag/DestroyController.php +++ b/app/Api/V1/Controllers/Models/Tag/DestroyController.php @@ -66,7 +66,6 @@ class DestroyController extends Controller * @param Tag $tag * * @return JsonResponse - */ public function destroy(Tag $tag): JsonResponse { diff --git a/app/Api/V1/Controllers/Models/Tag/ListController.php b/app/Api/V1/Controllers/Models/Tag/ListController.php index 6c0b24a542..31c931a955 100644 --- a/app/Api/V1/Controllers/Models/Tag/ListController.php +++ b/app/Api/V1/Controllers/Models/Tag/ListController.php @@ -76,7 +76,6 @@ class ListController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function attachments(Tag $tag): JsonResponse { @@ -112,7 +111,6 @@ class ListController extends Controller * * @return JsonResponse * @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 f8cac40f39..d103698dae 100644 --- a/app/Api/V1/Controllers/Models/Tag/ShowController.php +++ b/app/Api/V1/Controllers/Models/Tag/ShowController.php @@ -71,7 +71,6 @@ class ShowController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function index(): JsonResponse { @@ -107,7 +106,6 @@ class ShowController extends Controller * @param Tag $tag * * @return JsonResponse - */ public function show(Tag $tag): JsonResponse { diff --git a/app/Api/V1/Controllers/Models/Transaction/DestroyController.php b/app/Api/V1/Controllers/Models/Transaction/DestroyController.php index e6bf2148d7..3076ac2c7b 100644 --- a/app/Api/V1/Controllers/Models/Transaction/DestroyController.php +++ b/app/Api/V1/Controllers/Models/Transaction/DestroyController.php @@ -76,7 +76,6 @@ class DestroyController extends Controller * @param TransactionGroup $transactionGroup * * @return JsonResponse - */ public function destroy(TransactionGroup $transactionGroup): JsonResponse { @@ -116,7 +115,6 @@ class DestroyController extends Controller * * @param TransactionJournal $transactionJournal * - * @return JsonResponse */ public function destroyJournal(TransactionJournal $transactionJournal): JsonResponse diff --git a/app/Api/V1/Controllers/Models/Transaction/ListController.php b/app/Api/V1/Controllers/Models/Transaction/ListController.php index dff8789088..8d47934687 100644 --- a/app/Api/V1/Controllers/Models/Transaction/ListController.php +++ b/app/Api/V1/Controllers/Models/Transaction/ListController.php @@ -74,7 +74,6 @@ class ListController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function attachments(TransactionGroup $transactionGroup): JsonResponse { @@ -110,7 +109,6 @@ class ListController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function piggyBankEvents(TransactionGroup $transactionGroup): JsonResponse { @@ -149,7 +147,6 @@ class ListController extends Controller * * @return JsonResponse * @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 90d5f18157..d2f796392b 100644 --- a/app/Api/V1/Controllers/Models/Transaction/ShowController.php +++ b/app/Api/V1/Controllers/Models/Transaction/ShowController.php @@ -55,7 +55,6 @@ class ShowController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function index(Request $request): JsonResponse { @@ -107,7 +106,6 @@ class ShowController extends Controller * @param TransactionJournal $transactionJournal * * @return JsonResponse - */ public function showJournal(TransactionJournal $transactionJournal): JsonResponse { @@ -123,7 +121,6 @@ class ShowController extends Controller * @param TransactionGroup $transactionGroup * * @return JsonResponse - */ public function show(TransactionGroup $transactionGroup): JsonResponse { diff --git a/app/Api/V1/Controllers/Models/TransactionCurrency/DestroyController.php b/app/Api/V1/Controllers/Models/TransactionCurrency/DestroyController.php index 0a85e77d7d..a5b89d7738 100644 --- a/app/Api/V1/Controllers/Models/TransactionCurrency/DestroyController.php +++ b/app/Api/V1/Controllers/Models/TransactionCurrency/DestroyController.php @@ -39,7 +39,7 @@ use Validator; class DestroyController extends Controller { private CurrencyRepositoryInterface $repository; - private UserRepositoryInterface $userRepository; + private UserRepositoryInterface $userRepository; /** * CurrencyRepository constructor. @@ -51,7 +51,7 @@ class DestroyController extends Controller parent::__construct(); $this->middleware( function ($request, $next) { - $this->repository = app(CurrencyRepositoryInterface::class); + $this->repository = app(CurrencyRepositoryInterface::class); $this->userRepository = app(UserRepositoryInterface::class); $this->repository->setUser(auth()->user()); @@ -70,7 +70,6 @@ class DestroyController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function destroy(TransactionCurrency $currency): JsonResponse { diff --git a/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php b/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php index 0761cda12f..bca8c01b2f 100644 --- a/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php +++ b/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php @@ -41,7 +41,6 @@ use FireflyIII\Repositories\Budget\BudgetLimitRepositoryInterface; use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Repositories\Recurring\RecurringRepositoryInterface; use FireflyIII\Repositories\Rule\RuleRepositoryInterface; -use FireflyIII\Repositories\User\UserRepositoryInterface; use FireflyIII\Support\Http\Api\AccountFilter; use FireflyIII\Support\Http\Api\TransactionFilter; use FireflyIII\Transformers\AccountTransformer; @@ -67,6 +66,7 @@ class ListController extends Controller use TransactionFilter; private CurrencyRepositoryInterface $repository; + /** * CurrencyRepository constructor. * @@ -77,7 +77,7 @@ class ListController extends Controller parent::__construct(); $this->middleware( function ($request, $next) { - $this->repository = app(CurrencyRepositoryInterface::class); + $this->repository = app(CurrencyRepositoryInterface::class); $this->repository->setUser(auth()->user()); return $next($request); @@ -95,7 +95,6 @@ class ListController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function accounts(Request $request, TransactionCurrency $currency): JsonResponse { @@ -149,7 +148,6 @@ class ListController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function availableBudgets(TransactionCurrency $currency): JsonResponse { @@ -188,7 +186,6 @@ class ListController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function bills(TransactionCurrency $currency): JsonResponse { @@ -232,7 +229,6 @@ class ListController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function budgetLimits(TransactionCurrency $currency): JsonResponse { @@ -267,7 +263,6 @@ class ListController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function recurrences(TransactionCurrency $currency): JsonResponse { @@ -320,7 +315,6 @@ class ListController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function rules(TransactionCurrency $currency): JsonResponse { @@ -374,7 +368,6 @@ class ListController extends Controller * * @return JsonResponse * @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 f2f8106738..c94e9cb35b 100644 --- a/app/Api/V1/Controllers/Models/TransactionCurrency/ShowController.php +++ b/app/Api/V1/Controllers/Models/TransactionCurrency/ShowController.php @@ -75,7 +75,6 @@ class ShowController extends Controller * @return JsonResponse * @throws FireflyException * @throws JsonException - */ public function index(): JsonResponse { @@ -111,7 +110,6 @@ class ShowController extends Controller * @return JsonResponse * @throws FireflyException * @throws JsonException - */ public function show(TransactionCurrency $currency): JsonResponse { @@ -137,7 +135,6 @@ class ShowController extends Controller * @return JsonResponse * @throws FireflyException * @throws JsonException - */ public function showDefault(): JsonResponse { diff --git a/app/Api/V1/Controllers/Models/TransactionCurrency/UpdateController.php b/app/Api/V1/Controllers/Models/TransactionCurrency/UpdateController.php index f749a2b925..2789cd0df2 100644 --- a/app/Api/V1/Controllers/Models/TransactionCurrency/UpdateController.php +++ b/app/Api/V1/Controllers/Models/TransactionCurrency/UpdateController.php @@ -29,7 +29,6 @@ use FireflyIII\Api\V1\Requests\Models\TransactionCurrency\UpdateRequest; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\TransactionCurrency; use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; -use FireflyIII\Repositories\User\UserRepositoryInterface; use FireflyIII\Support\Http\Api\AccountFilter; use FireflyIII\Support\Http\Api\TransactionFilter; use FireflyIII\Transformers\CurrencyTransformer; @@ -76,7 +75,6 @@ class UpdateController extends Controller * @return JsonResponse * @throws FireflyException * @throws JsonException - */ public function disable(TransactionCurrency $currency): JsonResponse { @@ -109,7 +107,6 @@ class UpdateController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function makeDefault(TransactionCurrency $currency): JsonResponse { @@ -142,7 +139,6 @@ class UpdateController extends Controller * @return JsonResponse * @throws FireflyException * @throws JsonException - */ public function enable(TransactionCurrency $currency): JsonResponse { diff --git a/app/Api/V1/Controllers/Models/TransactionLink/DestroyController.php b/app/Api/V1/Controllers/Models/TransactionLink/DestroyController.php index c09fade3da..cbc4b1bf40 100644 --- a/app/Api/V1/Controllers/Models/TransactionLink/DestroyController.php +++ b/app/Api/V1/Controllers/Models/TransactionLink/DestroyController.php @@ -65,7 +65,6 @@ class DestroyController extends Controller * @param TransactionJournalLink $link * * @return JsonResponse - */ public function destroy(TransactionJournalLink $link): JsonResponse { diff --git a/app/Api/V1/Controllers/Models/TransactionLink/ShowController.php b/app/Api/V1/Controllers/Models/TransactionLink/ShowController.php index d3631ea9ac..8c69c1d8eb 100644 --- a/app/Api/V1/Controllers/Models/TransactionLink/ShowController.php +++ b/app/Api/V1/Controllers/Models/TransactionLink/ShowController.php @@ -73,7 +73,6 @@ class ShowController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function index(Request $request): JsonResponse { @@ -114,7 +113,6 @@ class ShowController extends Controller * @param TransactionJournalLink $journalLink * * @return JsonResponse - */ public function show(TransactionJournalLink $journalLink): JsonResponse { diff --git a/app/Api/V1/Controllers/Models/TransactionLinkType/ListController.php b/app/Api/V1/Controllers/Models/TransactionLinkType/ListController.php index 872e1f5c60..7891f4709f 100644 --- a/app/Api/V1/Controllers/Models/TransactionLinkType/ListController.php +++ b/app/Api/V1/Controllers/Models/TransactionLinkType/ListController.php @@ -29,7 +29,6 @@ use FireflyIII\Exceptions\FireflyException; use FireflyIII\Helpers\Collector\GroupCollectorInterface; use FireflyIII\Models\LinkType; use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface; -use FireflyIII\Repositories\User\UserRepositoryInterface; use FireflyIII\Support\Http\Api\TransactionFilter; use FireflyIII\Transformers\TransactionGroupTransformer; use FireflyIII\User; @@ -58,8 +57,8 @@ class ListController extends Controller $this->middleware( function ($request, $next) { /** @var User $user */ - $user = auth()->user(); - $this->repository = app(LinkTypeRepositoryInterface::class); + $user = auth()->user(); + $this->repository = app(LinkTypeRepositoryInterface::class); $this->repository->setUser($user); return $next($request); @@ -76,7 +75,6 @@ class ListController extends Controller * * @return JsonResponse * @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 2890aae7dc..aa011d8d46 100644 --- a/app/Api/V1/Controllers/Models/TransactionLinkType/ShowController.php +++ b/app/Api/V1/Controllers/Models/TransactionLinkType/ShowController.php @@ -28,7 +28,6 @@ use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\LinkType; use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface; -use FireflyIII\Repositories\User\UserRepositoryInterface; use FireflyIII\Support\Http\Api\TransactionFilter; use FireflyIII\Transformers\LinkTypeTransformer; use FireflyIII\User; @@ -58,8 +57,8 @@ class ShowController extends Controller $this->middleware( function ($request, $next) { /** @var User $user */ - $user = auth()->user(); - $this->repository = app(LinkTypeRepositoryInterface::class); + $user = auth()->user(); + $this->repository = app(LinkTypeRepositoryInterface::class); $this->repository->setUser($user); return $next($request); @@ -74,7 +73,6 @@ class ShowController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function index(): JsonResponse { @@ -110,7 +108,6 @@ class ShowController extends Controller * @param LinkType $linkType * * @return JsonResponse - */ public function show(LinkType $linkType): JsonResponse { diff --git a/app/Api/V1/Controllers/Summary/BasicController.php b/app/Api/V1/Controllers/Summary/BasicController.php index 2f1e4e75bc..21f44fd12c 100644 --- a/app/Api/V1/Controllers/Summary/BasicController.php +++ b/app/Api/V1/Controllers/Summary/BasicController.php @@ -360,7 +360,9 @@ class BasicController extends Controller /** @var NetWorthInterface $netWorthHelper */ $netWorthHelper = app(NetWorthInterface::class); $netWorthHelper->setUser($user); - $allAccounts = $this->accountRepository->getActiveAccountsByType([AccountType::ASSET, AccountType::DEFAULT, AccountType::LOAN, AccountType::MORTGAGE, AccountType::DEBT]); + $allAccounts = $this->accountRepository->getActiveAccountsByType( + [AccountType::ASSET, AccountType::DEFAULT, AccountType::LOAN, AccountType::MORTGAGE, AccountType::DEBT] + ); // filter list on preference of being included. $filtered = $allAccounts->filter( diff --git a/app/Api/V1/Controllers/System/AboutController.php b/app/Api/V1/Controllers/System/AboutController.php index dd3347c23f..390309d991 100644 --- a/app/Api/V1/Controllers/System/AboutController.php +++ b/app/Api/V1/Controllers/System/AboutController.php @@ -33,7 +33,6 @@ use League\Fractal\Resource\Item; /** * Returns basic information about this installation. * - * Class AboutController. */ class AboutController extends Controller diff --git a/app/Api/V1/Controllers/System/UserController.php b/app/Api/V1/Controllers/System/UserController.php index dbb744a92e..3c0f84b369 100644 --- a/app/Api/V1/Controllers/System/UserController.php +++ b/app/Api/V1/Controllers/System/UserController.php @@ -72,7 +72,6 @@ class UserController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function destroy(User $user): JsonResponse { @@ -98,7 +97,6 @@ class UserController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function index(): JsonResponse { @@ -135,7 +133,6 @@ class UserController extends Controller * @param User $user * * @return JsonResponse - */ public function show(User $user): JsonResponse { @@ -191,7 +188,7 @@ class UserController extends Controller */ public function update(UserUpdateRequest $request, User $user): JsonResponse { - $data = $request->getAll(); + $data = $request->getAll(); // can only update 'blocked' when user is admin. if (!$this->repository->hasRole(auth()->user(), 'owner')) { diff --git a/app/Api/V1/Controllers/User/PreferencesController.php b/app/Api/V1/Controllers/User/PreferencesController.php index d49e2cd752..0934b3982f 100644 --- a/app/Api/V1/Controllers/User/PreferencesController.php +++ b/app/Api/V1/Controllers/User/PreferencesController.php @@ -52,7 +52,6 @@ class PreferencesController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function index(): JsonResponse { @@ -85,7 +84,6 @@ class PreferencesController extends Controller * @param Preference $preference * * @return JsonResponse - */ public function show(Preference $preference): JsonResponse { diff --git a/app/Api/V1/Controllers/Webhook/AttemptController.php b/app/Api/V1/Controllers/Webhook/AttemptController.php index 2e856bb105..226416512a 100644 --- a/app/Api/V1/Controllers/Webhook/AttemptController.php +++ b/app/Api/V1/Controllers/Webhook/AttemptController.php @@ -45,7 +45,6 @@ class AttemptController extends Controller private WebhookRepositoryInterface $repository; /** - */ public function __construct() { diff --git a/app/Api/V1/Controllers/Webhook/DestroyController.php b/app/Api/V1/Controllers/Webhook/DestroyController.php index b7db2796ec..13bb023c95 100644 --- a/app/Api/V1/Controllers/Webhook/DestroyController.php +++ b/app/Api/V1/Controllers/Webhook/DestroyController.php @@ -40,7 +40,6 @@ class DestroyController extends Controller private WebhookRepositoryInterface $repository; /** - */ public function __construct() { @@ -64,7 +63,6 @@ class DestroyController extends Controller * @param Webhook $webhook * * @return JsonResponse - */ public function destroy(Webhook $webhook): JsonResponse { @@ -86,7 +84,6 @@ class DestroyController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function destroyAttempt(Webhook $webhook, WebhookMessage $message, WebhookAttempt $attempt): JsonResponse { @@ -114,7 +111,6 @@ class DestroyController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function destroyMessage(Webhook $webhook, WebhookMessage $message): JsonResponse { diff --git a/app/Api/V1/Controllers/Webhook/MessageController.php b/app/Api/V1/Controllers/Webhook/MessageController.php index d94a936c4f..2560bf7437 100644 --- a/app/Api/V1/Controllers/Webhook/MessageController.php +++ b/app/Api/V1/Controllers/Webhook/MessageController.php @@ -41,7 +41,6 @@ class MessageController extends Controller private WebhookRepositoryInterface $repository; /** - */ public function __construct() { diff --git a/app/Api/V1/Controllers/Webhook/ShowController.php b/app/Api/V1/Controllers/Webhook/ShowController.php index 1a6f43db10..9857b2e074 100644 --- a/app/Api/V1/Controllers/Webhook/ShowController.php +++ b/app/Api/V1/Controllers/Webhook/ShowController.php @@ -24,9 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Api\V1\Controllers\Webhook; use FireflyIII\Api\V1\Controllers\Controller; -use FireflyIII\Enums\WebhookTrigger; use FireflyIII\Events\RequestedSendWebhookMessages; -use FireflyIII\Events\StoredTransactionGroup; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Generator\Webhook\MessageGeneratorInterface; use FireflyIII\Models\TransactionGroup; @@ -49,7 +47,6 @@ class ShowController extends Controller private WebhookRepositoryInterface $repository; /** - */ public function __construct() { @@ -72,7 +69,6 @@ class ShowController extends Controller * * @return JsonResponse * @throws FireflyException - */ public function index(): JsonResponse { diff --git a/app/Api/V1/Controllers/Webhook/StoreController.php b/app/Api/V1/Controllers/Webhook/StoreController.php index e7043815e7..4df638d557 100644 --- a/app/Api/V1/Controllers/Webhook/StoreController.php +++ b/app/Api/V1/Controllers/Webhook/StoreController.php @@ -39,7 +39,6 @@ class StoreController extends Controller private WebhookRepositoryInterface $repository; /** - */ public function __construct() { diff --git a/app/Api/V1/Controllers/Webhook/SubmitController.php b/app/Api/V1/Controllers/Webhook/SubmitController.php index 75490362e0..96db2dc3a2 100644 --- a/app/Api/V1/Controllers/Webhook/SubmitController.php +++ b/app/Api/V1/Controllers/Webhook/SubmitController.php @@ -37,7 +37,6 @@ class SubmitController extends Controller private WebhookRepositoryInterface $repository; /** - */ public function __construct() { @@ -59,7 +58,6 @@ class SubmitController extends Controller * @param Webhook $webhook * * @return JsonResponse - */ public function submit(Webhook $webhook): JsonResponse { diff --git a/app/Api/V1/Controllers/Webhook/UpdateController.php b/app/Api/V1/Controllers/Webhook/UpdateController.php index 0189ac3f35..b5443cdc31 100644 --- a/app/Api/V1/Controllers/Webhook/UpdateController.php +++ b/app/Api/V1/Controllers/Webhook/UpdateController.php @@ -39,7 +39,6 @@ class UpdateController extends Controller private WebhookRepositoryInterface $repository; /** - */ public function __construct() { diff --git a/app/Api/V1/Requests/Data/Export/ExportRequest.php b/app/Api/V1/Requests/Data/Export/ExportRequest.php index d7a4d025da..fc264e4f8d 100644 --- a/app/Api/V1/Requests/Data/Export/ExportRequest.php +++ b/app/Api/V1/Requests/Data/Export/ExportRequest.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace FireflyIII\Api\V1\Requests\Data\Export; -use Carbon\Carbon; use FireflyIII\Models\AccountType; use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Support\Request\ChecksLogin; diff --git a/app/Api/V1/Requests/Models/Account/StoreRequest.php b/app/Api/V1/Requests/Models/Account/StoreRequest.php index cdaa7e28b7..c798731236 100644 --- a/app/Api/V1/Requests/Models/Account/StoreRequest.php +++ b/app/Api/V1/Requests/Models/Account/StoreRequest.php @@ -83,9 +83,9 @@ class StoreRequest extends FormRequest $data = $this->appendLocationData($data, null); if ('liability' === $data['account_type_name'] || 'liabilities' === $data['account_type_name']) { - $data['account_type_name'] = $this->convertString('liability_type'); - $data['liability_direction'] = $this->convertString('liability_direction'); - $data['account_type_id'] = null; + $data['account_type_name'] = $this->convertString('liability_type'); + $data['liability_direction'] = $this->convertString('liability_direction'); + $data['account_type_id'] = null; } return $data; diff --git a/app/Api/V1/Requests/Models/Account/UpdateRequest.php b/app/Api/V1/Requests/Models/Account/UpdateRequest.php index dd2058e119..227e8adbfc 100644 --- a/app/Api/V1/Requests/Models/Account/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/Account/UpdateRequest.php @@ -76,7 +76,7 @@ class UpdateRequest extends FormRequest 'liability_amount' => ['liability_amount', 'convertString'], 'liability_start_date' => ['liability_start_date', 'date'], ]; - $data = $this->getAllData($fields); + $data = $this->getAllData($fields); return $this->appendLocationData($data, null); } diff --git a/app/Api/V1/Requests/Models/RuleGroup/StoreRequest.php b/app/Api/V1/Requests/Models/RuleGroup/StoreRequest.php index 63e42dd273..00ffa6ec55 100644 --- a/app/Api/V1/Requests/Models/RuleGroup/StoreRequest.php +++ b/app/Api/V1/Requests/Models/RuleGroup/StoreRequest.php @@ -29,7 +29,6 @@ use FireflyIII\Support\Request\ConvertsDataTypes; use Illuminate\Foundation\Http\FormRequest; /** - * Class StoreRequest */ class StoreRequest extends FormRequest diff --git a/app/Api/V1/Requests/Models/RuleGroup/UpdateRequest.php b/app/Api/V1/Requests/Models/RuleGroup/UpdateRequest.php index 53356b15f2..62d3f4061b 100644 --- a/app/Api/V1/Requests/Models/RuleGroup/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/RuleGroup/UpdateRequest.php @@ -30,7 +30,6 @@ use FireflyIII\Support\Request\ConvertsDataTypes; use Illuminate\Foundation\Http\FormRequest; /** - * Class UpdateRequest */ class UpdateRequest extends FormRequest diff --git a/app/Api/V1/Requests/System/CronRequest.php b/app/Api/V1/Requests/System/CronRequest.php index 550c0c1033..3af1094aa2 100644 --- a/app/Api/V1/Requests/System/CronRequest.php +++ b/app/Api/V1/Requests/System/CronRequest.php @@ -24,7 +24,6 @@ declare(strict_types=1); namespace FireflyIII\Api\V1\Requests\System; -use Carbon\Carbon; use FireflyIII\Support\Request\ConvertsDataTypes; use Illuminate\Foundation\Http\FormRequest; diff --git a/app/Api/V2/Controllers/NetWorthController.php b/app/Api/V2/Controllers/NetWorthController.php index 1ea52301c4..e7dabc8133 100644 --- a/app/Api/V2/Controllers/NetWorthController.php +++ b/app/Api/V2/Controllers/NetWorthController.php @@ -26,7 +26,6 @@ namespace FireflyIII\Api\V2\Controllers; use FireflyIII\Api\V2\Request\Generic\SingleDateRequest; use FireflyIII\Helpers\Report\NetWorthInterface; -use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Support\Http\Api\ConvertsExchangeRates; use Illuminate\Http\JsonResponse; @@ -37,7 +36,7 @@ class NetWorthController extends Controller { use ConvertsExchangeRates; - private NetWorthInterface $netWorth; + private NetWorthInterface $netWorth; /** * @@ -47,7 +46,7 @@ class NetWorthController extends Controller parent::__construct(); $this->middleware( function ($request, $next) { - $this->netWorth = app(NetWorthInterface::class); + $this->netWorth = app(NetWorthInterface::class); $this->netWorth->setUser(auth()->user()); return $next($request); } diff --git a/app/Console/Commands/Correction/DeleteOrphanedTransactions.php b/app/Console/Commands/Correction/DeleteOrphanedTransactions.php index 1b2ab74827..2a21b39283 100644 --- a/app/Console/Commands/Correction/DeleteOrphanedTransactions.php +++ b/app/Console/Commands/Correction/DeleteOrphanedTransactions.php @@ -27,7 +27,6 @@ use Exception; use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; use Illuminate\Console\Command; -use Illuminate\Database\QueryException; use Log; use stdClass; diff --git a/app/Console/Commands/Correction/DeleteZeroAmount.php b/app/Console/Commands/Correction/DeleteZeroAmount.php index 5a7fabbd39..12d5ebf02b 100644 --- a/app/Console/Commands/Correction/DeleteZeroAmount.php +++ b/app/Console/Commands/Correction/DeleteZeroAmount.php @@ -26,7 +26,6 @@ namespace FireflyIII\Console\Commands\Correction; use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; use Illuminate\Console\Command; -use Illuminate\Database\QueryException; /** * Class DeleteZeroAmount diff --git a/app/Console/Commands/Correction/FixAccountTypes.php b/app/Console/Commands/Correction/FixAccountTypes.php index abdce7d3ac..58ae566710 100644 --- a/app/Console/Commands/Correction/FixAccountTypes.php +++ b/app/Console/Commands/Correction/FixAccountTypes.php @@ -30,6 +30,7 @@ use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionType; use Illuminate\Console\Command; +use JsonException; use Log; /** @@ -166,7 +167,7 @@ class FixAccountTypes extends Command * @param Transaction $dest * * @throws FireflyException - * @throws \JsonException + * @throws JsonException */ private function fixJournal(TransactionJournal $journal, string $type, Transaction $source, Transaction $dest): void { diff --git a/app/Console/Commands/Correction/FixTransactionTypes.php b/app/Console/Commands/Correction/FixTransactionTypes.php index 5a9faf2faf..fef7952d9a 100644 --- a/app/Console/Commands/Correction/FixTransactionTypes.php +++ b/app/Console/Commands/Correction/FixTransactionTypes.php @@ -147,7 +147,7 @@ class FixTransactionTypes extends Command /** @var Transaction $transaction */ $transaction = $collection->first(); /** @var Account|null $account */ - $account = $transaction->account; + $account = $transaction->account; if (null === $account) { throw new FireflyException(sprintf('300003: Journal #%d, transaction #%d has no source account.', $journal->id, $transaction->id)); } @@ -177,7 +177,7 @@ class FixTransactionTypes extends Command /** @var Transaction $transaction */ $transaction = $collection->first(); /** @var Account|null $account */ - $account = $transaction->account; + $account = $transaction->account; if (null === $account) { throw new FireflyException(sprintf('300006: Journal #%d, transaction #%d has no destination account.', $journal->id, $transaction->id)); } diff --git a/app/Console/Commands/Upgrade/BudgetLimitCurrency.php b/app/Console/Commands/Upgrade/BudgetLimitCurrency.php index 9f46ab81d8..6586001495 100644 --- a/app/Console/Commands/Upgrade/BudgetLimitCurrency.php +++ b/app/Console/Commands/Upgrade/BudgetLimitCurrency.php @@ -26,7 +26,6 @@ namespace FireflyIII\Console\Commands\Upgrade; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\BudgetLimit; use Illuminate\Console\Command; -use JsonException; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; diff --git a/app/Console/Commands/Upgrade/MigrateJournalNotes.php b/app/Console/Commands/Upgrade/MigrateJournalNotes.php index aaad2291f5..140f5f0222 100644 --- a/app/Console/Commands/Upgrade/MigrateJournalNotes.php +++ b/app/Console/Commands/Upgrade/MigrateJournalNotes.php @@ -27,7 +27,6 @@ use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Note; use FireflyIII\Models\TransactionJournalMeta; use Illuminate\Console\Command; -use Illuminate\Database\QueryException; use Log; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; diff --git a/app/Console/Commands/Upgrade/TransactionIdentifier.php b/app/Console/Commands/Upgrade/TransactionIdentifier.php index b8711e1084..3ce7f97a73 100644 --- a/app/Console/Commands/Upgrade/TransactionIdentifier.php +++ b/app/Console/Commands/Upgrade/TransactionIdentifier.php @@ -27,7 +27,6 @@ use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; use FireflyIII\Repositories\Journal\JournalCLIRepositoryInterface; -use FireflyIII\Repositories\Journal\JournalRepositoryInterface; use Illuminate\Console\Command; use Illuminate\Database\QueryException; use Log; @@ -117,8 +116,8 @@ class TransactionIdentifier extends Command */ private function stupidLaravel(): void { - $this->cliRepository = app(JournalCLIRepositoryInterface::class); - $this->count = 0; + $this->cliRepository = app(JournalCLIRepositoryInterface::class); + $this->count = 0; } /** diff --git a/app/Console/Commands/Upgrade/TransferCurrenciesCorrections.php b/app/Console/Commands/Upgrade/TransferCurrenciesCorrections.php index 2a67a3c234..7c95bdc594 100644 --- a/app/Console/Commands/Upgrade/TransferCurrenciesCorrections.php +++ b/app/Console/Commands/Upgrade/TransferCurrenciesCorrections.php @@ -237,7 +237,6 @@ class TransferCurrenciesCorrections extends Command * @param TransactionJournal $transfer * * @return bool - */ private function isSplitJournal(TransactionJournal $transfer): bool { @@ -262,7 +261,6 @@ class TransferCurrenciesCorrections extends Command * @param TransactionJournal $transfer * * @return Transaction|null - */ private function getSourceTransaction(TransactionJournal $transfer): ?Transaction { @@ -312,7 +310,6 @@ class TransferCurrenciesCorrections extends Command * @param TransactionJournal $transfer * * @return Transaction|null - */ private function getDestinationTransaction(TransactionJournal $transfer): ?Transaction { @@ -323,7 +320,6 @@ class TransferCurrenciesCorrections extends Command * Is either the source or destination transaction NULL? * * @return bool - */ private function isEmptyTransactions(): bool { @@ -334,7 +330,6 @@ class TransferCurrenciesCorrections extends Command /** * @return bool - */ private function isNoCurrencyPresent(): bool { diff --git a/app/Console/Commands/Upgrade/UpgradeLiabilitiesEight.php b/app/Console/Commands/Upgrade/UpgradeLiabilitiesEight.php index 76c10e813b..c41590525d 100644 --- a/app/Console/Commands/Upgrade/UpgradeLiabilitiesEight.php +++ b/app/Console/Commands/Upgrade/UpgradeLiabilitiesEight.php @@ -159,6 +159,90 @@ class UpgradeLiabilitiesEight extends Command Log::debug(sprintf('Done upgrading liability #%d ("%s")', $account->id, $account->name)); } + /** + * @param Account $account + * @return bool + */ + private function hasBadOpening(Account $account): bool + { + $openingBalanceType = TransactionType::whereType(TransactionType::OPENING_BALANCE)->first(); + $liabilityType = TransactionType::whereType(TransactionType::LIABILITY_CREDIT)->first(); + $openingJournal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') + ->where('transactions.account_id', $account->id) + ->where('transaction_journals.transaction_type_id', $openingBalanceType->id) + ->first(['transaction_journals.*']); + if (null === $openingJournal) { + Log::debug('Account has no opening balance and can be skipped.'); + return false; + } + $liabilityJournal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') + ->where('transactions.account_id', $account->id) + ->where('transaction_journals.transaction_type_id', $liabilityType->id) + ->first(['transaction_journals.*']); + if (null === $liabilityJournal) { + Log::debug('Account has no liability credit and can be skipped.'); + return false; + } + if (!$openingJournal->date->isSameDay($liabilityJournal->date)) { + Log::debug('Account has opening/credit not on the same day.'); + return false; + } + Log::debug('Account has bad opening balance data.'); + + return true; + } + + /** + * @param Account $account + * @return void + */ + private function deleteCreditTransaction(Account $account): void + { + Log::debug('Will delete credit transaction.'); + $liabilityType = TransactionType::whereType(TransactionType::LIABILITY_CREDIT)->first(); + $liabilityJournal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') + ->where('transactions.account_id', $account->id) + ->where('transaction_journals.transaction_type_id', $liabilityType->id) + ->first(['transaction_journals.*']); + if (null !== $liabilityJournal) { + $group = $liabilityJournal->transactionGroup; + $service = new TransactionGroupDestroyService(); + $service->destroy($group); + Log::debug(sprintf('Deleted liability credit group #%d', $group->id)); + return; + } + Log::debug('No liability credit journal found.'); + } + + /** + * @param Account $account + * @return void + */ + private function reverseOpeningBalance(Account $account): void + { + $openingBalanceType = TransactionType::whereType(TransactionType::OPENING_BALANCE)->first(); + /** @var TransactionJournal $openingJournal */ + $openingJournal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') + ->where('transactions.account_id', $account->id) + ->where('transaction_journals.transaction_type_id', $openingBalanceType->id) + ->first(['transaction_journals.*']); + /** @var Transaction|null $source */ + $source = $openingJournal->transactions()->where('amount', '<', 0)->first(); + /** @var Transaction|null $dest */ + $dest = $openingJournal->transactions()->where('amount', '>', 0)->first(); + if ($source && $dest) { + $sourceId = $source->account_id; + $destId = $dest->account_id; + $dest->account_id = $sourceId; + $source->account_id = $destId; + $source->save(); + $dest->save(); + Log::debug(sprintf('Opening balance transaction journal #%d reversed.', $openingJournal->id)); + return; + } + Log::warning('Did not find opening balance.'); + } + /** * @param $account * @return int @@ -204,29 +288,6 @@ class UpgradeLiabilitiesEight extends Command return $count; } - /** - * @param Account $account - * @return void - */ - private function deleteCreditTransaction(Account $account): void - { - Log::debug('Will delete credit transaction.'); - $liabilityType = TransactionType::whereType(TransactionType::LIABILITY_CREDIT)->first(); - $liabilityJournal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') - ->where('transactions.account_id', $account->id) - ->where('transaction_journals.transaction_type_id', $liabilityType->id) - ->first(['transaction_journals.*']); - if (null !== $liabilityJournal) { - $group = $liabilityJournal->transactionGroup; - $service = new TransactionGroupDestroyService(); - $service->destroy($group); - Log::debug(sprintf('Deleted liability credit group #%d', $group->id)); - return; - } - Log::debug('No liability credit journal found.'); - } - - /** * */ @@ -234,66 +295,4 @@ class UpgradeLiabilitiesEight extends Command { app('fireflyconfig')->set(self::CONFIG_NAME, true); } - - /** - * @param Account $account - * @return bool - */ - private function hasBadOpening(Account $account): bool - { - $openingBalanceType = TransactionType::whereType(TransactionType::OPENING_BALANCE)->first(); - $liabilityType = TransactionType::whereType(TransactionType::LIABILITY_CREDIT)->first(); - $openingJournal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') - ->where('transactions.account_id', $account->id) - ->where('transaction_journals.transaction_type_id', $openingBalanceType->id) - ->first(['transaction_journals.*']); - if (null === $openingJournal) { - Log::debug('Account has no opening balance and can be skipped.'); - return false; - } - $liabilityJournal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') - ->where('transactions.account_id', $account->id) - ->where('transaction_journals.transaction_type_id', $liabilityType->id) - ->first(['transaction_journals.*']); - if (null === $liabilityJournal) { - Log::debug('Account has no liability credit and can be skipped.'); - return false; - } - if (!$openingJournal->date->isSameDay($liabilityJournal->date)) { - Log::debug('Account has opening/credit not on the same day.'); - return false; - } - Log::debug('Account has bad opening balance data.'); - - return true; - } - - /** - * @param Account $account - * @return void - */ - private function reverseOpeningBalance(Account $account): void - { - $openingBalanceType = TransactionType::whereType(TransactionType::OPENING_BALANCE)->first(); - /** @var TransactionJournal $openingJournal */ - $openingJournal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') - ->where('transactions.account_id', $account->id) - ->where('transaction_journals.transaction_type_id', $openingBalanceType->id) - ->first(['transaction_journals.*']); - /** @var Transaction|null $source */ - $source = $openingJournal->transactions()->where('amount', '<', 0)->first(); - /** @var Transaction|null $dest */ - $dest = $openingJournal->transactions()->where('amount', '>', 0)->first(); - if ($source && $dest) { - $sourceId = $source->account_id; - $destId = $dest->account_id; - $dest->account_id = $sourceId; - $source->account_id = $destId; - $source->save(); - $dest->save(); - Log::debug(sprintf('Opening balance transaction journal #%d reversed.', $openingJournal->id)); - return; - } - Log::warning('Did not find opening balance.'); - } } diff --git a/app/Factory/RecurrenceFactory.php b/app/Factory/RecurrenceFactory.php index 5e66d9b63c..4a0afce717 100644 --- a/app/Factory/RecurrenceFactory.php +++ b/app/Factory/RecurrenceFactory.php @@ -30,6 +30,7 @@ use FireflyIII\Services\Internal\Support\RecurringTransactionTrait; use FireflyIII\Services\Internal\Support\TransactionTypeTrait; use FireflyIII\User; use Illuminate\Support\MessageBag; +use JsonException; use Log; /** @@ -58,7 +59,7 @@ class RecurrenceFactory * * @return Recurrence * @throws FireflyException - * @throws \JsonException + * @throws JsonException */ public function create(array $data): Recurrence { diff --git a/app/Factory/TransactionFactory.php b/app/Factory/TransactionFactory.php index ded41e19fb..f2a2627795 100644 --- a/app/Factory/TransactionFactory.php +++ b/app/Factory/TransactionFactory.php @@ -42,11 +42,11 @@ use Validator; class TransactionFactory { private Account $account; + private array $accountInformation; private TransactionCurrency $currency; private ?TransactionCurrency $foreignCurrency; private TransactionJournal $journal; private bool $reconciled; - private array $accountInformation; /** * Constructor. @@ -140,6 +140,38 @@ class TransactionFactory return $result; } + /** + * @return void + * @throws FireflyException + */ + private function updateAccountInformation(): void + { + if (!array_key_exists('iban', $this->accountInformation)) { + Log::debug('No IBAN information in array, will not update.'); + return; + } + if ('' !== (string)$this->account->iban) { + Log::debug('Account already has IBAN information, will not update.'); + return; + } + if ($this->account->iban === $this->accountInformation['iban']) { + Log::debug('Account already has this IBAN, will not update.'); + return; + } + // validate info: + $validator = Validator::make(['iban' => $this->accountInformation['iban']], [ + 'iban' => ['required', new UniqueIban($this->account, $this->account->accountType->type)], + ]); + if ($validator->fails()) { + Log::debug('Invalid or non-unique IBAN, will not update.'); + return; + } + + Log::debug('Will update account with IBAN information.'); + $service = app(AccountUpdateService::class); + $service->update($this->account, ['iban' => $this->accountInformation['iban']]); + } + /** * Create transaction with positive amount (for destination accounts). * @@ -171,6 +203,14 @@ class TransactionFactory $this->account = $account; } + /** + * @param array $accountInformation + */ + public function setAccountInformation(array $accountInformation): void + { + $this->accountInformation = $accountInformation; + } + /** * @param TransactionCurrency $currency * @@ -220,45 +260,4 @@ class TransactionFactory { // empty function. } - - /** - * @param array $accountInformation - */ - public function setAccountInformation(array $accountInformation): void - { - $this->accountInformation = $accountInformation; - } - - - /** - * @return void - * @throws FireflyException - */ - private function updateAccountInformation(): void - { - if (!array_key_exists('iban', $this->accountInformation)) { - Log::debug('No IBAN information in array, will not update.'); - return; - } - if ('' !== (string)$this->account->iban) { - Log::debug('Account already has IBAN information, will not update.'); - return; - } - if ($this->account->iban === $this->accountInformation['iban']) { - Log::debug('Account already has this IBAN, will not update.'); - return; - } - // validate info: - $validator = Validator::make(['iban' => $this->accountInformation['iban']], [ - 'iban' => ['required', new UniqueIban($this->account, $this->account->accountType->type)], - ]); - if ($validator->fails()) { - Log::debug('Invalid or non-unique IBAN, will not update.'); - return; - } - - Log::debug('Will update account with IBAN information.'); - $service = app(AccountUpdateService::class); - $service->update($this->account, ['iban' => $this->accountInformation['iban']]); - } } diff --git a/app/Factory/TransactionJournalFactory.php b/app/Factory/TransactionJournalFactory.php index 872f20342a..5293f2443d 100644 --- a/app/Factory/TransactionJournalFactory.php +++ b/app/Factory/TransactionJournalFactory.php @@ -73,7 +73,6 @@ class TransactionJournalFactory * Constructor. * * @throws Exception - */ public function __construct() { diff --git a/app/Factory/TransactionJournalMetaFactory.php b/app/Factory/TransactionJournalMetaFactory.php index c22da98f58..d84a7e0f44 100644 --- a/app/Factory/TransactionJournalMetaFactory.php +++ b/app/Factory/TransactionJournalMetaFactory.php @@ -25,7 +25,6 @@ namespace FireflyIII\Factory; use Carbon\Carbon; use FireflyIII\Models\TransactionJournalMeta; -use Illuminate\Database\QueryException; use Log; /** diff --git a/app/Generator/Report/Audit/MonthReportGenerator.php b/app/Generator/Report/Audit/MonthReportGenerator.php index 7c4e0963b9..5b9bb87ca8 100644 --- a/app/Generator/Report/Audit/MonthReportGenerator.php +++ b/app/Generator/Report/Audit/MonthReportGenerator.php @@ -50,7 +50,6 @@ class MonthReportGenerator implements ReportGeneratorInterface * @return string * @throws FireflyException * @throws JsonException - */ public function generate(): string { @@ -186,7 +185,6 @@ class MonthReportGenerator implements ReportGeneratorInterface * @param Collection $accounts * * @return ReportGeneratorInterface - */ public function setAccounts(Collection $accounts): ReportGeneratorInterface { @@ -201,7 +199,6 @@ class MonthReportGenerator implements ReportGeneratorInterface * @param Collection $budgets * * @return ReportGeneratorInterface - */ public function setBudgets(Collection $budgets): ReportGeneratorInterface { @@ -214,7 +211,6 @@ class MonthReportGenerator implements ReportGeneratorInterface * @param Collection $categories * * @return ReportGeneratorInterface - */ public function setCategories(Collection $categories): ReportGeneratorInterface { @@ -227,7 +223,6 @@ class MonthReportGenerator implements ReportGeneratorInterface * @param Carbon $date * * @return ReportGeneratorInterface - */ public function setEndDate(Carbon $date): ReportGeneratorInterface { @@ -242,7 +237,6 @@ class MonthReportGenerator implements ReportGeneratorInterface * @param Collection $expense * * @return ReportGeneratorInterface - */ public function setExpense(Collection $expense): ReportGeneratorInterface { @@ -256,7 +250,6 @@ class MonthReportGenerator implements ReportGeneratorInterface * @param Carbon $date * * @return ReportGeneratorInterface - */ public function setStartDate(Carbon $date): ReportGeneratorInterface { @@ -271,7 +264,6 @@ class MonthReportGenerator implements ReportGeneratorInterface * @param Collection $tags * * @return ReportGeneratorInterface - */ public function setTags(Collection $tags): ReportGeneratorInterface { diff --git a/app/Generator/Webhook/MessageGeneratorInterface.php b/app/Generator/Webhook/MessageGeneratorInterface.php index 3c6fe06f81..48c8979b09 100644 --- a/app/Generator/Webhook/MessageGeneratorInterface.php +++ b/app/Generator/Webhook/MessageGeneratorInterface.php @@ -46,12 +46,6 @@ interface MessageGeneratorInterface */ public function setObjects(Collection $objects): void; - /** - * @param Collection $webhooks - * @return void - */ - public function setWebhooks(Collection $webhooks): void; - /** * @param int $trigger */ @@ -61,4 +55,10 @@ interface MessageGeneratorInterface * @param User $user */ public function setUser(User $user): void; + + /** + * @param Collection $webhooks + * @return void + */ + public function setWebhooks(Collection $webhooks): void; } diff --git a/app/Handlers/Events/BillEventHandler.php b/app/Handlers/Events/BillEventHandler.php index 48b9e7c306..006f4af9d4 100644 --- a/app/Handlers/Events/BillEventHandler.php +++ b/app/Handlers/Events/BillEventHandler.php @@ -43,7 +43,7 @@ class BillEventHandler { Log::debug(sprintf('Now in %s', __METHOD__)); - $bill = $event->bill; + $bill = $event->bill; /** @var bool $preference */ $preference = Preferences::getForUser($bill->user, 'notification_bill_reminder', true)->data; diff --git a/app/Handlers/Events/PiggyBankEventHandler.php b/app/Handlers/Events/PiggyBankEventHandler.php index 316e5de639..85ce2e6719 100644 --- a/app/Handlers/Events/PiggyBankEventHandler.php +++ b/app/Handlers/Events/PiggyBankEventHandler.php @@ -24,7 +24,6 @@ declare(strict_types=1); namespace FireflyIII\Handlers\Events; -use Carbon\Carbon; use FireflyIII\Events\ChangedPiggyBankAmount; use FireflyIII\Models\PiggyBankEvent; use Illuminate\Support\Facades\Log; diff --git a/app/Handlers/Events/UserEventHandler.php b/app/Handlers/Events/UserEventHandler.php index 8d6af22cf6..2d14a8dc30 100644 --- a/app/Handlers/Events/UserEventHandler.php +++ b/app/Handlers/Events/UserEventHandler.php @@ -368,7 +368,7 @@ class UserEventHandler } $preference = array_values($preference); /** @var bool $send */ - $send = app('preferences')->getForUser($user, 'notification_user_login', true)->data; + $send = app('preferences')->getForUser($user, 'notification_user_login', true)->data; app('preferences')->setForUser($user, 'login_ip_history', $preference); if (false === $inArray && true === $send) { diff --git a/app/Helpers/Attachments/AttachmentHelper.php b/app/Helpers/Attachments/AttachmentHelper.php index 6a33a0fe4a..997028f8ab 100644 --- a/app/Helpers/Attachments/AttachmentHelper.php +++ b/app/Helpers/Attachments/AttachmentHelper.php @@ -69,7 +69,6 @@ class AttachmentHelper implements AttachmentHelperInterface /** * Returns the content of an attachment. * - * * @param Attachment $attachment * @@ -93,7 +92,6 @@ class AttachmentHelper implements AttachmentHelperInterface * * @param Attachment $attachment * - * @return string */ public function getAttachmentLocation(Attachment $attachment): string @@ -104,7 +102,6 @@ class AttachmentHelper implements AttachmentHelperInterface /** * Get all attachments. * - * @return Collection */ public function getAttachments(): Collection @@ -116,7 +113,6 @@ class AttachmentHelper implements AttachmentHelperInterface * Get all errors. * * @return MessageBag - */ public function getErrors(): MessageBag { @@ -127,7 +123,6 @@ class AttachmentHelper implements AttachmentHelperInterface * Get all messages. * * @return MessageBag - */ public function getMessages(): MessageBag { @@ -232,7 +227,7 @@ class AttachmentHelper implements AttachmentHelperInterface $validation = $this->validateUpload($file, $model); $attachment = null; if (false !== $validation) { - $user = $model->user; // @phpstan-ignore-line + $user = $model->user; // @phpstan-ignore-line // ignore lines about polymorphic calls. if ($model instanceof PiggyBank) { $user = $model->account->user; @@ -336,7 +331,6 @@ class AttachmentHelper implements AttachmentHelperInterface /** * Verify if the size of a file is valid. * - * * @param UploadedFile $file * @@ -377,7 +371,8 @@ class AttachmentHelper implements AttachmentHelperInterface $count = $model->account->user->attachments()->where('md5', $md5)->where('attachable_id', $model->id)->where('attachable_type', $class)->count(); } if ($model instanceof PiggyBank) { - $count = $model->user->attachments()->where('md5', $md5)->where('attachable_id', $model->id)->where('attachable_type', $class)->count(); // @phpstan-ignore-line + $count = $model->user->attachments()->where('md5', $md5)->where('attachable_id', $model->id)->where('attachable_type', $class)->count( + ); // @phpstan-ignore-line } $result = false; if ($count > 0) { diff --git a/app/Helpers/Collector/Extensions/MetaCollection.php b/app/Helpers/Collector/Extensions/MetaCollection.php index dff810fd7f..896eec2645 100644 --- a/app/Helpers/Collector/Extensions/MetaCollection.php +++ b/app/Helpers/Collector/Extensions/MetaCollection.php @@ -196,6 +196,19 @@ trait MetaCollection return $this; } + /** + * Join table to get tag information. + */ + protected function joinMetaDataTables(): void + { + if (false === $this->hasJoinedMetaTables) { + $this->hasJoinedMetaTables = true; + $this->query->leftJoin('journal_meta', 'transaction_journals.id', '=', 'journal_meta.transaction_journal_id'); + $this->fields[] = 'journal_meta.name as meta_name'; + $this->fields[] = 'journal_meta.data as meta_data'; + } + } + /** * @inheritDoc */ @@ -245,19 +258,6 @@ trait MetaCollection return $this; } - /** - * Join table to get tag information. - */ - protected function joinMetaDataTables(): void - { - if (false === $this->hasJoinedMetaTables) { - $this->hasJoinedMetaTables = true; - $this->query->leftJoin('journal_meta', 'transaction_journals.id', '=', 'journal_meta.transaction_journal_id'); - $this->fields[] = 'journal_meta.name as meta_name'; - $this->fields[] = 'journal_meta.data as meta_data'; - } - } - /** * @inheritDoc */ diff --git a/app/Helpers/Collector/GroupCollector.php b/app/Helpers/Collector/GroupCollector.php index a1768a271e..43264519bf 100644 --- a/app/Helpers/Collector/GroupCollector.php +++ b/app/Helpers/Collector/GroupCollector.php @@ -24,7 +24,6 @@ declare(strict_types=1); namespace FireflyIII\Helpers\Collector; use Carbon\Carbon; -use Carbon\Exceptions\InvalidDateException; use Carbon\Exceptions\InvalidFormatException; use Closure; use Exception; @@ -515,8 +514,8 @@ class GroupCollector implements GroupCollectorInterface if (!array_key_exists($groupId, $groups)) { // make new array - $parsedGroup = $this->parseAugmentedJournal($augumentedJournal); - $groupArray = [ + $parsedGroup = $this->parseAugmentedJournal($augumentedJournal); + $groupArray = [ 'id' => (int)$augumentedJournal->transaction_group_id, 'user_id' => (int)$augumentedJournal->user_id, // Field transaction_group_title was added by the query. diff --git a/app/Helpers/Fiscal/FiscalHelper.php b/app/Helpers/Fiscal/FiscalHelper.php index 7c0c549c16..73874b7eeb 100644 --- a/app/Helpers/Fiscal/FiscalHelper.php +++ b/app/Helpers/Fiscal/FiscalHelper.php @@ -42,7 +42,7 @@ class FiscalHelper implements FiscalHelperInterface */ public function __construct() { - $this->useCustomFiscalYear = (bool) app('preferences')->get('customFiscalYear', false)->data; + $this->useCustomFiscalYear = (bool)app('preferences')->get('customFiscalYear', false)->data; } /** diff --git a/app/Helpers/Report/NetWorth.php b/app/Helpers/Report/NetWorth.php index 6db4a2d301..50e5276989 100644 --- a/app/Helpers/Report/NetWorth.php +++ b/app/Helpers/Report/NetWorth.php @@ -32,7 +32,6 @@ use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Support\CacheProperties; use FireflyIII\User; use Illuminate\Support\Collection; -use Illuminate\Support\Facades\Log; use JsonException; /** @@ -112,7 +111,6 @@ class NetWorth implements NetWorthInterface $netWorth[$currencyId] = '0'; } $netWorth[$currencyId] = bcadd($balance, $netWorth[$currencyId]); - // Log::debug(sprintf('Total net worth for currency #%d is %s', $currencyId, $netWorth[$currencyId])); } ksort($netWorth); @@ -184,7 +182,9 @@ class NetWorth implements NetWorthInterface */ private function getAccounts(): Collection { - $accounts = $this->accountRepository->getAccountsByType([AccountType::ASSET, AccountType::DEFAULT, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE]); + $accounts = $this->accountRepository->getAccountsByType( + [AccountType::ASSET, AccountType::DEFAULT, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE] + ); $filtered = new Collection(); /** @var Account $account */ foreach ($accounts as $account) { diff --git a/app/Http/Controllers/Admin/UpdateController.php b/app/Http/Controllers/Admin/UpdateController.php index f568ac8302..2a24c22b59 100644 --- a/app/Http/Controllers/Admin/UpdateController.php +++ b/app/Http/Controllers/Admin/UpdateController.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace FireflyIII\Http\Controllers\Admin; -use FireflyIII\Exceptions\FireflyException; use FireflyIII\Helpers\Update\UpdateTrait; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Http\Middleware\IsDemoUser; diff --git a/app/Http/Controllers/Auth/ForgotPasswordController.php b/app/Http/Controllers/Auth/ForgotPasswordController.php index b43a7d4833..70d2db78ac 100644 --- a/app/Http/Controllers/Auth/ForgotPasswordController.php +++ b/app/Http/Controllers/Auth/ForgotPasswordController.php @@ -109,7 +109,6 @@ class ForgotPasswordController extends Controller /** * Show form for email recovery. * - * * @return Factory|View * @throws FireflyException diff --git a/app/Http/Controllers/Bill/ShowController.php b/app/Http/Controllers/Bill/ShowController.php index 930e43f2e9..87180560a6 100644 --- a/app/Http/Controllers/Bill/ShowController.php +++ b/app/Http/Controllers/Bill/ShowController.php @@ -24,7 +24,6 @@ declare(strict_types=1); namespace FireflyIII\Http\Controllers\Bill; use Carbon\Carbon; -use FireflyIII\Exceptions\FireflyException; use FireflyIII\Helpers\Collector\GroupCollectorInterface; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Models\Attachment; diff --git a/app/Http/Controllers/Budget/ShowController.php b/app/Http/Controllers/Budget/ShowController.php index 725b9c6530..d399bc6ff8 100644 --- a/app/Http/Controllers/Budget/ShowController.php +++ b/app/Http/Controllers/Budget/ShowController.php @@ -37,7 +37,6 @@ use FireflyIII\Support\Http\Controllers\PeriodOverview; use Illuminate\Contracts\View\Factory; use Illuminate\Http\Request; use Illuminate\View\View; -use JsonException; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; diff --git a/app/Http/Controllers/Category/IndexController.php b/app/Http/Controllers/Category/IndexController.php index 8e7b9886b5..6a3d54d35b 100644 --- a/app/Http/Controllers/Category/IndexController.php +++ b/app/Http/Controllers/Category/IndexController.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace FireflyIII\Http\Controllers\Category; -use FireflyIII\Exceptions\FireflyException; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Models\Category; use FireflyIII\Repositories\Category\CategoryRepositoryInterface; diff --git a/app/Http/Controllers/Category/ShowController.php b/app/Http/Controllers/Category/ShowController.php index 50dd4da426..990663174a 100644 --- a/app/Http/Controllers/Category/ShowController.php +++ b/app/Http/Controllers/Category/ShowController.php @@ -34,7 +34,6 @@ use Illuminate\Contracts\View\Factory; use Illuminate\Http\Request; use Illuminate\Support\Collection; use Illuminate\View\View; -use JsonException; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; diff --git a/app/Http/Controllers/Chart/BillController.php b/app/Http/Controllers/Chart/BillController.php index ae3ed729a2..fa540c279c 100644 --- a/app/Http/Controllers/Chart/BillController.php +++ b/app/Http/Controllers/Chart/BillController.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace FireflyIII\Http\Controllers\Chart; -use Carbon\Carbon; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Generator\Chart\Basic\GeneratorInterface; use FireflyIII\Helpers\Collector\GroupCollectorInterface; diff --git a/app/Http/Controllers/Chart/TransactionController.php b/app/Http/Controllers/Chart/TransactionController.php index 7e487c63f6..f0a6112527 100644 --- a/app/Http/Controllers/Chart/TransactionController.php +++ b/app/Http/Controllers/Chart/TransactionController.php @@ -25,7 +25,6 @@ declare(strict_types=1); namespace FireflyIII\Http\Controllers\Chart; use Carbon\Carbon; -use FireflyIII\Exceptions\FireflyException; use FireflyIII\Generator\Chart\Basic\GeneratorInterface; use FireflyIII\Helpers\Collector\GroupCollectorInterface; use FireflyIII\Http\Controllers\Controller; diff --git a/app/Http/Controllers/Json/ReconcileController.php b/app/Http/Controllers/Json/ReconcileController.php index 78d115408a..59ee86bc8b 100644 --- a/app/Http/Controllers/Json/ReconcileController.php +++ b/app/Http/Controllers/Json/ReconcileController.php @@ -31,8 +31,6 @@ use FireflyIII\Models\Account; use FireflyIII\Models\TransactionCurrency; use FireflyIII\Models\TransactionType; use FireflyIII\Repositories\Account\AccountRepositoryInterface; -use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; -use FireflyIII\Repositories\Journal\JournalRepositoryInterface; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; use Illuminate\Support\Collection; @@ -46,7 +44,7 @@ use Throwable; */ class ReconcileController extends Controller { - private AccountRepositoryInterface $accountRepos; + private AccountRepositoryInterface $accountRepos; /** * ReconcileController constructor. @@ -62,7 +60,7 @@ class ReconcileController extends Controller function ($request, $next) { app('view')->share('mainTitleIcon', 'fa-credit-card'); app('view')->share('title', (string)trans('firefly.accounts')); - $this->accountRepos = app(AccountRepositoryInterface::class); + $this->accountRepos = app(AccountRepositoryInterface::class); return $next($request); } diff --git a/app/Http/Controllers/Json/RecurrenceController.php b/app/Http/Controllers/Json/RecurrenceController.php index 72a566be14..ff0037f633 100644 --- a/app/Http/Controllers/Json/RecurrenceController.php +++ b/app/Http/Controllers/Json/RecurrenceController.php @@ -71,7 +71,7 @@ class RecurrenceController extends Controller */ public function events(Request $request): JsonResponse { - $occurrences = []; + $occurrences = []; $return = []; $start = Carbon::createFromFormat('Y-m-d', $request->get('start')); $end = Carbon::createFromFormat('Y-m-d', $request->get('end')); diff --git a/app/Http/Controllers/PiggyBank/ShowController.php b/app/Http/Controllers/PiggyBank/ShowController.php index 414ec6e3e9..a81404e93b 100644 --- a/app/Http/Controllers/PiggyBank/ShowController.php +++ b/app/Http/Controllers/PiggyBank/ShowController.php @@ -32,6 +32,7 @@ use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface; use FireflyIII\Transformers\PiggyBankTransformer; use Illuminate\Contracts\View\Factory; use Illuminate\View\View; +use JsonException; use Symfony\Component\HttpFoundation\ParameterBag; /** @@ -69,7 +70,7 @@ class ShowController extends Controller * * @return Factory|View * @throws FireflyException - * @throws \JsonException + * @throws JsonException */ public function show(PiggyBank $piggyBank) { diff --git a/app/Http/Controllers/PreferencesController.php b/app/Http/Controllers/PreferencesController.php index ae56d03797..0eb0eaf471 100644 --- a/app/Http/Controllers/PreferencesController.php +++ b/app/Http/Controllers/PreferencesController.php @@ -95,8 +95,8 @@ class PreferencesController extends Controller } ksort($groupedAccounts); - $accountIds = $accounts->pluck('id')->toArray(); - $viewRange = app('navigation')->getViewRange(false); + $accountIds = $accounts->pluck('id')->toArray(); + $viewRange = app('navigation')->getViewRange(false); $frontPageAccounts = app('preferences')->get('frontPageAccounts', $accountIds); $language = app('steam')->getLanguage(); $languages = config('firefly.languages'); diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index 1cc5f8d481..edbef0bce3 100644 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -25,6 +25,7 @@ namespace FireflyIII\Http\Controllers; use Auth; use DB; +use Exception; use FireflyIII\Events\UserChangedEmail; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Exceptions\ValidationException; @@ -641,7 +642,7 @@ class ProfileController extends Controller * @param Request $request * * @return RedirectResponse|Redirector - * @throws \Exception + * @throws Exception */ public function regenerate(Request $request) { diff --git a/app/Http/Controllers/Recurring/TriggerController.php b/app/Http/Controllers/Recurring/TriggerController.php index 6e2893f51b..1f1e1bdf68 100644 --- a/app/Http/Controllers/Recurring/TriggerController.php +++ b/app/Http/Controllers/Recurring/TriggerController.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace FireflyIII\Http\Controllers\Recurring; -use Carbon\Carbon; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Http\Requests\TriggerRecurrenceRequest; use FireflyIII\Jobs\CreateRecurringTransactions; diff --git a/app/Http/Controllers/Report/CategoryController.php b/app/Http/Controllers/Report/CategoryController.php index 588a0f8270..595a3639a7 100644 --- a/app/Http/Controllers/Report/CategoryController.php +++ b/app/Http/Controllers/Report/CategoryController.php @@ -36,7 +36,6 @@ use FireflyIII\Support\Report\Category\CategoryReportGenerator; use Illuminate\Contracts\View\Factory; use Illuminate\Support\Collection; use Illuminate\View\View; -use JsonException; use Log; use Throwable; diff --git a/app/Http/Controllers/Transaction/MassController.php b/app/Http/Controllers/Transaction/MassController.php index aa1297252c..f4c1345c67 100644 --- a/app/Http/Controllers/Transaction/MassController.php +++ b/app/Http/Controllers/Transaction/MassController.php @@ -108,7 +108,7 @@ class MassController extends Controller Log::debug(sprintf('Searching for ID #%d', $journalId)); /** @var TransactionJournal $journal */ $journal = $this->repository->find((int)$journalId); - if (null !== $journal && (int)$journalId === (int) $journal->id) { + if (null !== $journal && (int)$journalId === (int)$journal->id) { $this->repository->destroyJournal($journal); ++$count; Log::debug(sprintf('Deleted transaction journal #%d', $journalId)); @@ -239,7 +239,6 @@ class MassController extends Controller * @param string $key * * @return Carbon|null - */ private function getDateFromRequest(MassEditJournalRequest $request, int $journalId, string $key): ?Carbon { @@ -267,7 +266,6 @@ class MassController extends Controller * @param string $string * * @return string|null - */ private function getStringFromRequest(MassEditJournalRequest $request, int $journalId, string $string): ?string { @@ -288,7 +286,6 @@ class MassController extends Controller * @param string $string * * @return int|null - */ private function getIntFromRequest(MassEditJournalRequest $request, int $journalId, string $string): ?int { diff --git a/app/Http/Controllers/Webhooks/DeleteController.php b/app/Http/Controllers/Webhooks/DeleteController.php index 13a27c2442..ff5569aaff 100644 --- a/app/Http/Controllers/Webhooks/DeleteController.php +++ b/app/Http/Controllers/Webhooks/DeleteController.php @@ -25,10 +25,9 @@ namespace FireflyIII\Http\Controllers\Webhooks; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Models\Webhook; +use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\View\Factory; -use Illuminate\Http\RedirectResponse; -use Illuminate\Routing\Redirector; -use Illuminate\View\View; +use Illuminate\Contracts\View\View; /** * Class DeleteController @@ -62,7 +61,7 @@ class DeleteController extends Controller * * @param Webhook $webhook * - * @return Factory|\Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\View + * @return Factory|Application|View */ public function index(Webhook $webhook) { diff --git a/app/Http/Controllers/Webhooks/EditController.php b/app/Http/Controllers/Webhooks/EditController.php index d16948a934..454abf2daf 100644 --- a/app/Http/Controllers/Webhooks/EditController.php +++ b/app/Http/Controllers/Webhooks/EditController.php @@ -25,10 +25,9 @@ namespace FireflyIII\Http\Controllers\Webhooks; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Models\Webhook; +use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\View\Factory; -use Illuminate\Http\RedirectResponse; -use Illuminate\Routing\Redirector; -use Illuminate\View\View; +use Illuminate\Contracts\View\View; /** * Class EditController @@ -61,7 +60,7 @@ class EditController extends Controller * * @param Webhook $webhook * - * @return Factory|\Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\View + * @return Factory|Application|View */ public function index(Webhook $webhook) { diff --git a/app/Http/Controllers/Webhooks/IndexController.php b/app/Http/Controllers/Webhooks/IndexController.php index 00b54d87a0..c7a8070b3d 100644 --- a/app/Http/Controllers/Webhooks/IndexController.php +++ b/app/Http/Controllers/Webhooks/IndexController.php @@ -24,7 +24,6 @@ declare(strict_types=1); namespace FireflyIII\Http\Controllers\Webhooks; -use FireflyIII\Exceptions\FireflyException; use FireflyIII\Http\Controllers\Controller; use Illuminate\Contracts\View\Factory; use Illuminate\Http\Request; diff --git a/app/Http/Controllers/Webhooks/ShowController.php b/app/Http/Controllers/Webhooks/ShowController.php index ad35c5ca20..db25066ce4 100644 --- a/app/Http/Controllers/Webhooks/ShowController.php +++ b/app/Http/Controllers/Webhooks/ShowController.php @@ -25,10 +25,9 @@ namespace FireflyIII\Http\Controllers\Webhooks; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Models\Webhook; +use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\View\Factory; -use Illuminate\Http\RedirectResponse; -use Illuminate\Routing\Redirector; -use Illuminate\View\View; +use Illuminate\Contracts\View\View; /** * Class ShowController @@ -61,7 +60,7 @@ class ShowController extends Controller * * @param Webhook $webhook * - * @return Factory|\Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\View + * @return Factory|Application|View */ public function index(Webhook $webhook) { diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index cb6a51aef6..6cc01c4b7a 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -179,14 +179,14 @@ class Kernel extends HttpKernel ], // full API authentication - 'api' => [ + 'api' => [ AcceptHeaders::class, EnsureFrontendRequestsAreStateful::class, 'auth:api,sanctum', 'bindings', ], // do only bindings, no auth - 'api_basic' => [ + 'api_basic' => [ AcceptHeaders::class, 'bindings', ], diff --git a/app/Http/Middleware/Installer.php b/app/Http/Middleware/Installer.php index 7d28ecc803..c9c922eed1 100644 --- a/app/Http/Middleware/Installer.php +++ b/app/Http/Middleware/Installer.php @@ -35,7 +35,6 @@ use Log; /** * Class Installer * - * */ class Installer diff --git a/app/Http/Requests/AccountFormRequest.php b/app/Http/Requests/AccountFormRequest.php index d2a76c7426..6a9a132641 100644 --- a/app/Http/Requests/AccountFormRequest.php +++ b/app/Http/Requests/AccountFormRequest.php @@ -139,6 +139,7 @@ class AccountFormRequest extends FormRequest return $rules; } + /** * Configure the validator instance with special rules for after the basic validation rules. * diff --git a/app/Http/Requests/BudgetFormStoreRequest.php b/app/Http/Requests/BudgetFormStoreRequest.php index 1a457a8891..d0706a57ab 100644 --- a/app/Http/Requests/BudgetFormStoreRequest.php +++ b/app/Http/Requests/BudgetFormStoreRequest.php @@ -30,7 +30,6 @@ use Illuminate\Foundation\Http\FormRequest; use Illuminate\Validation\Validator; /** - * Class BudgetFormStoreRequest */ class BudgetFormStoreRequest extends FormRequest diff --git a/app/Http/Requests/BudgetFormUpdateRequest.php b/app/Http/Requests/BudgetFormUpdateRequest.php index 0587a72b2a..3b89ef8759 100644 --- a/app/Http/Requests/BudgetFormUpdateRequest.php +++ b/app/Http/Requests/BudgetFormUpdateRequest.php @@ -31,7 +31,6 @@ use Illuminate\Foundation\Http\FormRequest; use Illuminate\Validation\Validator; /** - * Class BudgetFormUpdateRequest */ class BudgetFormUpdateRequest extends FormRequest diff --git a/app/Http/Requests/RecurrenceFormRequest.php b/app/Http/Requests/RecurrenceFormRequest.php index fa531ded19..83e2b09eba 100644 --- a/app/Http/Requests/RecurrenceFormRequest.php +++ b/app/Http/Requests/RecurrenceFormRequest.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace FireflyIII\Http\Requests; -use Carbon\Carbon; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Factory\CategoryFactory; use FireflyIII\Models\Recurrence; @@ -312,20 +311,20 @@ class RecurrenceFormRequest extends FormRequest // TODO typeOverrule: the account validator may have another opinion the transaction type. // TODO either use 'withdrawal' or the strtolower() variant, not both. - $type = $this->convertString('transaction_type'); + $type = $this->convertString('transaction_type'); $throwError = true; if ('withdrawal' === $type) { - $throwError = false; + $throwError = false; $sourceId = (int)$data['source_id']; $destinationId = (int)$data['withdrawal_destination_id']; } if ('deposit' === $type) { - $throwError = false; + $throwError = false; $sourceId = (int)$data['deposit_source_id']; $destinationId = (int)$data['destination_id']; } if ('transfer' === $type) { - $throwError = false; + $throwError = false; $sourceId = (int)$data['source_id']; $destinationId = (int)$data['destination_id']; } diff --git a/app/Jobs/CreateAutoBudgetLimits.php b/app/Jobs/CreateAutoBudgetLimits.php index 0f0ef38ce7..a1e8eddcbd 100644 --- a/app/Jobs/CreateAutoBudgetLimits.php +++ b/app/Jobs/CreateAutoBudgetLimits.php @@ -53,7 +53,6 @@ class CreateAutoBudgetLimits implements ShouldQueue /** * Create a new job instance. * - * * @param Carbon|null $date */ diff --git a/app/Jobs/CreateRecurringTransactions.php b/app/Jobs/CreateRecurringTransactions.php index 9bc13b0c6d..07ed219409 100644 --- a/app/Jobs/CreateRecurringTransactions.php +++ b/app/Jobs/CreateRecurringTransactions.php @@ -69,7 +69,6 @@ class CreateRecurringTransactions implements ShouldQueue /** * Create a new job instance. * - * * @param Carbon|null $date */ diff --git a/app/Jobs/DownloadExchangeRates.php b/app/Jobs/DownloadExchangeRates.php index 1cad14faa3..72c2cf6170 100644 --- a/app/Jobs/DownloadExchangeRates.php +++ b/app/Jobs/DownloadExchangeRates.php @@ -56,7 +56,6 @@ class DownloadExchangeRates implements ShouldQueue /** * Create a new job instance. * - * * @param Carbon|null $date */ diff --git a/app/Jobs/WarnAboutBills.php b/app/Jobs/WarnAboutBills.php index f024031760..2aee67ce18 100644 --- a/app/Jobs/WarnAboutBills.php +++ b/app/Jobs/WarnAboutBills.php @@ -50,7 +50,6 @@ class WarnAboutBills implements ShouldQueue /** * Create a new job instance. * - * * @param Carbon|null $date */ diff --git a/app/Models/Account.php b/app/Models/Account.php index 8b013738cb..ca00205b86 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -154,7 +154,6 @@ class Account extends Model /** * @return BelongsTo - */ public function user(): BelongsTo { @@ -163,7 +162,6 @@ class Account extends Model /** * @return BelongsTo - */ public function accountType(): BelongsTo { @@ -171,7 +169,6 @@ class Account extends Model } /** - * @return MorphMany */ public function attachments(): MorphMany @@ -196,7 +193,6 @@ class Account extends Model /** * @return HasMany - */ public function accountMeta(): HasMany { @@ -205,7 +201,6 @@ class Account extends Model /** * @return string - */ public function getEditNameAttribute(): string { @@ -219,7 +214,6 @@ class Account extends Model } /** - * @return MorphMany */ public function locations(): MorphMany @@ -228,7 +222,6 @@ class Account extends Model } /** - * Get all of the notes. */ public function notes(): MorphMany @@ -246,7 +239,6 @@ class Account extends Model /** * @return HasMany - */ public function piggyBanks(): HasMany { @@ -254,7 +246,6 @@ class Account extends Model } /** - * * @param EloquentBuilder $query * @param array $types @@ -269,7 +260,6 @@ class Account extends Model } /** - * * @param mixed $value * @@ -286,7 +276,6 @@ class Account extends Model /** * @return HasMany - */ public function transactions(): HasMany { @@ -301,7 +290,7 @@ class Account extends Model protected function virtualBalance(): Attribute { return Attribute::make( - get: fn ($value) => (string) $value, + get: fn ($value) => (string)$value, ); } } diff --git a/app/Models/AccountMeta.php b/app/Models/AccountMeta.php index 9b0331c209..ea636961c6 100644 --- a/app/Models/AccountMeta.php +++ b/app/Models/AccountMeta.php @@ -70,7 +70,6 @@ class AccountMeta extends Model /** * @return BelongsTo - */ public function account(): BelongsTo { @@ -82,7 +81,6 @@ class AccountMeta extends Model * * @return mixed * @throws JsonException - */ public function getDataAttribute($value) { diff --git a/app/Models/AccountType.php b/app/Models/AccountType.php index 1d304f13fb..6f005e2546 100644 --- a/app/Models/AccountType.php +++ b/app/Models/AccountType.php @@ -81,7 +81,6 @@ class AccountType extends Model /** * @return HasMany - */ public function accounts(): HasMany { diff --git a/app/Models/Attachment.php b/app/Models/Attachment.php index 8171c93168..fb1b835677 100644 --- a/app/Models/Attachment.php +++ b/app/Models/Attachment.php @@ -125,7 +125,6 @@ class Attachment extends Model } /** - * @return BelongsTo */ public function user(): BelongsTo @@ -136,7 +135,6 @@ class Attachment extends Model /** * Get all of the owning attachable models. * - * * @return MorphTo */ @@ -148,7 +146,6 @@ class Attachment extends Model /** * Returns the expected filename for this attachment. * - * @return string */ public function fileName(): string @@ -157,7 +154,6 @@ class Attachment extends Model } /** - * Get all of the notes. */ public function notes(): MorphMany diff --git a/app/Models/AuditLogEntry.php b/app/Models/AuditLogEntry.php index 52449c821e..5509e5431f 100644 --- a/app/Models/AuditLogEntry.php +++ b/app/Models/AuditLogEntry.php @@ -79,7 +79,6 @@ class AuditLogEntry extends Model ]; /** - */ public function auditable(): MorphTo { @@ -87,7 +86,6 @@ class AuditLogEntry extends Model } /** - */ public function changer(): MorphTo { diff --git a/app/Models/AutoBudget.php b/app/Models/AutoBudget.php index 2caf50d4ed..128bb4b4b7 100644 --- a/app/Models/AutoBudget.php +++ b/app/Models/AutoBudget.php @@ -71,7 +71,6 @@ class AutoBudget extends Model public const AUTO_BUDGET_ROLLOVER = 2; /** - * @return BelongsTo */ public function budget(): BelongsTo @@ -80,7 +79,6 @@ class AutoBudget extends Model } /** - * @return BelongsTo */ public function transactionCurrency(): BelongsTo @@ -94,7 +92,7 @@ class AutoBudget extends Model protected function amount(): Attribute { return Attribute::make( - get: fn ($value) => (string) $value, + get: fn ($value) => (string)$value, ); } } diff --git a/app/Models/AvailableBudget.php b/app/Models/AvailableBudget.php index 0fad31a1e2..7b14ebf2f3 100644 --- a/app/Models/AvailableBudget.php +++ b/app/Models/AvailableBudget.php @@ -111,7 +111,6 @@ class AvailableBudget extends Model } /** - * @return BelongsTo */ public function user(): BelongsTo @@ -120,7 +119,6 @@ class AvailableBudget extends Model } /** - * @return BelongsTo */ public function transactionCurrency(): BelongsTo diff --git a/app/Models/Bill.php b/app/Models/Bill.php index afa848ef39..06533eda3b 100644 --- a/app/Models/Bill.php +++ b/app/Models/Bill.php @@ -167,7 +167,6 @@ class Bill extends Model } /** - * @return BelongsTo */ public function user(): BelongsTo @@ -176,7 +175,6 @@ class Bill extends Model } /** - * @return MorphMany */ public function attachments(): MorphMany @@ -185,7 +183,6 @@ class Bill extends Model } /** - * Get all of the notes. */ public function notes(): MorphMany @@ -202,7 +199,6 @@ class Bill extends Model } /** - * * @param mixed $value */ @@ -222,7 +218,6 @@ class Bill extends Model } /** - * @return BelongsTo */ public function transactionCurrency(): BelongsTo @@ -231,7 +226,6 @@ class Bill extends Model } /** - * @return HasMany */ public function transactionJournals(): HasMany diff --git a/app/Models/Budget.php b/app/Models/Budget.php index 11d1cf8c27..91e50d746a 100644 --- a/app/Models/Budget.php +++ b/app/Models/Budget.php @@ -127,7 +127,6 @@ class Budget extends Model } /** - * @return BelongsTo */ public function user(): BelongsTo @@ -136,7 +135,6 @@ class Budget extends Model } /** - * @return MorphMany */ public function attachments(): MorphMany @@ -145,7 +143,6 @@ class Budget extends Model } /** - * @return HasMany */ public function autoBudgets(): HasMany @@ -154,7 +151,6 @@ class Budget extends Model } /** - * @return HasMany */ public function budgetlimits(): HasMany @@ -163,7 +159,6 @@ class Budget extends Model } /** - * Get all of the notes. */ public function notes(): MorphMany @@ -172,7 +167,6 @@ class Budget extends Model } /** - * @return BelongsToMany */ public function transactionJournals(): BelongsToMany @@ -181,7 +175,6 @@ class Budget extends Model } /** - * @return BelongsToMany */ public function transactions(): BelongsToMany diff --git a/app/Models/BudgetLimit.php b/app/Models/BudgetLimit.php index ae5062599d..b8419b0fce 100644 --- a/app/Models/BudgetLimit.php +++ b/app/Models/BudgetLimit.php @@ -105,7 +105,6 @@ class BudgetLimit extends Model } /** - * @return BelongsTo */ public function budget(): BelongsTo @@ -114,7 +113,6 @@ class BudgetLimit extends Model } /** - * @return BelongsTo */ public function transactionCurrency(): BelongsTo diff --git a/app/Models/Category.php b/app/Models/Category.php index 8bc5ac8b0c..5b46982225 100644 --- a/app/Models/Category.php +++ b/app/Models/Category.php @@ -117,7 +117,6 @@ class Category extends Model } /** - * @return BelongsTo */ public function user(): BelongsTo @@ -126,7 +125,6 @@ class Category extends Model } /** - * @return MorphMany */ public function attachments(): MorphMany @@ -135,7 +133,6 @@ class Category extends Model } /** - * Get all of the category's notes. */ public function notes(): MorphMany @@ -144,7 +141,6 @@ class Category extends Model } /** - * @return BelongsToMany */ public function transactionJournals(): BelongsToMany @@ -153,7 +149,6 @@ class Category extends Model } /** - * @return BelongsToMany */ public function transactions(): BelongsToMany diff --git a/app/Models/Configuration.php b/app/Models/Configuration.php index bd6155b958..984e4b5311 100644 --- a/app/Models/Configuration.php +++ b/app/Models/Configuration.php @@ -73,7 +73,6 @@ class Configuration extends Model /** * TODO can be replaced with native laravel code. * - * * @param mixed $value * @@ -85,7 +84,6 @@ class Configuration extends Model } /** - * * @param mixed $value */ diff --git a/app/Models/CurrencyExchangeRate.php b/app/Models/CurrencyExchangeRate.php index 7be23bd662..446a60ab99 100644 --- a/app/Models/CurrencyExchangeRate.php +++ b/app/Models/CurrencyExchangeRate.php @@ -79,7 +79,6 @@ class CurrencyExchangeRate extends Model protected $fillable = ['user_id', 'from_currency_id', 'to_currency_id', 'date', 'rate']; /** - * @return BelongsTo */ public function fromCurrency(): BelongsTo @@ -88,7 +87,6 @@ class CurrencyExchangeRate extends Model } /** - * @return BelongsTo */ public function toCurrency(): BelongsTo @@ -97,7 +95,6 @@ class CurrencyExchangeRate extends Model } /** - * @return BelongsTo */ public function user(): BelongsTo @@ -111,7 +108,7 @@ class CurrencyExchangeRate extends Model protected function rate(): Attribute { return Attribute::make( - get: fn ($value) => (string) $value, + get: fn ($value) => (string)$value, ); } @@ -121,7 +118,7 @@ class CurrencyExchangeRate extends Model protected function userRate(): Attribute { return Attribute::make( - get: fn ($value) => (string) $value, + get: fn ($value) => (string)$value, ); } } diff --git a/app/Models/InvitedUser.php b/app/Models/InvitedUser.php index 39dd9ee44b..0fac9d22c9 100644 --- a/app/Models/InvitedUser.php +++ b/app/Models/InvitedUser.php @@ -24,12 +24,12 @@ declare(strict_types=1); namespace FireflyIII\Models; +use Carbon\Carbon; use Eloquent; use FireflyIII\User; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Relations\BelongsTo; -use Carbon\Carbon; /** * Class InvitedUser @@ -59,14 +59,13 @@ use Carbon\Carbon; class InvitedUser extends Model { protected $casts - = [ + = [ 'expires' => 'datetime', 'redeemed' => 'boolean', ]; protected $fillable = ['user_id', 'email', 'invite_code', 'expires', 'redeemed']; /** - * @return BelongsTo */ public function user(): BelongsTo diff --git a/app/Models/LinkType.php b/app/Models/LinkType.php index ab44f2b1f7..6a5ae23b17 100644 --- a/app/Models/LinkType.php +++ b/app/Models/LinkType.php @@ -104,7 +104,6 @@ class LinkType extends Model } /** - * @return HasMany */ public function transactionJournalLinks(): HasMany diff --git a/app/Models/Location.php b/app/Models/Location.php index 605efcc948..3c98f51174 100644 --- a/app/Models/Location.php +++ b/app/Models/Location.php @@ -97,7 +97,6 @@ class Location extends Model } /** - * Get all of the accounts. */ public function accounts(): MorphMany @@ -108,7 +107,6 @@ class Location extends Model /** * Get all of the owning attachable models. * - * * @return MorphTo */ diff --git a/app/Models/Note.php b/app/Models/Note.php index 420f0ccff9..940305a4fa 100644 --- a/app/Models/Note.php +++ b/app/Models/Note.php @@ -77,7 +77,6 @@ class Note extends Model protected $fillable = ['title', 'text', 'noteable_id', 'noteable_type']; /** - * * Get all the owning noteable models. */ diff --git a/app/Models/ObjectGroup.php b/app/Models/ObjectGroup.php index de15cd5421..279580b499 100644 --- a/app/Models/ObjectGroup.php +++ b/app/Models/ObjectGroup.php @@ -103,7 +103,6 @@ class ObjectGroup extends Model /** * @return BelongsTo - */ public function user(): BelongsTo { diff --git a/app/Models/PiggyBank.php b/app/Models/PiggyBank.php index 2fc9520983..af01280562 100644 --- a/app/Models/PiggyBank.php +++ b/app/Models/PiggyBank.php @@ -129,7 +129,6 @@ class PiggyBank extends Model } /** - * @return BelongsTo */ public function account(): BelongsTo @@ -138,7 +137,6 @@ class PiggyBank extends Model } /** - * @return MorphMany */ public function attachments(): MorphMany @@ -147,7 +145,6 @@ class PiggyBank extends Model } /** - * Get all of the piggy bank's notes. */ public function notes(): MorphMany @@ -164,7 +161,6 @@ class PiggyBank extends Model } /** - * @return HasMany */ public function piggyBankEvents(): HasMany @@ -173,7 +169,6 @@ class PiggyBank extends Model } /** - * @return HasMany */ public function piggyBankRepetitions(): HasMany @@ -182,7 +177,6 @@ class PiggyBank extends Model } /** - * * @param mixed $value */ diff --git a/app/Models/PiggyBankEvent.php b/app/Models/PiggyBankEvent.php index e4b0f0891d..f3b5b34767 100644 --- a/app/Models/PiggyBankEvent.php +++ b/app/Models/PiggyBankEvent.php @@ -73,7 +73,6 @@ class PiggyBankEvent extends Model protected $hidden = ['amount_encrypted']; /** - * @return BelongsTo */ public function piggyBank(): BelongsTo @@ -82,7 +81,6 @@ class PiggyBankEvent extends Model } /** - * * @param mixed $value */ @@ -92,7 +90,6 @@ class PiggyBankEvent extends Model } /** - * @return BelongsTo */ public function transactionJournal(): BelongsTo diff --git a/app/Models/PiggyBankRepetition.php b/app/Models/PiggyBankRepetition.php index 5cfa4fe4de..8837c2dc4b 100644 --- a/app/Models/PiggyBankRepetition.php +++ b/app/Models/PiggyBankRepetition.php @@ -73,7 +73,6 @@ class PiggyBankRepetition extends Model protected $fillable = ['piggy_bank_id', 'startdate', 'targetdate', 'currentamount']; /** - * @return BelongsTo */ public function piggyBank(): BelongsTo @@ -82,7 +81,6 @@ class PiggyBankRepetition extends Model } /** - * * @param EloquentBuilder $query * @param Carbon $start @@ -96,7 +94,6 @@ class PiggyBankRepetition extends Model } /** - * * @param EloquentBuilder $query * @param Carbon $date @@ -120,7 +117,6 @@ class PiggyBankRepetition extends Model } /** - * * @param mixed $value */ diff --git a/app/Models/Preference.php b/app/Models/Preference.php index 595b21b9ae..4121b925ef 100644 --- a/app/Models/Preference.php +++ b/app/Models/Preference.php @@ -105,7 +105,6 @@ class Preference extends Model } /** - * @return BelongsTo */ public function user(): BelongsTo diff --git a/app/Models/Recurrence.php b/app/Models/Recurrence.php index 39b9e7ca47..97fb0958c5 100644 --- a/app/Models/Recurrence.php +++ b/app/Models/Recurrence.php @@ -143,7 +143,6 @@ class Recurrence extends Model } /** - * @return BelongsTo */ public function user(): BelongsTo @@ -152,7 +151,6 @@ class Recurrence extends Model } /** - * @return MorphMany */ public function attachments(): MorphMany @@ -161,7 +159,6 @@ class Recurrence extends Model } /** - * Get all the notes. */ public function notes(): MorphMany @@ -171,7 +168,6 @@ class Recurrence extends Model /** * @return HasMany - */ public function recurrenceMeta(): HasMany { @@ -180,7 +176,6 @@ class Recurrence extends Model /** * @return HasMany - */ public function recurrenceRepetitions(): HasMany { @@ -189,7 +184,6 @@ class Recurrence extends Model /** * @return HasMany - */ public function recurrenceTransactions(): HasMany { @@ -197,7 +191,6 @@ class Recurrence extends Model } /** - * @return BelongsTo */ public function transactionCurrency(): BelongsTo @@ -206,7 +199,6 @@ class Recurrence extends Model } /** - * @return BelongsTo */ public function transactionType(): BelongsTo diff --git a/app/Models/RecurrenceMeta.php b/app/Models/RecurrenceMeta.php index 00c79e7269..09699d1d8a 100644 --- a/app/Models/RecurrenceMeta.php +++ b/app/Models/RecurrenceMeta.php @@ -80,7 +80,6 @@ class RecurrenceMeta extends Model /** * @return BelongsTo - */ public function recurrence(): BelongsTo { diff --git a/app/Models/RecurrenceRepetition.php b/app/Models/RecurrenceRepetition.php index 240e2c9d20..1e3ac12556 100644 --- a/app/Models/RecurrenceRepetition.php +++ b/app/Models/RecurrenceRepetition.php @@ -91,7 +91,6 @@ class RecurrenceRepetition extends Model /** * @return BelongsTo - */ public function recurrence(): BelongsTo { diff --git a/app/Models/RecurrenceTransaction.php b/app/Models/RecurrenceTransaction.php index ba09af0f26..8eef7928de 100644 --- a/app/Models/RecurrenceTransaction.php +++ b/app/Models/RecurrenceTransaction.php @@ -112,7 +112,6 @@ class RecurrenceTransaction extends Model protected $table = 'recurrences_transactions'; /** - * @return BelongsTo */ public function destinationAccount(): BelongsTo @@ -121,7 +120,6 @@ class RecurrenceTransaction extends Model } /** - * @return BelongsTo */ public function foreignCurrency(): BelongsTo @@ -131,7 +129,6 @@ class RecurrenceTransaction extends Model /** * @return BelongsTo - */ public function recurrence(): BelongsTo { @@ -140,7 +137,6 @@ class RecurrenceTransaction extends Model /** * @return HasMany - */ public function recurrenceTransactionMeta(): HasMany { @@ -148,7 +144,6 @@ class RecurrenceTransaction extends Model } /** - * @return BelongsTo */ public function sourceAccount(): BelongsTo @@ -157,7 +152,6 @@ class RecurrenceTransaction extends Model } /** - * @return BelongsTo */ public function transactionCurrency(): BelongsTo @@ -166,7 +160,6 @@ class RecurrenceTransaction extends Model } /** - * @return BelongsTo */ public function transactionType(): BelongsTo @@ -180,7 +173,7 @@ class RecurrenceTransaction extends Model protected function amount(): Attribute { return Attribute::make( - get: fn ($value) => (string) $value, + get: fn ($value) => (string)$value, ); } @@ -190,7 +183,7 @@ class RecurrenceTransaction extends Model protected function foreignAmount(): Attribute { return Attribute::make( - get: fn ($value) => (string) $value, + get: fn ($value) => (string)$value, ); } } diff --git a/app/Models/RecurrenceTransactionMeta.php b/app/Models/RecurrenceTransactionMeta.php index 43085d48f5..31794fa5cf 100644 --- a/app/Models/RecurrenceTransactionMeta.php +++ b/app/Models/RecurrenceTransactionMeta.php @@ -80,7 +80,6 @@ class RecurrenceTransactionMeta extends Model /** * @return BelongsTo - */ public function recurrenceTransaction(): BelongsTo { diff --git a/app/Models/Role.php b/app/Models/Role.php index 4f5c36c89a..2aecb38ad7 100644 --- a/app/Models/Role.php +++ b/app/Models/Role.php @@ -70,7 +70,6 @@ class Role extends Model protected $fillable = ['name', 'display_name', 'description']; /** - * @return BelongsToMany */ public function users(): BelongsToMany diff --git a/app/Models/Rule.php b/app/Models/Rule.php index 09bb55f03e..a341663a62 100644 --- a/app/Models/Rule.php +++ b/app/Models/Rule.php @@ -125,7 +125,6 @@ class Rule extends Model } /** - * @return BelongsTo */ public function user(): BelongsTo @@ -134,7 +133,6 @@ class Rule extends Model } /** - * @return HasMany */ public function ruleActions(): HasMany @@ -143,7 +141,6 @@ class Rule extends Model } /** - * @return BelongsTo */ public function ruleGroup(): BelongsTo @@ -152,7 +149,6 @@ class Rule extends Model } /** - * @return HasMany */ public function ruleTriggers(): HasMany diff --git a/app/Models/RuleAction.php b/app/Models/RuleAction.php index 8044f4facb..29ee17ec90 100644 --- a/app/Models/RuleAction.php +++ b/app/Models/RuleAction.php @@ -76,7 +76,6 @@ class RuleAction extends Model protected $fillable = ['rule_id', 'action_type', 'action_value', 'order', 'active', 'stop_processing']; /** - * @return BelongsTo */ public function rule(): BelongsTo diff --git a/app/Models/RuleGroup.php b/app/Models/RuleGroup.php index f8dcc4fb1e..824104a160 100644 --- a/app/Models/RuleGroup.php +++ b/app/Models/RuleGroup.php @@ -116,7 +116,6 @@ class RuleGroup extends Model } /** - * @return BelongsTo */ public function user(): BelongsTo @@ -125,7 +124,6 @@ class RuleGroup extends Model } /** - * @return HasMany */ public function rules(): HasMany diff --git a/app/Models/RuleTrigger.php b/app/Models/RuleTrigger.php index 37623e9f85..df4a906c0d 100644 --- a/app/Models/RuleTrigger.php +++ b/app/Models/RuleTrigger.php @@ -76,7 +76,6 @@ class RuleTrigger extends Model protected $fillable = ['rule_id', 'trigger_type', 'trigger_value', 'order', 'active', 'stop_processing']; /** - * @return BelongsTo */ public function rule(): BelongsTo diff --git a/app/Models/Tag.php b/app/Models/Tag.php index e39cdd6037..124c231e52 100644 --- a/app/Models/Tag.php +++ b/app/Models/Tag.php @@ -127,7 +127,6 @@ class Tag extends Model } /** - * @return BelongsTo */ public function user(): BelongsTo @@ -136,7 +135,6 @@ class Tag extends Model } /** - * @return MorphMany */ public function attachments(): MorphMany @@ -145,7 +143,6 @@ class Tag extends Model } /** - * @return MorphMany */ public function locations(): MorphMany @@ -154,7 +151,6 @@ class Tag extends Model } /** - * @return BelongsToMany */ public function transactionJournals(): BelongsToMany diff --git a/app/Models/Transaction.php b/app/Models/Transaction.php index a4f57ca72e..7a6af8e9c7 100644 --- a/app/Models/Transaction.php +++ b/app/Models/Transaction.php @@ -126,7 +126,6 @@ class Transaction extends Model /** * Get the account this object belongs to. * - * @return BelongsTo */ public function account(): BelongsTo @@ -137,7 +136,6 @@ class Transaction extends Model /** * Get the budget(s) this object belongs to. * - * @return BelongsToMany */ public function budgets(): BelongsToMany @@ -148,7 +146,6 @@ class Transaction extends Model /** * Get the category(ies) this object belongs to. * - * @return BelongsToMany */ public function categories(): BelongsToMany @@ -159,7 +156,6 @@ class Transaction extends Model /** * Get the currency this object belongs to. * - * @return BelongsTo */ public function foreignCurrency(): BelongsTo @@ -170,7 +166,6 @@ class Transaction extends Model /** * Check for transactions AFTER a specified date. * - * * @param Builder $query * @param Carbon $date @@ -190,7 +185,6 @@ class Transaction extends Model * @param string $table * * @return bool - */ public static function isJoined(Builder $query, string $table): bool { @@ -210,7 +204,6 @@ class Transaction extends Model /** * Check for transactions BEFORE the specified date. * - * * @param Builder $query * @param Carbon $date @@ -224,7 +217,6 @@ class Transaction extends Model } /** - * * @param Builder $query * @param array $types @@ -242,7 +234,6 @@ class Transaction extends Model } /** - * * @param mixed $value */ @@ -252,7 +243,6 @@ class Transaction extends Model } /** - * @return BelongsTo */ public function transactionCurrency(): BelongsTo @@ -261,7 +251,6 @@ class Transaction extends Model } /** - * @return BelongsTo */ public function transactionJournal(): BelongsTo diff --git a/app/Models/TransactionCurrency.php b/app/Models/TransactionCurrency.php index 8ed812ee65..f8abc83c2e 100644 --- a/app/Models/TransactionCurrency.php +++ b/app/Models/TransactionCurrency.php @@ -108,7 +108,6 @@ class TransactionCurrency extends Model } /** - * @return HasMany */ public function budgetLimits(): HasMany @@ -117,7 +116,6 @@ class TransactionCurrency extends Model } /** - * @return HasMany */ public function transactionJournals(): HasMany @@ -126,7 +124,6 @@ class TransactionCurrency extends Model } /** - * @return HasMany */ public function transactions(): HasMany diff --git a/app/Models/TransactionGroup.php b/app/Models/TransactionGroup.php index d07f15f589..55ffe8b5a4 100644 --- a/app/Models/TransactionGroup.php +++ b/app/Models/TransactionGroup.php @@ -116,7 +116,6 @@ class TransactionGroup extends Model } /** - * @return BelongsTo */ public function user(): BelongsTo @@ -125,7 +124,6 @@ class TransactionGroup extends Model } /** - * @return HasMany */ public function transactionJournals(): HasMany diff --git a/app/Models/TransactionJournal.php b/app/Models/TransactionJournal.php index 7fc8dcd351..3777407c15 100644 --- a/app/Models/TransactionJournal.php +++ b/app/Models/TransactionJournal.php @@ -185,7 +185,6 @@ class TransactionJournal extends Model } /** - * @return BelongsTo */ public function user(): BelongsTo @@ -194,7 +193,6 @@ class TransactionJournal extends Model } /** - * @return MorphMany */ public function attachments(): MorphMany @@ -203,7 +201,6 @@ class TransactionJournal extends Model } /** - * @return BelongsTo */ public function bill(): BelongsTo @@ -212,7 +209,6 @@ class TransactionJournal extends Model } /** - * @return BelongsToMany */ public function budgets(): BelongsToMany @@ -221,7 +217,6 @@ class TransactionJournal extends Model } /** - * @return BelongsToMany */ public function categories(): BelongsToMany @@ -230,7 +225,6 @@ class TransactionJournal extends Model } /** - * @return HasMany */ public function destJournalLinks(): HasMany @@ -239,7 +233,6 @@ class TransactionJournal extends Model } /** - * @return bool */ public function isTransfer(): bool @@ -252,7 +245,6 @@ class TransactionJournal extends Model } /** - * @return MorphMany */ public function locations(): MorphMany @@ -261,7 +253,6 @@ class TransactionJournal extends Model } /** - * Get all of the notes. */ public function notes(): MorphMany @@ -270,7 +261,6 @@ class TransactionJournal extends Model } /** - * @return HasMany */ public function piggyBankEvents(): HasMany @@ -279,7 +269,6 @@ class TransactionJournal extends Model } /** - * * @param EloquentBuilder $query * @param Carbon $date @@ -292,7 +281,6 @@ class TransactionJournal extends Model } /** - * * @param EloquentBuilder $query * @param Carbon $date @@ -305,7 +293,6 @@ class TransactionJournal extends Model } /** - * * @param EloquentBuilder $query * @param array $types @@ -323,7 +310,6 @@ class TransactionJournal extends Model /** * Checks if tables are joined. * - * * @param Builder $query * @param string $table @@ -346,7 +332,6 @@ class TransactionJournal extends Model } /** - * @return HasMany */ public function sourceJournalLinks(): HasMany @@ -355,7 +340,6 @@ class TransactionJournal extends Model } /** - * @return BelongsToMany */ public function tags(): BelongsToMany @@ -364,7 +348,6 @@ class TransactionJournal extends Model } /** - * @return BelongsTo */ public function transactionCurrency(): BelongsTo @@ -373,7 +356,6 @@ class TransactionJournal extends Model } /** - * @return BelongsTo */ public function transactionGroup(): BelongsTo @@ -382,7 +364,6 @@ class TransactionJournal extends Model } /** - * @return HasMany */ public function transactionJournalMeta(): HasMany @@ -391,7 +372,6 @@ class TransactionJournal extends Model } /** - * @return BelongsTo */ public function transactionType(): BelongsTo @@ -400,7 +380,6 @@ class TransactionJournal extends Model } /** - * @return HasMany */ public function transactions(): HasMany diff --git a/app/Models/TransactionJournalLink.php b/app/Models/TransactionJournalLink.php index 4a3046bddc..70dcb1c7e5 100644 --- a/app/Models/TransactionJournalLink.php +++ b/app/Models/TransactionJournalLink.php @@ -103,7 +103,6 @@ class TransactionJournalLink extends Model } /** - * @return BelongsTo */ public function destination(): BelongsTo @@ -112,7 +111,6 @@ class TransactionJournalLink extends Model } /** - * @return BelongsTo */ public function linkType(): BelongsTo @@ -121,7 +119,6 @@ class TransactionJournalLink extends Model } /** - * Get all of the notes. */ public function notes(): MorphMany @@ -130,7 +127,6 @@ class TransactionJournalLink extends Model } /** - * @return BelongsTo */ public function source(): BelongsTo diff --git a/app/Models/TransactionJournalMeta.php b/app/Models/TransactionJournalMeta.php index 7ea702a4d8..93195c34c4 100644 --- a/app/Models/TransactionJournalMeta.php +++ b/app/Models/TransactionJournalMeta.php @@ -79,7 +79,6 @@ class TransactionJournalMeta extends Model protected $table = 'journal_meta'; /** - * * @param mixed $value * @@ -91,7 +90,6 @@ class TransactionJournalMeta extends Model } /** - * * @param mixed $value */ @@ -103,7 +101,6 @@ class TransactionJournalMeta extends Model } /** - * @return BelongsTo */ public function transactionJournal(): BelongsTo diff --git a/app/Models/TransactionType.php b/app/Models/TransactionType.php index 53d3eae91b..4a83d3dc91 100644 --- a/app/Models/TransactionType.php +++ b/app/Models/TransactionType.php @@ -96,7 +96,6 @@ class TransactionType extends Model } /** - * @return bool */ public function isDeposit(): bool @@ -105,7 +104,6 @@ class TransactionType extends Model } /** - * @return bool */ public function isOpeningBalance(): bool @@ -114,7 +112,6 @@ class TransactionType extends Model } /** - * @return bool */ public function isTransfer(): bool @@ -123,7 +120,6 @@ class TransactionType extends Model } /** - * @return bool */ public function isWithdrawal(): bool @@ -132,7 +128,6 @@ class TransactionType extends Model } /** - * @return HasMany */ public function transactionJournals(): HasMany diff --git a/app/Models/UserGroup.php b/app/Models/UserGroup.php index e68bd17e32..a5e36294d2 100644 --- a/app/Models/UserGroup.php +++ b/app/Models/UserGroup.php @@ -56,7 +56,6 @@ class UserGroup extends Model protected $fillable = ['title']; /** - * * @return HasMany */ diff --git a/app/Models/UserRole.php b/app/Models/UserRole.php index c8b03dc1ae..b09c8d0a0a 100644 --- a/app/Models/UserRole.php +++ b/app/Models/UserRole.php @@ -68,7 +68,6 @@ class UserRole extends Model protected $fillable = ['title']; /** - * * @return HasMany */ diff --git a/app/Models/Webhook.php b/app/Models/Webhook.php index 66f2463374..cc41df4b18 100644 --- a/app/Models/Webhook.php +++ b/app/Models/Webhook.php @@ -195,7 +195,6 @@ class Webhook extends Model } /** - * @return BelongsTo */ public function user(): BelongsTo @@ -204,7 +203,6 @@ class Webhook extends Model } /** - * @return HasMany */ public function webhookMessages(): HasMany diff --git a/app/Models/WebhookAttempt.php b/app/Models/WebhookAttempt.php index a3d3346e89..85d617ac33 100644 --- a/app/Models/WebhookAttempt.php +++ b/app/Models/WebhookAttempt.php @@ -88,7 +88,6 @@ class WebhookAttempt extends Model } /** - * @return BelongsTo */ public function webhookMessage(): BelongsTo diff --git a/app/Models/WebhookMessage.php b/app/Models/WebhookMessage.php index b019885d47..46740053a7 100644 --- a/app/Models/WebhookMessage.php +++ b/app/Models/WebhookMessage.php @@ -102,7 +102,6 @@ class WebhookMessage extends Model } /** - * @return BelongsTo */ public function webhook(): BelongsTo @@ -111,13 +110,13 @@ class WebhookMessage extends Model } /** - * @return HasMany */ public function webhookAttempts(): HasMany { return $this->hasMany(WebhookAttempt::class); } + /** * Get the amount * diff --git a/app/Notifications/User/UserLogin.php b/app/Notifications/User/UserLogin.php index 80de3eae66..243e1304cb 100644 --- a/app/Notifications/User/UserLogin.php +++ b/app/Notifications/User/UserLogin.php @@ -24,7 +24,6 @@ declare(strict_types=1); namespace FireflyIII\Notifications\User; -use Exception; use FireflyIII\Exceptions\FireflyException; use Illuminate\Bus\Queueable; use Illuminate\Notifications\Messages\MailMessage; diff --git a/app/Providers/AccountServiceProvider.php b/app/Providers/AccountServiceProvider.php index 4522c0efd7..a6539fe8d8 100644 --- a/app/Providers/AccountServiceProvider.php +++ b/app/Providers/AccountServiceProvider.php @@ -33,7 +33,6 @@ use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; /** - * Class AccountServiceProvider. */ class AccountServiceProvider extends ServiceProvider diff --git a/app/Providers/AdminServiceProvider.php b/app/Providers/AdminServiceProvider.php index c1bd462a93..baa781b603 100644 --- a/app/Providers/AdminServiceProvider.php +++ b/app/Providers/AdminServiceProvider.php @@ -29,7 +29,6 @@ use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; /** - * Class AdminServiceProvider */ class AdminServiceProvider extends ServiceProvider diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index ade642fb79..d1a1538827 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -31,7 +31,6 @@ use Laravel\Sanctum\Sanctum; use URL; /** - * Class AppServiceProvider */ class AppServiceProvider extends ServiceProvider diff --git a/app/Providers/AttachmentServiceProvider.php b/app/Providers/AttachmentServiceProvider.php index 097440f2ba..c6ba8cae34 100644 --- a/app/Providers/AttachmentServiceProvider.php +++ b/app/Providers/AttachmentServiceProvider.php @@ -29,7 +29,6 @@ use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; /** - * Class AttachmentServiceProvider. */ class AttachmentServiceProvider extends ServiceProvider diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index 1464c2e37c..b02911ac58 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -30,7 +30,6 @@ use Illuminate\Support\Facades\Auth; use Laravel\Passport\Passport; /** - * Class AuthServiceProvider */ class AuthServiceProvider extends ServiceProvider diff --git a/app/Providers/BillServiceProvider.php b/app/Providers/BillServiceProvider.php index 65f8edb3a2..3ac8ed9f3b 100644 --- a/app/Providers/BillServiceProvider.php +++ b/app/Providers/BillServiceProvider.php @@ -29,7 +29,6 @@ use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; /** - * Class BillServiceProvider. */ class BillServiceProvider extends ServiceProvider diff --git a/app/Providers/BroadcastServiceProvider.php b/app/Providers/BroadcastServiceProvider.php index f75f7bd99e..6e80ef7451 100644 --- a/app/Providers/BroadcastServiceProvider.php +++ b/app/Providers/BroadcastServiceProvider.php @@ -27,7 +27,6 @@ use Illuminate\Support\Facades\Broadcast; use Illuminate\Support\ServiceProvider; /** - * Class BroadcastServiceProvider */ class BroadcastServiceProvider extends ServiceProvider diff --git a/app/Providers/BudgetServiceProvider.php b/app/Providers/BudgetServiceProvider.php index e6132312a4..f0aad0da78 100644 --- a/app/Providers/BudgetServiceProvider.php +++ b/app/Providers/BudgetServiceProvider.php @@ -37,7 +37,6 @@ use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; /** - * Class BudgetServiceProvider. */ class BudgetServiceProvider extends ServiceProvider diff --git a/app/Providers/CategoryServiceProvider.php b/app/Providers/CategoryServiceProvider.php index 408348afd0..c5c27b54b7 100644 --- a/app/Providers/CategoryServiceProvider.php +++ b/app/Providers/CategoryServiceProvider.php @@ -33,7 +33,6 @@ use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; /** - * Class CategoryServiceProvider. */ class CategoryServiceProvider extends ServiceProvider diff --git a/app/Providers/CurrencyServiceProvider.php b/app/Providers/CurrencyServiceProvider.php index 806370066c..a543385757 100644 --- a/app/Providers/CurrencyServiceProvider.php +++ b/app/Providers/CurrencyServiceProvider.php @@ -29,7 +29,6 @@ use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; /** - * Class CurrencyServiceProvider. */ class CurrencyServiceProvider extends ServiceProvider diff --git a/app/Providers/FireflyServiceProvider.php b/app/Providers/FireflyServiceProvider.php index 02212f03bc..c8b4d42d8a 100644 --- a/app/Providers/FireflyServiceProvider.php +++ b/app/Providers/FireflyServiceProvider.php @@ -76,7 +76,6 @@ use Validator; * * Class FireflyServiceProvider. * - * */ class FireflyServiceProvider extends ServiceProvider diff --git a/app/Providers/FireflySessionProvider.php b/app/Providers/FireflySessionProvider.php index 3e80a02f14..f07474003c 100644 --- a/app/Providers/FireflySessionProvider.php +++ b/app/Providers/FireflySessionProvider.php @@ -28,7 +28,6 @@ use Illuminate\Session\SessionManager; use Illuminate\Support\ServiceProvider; /** - * Class FireflySessionProvider */ class FireflySessionProvider extends ServiceProvider diff --git a/app/Providers/JournalServiceProvider.php b/app/Providers/JournalServiceProvider.php index 1fb0fd1b32..8a2ae5ae89 100644 --- a/app/Providers/JournalServiceProvider.php +++ b/app/Providers/JournalServiceProvider.php @@ -37,7 +37,6 @@ use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; /** - * Class JournalServiceProvider. */ class JournalServiceProvider extends ServiceProvider diff --git a/app/Providers/PiggyBankServiceProvider.php b/app/Providers/PiggyBankServiceProvider.php index 5e810fb3a0..05e0514419 100644 --- a/app/Providers/PiggyBankServiceProvider.php +++ b/app/Providers/PiggyBankServiceProvider.php @@ -29,7 +29,6 @@ use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; /** - * Class PiggyBankServiceProvider. */ class PiggyBankServiceProvider extends ServiceProvider diff --git a/app/Providers/RecurringServiceProvider.php b/app/Providers/RecurringServiceProvider.php index bff8c08c66..b954885476 100644 --- a/app/Providers/RecurringServiceProvider.php +++ b/app/Providers/RecurringServiceProvider.php @@ -29,7 +29,6 @@ use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; /** - * Class RecurringServiceProvider. */ class RecurringServiceProvider extends ServiceProvider diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index 6c2f8e6770..2950640f53 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -27,7 +27,6 @@ use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvi use Illuminate\Support\Facades\Route; /** - * Class RouteServiceProvider */ class RouteServiceProvider extends ServiceProvider diff --git a/app/Providers/RuleGroupServiceProvider.php b/app/Providers/RuleGroupServiceProvider.php index cb7a208f0e..01297995ae 100644 --- a/app/Providers/RuleGroupServiceProvider.php +++ b/app/Providers/RuleGroupServiceProvider.php @@ -29,7 +29,6 @@ use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; /** - * Class RuleGroupServiceProvider. */ class RuleGroupServiceProvider extends ServiceProvider diff --git a/app/Providers/RuleServiceProvider.php b/app/Providers/RuleServiceProvider.php index b94ac7d219..62dfb0e3e7 100644 --- a/app/Providers/RuleServiceProvider.php +++ b/app/Providers/RuleServiceProvider.php @@ -29,7 +29,6 @@ use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; /** - * Class RuleServiceProvider. */ class RuleServiceProvider extends ServiceProvider diff --git a/app/Providers/SearchServiceProvider.php b/app/Providers/SearchServiceProvider.php index cc03da82ec..3bdbcdf5e6 100644 --- a/app/Providers/SearchServiceProvider.php +++ b/app/Providers/SearchServiceProvider.php @@ -29,7 +29,6 @@ use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; /** - * Class SearchServiceProvider. */ class SearchServiceProvider extends ServiceProvider diff --git a/app/Providers/SessionServiceProvider.php b/app/Providers/SessionServiceProvider.php index 1b64bc034d..ea840005df 100644 --- a/app/Providers/SessionServiceProvider.php +++ b/app/Providers/SessionServiceProvider.php @@ -27,7 +27,6 @@ use FireflyIII\Http\Middleware\StartFireflySession; use Illuminate\Session\SessionServiceProvider as BaseSessionServiceProvider; /** - * Class SessionServiceProvider. */ class SessionServiceProvider extends BaseSessionServiceProvider diff --git a/app/Providers/TagServiceProvider.php b/app/Providers/TagServiceProvider.php index 851fa4a77e..17f5e107d2 100644 --- a/app/Providers/TagServiceProvider.php +++ b/app/Providers/TagServiceProvider.php @@ -31,7 +31,6 @@ use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; /** - * Class TagServiceProvider. */ class TagServiceProvider extends ServiceProvider diff --git a/app/Repositories/Attachment/AttachmentRepository.php b/app/Repositories/Attachment/AttachmentRepository.php index 6a699a82a1..b28fc55814 100644 --- a/app/Repositories/Attachment/AttachmentRepository.php +++ b/app/Repositories/Attachment/AttachmentRepository.php @@ -36,8 +36,8 @@ use Illuminate\Contracts\Encryption\DecryptException; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Storage; use League\Flysystem\UnableToDeleteFile; -use LogicException; use Log; +use LogicException; /** * Class AttachmentRepository. diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.php index 9e02398bfd..9122c374a5 100644 --- a/app/Repositories/Budget/BudgetRepository.php +++ b/app/Repositories/Budget/BudgetRepository.php @@ -203,6 +203,61 @@ class BudgetRepository implements BudgetRepositoryInterface return 0; } + /** + * @inheritDoc + */ + public function budgetedInPeriodForBudget(Budget $budget, Carbon $start, Carbon $end): array + { + Log::debug(sprintf('Now in budgetedInPeriod(#%d, "%s", "%s")', $budget->id, $start->format('Y-m-d'), $end->format('Y-m-d'))); + $return = []; + /** @var BudgetLimitRepository $limitRepository */ + $limitRepository = app(BudgetLimitRepository::class); + $limitRepository->setUser($this->user); + + Log::debug(sprintf('Budget #%d: "%s"', $budget->id, $budget->name)); + $limits = $limitRepository->getBudgetLimits($budget, $start, $end); + /** @var BudgetLimit $limit */ + foreach ($limits as $limit) { + Log::debug(sprintf('Budget limit #%d', $limit->id)); + $currency = $limit->transactionCurrency; + $return[$currency->id] = $return[$currency->id] ?? [ + 'id' => (string)$currency->id, + 'name' => $currency->name, + 'symbol' => $currency->symbol, + 'code' => $currency->code, + 'decimal_places' => $currency->decimal_places, + 'sum' => '0', + ]; + // same period + if ($limit->start_date->isSameDay($start) && $limit->end_date->isSameDay($end)) { + $return[$currency->id]['sum'] = bcadd($return[$currency->id]['sum'], (string)$limit->amount); + Log::debug(sprintf('Add full amount [1]: %s', $limit->amount)); + continue; + } + // limit is inside of date range + if ($start->lte($limit->start_date) && $end->gte($limit->end_date)) { + $return[$currency->id]['sum'] = bcadd($return[$currency->id]['sum'], (string)$limit->amount); + Log::debug(sprintf('Add full amount [2]: %s', $limit->amount)); + continue; + } + $total = $limit->start_date->diffInDays($limit->end_date) + 1; // include the day itself. + $days = $this->daysInOverlap($limit, $start, $end); + $amount = bcmul(bcdiv((string)$limit->amount, (string)$total), (string)$days); + $return[$currency->id]['sum'] = bcadd($return[$currency->id]['sum'], $amount); + Log::debug( + sprintf( + 'Amount per day: %s (%s over %d days). Total amount for %d days: %s', + bcdiv((string)$limit->amount, (string)$total), + $limit->amount, + $total, + $days, + $amount + ) + ); + } + return $return; + } + /** * @return bool */ @@ -664,6 +719,69 @@ class BudgetRepository implements BudgetRepositoryInterface return $array; } + /** + * @inheritDoc + */ + public function spentInPeriodForBudget(Budget $budget, Carbon $start, Carbon $end): array + { + Log::debug(sprintf('Now in %s', __METHOD__)); + $start->startOfDay(); + $end->endOfDay(); + + // exclude specific liabilities + $repository = app(AccountRepositoryInterface::class); + $repository->setUser($this->user); + $subset = $repository->getAccountsByType(config('firefly.valid_liabilities')); + $selection = new Collection(); + /** @var Account $account */ + foreach ($subset as $account) { + if ('credit' === $repository->getMetaValue($account, 'liability_direction')) { + $selection->push($account); + } + } + + // start collecting: + /** @var GroupCollectorInterface $collector */ + $collector = app(GroupCollectorInterface::class); + $collector->setUser($this->user) + ->setRange($start, $end) + ->excludeDestinationAccounts($selection) + ->setTypes([TransactionType::WITHDRAWAL]) + ->setBudget($budget); + + $journals = $collector->getExtractedJournals(); + $array = []; + + foreach ($journals as $journal) { + $currencyId = (int)$journal['currency_id']; + $array[$currencyId] = $array[$currencyId] ?? [ + 'id' => (string)$currencyId, + 'name' => $journal['currency_name'], + 'symbol' => $journal['currency_symbol'], + 'code' => $journal['currency_code'], + 'decimal_places' => $journal['currency_decimal_places'], + 'sum' => '0', + ]; + $array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], app('steam')->negative($journal['amount'])); + + // also do foreign amount: + $foreignId = (int)$journal['foreign_currency_id']; + if (0 !== $foreignId) { + $array[$foreignId] = $array[$foreignId] ?? [ + 'id' => (string)$foreignId, + 'name' => $journal['foreign_currency_name'], + 'symbol' => $journal['foreign_currency_symbol'], + 'code' => $journal['foreign_currency_code'], + 'decimal_places' => $journal['foreign_currency_decimal_places'], + 'sum' => '0', + ]; + $array[$foreignId]['sum'] = bcadd($array[$foreignId]['sum'], app('steam')->negative($journal['foreign_amount'])); + } + } + + return $array; + } + /** * @param array $data * @@ -756,122 +874,4 @@ class BudgetRepository implements BudgetRepositoryInterface { return (int)$this->user->budgets()->max('order'); } - - /** - * @inheritDoc - */ - public function spentInPeriodForBudget(Budget $budget, Carbon $start, Carbon $end): array - { - Log::debug(sprintf('Now in %s', __METHOD__)); - $start->startOfDay(); - $end->endOfDay(); - - // exclude specific liabilities - $repository = app(AccountRepositoryInterface::class); - $repository->setUser($this->user); - $subset = $repository->getAccountsByType(config('firefly.valid_liabilities')); - $selection = new Collection(); - /** @var Account $account */ - foreach ($subset as $account) { - if ('credit' === $repository->getMetaValue($account, 'liability_direction')) { - $selection->push($account); - } - } - - // start collecting: - /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); - $collector->setUser($this->user) - ->setRange($start, $end) - ->excludeDestinationAccounts($selection) - ->setTypes([TransactionType::WITHDRAWAL]) - ->setBudget($budget); - - $journals = $collector->getExtractedJournals(); - $array = []; - - foreach ($journals as $journal) { - $currencyId = (int)$journal['currency_id']; - $array[$currencyId] = $array[$currencyId] ?? [ - 'id' => (string)$currencyId, - 'name' => $journal['currency_name'], - 'symbol' => $journal['currency_symbol'], - 'code' => $journal['currency_code'], - 'decimal_places' => $journal['currency_decimal_places'], - 'sum' => '0', - ]; - $array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], app('steam')->negative($journal['amount'])); - - // also do foreign amount: - $foreignId = (int)$journal['foreign_currency_id']; - if (0 !== $foreignId) { - $array[$foreignId] = $array[$foreignId] ?? [ - 'id' => (string)$foreignId, - 'name' => $journal['foreign_currency_name'], - 'symbol' => $journal['foreign_currency_symbol'], - 'code' => $journal['foreign_currency_code'], - 'decimal_places' => $journal['foreign_currency_decimal_places'], - 'sum' => '0', - ]; - $array[$foreignId]['sum'] = bcadd($array[$foreignId]['sum'], app('steam')->negative($journal['foreign_amount'])); - } - } - - return $array; - } - - /** - * @inheritDoc - */ - public function budgetedInPeriodForBudget(Budget $budget, Carbon $start, Carbon $end): array - { - Log::debug(sprintf('Now in budgetedInPeriod(#%d, "%s", "%s")', $budget->id, $start->format('Y-m-d'), $end->format('Y-m-d'))); - $return = []; - /** @var BudgetLimitRepository $limitRepository */ - $limitRepository = app(BudgetLimitRepository::class); - $limitRepository->setUser($this->user); - - Log::debug(sprintf('Budget #%d: "%s"', $budget->id, $budget->name)); - $limits = $limitRepository->getBudgetLimits($budget, $start, $end); - /** @var BudgetLimit $limit */ - foreach ($limits as $limit) { - Log::debug(sprintf('Budget limit #%d', $limit->id)); - $currency = $limit->transactionCurrency; - $return[$currency->id] = $return[$currency->id] ?? [ - 'id' => (string)$currency->id, - 'name' => $currency->name, - 'symbol' => $currency->symbol, - 'code' => $currency->code, - 'decimal_places' => $currency->decimal_places, - 'sum' => '0', - ]; - // same period - if ($limit->start_date->isSameDay($start) && $limit->end_date->isSameDay($end)) { - $return[$currency->id]['sum'] = bcadd($return[$currency->id]['sum'], (string)$limit->amount); - Log::debug(sprintf('Add full amount [1]: %s', $limit->amount)); - continue; - } - // limit is inside of date range - if ($start->lte($limit->start_date) && $end->gte($limit->end_date)) { - $return[$currency->id]['sum'] = bcadd($return[$currency->id]['sum'], (string)$limit->amount); - Log::debug(sprintf('Add full amount [2]: %s', $limit->amount)); - continue; - } - $total = $limit->start_date->diffInDays($limit->end_date) + 1; // include the day itself. - $days = $this->daysInOverlap($limit, $start, $end); - $amount = bcmul(bcdiv((string)$limit->amount, (string)$total), (string)$days); - $return[$currency->id]['sum'] = bcadd($return[$currency->id]['sum'], $amount); - Log::debug( - sprintf( - 'Amount per day: %s (%s over %d days). Total amount for %d days: %s', - bcdiv((string)$limit->amount, (string)$total), - $limit->amount, - $total, - $days, - $amount - ) - ); - } - return $return; - } } diff --git a/app/Repositories/Budget/BudgetRepositoryInterface.php b/app/Repositories/Budget/BudgetRepositoryInterface.php index 88f0a7c4dc..b8766620b6 100644 --- a/app/Repositories/Budget/BudgetRepositoryInterface.php +++ b/app/Repositories/Budget/BudgetRepositoryInterface.php @@ -64,7 +64,7 @@ interface BudgetRepositoryInterface /** * Returns the amount that is budgeted in a period. * - * @param Budget $budget + * @param Budget $budget * @param Carbon $start * @param Carbon $end * @return array diff --git a/app/Repositories/Category/CategoryRepository.php b/app/Repositories/Category/CategoryRepository.php index a5d0d41b78..26fa5ee630 100644 --- a/app/Repositories/Category/CategoryRepository.php +++ b/app/Repositories/Category/CategoryRepository.php @@ -205,6 +205,7 @@ class CategoryRepository implements CategoryRepositoryInterface $this->user = $user; } } + /** * @param Category $category */ diff --git a/app/Repositories/PiggyBank/ModifiesPiggyBanks.php b/app/Repositories/PiggyBank/ModifiesPiggyBanks.php index 825ffe6324..fb70760fcb 100644 --- a/app/Repositories/PiggyBank/ModifiesPiggyBanks.php +++ b/app/Repositories/PiggyBank/ModifiesPiggyBanks.php @@ -34,6 +34,7 @@ use FireflyIII\Models\TransactionJournal; use FireflyIII\Repositories\ObjectGroup\CreatesObjectGroups; use Illuminate\Database\QueryException; use Illuminate\Support\Facades\Log; +use JsonException; /** * Trait ModifiesPiggyBanks @@ -97,7 +98,7 @@ trait ModifiesPiggyBanks * @param string $amount * * @return bool - * @throws \JsonException + * @throws JsonException */ public function canAddAmount(PiggyBank $piggyBank, string $amount): bool { diff --git a/app/Repositories/PiggyBank/PiggyBankRepository.php b/app/Repositories/PiggyBank/PiggyBankRepository.php index d8d561a24e..861c823906 100644 --- a/app/Repositories/PiggyBank/PiggyBankRepository.php +++ b/app/Repositories/PiggyBank/PiggyBankRepository.php @@ -336,12 +336,14 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface public function getPiggyBanks(): Collection { return $this->user // @phpstan-ignore-line (phpstan does not recognize objectGroups) - ->piggyBanks() - ->with( - ['account', - 'objectGroups'] - ) - ->orderBy('order', 'ASC')->get(); + ->piggyBanks() + ->with( + [ + 'account', + 'objectGroups', + ] + ) + ->orderBy('order', 'ASC')->get(); } /** diff --git a/app/Repositories/Recurring/RecurringRepository.php b/app/Repositories/Recurring/RecurringRepository.php index 6b2c473046..091a036568 100644 --- a/app/Repositories/Recurring/RecurringRepository.php +++ b/app/Repositories/Recurring/RecurringRepository.php @@ -92,6 +92,21 @@ class RecurringRepository implements RecurringRepositoryInterface return false; } + /** + * Returns all of the user's recurring transactions. + * + * @return Collection + */ + public function get(): Collection + { + return $this->user->recurrences() + ->with(['TransactionCurrency', 'TransactionType', 'RecurrenceRepetitions', 'RecurrenceTransactions']) + ->orderBy('active', 'DESC') + ->orderBy('transaction_type_id', 'ASC') + ->orderBy('title', 'ASC') + ->get(); + } + /** * Destroy a recurring transaction. * @@ -126,21 +141,6 @@ class RecurringRepository implements RecurringRepositoryInterface ->get(); } - /** - * Returns all of the user's recurring transactions. - * - * @return Collection - */ - public function get(): Collection - { - return $this->user->recurrences() - ->with(['TransactionCurrency', 'TransactionType', 'RecurrenceRepetitions', 'RecurrenceTransactions']) - ->orderBy('active', 'DESC') - ->orderBy('transaction_type_id', 'ASC') - ->orderBy('title', 'ASC') - ->get(); - } - /** * @inheritDoc */ diff --git a/app/Repositories/TransactionGroup/TransactionGroupRepository.php b/app/Repositories/TransactionGroup/TransactionGroupRepository.php index d305566060..00eadc2740 100644 --- a/app/Repositories/TransactionGroup/TransactionGroupRepository.php +++ b/app/Repositories/TransactionGroup/TransactionGroupRepository.php @@ -176,11 +176,11 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface $result = []; /** @var Attachment $attachment */ foreach ($set as $attachment) { - $journalId = (int)$attachment->attachable_id; - $result[$journalId] = $result[$journalId] ?? []; - $current = $attachment->toArray(); - $current['file_exists'] = true; - $current['notes'] = $repository->getNoteText($attachment); + $journalId = (int)$attachment->attachable_id; + $result[$journalId] = $result[$journalId] ?? []; + $current = $attachment->toArray(); + $current['file_exists'] = true; + $current['notes'] = $repository->getNoteText($attachment); // already determined that this attachable is a TransactionJournal. $current['journal_title'] = $attachment->attachable->description; // @phpstan-ignore-line $result[$journalId][] = $current; diff --git a/app/Repositories/User/UserRepository.php b/app/Repositories/User/UserRepository.php index 4ce157cb4b..7e2bc84938 100644 --- a/app/Repositories/User/UserRepository.php +++ b/app/Repositories/User/UserRepository.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace FireflyIII\Repositories\User; -use Carbon\Carbon; use Exception; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\BudgetLimit; @@ -168,16 +167,6 @@ class UserRepository implements UserRepositoryInterface return User::orderBy('id', 'DESC')->get(['users.*']); } - /** - * @param int $userId - * - * @return User|null - */ - public function find(int $userId): ?User - { - return User::find($userId); - } - /** * @param string $email * @@ -222,6 +211,37 @@ class UserRepository implements UserRepositoryInterface return null; } + /** + * @inheritDoc + * @throws FireflyException + */ + public function getRolesInGroup(User $user, int $groupId): array + { + /** @var UserGroup $group */ + $group = UserGroup::find($groupId); + if (null === $group) { + throw new FireflyException(sprintf('Could not find group #%d', $groupId)); + } + $memberships = $group->groupMemberships()->where('user_id', $user->id)->get(); + $roles = []; + /** @var GroupMembership $membership */ + foreach ($memberships as $membership) { + $role = $membership->userRole; + $roles[] = $role->title; + } + return $roles; + } + + /** + * @param int $userId + * + * @return User|null + */ + public function find(int $userId): ?User + { + return User::find($userId); + } + /** * Return basic user information. * @@ -467,25 +487,4 @@ class UserRepository implements UserRepositoryInterface $invitee = InvitedUser::where('invite_code', $code)->where('expires', '>', $now->format('Y-m-d H:i:s'))->where('redeemed', 0)->first(); return null !== $invitee; } - - /** - * @inheritDoc - * @throws FireflyException - */ - public function getRolesInGroup(User $user, int $groupId): array - { - /** @var UserGroup $group */ - $group = UserGroup::find($groupId); - if (null === $group) { - throw new FireflyException(sprintf('Could not find group #%d', $groupId)); - } - $memberships = $group->groupMemberships()->where('user_id', $user->id)->get(); - $roles = []; - /** @var GroupMembership $membership */ - foreach ($memberships as $membership) { - $role = $membership->userRole; - $roles[] = $role->title; - } - return $roles; - } } diff --git a/app/Repositories/User/UserRepositoryInterface.php b/app/Repositories/User/UserRepositoryInterface.php index b27138c5f6..264409ad65 100644 --- a/app/Repositories/User/UserRepositoryInterface.php +++ b/app/Repositories/User/UserRepositoryInterface.php @@ -40,13 +40,6 @@ interface UserRepositoryInterface */ public function all(): Collection; - /** - * @param User $user - * @param int $groupId - * @return array - */ - public function getRolesInGroup(User $user, int $groupId): array; - /** * Gives a user a role. * @@ -155,6 +148,13 @@ interface UserRepositoryInterface */ public function getRoleByUser(User $user): ?string; + /** + * @param User $user + * @param int $groupId + * @return array + */ + public function getRolesInGroup(User $user, int $groupId): array; + /** * Return basic user information. * diff --git a/app/Rules/BelongsUser.php b/app/Rules/BelongsUser.php index 11b0b28a3e..e157dad67f 100644 --- a/app/Rules/BelongsUser.php +++ b/app/Rules/BelongsUser.php @@ -43,7 +43,6 @@ class BelongsUser implements Rule * Create a new rule instance. * * @return void - */ public function __construct() { @@ -54,7 +53,6 @@ class BelongsUser implements Rule * Get the validation error message. * * @return string - */ public function message(): string { diff --git a/app/Rules/IsAssetAccountId.php b/app/Rules/IsAssetAccountId.php index ef7b5bb41d..731fa8a421 100644 --- a/app/Rules/IsAssetAccountId.php +++ b/app/Rules/IsAssetAccountId.php @@ -37,7 +37,6 @@ class IsAssetAccountId implements Rule * Get the validation error message. This is not translated because only the API uses it. * * @return string - */ public function message(): string { diff --git a/app/Rules/IsBoolean.php b/app/Rules/IsBoolean.php index 0a68b4854e..5ab13d58fd 100644 --- a/app/Rules/IsBoolean.php +++ b/app/Rules/IsBoolean.php @@ -34,7 +34,6 @@ class IsBoolean implements Rule /** * Get the validation error message. * - * @return string */ public function message(): string diff --git a/app/Rules/IsDateOrTime.php b/app/Rules/IsDateOrTime.php index de5c2c7f22..f79a1287a0 100644 --- a/app/Rules/IsDateOrTime.php +++ b/app/Rules/IsDateOrTime.php @@ -39,7 +39,6 @@ class IsDateOrTime implements Rule * Get the validation error message. * * @return string - */ public function message() { diff --git a/app/Rules/IsValidAttachmentModel.php b/app/Rules/IsValidAttachmentModel.php index 1170b6f95a..9eb88777a9 100644 --- a/app/Rules/IsValidAttachmentModel.php +++ b/app/Rules/IsValidAttachmentModel.php @@ -53,7 +53,6 @@ class IsValidAttachmentModel implements Rule /** * IsValidAttachmentModel constructor. * - * * @param string $model */ @@ -80,7 +79,6 @@ class IsValidAttachmentModel implements Rule /** * Get the validation error message. * - * @return string */ public function message(): string diff --git a/app/Rules/UniqueAccountNumber.php b/app/Rules/UniqueAccountNumber.php index 39cc1a787b..6bfd71f42d 100644 --- a/app/Rules/UniqueAccountNumber.php +++ b/app/Rules/UniqueAccountNumber.php @@ -40,7 +40,6 @@ class UniqueAccountNumber implements Rule /** * Create a new rule instance. * - * * @param Account|null $account * @param string|null $expectedType @@ -66,7 +65,6 @@ class UniqueAccountNumber implements Rule /** * Get the validation error message. * - * * @return string */ diff --git a/app/Rules/UniqueIban.php b/app/Rules/UniqueIban.php index 90d67aabe8..84afd3494a 100644 --- a/app/Rules/UniqueIban.php +++ b/app/Rules/UniqueIban.php @@ -39,7 +39,6 @@ class UniqueIban implements Rule /** * Create a new rule instance. * - * * @param Account|null $account * @param string|null $expectedType @@ -63,7 +62,6 @@ class UniqueIban implements Rule /** * Get the validation error message. * - * * @return string */ diff --git a/app/Services/Internal/Destroy/BillDestroyService.php b/app/Services/Internal/Destroy/BillDestroyService.php index d779510fbc..af92b7b229 100644 --- a/app/Services/Internal/Destroy/BillDestroyService.php +++ b/app/Services/Internal/Destroy/BillDestroyService.php @@ -23,11 +23,9 @@ declare(strict_types=1); namespace FireflyIII\Services\Internal\Destroy; -use Exception; use FireflyIII\Models\Bill; /** - * Class BillDestroyService */ class BillDestroyService diff --git a/app/Services/Internal/Destroy/BudgetDestroyService.php b/app/Services/Internal/Destroy/BudgetDestroyService.php index b7db3a7e16..c3030e3635 100644 --- a/app/Services/Internal/Destroy/BudgetDestroyService.php +++ b/app/Services/Internal/Destroy/BudgetDestroyService.php @@ -24,7 +24,6 @@ declare(strict_types=1); namespace FireflyIII\Services\Internal\Destroy; use DB; -use Exception; use FireflyIII\Models\Budget; /** diff --git a/app/Services/Internal/Destroy/CategoryDestroyService.php b/app/Services/Internal/Destroy/CategoryDestroyService.php index 428f1a0e1c..db7f156bd7 100644 --- a/app/Services/Internal/Destroy/CategoryDestroyService.php +++ b/app/Services/Internal/Destroy/CategoryDestroyService.php @@ -24,7 +24,6 @@ declare(strict_types=1); namespace FireflyIII\Services\Internal\Destroy; use DB; -use Exception; use FireflyIII\Models\Category; /** diff --git a/app/Services/Internal/Destroy/CurrencyDestroyService.php b/app/Services/Internal/Destroy/CurrencyDestroyService.php index 343e85b7ac..5c188e1300 100644 --- a/app/Services/Internal/Destroy/CurrencyDestroyService.php +++ b/app/Services/Internal/Destroy/CurrencyDestroyService.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace FireflyIII\Services\Internal\Destroy; -use Exception; use FireflyIII\Models\TransactionCurrency; /** diff --git a/app/Services/Internal/Destroy/JournalDestroyService.php b/app/Services/Internal/Destroy/JournalDestroyService.php index 33d7feaf82..b25f27e458 100644 --- a/app/Services/Internal/Destroy/JournalDestroyService.php +++ b/app/Services/Internal/Destroy/JournalDestroyService.php @@ -32,7 +32,6 @@ use FireflyIII\Models\TransactionJournalMeta; use Log; /** - * Class JournalDestroyService */ class JournalDestroyService diff --git a/app/Services/Internal/Destroy/RecurrenceDestroyService.php b/app/Services/Internal/Destroy/RecurrenceDestroyService.php index d68c51f59a..7e48391be0 100644 --- a/app/Services/Internal/Destroy/RecurrenceDestroyService.php +++ b/app/Services/Internal/Destroy/RecurrenceDestroyService.php @@ -27,7 +27,6 @@ use FireflyIII\Models\Recurrence; use FireflyIII\Models\RecurrenceTransaction; /** - * Class RecurrenceDestroyService */ class RecurrenceDestroyService diff --git a/app/Services/Internal/Support/AccountServiceTrait.php b/app/Services/Internal/Support/AccountServiceTrait.php index a05b797a9b..3c0832a356 100644 --- a/app/Services/Internal/Support/AccountServiceTrait.php +++ b/app/Services/Internal/Support/AccountServiceTrait.php @@ -164,7 +164,6 @@ trait AccountServiceTrait * @param Account $account * @param string $note * - * @return bool */ public function updateNote(Account $account, string $note): bool diff --git a/app/Services/Internal/Support/CreditRecalculateService.php b/app/Services/Internal/Support/CreditRecalculateService.php index b5b3f00bbe..a1dd1ee691 100644 --- a/app/Services/Internal/Support/CreditRecalculateService.php +++ b/app/Services/Internal/Support/CreditRecalculateService.php @@ -331,7 +331,9 @@ class CreditRecalculateService // in any other case, remove amount from left of debt. if (in_array($type, [TransactionType::WITHDRAWAL, TransactionType::DEPOSIT, TransactionType::TRANSFER], true)) { $newLeftOfDebt = bcadd($leftOfDebt, bcmul($usedAmount, '-1')); - Log::debug(sprintf('[5] Fallback: transaction is withdrawal/deposit/transfer, remove amount %s from left of debt, = %s.', $usedAmount, $newLeftOfDebt)); + Log::debug( + sprintf('[5] Fallback: transaction is withdrawal/deposit/transfer, remove amount %s from left of debt, = %s.', $usedAmount, $newLeftOfDebt) + ); return $newLeftOfDebt; } diff --git a/app/Services/Internal/Support/JournalServiceTrait.php b/app/Services/Internal/Support/JournalServiceTrait.php index 5f2c0bd247..a57d16487f 100644 --- a/app/Services/Internal/Support/JournalServiceTrait.php +++ b/app/Services/Internal/Support/JournalServiceTrait.php @@ -77,11 +77,11 @@ trait JournalServiceTrait $result = $this->findAccountByNumber($result, $data, $expectedTypes[$transactionType]); $numberResult = $result; $result = $this->findAccountByName($result, $data, $expectedTypes[$transactionType]); - $nameResult =$result; + $nameResult = $result; // if $result (find by name) is NULL, but IBAN is set, any result of the search by NAME can't overrule // this account. In such a case, the name search must be retried with a new name. - if (null !== $nameResult && null === $numberResult && null === $ibanResult && '' !== (string)$data['iban'] && '' !== (string) $nameResult->iban) { + if (null !== $nameResult && null === $numberResult && null === $ibanResult && '' !== (string)$data['iban'] && '' !== (string)$nameResult->iban) { $data['name'] = sprintf('%s (%s)', $data['name'], $data['iban']); Log::debug(sprintf('Search again using the new name, "%s".', $data['name'])); $result = $this->findAccountByName(null, $data, $expectedTypes[$transactionType]); diff --git a/app/Services/Internal/Support/RecurringTransactionTrait.php b/app/Services/Internal/Support/RecurringTransactionTrait.php index a8a0262083..1510e5ecff 100644 --- a/app/Services/Internal/Support/RecurringTransactionTrait.php +++ b/app/Services/Internal/Support/RecurringTransactionTrait.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace FireflyIII\Services\Internal\Support; -use Exception; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Factory\AccountFactory; use FireflyIII\Factory\BillFactory; diff --git a/app/Services/Internal/Update/AccountUpdateService.php b/app/Services/Internal/Update/AccountUpdateService.php index a168a2d147..1ba8182121 100644 --- a/app/Services/Internal/Update/AccountUpdateService.php +++ b/app/Services/Internal/Update/AccountUpdateService.php @@ -31,6 +31,7 @@ use FireflyIII\Models\Location; use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Services\Internal\Support\AccountServiceTrait; use FireflyIII\User; +use JsonException; use Log; /** @@ -70,7 +71,7 @@ class AccountUpdateService * * @return Account * @throws FireflyException - * @throws \JsonException + * @throws JsonException */ public function update(Account $account, array $data): Account { @@ -301,7 +302,9 @@ class AccountUpdateService // if liability, make sure the amount is positive for a credit, and negative for a debit. if ($this->isLiability($account)) { - $openingBalance = 'credit' === $data['liability_direction'] ? app('steam')->positive($openingBalance) : app('steam')->negative($openingBalance); + $openingBalance = 'credit' === $data['liability_direction'] ? app('steam')->positive($openingBalance) : app('steam')->negative( + $openingBalance + ); } $this->updateOBGroupV2($account, $openingBalance, $openingBalanceDate); @@ -317,37 +320,6 @@ class AccountUpdateService } } - /** - * @param Account $account - * @param array $data - * - * @throws FireflyException - * @deprecated In Firefly III v5.8.0 and onwards, credit transactions for liabilities are no longer created. - */ - private function updateCreditLiability(Account $account, array $data): void - { - $type = $account->accountType; - $valid = config('firefly.valid_liabilities'); - if (in_array($type->type, $valid, true)) { - $direction = array_key_exists('liability_direction', $data) ? $data['liability_direction'] : 'empty'; - // check if is submitted as empty, that makes it valid: - if ($this->validOBData($data) && !$this->isEmptyOBData($data)) { - $openingBalance = $data['opening_balance']; - $openingBalanceDate = $data['opening_balance_date']; - if ('credit' === $direction) { - $this->updateCreditTransaction($account, $direction, $openingBalance, $openingBalanceDate); - } - } - - if (!$this->validOBData($data) && $this->isEmptyOBData($data)) { - $this->deleteCreditTransaction($account); - } - if ($this->validOBData($data) && !$this->isEmptyOBData($data) && 'credit' !== $direction) { - $this->deleteCreditTransaction($account); - } - } - } - /** * @param Account $account * @@ -377,4 +349,35 @@ class AccountUpdateService Log::debug('Final new array is', $new); app('preferences')->setForUser($account->user, 'frontpageAccounts', $new); } + + /** + * @param Account $account + * @param array $data + * + * @throws FireflyException + * @deprecated In Firefly III v5.8.0 and onwards, credit transactions for liabilities are no longer created. + */ + private function updateCreditLiability(Account $account, array $data): void + { + $type = $account->accountType; + $valid = config('firefly.valid_liabilities'); + if (in_array($type->type, $valid, true)) { + $direction = array_key_exists('liability_direction', $data) ? $data['liability_direction'] : 'empty'; + // check if is submitted as empty, that makes it valid: + if ($this->validOBData($data) && !$this->isEmptyOBData($data)) { + $openingBalance = $data['opening_balance']; + $openingBalanceDate = $data['opening_balance_date']; + if ('credit' === $direction) { + $this->updateCreditTransaction($account, $direction, $openingBalance, $openingBalanceDate); + } + } + + if (!$this->validOBData($data) && $this->isEmptyOBData($data)) { + $this->deleteCreditTransaction($account); + } + if ($this->validOBData($data) && !$this->isEmptyOBData($data) && 'credit' !== $direction) { + $this->deleteCreditTransaction($account); + } + } + } } diff --git a/app/Services/Internal/Update/BillUpdateService.php b/app/Services/Internal/Update/BillUpdateService.php index 63e494a785..0980eece73 100644 --- a/app/Services/Internal/Update/BillUpdateService.php +++ b/app/Services/Internal/Update/BillUpdateService.php @@ -37,7 +37,6 @@ use JsonException; use Log; /** - * Class BillUpdateService */ class BillUpdateService diff --git a/app/Services/Internal/Update/CurrencyUpdateService.php b/app/Services/Internal/Update/CurrencyUpdateService.php index f7e16acb01..ab6606141c 100644 --- a/app/Services/Internal/Update/CurrencyUpdateService.php +++ b/app/Services/Internal/Update/CurrencyUpdateService.php @@ -53,11 +53,11 @@ class CurrencyUpdateService } if (array_key_exists('enabled', $data) && is_bool($data['enabled'])) { - $currency->enabled = (bool) $data['enabled']; + $currency->enabled = (bool)$data['enabled']; } if (array_key_exists('decimal_places', $data) && is_int($data['decimal_places'])) { - $currency->decimal_places = (int) $data['decimal_places']; + $currency->decimal_places = (int)$data['decimal_places']; } $currency->save(); diff --git a/app/Services/Internal/Update/GroupCloneService.php b/app/Services/Internal/Update/GroupCloneService.php index e11724653e..d2a64395c0 100644 --- a/app/Services/Internal/Update/GroupCloneService.php +++ b/app/Services/Internal/Update/GroupCloneService.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace FireflyIII\Services\Internal\Update; -use Carbon\Carbon; use FireflyIII\Factory\PiggyBankEventFactory; use FireflyIII\Models\Budget; use FireflyIII\Models\Category; diff --git a/app/Services/Internal/Update/JournalUpdateService.php b/app/Services/Internal/Update/JournalUpdateService.php index 4b06e72366..b6a12e6d67 100644 --- a/app/Services/Internal/Update/JournalUpdateService.php +++ b/app/Services/Internal/Update/JournalUpdateService.php @@ -25,7 +25,6 @@ namespace FireflyIII\Services\Internal\Update; use Carbon\Carbon; use Carbon\Exceptions\InvalidDateException; -use Exception; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Factory\TagFactory; use FireflyIII\Factory\TransactionJournalMetaFactory; diff --git a/app/Services/Internal/Update/RecurrenceUpdateService.php b/app/Services/Internal/Update/RecurrenceUpdateService.php index 7febe5c3e1..5d3ddd44bb 100644 --- a/app/Services/Internal/Update/RecurrenceUpdateService.php +++ b/app/Services/Internal/Update/RecurrenceUpdateService.php @@ -32,6 +32,7 @@ use FireflyIII\Models\RecurrenceTransaction; use FireflyIII\Services\Internal\Support\RecurringTransactionTrait; use FireflyIII\Services\Internal\Support\TransactionTypeTrait; use FireflyIII\User; +use JsonException; use Log; /** @@ -217,7 +218,7 @@ class RecurrenceUpdateService * @param array $transactions * * @throws FireflyException - * @throws \JsonException + * @throws JsonException */ private function updateTransactions(Recurrence $recurrence, array $transactions): void { diff --git a/app/Support/Authentication/RemoteUserGuard.php b/app/Support/Authentication/RemoteUserGuard.php index 3df4ed6f02..9edee6510c 100644 --- a/app/Support/Authentication/RemoteUserGuard.php +++ b/app/Support/Authentication/RemoteUserGuard.php @@ -62,15 +62,6 @@ class RemoteUserGuard implements Guard $this->user = null; } - /** - * @return bool - */ - public function viaRemember(): bool - { - Log::debug(sprintf('Now at %s', __METHOD__)); - return false; - } - /** * */ @@ -189,4 +180,13 @@ class RemoteUserGuard implements Guard Log::debug(sprintf('Now at %s', __METHOD__)); throw new FireflyException('Did not implement RemoteUserGuard::validate()'); } + + /** + * @return bool + */ + public function viaRemember(): bool + { + Log::debug(sprintf('Now at %s', __METHOD__)); + return false; + } } diff --git a/app/Support/Chart/Budget/FrontpageChartGenerator.php b/app/Support/Chart/Budget/FrontpageChartGenerator.php index d1873f1e52..bca53c6574 100644 --- a/app/Support/Chart/Budget/FrontpageChartGenerator.php +++ b/app/Support/Chart/Budget/FrontpageChartGenerator.php @@ -24,7 +24,6 @@ declare(strict_types=1); namespace FireflyIII\Support\Chart\Budget; use Carbon\Carbon; -use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Budget; use FireflyIII\Models\BudgetLimit; use FireflyIII\Repositories\Budget\BudgetLimitRepositoryInterface; diff --git a/app/Support/Export/ExportDataGenerator.php b/app/Support/Export/ExportDataGenerator.php index 4851e2d3b0..cf24132ebe 100644 --- a/app/Support/Export/ExportDataGenerator.php +++ b/app/Support/Export/ExportDataGenerator.php @@ -828,6 +828,14 @@ class ExportDataGenerator return $string; } + /** + * @inheritDoc + */ + public function get(string $key, mixed $default = null): mixed + { + return null; + } + /** * @return string * @throws FireflyException @@ -997,6 +1005,14 @@ class ExportDataGenerator return implode(',', $smol); } + /** + * @inheritDoc + */ + public function has(mixed $key): mixed + { + return null; + } + /** * @param Carbon $end */ @@ -1084,20 +1100,4 @@ class ExportDataGenerator { $this->start = $start; } - - /** - * @inheritDoc - */ - public function get(string $key, mixed $default = null): mixed - { - return null; - } - - /** - * @inheritDoc - */ - public function has(mixed $key): mixed - { - return null; - } } diff --git a/app/Support/Facades/AccountForm.php b/app/Support/Facades/AccountForm.php index d6c69236ec..6681ad427c 100644 --- a/app/Support/Facades/AccountForm.php +++ b/app/Support/Facades/AccountForm.php @@ -26,7 +26,6 @@ namespace FireflyIII\Support\Facades; use Illuminate\Support\Facades\Facade; /** - * Class AccountForm. * */ diff --git a/app/Support/Facades/Amount.php b/app/Support/Facades/Amount.php index c1918596c5..c11965dc7d 100644 --- a/app/Support/Facades/Amount.php +++ b/app/Support/Facades/Amount.php @@ -29,7 +29,6 @@ use Illuminate\Support\Collection; use Illuminate\Support\Facades\Facade; /** - * Class Amount. * * @method string formatAnything(TransactionCurrency $format, string $amount, bool $coloured = true) diff --git a/app/Support/Facades/CurrencyForm.php b/app/Support/Facades/CurrencyForm.php index a272f1590d..08fdf6b78d 100644 --- a/app/Support/Facades/CurrencyForm.php +++ b/app/Support/Facades/CurrencyForm.php @@ -26,7 +26,6 @@ namespace FireflyIII\Support\Facades; use Illuminate\Support\Facades\Facade; /** - * Class CurrencyForm. * */ diff --git a/app/Support/Facades/ExpandedForm.php b/app/Support/Facades/ExpandedForm.php index 7e8f16a254..bd9c781816 100644 --- a/app/Support/Facades/ExpandedForm.php +++ b/app/Support/Facades/ExpandedForm.php @@ -26,7 +26,6 @@ namespace FireflyIII\Support\Facades; use Illuminate\Support\Facades\Facade; /** - * Class ExpandedForm. */ class ExpandedForm extends Facade diff --git a/app/Support/Facades/FireflyConfig.php b/app/Support/Facades/FireflyConfig.php index 8f1c8fc1f4..3c5fc74e53 100644 --- a/app/Support/Facades/FireflyConfig.php +++ b/app/Support/Facades/FireflyConfig.php @@ -27,7 +27,6 @@ use FireflyIII\Models\Configuration; use Illuminate\Support\Facades\Facade; /** - * Class FireflyConfig. * @method null|Configuration get($name, $default = null) * @method Configuration set(string $name, $value) diff --git a/app/Support/Facades/Navigation.php b/app/Support/Facades/Navigation.php index 33aee79fb5..3e18b1568c 100644 --- a/app/Support/Facades/Navigation.php +++ b/app/Support/Facades/Navigation.php @@ -27,7 +27,6 @@ use Carbon\Carbon; use Illuminate\Support\Facades\Facade; /** - * Class Navigation. * * @method Carbon addPeriod(Carbon $theDate, string $repeatFreq, int $skip) diff --git a/app/Support/Facades/PiggyBankForm.php b/app/Support/Facades/PiggyBankForm.php index 0f38c5869b..bfb9bfe307 100644 --- a/app/Support/Facades/PiggyBankForm.php +++ b/app/Support/Facades/PiggyBankForm.php @@ -26,7 +26,6 @@ namespace FireflyIII\Support\Facades; use Illuminate\Support\Facades\Facade; /** - * Class PiggyBankForm. * */ diff --git a/app/Support/Facades/Preferences.php b/app/Support/Facades/Preferences.php index bcbd53bb1d..4fa1bb978e 100644 --- a/app/Support/Facades/Preferences.php +++ b/app/Support/Facades/Preferences.php @@ -29,7 +29,6 @@ use Illuminate\Support\Collection; use Illuminate\Support\Facades\Facade; /** - * Class Preferences. * * @method Collection beginsWith(User $user, string $search) diff --git a/app/Support/Facades/RuleForm.php b/app/Support/Facades/RuleForm.php index 1455471b9d..a13a626cac 100644 --- a/app/Support/Facades/RuleForm.php +++ b/app/Support/Facades/RuleForm.php @@ -26,7 +26,6 @@ namespace FireflyIII\Support\Facades; use Illuminate\Support\Facades\Facade; /** - * Class RuleForm. * */ diff --git a/app/Support/Http/Api/ConvertsExchangeRates.php b/app/Support/Http/Api/ConvertsExchangeRates.php index f5bd614ada..2da58e4abe 100644 --- a/app/Support/Http/Api/ConvertsExchangeRates.php +++ b/app/Support/Http/Api/ConvertsExchangeRates.php @@ -74,60 +74,6 @@ trait ConvertsExchangeRates return $set; } - /** - * For a sum of entries, get the exchange rate to the native currency of - * the user. - * @param array $entries - * @return array - */ - public function cerSum(array $entries): array - { - if (null === $this->enabled) { - $this->getPreference(); - } - - // if false, return the same array without conversion info - if (false === $this->enabled) { - $return = []; - /** @var array $entry */ - foreach ($entries as $entry) { - $entry['converted'] = false; - $return[] = $entry; - } - return $return; - } - - - /** @var TransactionCurrency $native */ - $native = app('amount')->getDefaultCurrency(); - $return = []; - /** @var array $entry */ - foreach ($entries as $entry) { - $currency = $this->getCurrency((int)$entry['id']); - if ($currency->id !== $native->id) { - $amount = $this->convertAmount($entry['sum'], $currency, $native); - $entry['converted'] = true; - $entry['native_sum'] = $amount; - $entry['native_id'] = (string)$native->id; - $entry['native_name'] = $native->name; - $entry['native_symbol'] = $native->symbol; - $entry['native_code'] = $native->code; - $entry['native_decimal_places'] = $native->decimal_places; - } - if ($currency->id === $native->id) { - $entry['converted'] = false; - $entry['native_sum'] = $entry['sum']; - $entry['native_id'] = (string)$native->id; - $entry['native_name'] = $native->name; - $entry['native_symbol'] = $native->symbol; - $entry['native_code'] = $native->code; - $entry['native_decimal_places'] = $native->decimal_places; - } - $return[] = $entry; - } - return $return; - } - /** * @return void */ @@ -149,15 +95,6 @@ trait ConvertsExchangeRates return $result; } - private function convertAmount(string $amount, TransactionCurrency $from, TransactionCurrency $to, ?Carbon $date = null): string - { - Log::debug(sprintf('Converting %s from %s to %s', $amount, $from->code, $to->code)); - $date = $date ?? today(config('app.timezone')); - $rate = $this->getRate($from, $to, $date); - - return bcmul($amount, $rate); - } - /** * @param TransactionCurrency $from * @param TransactionCurrency $to @@ -260,4 +197,67 @@ trait ConvertsExchangeRates Log::debug(sprintf('No rate for %s to EUR.', $currency->code)); return '0'; } + + /** + * For a sum of entries, get the exchange rate to the native currency of + * the user. + * @param array $entries + * @return array + */ + public function cerSum(array $entries): array + { + if (null === $this->enabled) { + $this->getPreference(); + } + + // if false, return the same array without conversion info + if (false === $this->enabled) { + $return = []; + /** @var array $entry */ + foreach ($entries as $entry) { + $entry['converted'] = false; + $return[] = $entry; + } + return $return; + } + + + /** @var TransactionCurrency $native */ + $native = app('amount')->getDefaultCurrency(); + $return = []; + /** @var array $entry */ + foreach ($entries as $entry) { + $currency = $this->getCurrency((int)$entry['id']); + if ($currency->id !== $native->id) { + $amount = $this->convertAmount($entry['sum'], $currency, $native); + $entry['converted'] = true; + $entry['native_sum'] = $amount; + $entry['native_id'] = (string)$native->id; + $entry['native_name'] = $native->name; + $entry['native_symbol'] = $native->symbol; + $entry['native_code'] = $native->code; + $entry['native_decimal_places'] = $native->decimal_places; + } + if ($currency->id === $native->id) { + $entry['converted'] = false; + $entry['native_sum'] = $entry['sum']; + $entry['native_id'] = (string)$native->id; + $entry['native_name'] = $native->name; + $entry['native_symbol'] = $native->symbol; + $entry['native_code'] = $native->code; + $entry['native_decimal_places'] = $native->decimal_places; + } + $return[] = $entry; + } + return $return; + } + + private function convertAmount(string $amount, TransactionCurrency $from, TransactionCurrency $to, ?Carbon $date = null): string + { + Log::debug(sprintf('Converting %s from %s to %s', $amount, $from->code, $to->code)); + $date = $date ?? today(config('app.timezone')); + $rate = $this->getRate($from, $to, $date); + + return bcmul($amount, $rate); + } } diff --git a/app/Support/Http/Controllers/ModelInformation.php b/app/Support/Http/Controllers/ModelInformation.php index 4c82189631..ecdacf06bf 100644 --- a/app/Support/Http/Controllers/ModelInformation.php +++ b/app/Support/Http/Controllers/ModelInformation.php @@ -70,7 +70,6 @@ trait ModelInformation } /** - * * @return string[] * @@ -95,7 +94,6 @@ trait ModelInformation } /** - * @return array */ protected function getRoles(): array diff --git a/app/Support/Http/Controllers/PeriodOverview.php b/app/Support/Http/Controllers/PeriodOverview.php index 7f17a513b8..ed6973a058 100644 --- a/app/Support/Http/Controllers/PeriodOverview.php +++ b/app/Support/Http/Controllers/PeriodOverview.php @@ -200,7 +200,6 @@ trait PeriodOverview * @param array $journals * * @return array - */ private function filterTransferredIn(Account $account, array $journals): array { @@ -219,7 +218,6 @@ trait PeriodOverview * @param array $journals * * @return array - */ private function groupByCurrency(array $journals): array { diff --git a/app/Support/Http/Controllers/RequestInformation.php b/app/Support/Http/Controllers/RequestInformation.php index 5e7059e06a..824975c4ed 100644 --- a/app/Support/Http/Controllers/RequestInformation.php +++ b/app/Support/Http/Controllers/RequestInformation.php @@ -24,7 +24,6 @@ declare(strict_types=1); namespace FireflyIII\Support\Http\Controllers; use Carbon\Carbon; -use FireflyIII\Exceptions\FireflyException; use FireflyIII\Exceptions\ValidationException; use FireflyIII\Helpers\Help\HelpInterface; use FireflyIII\Http\Requests\RuleFormRequest; @@ -219,7 +218,6 @@ trait RequestInformation * @param array $data * * @return ValidatorContract - */ final protected function validator(array $data): ValidatorContract { diff --git a/app/Support/Navigation.php b/app/Support/Navigation.php index 4f99f8000a..fbc99514cb 100644 --- a/app/Support/Navigation.php +++ b/app/Support/Navigation.php @@ -330,6 +330,37 @@ class Navigation return $currentEnd; } + /** + * Returns the user's view range and if necessary, corrects the dynamic view + * range to a normal range. + * @param bool $correct + * @return string + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ + public function getViewRange(bool $correct): string + { + $range = (string)app('preferences')->get('viewRange', '1M')?->data ?? '1M'; + if (!$correct) { + return $range; + } + switch ($range) { + default: + return $range; + case 'last7': + return '1W'; + case 'last30': + case 'MTD': + return '1M'; + case 'last90': + case 'QTD': + return '3M'; + case 'last365': + case 'YTD': + return '1Y'; + } + } + /** * @param Carbon $start * @param Carbon $end @@ -430,37 +461,6 @@ class Navigation return $date->format('Y-m-d'); } - /** - * Returns the user's view range and if necessary, corrects the dynamic view - * range to a normal range. - * @param bool $correct - * @return string - * @throws ContainerExceptionInterface - * @throws NotFoundExceptionInterface - */ - public function getViewRange(bool $correct): string - { - $range = (string)app('preferences')->get('viewRange', '1M')?->data ?? '1M'; - if (!$correct) { - return $range; - } - switch ($range) { - default: - return $range; - case 'last7': - return '1W'; - case 'last30': - case 'MTD': - return '1M'; - case 'last90': - case 'QTD': - return '3M'; - case 'last365': - case 'YTD': - return '1Y'; - } - } - /** * If the date difference between start and end is less than a month, method returns trans(config.month_and_day). If the difference is less than a year, * method returns "config.month". If the date difference is larger, method returns "config.year". diff --git a/app/Support/Preferences.php b/app/Support/Preferences.php index 3014b1fc76..697b7fd3f5 100644 --- a/app/Support/Preferences.php +++ b/app/Support/Preferences.php @@ -24,7 +24,6 @@ declare(strict_types=1); namespace FireflyIII\Support; use Cache; -use Exception; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Preference; use FireflyIII\User; diff --git a/app/Support/Request/ConvertsDataTypes.php b/app/Support/Request/ConvertsDataTypes.php index f66009d1c7..978a969760 100644 --- a/app/Support/Request/ConvertsDataTypes.php +++ b/app/Support/Request/ConvertsDataTypes.php @@ -32,25 +32,6 @@ use Log; */ trait ConvertsDataTypes { - /** - * Abstract method that always exists in the Request classes that use this - * trait, OR a stub needs to be added by any other class that uses this train. - * - * @param string $key - * @param mixed|null $default - * @return mixed - */ - abstract public function get(string $key, mixed $default = null): mixed; - - /** - * Abstract method that always exists in the Request classes that use this - * trait, OR a stub needs to be added by any other class that uses this train. - * - * @param mixed $key - * @return mixed - */ - abstract public function has($key); - /** * Return integer value. * @@ -63,6 +44,16 @@ trait ConvertsDataTypes return (int)$this->get($field); } + /** + * Abstract method that always exists in the Request classes that use this + * trait, OR a stub needs to be added by any other class that uses this train. + * + * @param string $key + * @param mixed|null $default + * @return mixed + */ + abstract public function get(string $key, mixed $default = null): mixed; + /** * Return string value. * @@ -285,6 +276,15 @@ trait ConvertsDataTypes return $return; } + /** + * Abstract method that always exists in the Request classes that use this + * trait, OR a stub needs to be added by any other class that uses this train. + * + * @param mixed $key + * @return mixed + */ + abstract public function has($key); + /** * Return date or NULL. * diff --git a/app/Support/Search/OperatorQuerySearch.php b/app/Support/Search/OperatorQuerySearch.php index fdbac099b4..1ac3dd3b4b 100644 --- a/app/Support/Search/OperatorQuerySearch.php +++ b/app/Support/Search/OperatorQuerySearch.php @@ -63,6 +63,7 @@ use TypeError; */ class OperatorQuerySearch implements SearchInterface { + protected Carbon $date; private AccountRepositoryInterface $accountRepository; private BillRepositoryInterface $billRepository; private BudgetRepositoryInterface $budgetRepository; @@ -73,9 +74,6 @@ class OperatorQuerySearch implements SearchInterface private int $limit; private Collection $operators; private int $page; - protected Carbon $date; - - private array $prohibitedWords; private float $startTime; private TagRepositoryInterface $tagRepository; @@ -1993,6 +1991,14 @@ class OperatorQuerySearch implements SearchInterface return $this->words; } + /** + * @param Carbon $date + */ + public function setDate(Carbon $date): void + { + $this->date = $date; + } + /** * @inheritDoc */ @@ -2027,12 +2033,4 @@ class OperatorQuerySearch implements SearchInterface $this->limit = $limit; $this->collector->setLimit($this->limit); } - - /** - * @param Carbon $date - */ - public function setDate(Carbon $date): void - { - $this->date = $date; - } } diff --git a/app/Support/Steam.php b/app/Support/Steam.php index 445a9f675e..adcc6dd775 100644 --- a/app/Support/Steam.php +++ b/app/Support/Steam.php @@ -428,6 +428,21 @@ class Steam return str_replace($search, '', $string); } + /** + * @param string $ipAddress + * @return string + * @throws FireflyException + */ + public function getHostName(string $ipAddress): string + { + try { + $hostName = gethostbyaddr($ipAddress); + } catch (Exception $e) { // intentional generic exception + throw new FireflyException($e->getMessage(), 0, $e); + } + return $hostName; + } + /** * @param array $accounts * @@ -668,19 +683,4 @@ class Steam return $amount; } - - /** - * @param string $ipAddress - * @return string - * @throws FireflyException - */ - public function getHostName(string $ipAddress): string - { - try { - $hostName = gethostbyaddr($ipAddress); - } catch (Exception $e) { // intentional generic exception - throw new FireflyException($e->getMessage(), 0, $e); - } - return $hostName; - } } diff --git a/app/TransactionRules/Actions/ConvertToDeposit.php b/app/TransactionRules/Actions/ConvertToDeposit.php index 4bd3cc8f5b..157e3f81da 100644 --- a/app/TransactionRules/Actions/ConvertToDeposit.php +++ b/app/TransactionRules/Actions/ConvertToDeposit.php @@ -32,6 +32,7 @@ use FireflyIII\Models\RuleAction; use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionType; use FireflyIII\User; +use JsonException; use Log; /** @@ -98,7 +99,7 @@ class ConvertToDeposit implements ActionInterface * * @return bool * @throws FireflyException - * @throws \JsonException + * @throws JsonException */ private function convertWithdrawalArray(array $journal): bool { @@ -147,7 +148,7 @@ class ConvertToDeposit implements ActionInterface * * @return bool * @throws FireflyException - * @throws \JsonException + * @throws JsonException */ private function convertTransferArray(array $journal): bool { diff --git a/app/TransactionRules/Actions/ConvertToWithdrawal.php b/app/TransactionRules/Actions/ConvertToWithdrawal.php index 09242f2aeb..14aee755ff 100644 --- a/app/TransactionRules/Actions/ConvertToWithdrawal.php +++ b/app/TransactionRules/Actions/ConvertToWithdrawal.php @@ -32,6 +32,7 @@ use FireflyIII\Models\RuleAction; use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionType; use FireflyIII\User; +use JsonException; use Log; /** @@ -131,7 +132,7 @@ class ConvertToWithdrawal implements ActionInterface * * @return bool * @throws FireflyException - * @throws \JsonException + * @throws JsonException */ private function convertTransferArray(array $journal): bool { diff --git a/app/TransactionRules/Actions/LinkToBill.php b/app/TransactionRules/Actions/LinkToBill.php index 7384d227fb..bbff66dfb3 100644 --- a/app/TransactionRules/Actions/LinkToBill.php +++ b/app/TransactionRules/Actions/LinkToBill.php @@ -42,7 +42,6 @@ class LinkToBill implements ActionInterface /** * TriggerInterface constructor. * - * * @param RuleAction $action */ diff --git a/app/TransactionRules/Actions/MoveDescriptionToNotes.php b/app/TransactionRules/Actions/MoveDescriptionToNotes.php index e0fd1485e2..d9208b6bce 100644 --- a/app/TransactionRules/Actions/MoveDescriptionToNotes.php +++ b/app/TransactionRules/Actions/MoveDescriptionToNotes.php @@ -40,7 +40,6 @@ class MoveDescriptionToNotes implements ActionInterface /** * TriggerInterface constructor. * - * * @param RuleAction $action */ diff --git a/app/TransactionRules/Actions/MoveNotesToDescription.php b/app/TransactionRules/Actions/MoveNotesToDescription.php index 92a59264b4..24ca785380 100644 --- a/app/TransactionRules/Actions/MoveNotesToDescription.php +++ b/app/TransactionRules/Actions/MoveNotesToDescription.php @@ -39,7 +39,6 @@ class MoveNotesToDescription implements ActionInterface /** * TriggerInterface constructor. * - * * @param RuleAction $action */ diff --git a/app/Transformers/V2/AccountTransformer.php b/app/Transformers/V2/AccountTransformer.php index 4c534a5dd0..ed0169fed8 100644 --- a/app/Transformers/V2/AccountTransformer.php +++ b/app/Transformers/V2/AccountTransformer.php @@ -73,6 +73,19 @@ class AccountTransformer extends AbstractTransformer } } + /** + * @return Carbon + */ + private function getDate(): Carbon + { + $date = today(config('app.timezone')); + if (null !== $this->parameters->get('date')) { + $date = $this->parameters->get('date'); + } + + return $date; + } + /** * Transform the account. * @@ -133,17 +146,4 @@ class AccountTransformer extends AbstractTransformer ], ]; } - - /** - * @return Carbon - */ - private function getDate(): Carbon - { - $date = today(config('app.timezone')); - if (null !== $this->parameters->get('date')) { - $date = $this->parameters->get('date'); - } - - return $date; - } } diff --git a/app/User.php b/app/User.php index bc026b4166..7ffde05b89 100644 --- a/app/User.php +++ b/app/User.php @@ -220,7 +220,6 @@ class User extends Authenticatable } /** - * Link to accounts. * * @return HasMany @@ -231,7 +230,6 @@ class User extends Authenticatable } /** - * Link to attachments * * @return HasMany @@ -242,7 +240,6 @@ class User extends Authenticatable } /** - * Link to available budgets * * @return HasMany @@ -253,7 +250,6 @@ class User extends Authenticatable } /** - * Link to bills. * * @return HasMany @@ -264,7 +260,6 @@ class User extends Authenticatable } /** - * Link to budgets. * * @return HasMany @@ -275,7 +270,6 @@ class User extends Authenticatable } /** - * Link to categories * * @return HasMany @@ -286,7 +280,6 @@ class User extends Authenticatable } /** - * Link to currency exchange rates * * @return HasMany @@ -297,7 +290,6 @@ class User extends Authenticatable } /** - * Generates access token. * * @return string @@ -310,6 +302,21 @@ class User extends Authenticatable return bin2hex($bytes); } + /** + * A safe method that returns the user's current administration ID (group ID). + * + * @return int + * @throws FireflyException + */ + public function getAdministrationId(): int + { + $groupId = (int)$this->user_group_id; + if (0 === $groupId) { + throw new FireflyException('User has no administration ID.'); + } + return $groupId; + } + /** * Get the models LDAP domain. * @return string @@ -355,7 +362,6 @@ class User extends Authenticatable } /** - * * @return HasMany */ @@ -365,22 +371,6 @@ class User extends Authenticatable } /** - * A safe method that returns the user's current administration ID (group ID). - * - * @return int - * @throws FireflyException - */ - public function getAdministrationId(): int - { - $groupId = (int)$this->user_group_id; - if (0 === $groupId) { - throw new FireflyException('User has no administration ID.'); - } - return $groupId; - } - - /** - * Link to object groups. * * @return HasMany @@ -391,7 +381,6 @@ class User extends Authenticatable } /** - * Link to piggy banks. * * @return HasManyThrough @@ -402,7 +391,6 @@ class User extends Authenticatable } /** - * Link to preferences. * * @return HasMany @@ -413,7 +401,6 @@ class User extends Authenticatable } /** - * Link to recurring transactions. * * @return HasMany @@ -464,7 +451,6 @@ class User extends Authenticatable } /** - * Link to roles. * * @return BelongsToMany @@ -501,7 +487,6 @@ class User extends Authenticatable } /** - * Link to rule groups. * * @return HasMany @@ -512,7 +497,6 @@ class User extends Authenticatable } /** - * Link to rules. * * @return HasMany @@ -523,7 +507,6 @@ class User extends Authenticatable } /** - * Send the password reset notification. * * @param string $token @@ -563,7 +546,6 @@ class User extends Authenticatable } /** - * Link to tags. * * @return HasMany @@ -574,7 +556,6 @@ class User extends Authenticatable } /** - * Link to transaction groups. * * @return HasMany @@ -585,7 +566,6 @@ class User extends Authenticatable } /** - * Link to transaction journals. * * @return HasMany @@ -596,7 +576,6 @@ class User extends Authenticatable } /** - * Link to transactions. * * @return HasManyThrough @@ -607,7 +586,6 @@ class User extends Authenticatable } /** - * @return BelongsTo */ public function userGroup(): BelongsTo @@ -616,7 +594,6 @@ class User extends Authenticatable } /** - * * Link to webhooks * diff --git a/app/Validation/Administration/ValidatesAdministrationAccess.php b/app/Validation/Administration/ValidatesAdministrationAccess.php index 9676f775fa..7181b21cff 100644 --- a/app/Validation/Administration/ValidatesAdministrationAccess.php +++ b/app/Validation/Administration/ValidatesAdministrationAccess.php @@ -65,7 +65,7 @@ trait ValidatesAdministrationAccess $repository = app(UserRepositoryInterface::class); // collect the user's roles in this group: - $array = $repository->getRolesInGroup($user, $administrationId); + $array = $repository->getRolesInGroup($user, $administrationId); if (0 === count($array)) { Log::error(sprintf('User #%d ("%s") has no membership in group #%d.', $user->id, $user->email, $administrationId)); $validator->errors()->add('administration', (string)trans('validation.no_access_user_group')); diff --git a/app/Validation/CurrencyValidation.php b/app/Validation/CurrencyValidation.php index 478cded5d4..7af3da4668 100644 --- a/app/Validation/CurrencyValidation.php +++ b/app/Validation/CurrencyValidation.php @@ -35,6 +35,7 @@ use Log; trait CurrencyValidation { public const TEST = 'Test'; + /** * If the transactions contain foreign amounts, there must also be foreign currency information. *