Skip to content

Firefly III: a personal finances manager

Clean up some code

James Cole24696bf80036
diff --git a/app/Helpers/Attachments/AttachmentHelper.php b/app/Helpers/Attachments/AttachmentHelper.php
index 18a15bfbb4..0d566bfd4c 100644
--- a/app/Helpers/Attachments/AttachmentHelper.php
+++ b/app/Helpers/Attachments/AttachmentHelper.php
@@ -235,7 +235,7 @@ class AttachmentHelper implements AttachmentHelperInterface
$user = $model->user; // @phpstan-ignore-line
// ignore lines about polymorphic calls.
if ($model instanceof PiggyBank) {
- $user = $model->account->user; // @phpstan-ignore-line
+ $user = $model->account->user;
}
$attachment = new Attachment(); // create Attachment object.
@@ -374,7 +374,7 @@ class AttachmentHelper implements AttachmentHelperInterface
$count = 0;
// ignore lines about polymorphic calls.
if ($model instanceof PiggyBank) {
- $count = $model->account->user->attachments()->where('md5', $md5)->where('attachable_id', $model->id)->where('attachable_type', $class)->count(); // @phpstan-ignore-line
+ $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
diff --git a/app/Http/Controllers/Account/ReconcileController.php b/app/Http/Controllers/Account/ReconcileController.php
index 7ff5ad881d..8c1d7e40b2 100644
--- a/app/Http/Controllers/Account/ReconcileController.php
+++ b/app/Http/Controllers/Account/ReconcileController.php
@@ -93,7 +93,7 @@ class ReconcileController extends Controller
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
- public function reconcile(Account $account, Carbon $start = null, Carbon $end = null)
+ public function reconcile(Account $account, Carbon $start = null, Carbon $end = null)
{
if (!$this->isEditableAccount($account)) {
return $this->redirectAccountToAccount($account);
diff --git a/app/Http/Controllers/Account/ShowController.php b/app/Http/Controllers/Account/ShowController.php
index 9adeee99e0..dcf5c3b3ec 100644
--- a/app/Http/Controllers/Account/ShowController.php
+++ b/app/Http/Controllers/Account/ShowController.php
@@ -91,7 +91,7 @@ class ShowController extends Controller
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
- public function show(Request $request, Account $account, Carbon $start = null, Carbon $end = null)
+ public function show(Request $request, Account $account, Carbon $start = null, Carbon $end = null)
{
$objectType = config(sprintf('firefly.shortNamesByFullName.%s', $account->accountType->type));
diff --git a/app/Http/Controllers/Auth/ResetPasswordController.php b/app/Http/Controllers/Auth/ResetPasswordController.php
index c8214251c9..a81b36a5e3 100644
--- a/app/Http/Controllers/Auth/ResetPasswordController.php
+++ b/app/Http/Controllers/Auth/ResetPasswordController.php
@@ -129,7 +129,7 @@ class ResetPasswordController extends Controller
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
- public function showResetForm(Request $request, $token = null)
+ public function showResetForm(Request $request, $token = null)
{
$loginProvider = config('firefly.login_provider');
if ('eloquent' !== $loginProvider) {
diff --git a/app/Http/Controllers/Budget/IndexController.php b/app/Http/Controllers/Budget/IndexController.php
index 0377016088..35e6072e5e 100644
--- a/app/Http/Controllers/Budget/IndexController.php
+++ b/app/Http/Controllers/Budget/IndexController.php
@@ -99,7 +99,7 @@ class IndexController extends Controller
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
- public function index(Request $request, Carbon $start = null, Carbon $end = null)
+ public function index(Request $request, Carbon $start = null, Carbon $end = null)
{
Log::debug('Start of IndexController::index()');
diff --git a/app/Http/Controllers/Category/ShowController.php b/app/Http/Controllers/Category/ShowController.php
index 36f1911d77..5e7a02ffe4 100644
--- a/app/Http/Controllers/Category/ShowController.php
+++ b/app/Http/Controllers/Category/ShowController.php
@@ -85,7 +85,7 @@ class ShowController extends Controller
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
- public function show(Request $request, Category $category, Carbon $start = null, Carbon $end = null)
+ public function show(Request $request, Category $category, Carbon $start = null, Carbon $end = null)
{
/** @var Carbon $start */
$start = $start ?? session('start', Carbon::now()->startOfMonth());
diff --git a/app/Http/Controllers/Chart/BudgetController.php b/app/Http/Controllers/Chart/BudgetController.php
index bedd62688a..1e01a1d2d6 100644
--- a/app/Http/Controllers/Chart/BudgetController.php
+++ b/app/Http/Controllers/Chart/BudgetController.php
@@ -205,7 +205,7 @@ class BudgetController extends Controller
*
* @return JsonResponse
*/
- public function expenseAsset(Budget $budget, ?BudgetLimit $budgetLimit = null): JsonResponse
+ public function expenseAsset(Budget $budget, ?BudgetLimit $budgetLimit = null): JsonResponse
{
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
@@ -273,7 +273,7 @@ class BudgetController extends Controller
*
* @return JsonResponse
*/
- public function expenseCategory(Budget $budget, ?BudgetLimit $budgetLimit = null): JsonResponse
+ public function expenseCategory(Budget $budget, ?BudgetLimit $budgetLimit = null): JsonResponse
{
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
@@ -337,7 +337,7 @@ class BudgetController extends Controller
*
* @return JsonResponse
*/
- public function expenseExpense(Budget $budget, ?BudgetLimit $budgetLimit = null): JsonResponse
+ public function expenseExpense(Budget $budget, ?BudgetLimit $budgetLimit = null): JsonResponse
{
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
diff --git a/app/Http/Controllers/Json/IntroController.php b/app/Http/Controllers/Json/IntroController.php
index 460a9a4780..500c0291c9 100644
--- a/app/Http/Controllers/Json/IntroController.php
+++ b/app/Http/Controllers/Json/IntroController.php
@@ -44,7 +44,7 @@ class IntroController extends Controller
*
* @return JsonResponse
*/
- public function getIntroSteps(string $route, string $specificPage = null): JsonResponse
+ public function getIntroSteps(string $route, string $specificPage = null): JsonResponse
{
Log::debug(sprintf('getIntroSteps for route "%s" and page "%s"', $route, $specificPage));
$specificPage = $specificPage ?? '';
@@ -105,7 +105,7 @@ class IntroController extends Controller
* @return JsonResponse
* @throws FireflyException
*/
- public function postEnable(string $route, string $specialPage = null): JsonResponse
+ public function postEnable(string $route, string $specialPage = null): JsonResponse
{
$specialPage = $specialPage ?? '';
$route = str_replace('.', '_', $route);
@@ -129,7 +129,7 @@ class IntroController extends Controller
* @return JsonResponse
* @throws FireflyException
*/
- public function postFinished(string $route, string $specialPage = null): JsonResponse
+ public function postFinished(string $route, string $specialPage = null): JsonResponse
{
$specialPage = $specialPage ?? '';
$key = 'shown_demo_'.$route;
diff --git a/app/Http/Controllers/Json/ReconcileController.php b/app/Http/Controllers/Json/ReconcileController.php
index a5e8a4527a..f50ddc4452 100644
--- a/app/Http/Controllers/Json/ReconcileController.php
+++ b/app/Http/Controllers/Json/ReconcileController.php
@@ -85,7 +85,7 @@ class ReconcileController extends Controller
* @throws FireflyException
* @throws JsonException
*/
- public function overview(Request $request, Account $account = null, Carbon $start = null, Carbon $end = null): JsonResponse
+ public function overview(Request $request, Account $account = null, Carbon $start = null, Carbon $end = null): JsonResponse
{
$startBalance = $request->get('startBalance');
$endBalance = $request->get('endBalance');
@@ -226,7 +226,7 @@ class ReconcileController extends Controller
* @throws FireflyException
* @throws JsonException
*/
- public function transactions(Account $account, Carbon $start = null, Carbon $end = null)
+ public function transactions(Account $account, Carbon $start = null, Carbon $end = null)
{
if (null === $start || null === $end) {
throw new FireflyException('Invalid dates submitted.');
diff --git a/app/Providers/AccountServiceProvider.php b/app/Providers/AccountServiceProvider.php
index ae57518c7b..a58e62ad67 100644
--- a/app/Providers/AccountServiceProvider.php
+++ b/app/Providers/AccountServiceProvider.php
@@ -65,7 +65,8 @@ class AccountServiceProvider extends ServiceProvider
/** @var AccountRepositoryInterface $repository */
$repository = app(AccountRepository::class);
- if ($app->auth->check()) {
+ // phpstan thinks auth does not exist.
+ if ($app->auth->check()) { // @phpstan-ignore-line
$repository->setUser(auth()->user());
}
@@ -79,7 +80,8 @@ class AccountServiceProvider extends ServiceProvider
/** @var OperationsRepository $repository */
$repository = app(OperationsRepository::class);
- if ($app->auth->check()) {
+ // phpstan thinks auth does not exist.
+ if ($app->auth->check()) { // @phpstan-ignore-line
$repository->setUser(auth()->user());
}
@@ -99,7 +101,8 @@ class AccountServiceProvider extends ServiceProvider
/** @var AccountTaskerInterface $tasker */
$tasker = app(AccountTasker::class);
- if ($app->auth->check()) {
+ // phpstan thinks auth does not exist.
+ if ($app->auth->check()) { // @phpstan-ignore-line
$tasker->setUser(auth()->user());
}
diff --git a/resources/assets/js/components/form/Checkbox.vue b/resources/assets/js/components/form/Checkbox.vue
index e72b852e4a..42919dd315 100644
--- a/resources/assets/js/components/form/Checkbox.vue
+++ b/resources/assets/js/components/form/Checkbox.vue
@@ -30,7 +30,7 @@
<input v-model=active :name="name" @change="handleInput" type="checkbox" value="1">
</label>
</div>
- <p class="help-block" v-html="$t('firefly.webhook_active_form_help')"></p>
+ <p class="help-block" v-text="$t('firefly.webhook_active_form_help')"></p>
</div>
</div>
</template>
diff --git a/resources/assets/js/components/form/WebhookDelivery.vue b/resources/assets/js/components/form/WebhookDelivery.vue
index c635db4008..1c528ff0e5 100644
--- a/resources/assets/js/components/form/WebhookDelivery.vue
+++ b/resources/assets/js/components/form/WebhookDelivery.vue
@@ -37,7 +37,7 @@
:value="delivery.id">{{ delivery.name }}
</option>
</select>
- <p class="help-block" v-html="$t('firefly.webhook_delivery_form_help')"></p>
+ <p class="help-block" v-text="$t('firefly.webhook_delivery_form_help')"></p>
<ul v-for="error in this.error" class="list-unstyled">
<li class="text-danger">{{ error }}</li>
</ul>
diff --git a/resources/assets/js/components/form/WebhookResponse.vue b/resources/assets/js/components/form/WebhookResponse.vue
index 773fbc3428..93cc404645 100644
--- a/resources/assets/js/components/form/WebhookResponse.vue
+++ b/resources/assets/js/components/form/WebhookResponse.vue
@@ -37,7 +37,7 @@
:value="response.id">{{ response.name }}
</option>
</select>
- <p class="help-block" v-html="$t('firefly.webhook_response_form_help')"></p>
+ <p class="help-block" v-text="$t('firefly.webhook_response_form_help')"></p>
<ul v-for="error in this.error" class="list-unstyled">
<li class="text-danger">{{ error }}</li>
</ul>
diff --git a/resources/assets/js/components/form/WebhookTrigger.vue b/resources/assets/js/components/form/WebhookTrigger.vue
index a377afc6ac..9b67934e3b 100644
--- a/resources/assets/js/components/form/WebhookTrigger.vue
+++ b/resources/assets/js/components/form/WebhookTrigger.vue
@@ -37,7 +37,7 @@
:value="trigger.id">{{ trigger.name }}
</option>
</select>
- <p class="help-block" v-html="$t('firefly.webhook_trigger_form_help')"></p>
+ <p class="help-block" v-text="$t('firefly.webhook_trigger_form_help')"></p>
<ul v-for="error in this.error" class="list-unstyled">
<li class="text-danger">{{ error }}</li>
</ul>
diff --git a/resources/assets/js/components/transactions/Bill.vue b/resources/assets/js/components/transactions/Bill.vue
index 4826fb2c89..6e61bb531e 100644
--- a/resources/assets/js/components/transactions/Bill.vue
+++ b/resources/assets/js/components/transactions/Bill.vue
@@ -40,7 +40,7 @@
:value="cBill.id">{{ cBill.name }}
</option>
</select>
- <p v-if="this.bills.length === 1" class="help-block" v-html="$t('firefly.no_bill_pointer')"></p>
+ <p v-if="this.bills.length === 1" class="help-block" v-text="$t('firefly.no_bill_pointer')"></p>
<ul v-for="error in this.error" class="list-unstyled">
<li class="text-danger">{{ error }}</li>
</ul>
diff --git a/resources/assets/js/components/transactions/Budget.vue b/resources/assets/js/components/transactions/Budget.vue
index 1b538c4501..77e9738e44 100644
--- a/resources/assets/js/components/transactions/Budget.vue
+++ b/resources/assets/js/components/transactions/Budget.vue
@@ -40,7 +40,7 @@
:value="cBudget.id">{{ cBudget.name }}
</option>
</select>
- <p v-if="this.budgets.length === 1" class="help-block" v-html="$t('firefly.no_budget_pointer')"></p>
+ <p v-if="this.budgets.length === 1" class="help-block" v-text="$t('firefly.no_budget_pointer')"></p>
<ul v-for="error in this.error" class="list-unstyled">
<li class="text-danger">{{ error }}</li>
</ul>
diff --git a/resources/assets/js/components/transactions/CustomTransactionFields.vue b/resources/assets/js/components/transactions/CustomTransactionFields.vue
index e55fcf0014..7dbfdc11ed 100644
--- a/resources/assets/js/components/transactions/CustomTransactionFields.vue
+++ b/resources/assets/js/components/transactions/CustomTransactionFields.vue
@@ -20,7 +20,7 @@
<template>
<div>
- <p class="help-block" v-html="$t('firefly.hidden_fields_preferences')"></p>
+ <p class="help-block" v-text="$t('firefly.hidden_fields_preferences')"></p>
<component
v-bind:is="dateComponent"
v-if="this.fields.interest_date" v-model="value.interest_date" :error="error.interest_date"
diff --git a/resources/assets/js/components/webhooks/Show.vue b/resources/assets/js/components/webhooks/Show.vue
index 00943db856..a0470cd582 100644
--- a/resources/assets/js/components/webhooks/Show.vue
+++ b/resources/assets/js/components/webhooks/Show.vue
@@ -85,7 +85,7 @@
<table class="table table-hover" aria-label="A table">
<tbody>
<tr>
- <th style="width:40%;">{{ $t('list.url') }}</th>
+ <th scope="row" style="width:40%;">{{ $t('list.url') }}</th>
<td><input type="text" readonly class="form-control" :value=url></td>
</tr>
<tr>