Skip to content

Firefly III: a personal finances manager

Fix some linting issues

James Cole45d623e0c14d
diff --git a/app/Api/V1/Controllers/Models/Rule/TriggerController.php b/app/Api/V1/Controllers/Models/Rule/TriggerController.php
index d11279c6b0..0f4d77afe2 100644
--- a/app/Api/V1/Controllers/Models/Rule/TriggerController.php
+++ b/app/Api/V1/Controllers/Models/Rule/TriggerController.php
@@ -98,7 +98,7 @@ final class TriggerController extends Controller
$enrichment->setUser($rule->user);
$transactions = $enrichment->enrich($transactions);
- $paginator = new LengthAwarePaginator($transactions, $count, 31337, $this->parameters->get('page'));
+ $paginator = new LengthAwarePaginator($transactions, $count, 31_337, $this->parameters->get('page'));
$paginator->setPath(route('api.v1.rules.test', [$rule->id]).$this->buildParams());
// resulting list is presented as JSON thing.
diff --git a/app/Api/V1/Controllers/Models/RuleGroup/TriggerController.php b/app/Api/V1/Controllers/Models/RuleGroup/TriggerController.php
index 9387ca17db..3e1888723f 100644
--- a/app/Api/V1/Controllers/Models/RuleGroup/TriggerController.php
+++ b/app/Api/V1/Controllers/Models/RuleGroup/TriggerController.php
@@ -105,7 +105,7 @@ final class TriggerController extends Controller
$enrichment->setUser($group->user);
$transactions = $enrichment->enrich($transactions);
- $paginator = new LengthAwarePaginator($transactions, $count, 31337, $this->parameters->get('page'));
+ $paginator = new LengthAwarePaginator($transactions, $count, 31_337, $this->parameters->get('page'));
$paginator->setPath(route('api.v1.rule-groups.test', [$group->id]).$this->buildParams());
// resulting list is presented as JSON thing.
diff --git a/app/Api/V1/Requests/Models/RuleGroup/StoreRequest.php b/app/Api/V1/Requests/Models/RuleGroup/StoreRequest.php
index 1702aa52ce..f3a6ac210b 100644
--- a/app/Api/V1/Requests/Models/RuleGroup/StoreRequest.php
+++ b/app/Api/V1/Requests/Models/RuleGroup/StoreRequest.php
@@ -45,7 +45,7 @@ class StoreRequest extends FormRequest
public function getAll(): array
{
$active = true;
- $order = 31337;
+ $order = 31_337;
if (null !== $this->get('active')) {
$active = $this->boolean('active');
}
diff --git a/app/Factory/AccountFactory.php b/app/Factory/AccountFactory.php
index 43fe4109ac..3b32423a24 100644
--- a/app/Factory/AccountFactory.php
+++ b/app/Factory/AccountFactory.php
@@ -219,7 +219,7 @@ class AccountFactory
'user_group_id' => $this->user->user_group_id,
'account_type_id' => $type->id,
'name' => $data['name'],
- 'order' => 25000,
+ 'order' => 25_000,
'virtual_balance' => $virtualBalance,
'active' => $active,
'iban' => $data['iban'],
diff --git a/app/Factory/PiggyBankFactory.php b/app/Factory/PiggyBankFactory.php
index 0bd782cded..e812625cf1 100644
--- a/app/Factory/PiggyBankFactory.php
+++ b/app/Factory/PiggyBankFactory.php
@@ -246,7 +246,7 @@ class PiggyBankFactory
$piggyBankData['target_date_tz'] = $piggyBankData['target_date']?->format('e');
$piggyBankData['account_id'] = null;
$piggyBankData['transaction_currency_id'] = $this->getCurrency($data)->id;
- $piggyBankData['order'] = 131337;
+ $piggyBankData['order'] = 131_337;
try {
/** @var PiggyBank $piggyBank */
diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php
index 2e7230cfe2..d115582890 100644
--- a/app/Http/Controllers/Auth/LoginController.php
+++ b/app/Http/Controllers/Auth/LoginController.php
@@ -33,7 +33,7 @@ use FireflyIII\Repositories\User\UserRepositoryInterface;
use FireflyIII\Support\Facades\FireflyConfig;
use FireflyIII\Support\Facades\Steam;
use FireflyIII\User;
-use Illuminate\Contracts\Foundation\Application;
+
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php
index 965df84ea6..aa64e06dc6 100644
--- a/app/Http/Controllers/Auth/RegisterController.php
+++ b/app/Http/Controllers/Auth/RegisterController.php
@@ -31,7 +31,7 @@ use FireflyIII\Repositories\User\UserRepositoryInterface;
use FireflyIII\Support\Facades\FireflyConfig;
use FireflyIII\Support\Http\Controllers\CreateStuff;
use FireflyIII\User;
-use Illuminate\Contracts\Foundation\Application;
+
use Illuminate\Contracts\View\Factory;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Http\RedirectResponse;
diff --git a/app/Http/Controllers/Budget/BudgetLimitController.php b/app/Http/Controllers/Budget/BudgetLimitController.php
index c7b431bfbc..3891ef1ae6 100644
--- a/app/Http/Controllers/Budget/BudgetLimitController.php
+++ b/app/Http/Controllers/Budget/BudgetLimitController.php
@@ -172,7 +172,7 @@ final class BudgetLimitController extends Controller
// return empty array:
return response()->json([]);
}
- if ((int) $amount > 268435456) { // intentional cast to integer
+ if ((int) $amount > 268_435_456) { // intentional cast to integer
$amount = '268435456';
}
if (-1 === bccomp($amount, '0')) {
@@ -232,7 +232,7 @@ final class BudgetLimitController extends Controller
if ('' === $amount) {
$amount = '0';
}
- if ((int) $amount > 268435456) { // 268 million, intentional integer
+ if ((int) $amount > 268_435_456) { // 268 million, intentional integer
$amount = '268435456';
}
// sanity check on amount:
@@ -254,8 +254,8 @@ final class BudgetLimitController extends Controller
$amount = bcmul($amount, '-1');
}
$notes = (string) $request->get('notes');
- if (strlen($notes) > 32768) {
- $notes = substr($notes, 0, 32768);
+ if (strlen($notes) > 32_768) {
+ $notes = substr($notes, 0, 32_768);
}
$limit = $this->blRepository->update($budgetLimit, ['amount' => $amount, 'notes' => $notes]);
diff --git a/app/Http/Controllers/DebugController.php b/app/Http/Controllers/DebugController.php
index 548cf9ec10..0dec2c4cfe 100644
--- a/app/Http/Controllers/DebugController.php
+++ b/app/Http/Controllers/DebugController.php
@@ -160,7 +160,7 @@ final class DebugController extends Controller
}
if ('' !== $logContent) {
// last few lines
- $logContent = 'Truncated from this point <----|'.substr($logContent, -16384);
+ $logContent = 'Truncated from this point <----|'.substr($logContent, -16_384);
}
return view('debug', ['table' => $table, 'now' => $now, 'logContent' => $logContent]);
diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php
index 8562fe89b8..3312cea82e 100644
--- a/app/Http/Middleware/Authenticate.php
+++ b/app/Http/Middleware/Authenticate.php
@@ -26,13 +26,13 @@ namespace FireflyIII\Http\Middleware;
use Closure;
use FireflyIII\Exceptions\FireflyException;
-use FireflyIII\Exceptions\Handler;
+
use FireflyIII\User;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Contracts\Auth\Factory as Auth;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
-use League\OAuth2\Server\Exception\OAuthServerException;
+
/**
* Class Authenticate
@@ -100,7 +100,7 @@ class Authenticate
throw new FireflyException('This point is generally unreachable.');
- //
+
// exit('five');
// foreach ($guards as $guard) {
// exit('six');
diff --git a/app/Listeners/Security/System/ChecksForNewVersion.php b/app/Listeners/Security/System/ChecksForNewVersion.php
index 4524f504af..ad453f6899 100644
--- a/app/Listeners/Security/System/ChecksForNewVersion.php
+++ b/app/Listeners/Security/System/ChecksForNewVersion.php
@@ -68,7 +68,7 @@ class ChecksForNewVersion implements ShouldQueue
$now = Carbon::now()->getTimestamp();
$diff = $now - $lastCheckTime->data;
Log::debug(sprintf('Last check time is %d, current time is %d, difference is %d', $lastCheckTime->data, $now, $diff));
- if ($diff < 604800) {
+ if ($diff < 604_800) {
Log::debug(sprintf('Checked for updates less than a week ago (on %s).', Carbon::createFromTimestamp($lastCheckTime->data)->format('Y-m-d H:i:s')));
return;
@@ -121,7 +121,7 @@ class ChecksForNewVersion implements ShouldQueue
$now = Carbon::now()->getTimestamp();
$diff = $now - $lastCheckTime->data;
Log::debug(sprintf('Last warning time is %d, current time is %d, difference is %d', $lastCheckTime->data, $now, $diff));
- if ($diff < (604800 * 4)) {
+ if ($diff < (604_800 * 4)) {
Log::debug(sprintf(
'Warned about updates less than four weeks ago (on %s).',
Carbon::createFromTimestamp($lastCheckTime->data)->format('Y-m-d H:i:s')
diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php
index a1d3371335..67f5a5f643 100644
--- a/app/Providers/RouteServiceProvider.php
+++ b/app/Providers/RouteServiceProvider.php
@@ -24,7 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Providers;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
-use Illuminate\Support\Facades\Route;
+
use Override;
/**
diff --git a/app/Repositories/Rule/RuleRepository.php b/app/Repositories/Rule/RuleRepository.php
index 35be12d667..2a6ccbedf6 100644
--- a/app/Repositories/Rule/RuleRepository.php
+++ b/app/Repositories/Rule/RuleRepository.php
@@ -327,7 +327,7 @@ class RuleRepository implements RuleRepositoryInterface, UserGroupInterface
$rule->userGroup()->associate($this->user->userGroup);
$rule->rule_group_id = $ruleGroup->id;
- $rule->order = 31337;
+ $rule->order = 31_337;
$rule->active = array_key_exists('active', $data) ? $data['active'] : true;
$rule->strict = array_key_exists('strict', $data) ? $data['strict'] : false;
$rule->stop_processing = array_key_exists('stop_processing', $data) ? $data['stop_processing'] : false;
diff --git a/app/Repositories/RuleGroup/RuleGroupRepository.php b/app/Repositories/RuleGroup/RuleGroupRepository.php
index 4a44211c90..044e04153d 100644
--- a/app/Repositories/RuleGroup/RuleGroupRepository.php
+++ b/app/Repositories/RuleGroup/RuleGroupRepository.php
@@ -382,7 +382,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface, UserGroupInte
'user_group_id' => $this->user->user_group_id,
'title' => $data['title'],
'description' => $data['description'],
- 'order' => 31337,
+ 'order' => 31_337,
'active' => array_key_exists('active', $data) ? $data['active'] : true,
]);
$newRuleGroup->save();
diff --git a/app/Support/Cronjobs/AbstractCronjob.php b/app/Support/Cronjobs/AbstractCronjob.php
index b8de7d8b63..748d92936d 100644
--- a/app/Support/Cronjobs/AbstractCronjob.php
+++ b/app/Support/Cronjobs/AbstractCronjob.php
@@ -35,7 +35,7 @@ abstract class AbstractCronjob
public bool $jobFired = false;
public bool $jobSucceeded = false;
public ?string $message = null;
- public int $timeBetweenRuns = 43200;
+ public int $timeBetweenRuns = 43_200;
protected Carbon $date;
protected bool $force = false;
diff --git a/app/Support/Cronjobs/AutoBudgetCronjob.php b/app/Support/Cronjobs/AutoBudgetCronjob.php
index 9023fce8f7..000291eb38 100644
--- a/app/Support/Cronjobs/AutoBudgetCronjob.php
+++ b/app/Support/Cronjobs/AutoBudgetCronjob.php
@@ -47,7 +47,7 @@ class AutoBudgetCronjob extends AbstractCronjob
Log::info('Auto budget cron-job has never fired before.');
}
// less than half a day ago:
- if ($lastTime > 0 && $diff <= 43200) {
+ if ($lastTime > 0 && $diff <= 43_200) {
Log::info(sprintf('It has been %s since the auto budget cron-job has fired.', $diffForHumans));
if (false === $this->force) {
Log::info('The auto budget cron-job will not fire now.');
@@ -58,7 +58,7 @@ class AutoBudgetCronjob extends AbstractCronjob
Log::info('Execution of the auto budget cron-job has been FORCED.');
}
- if ($lastTime > 0 && $diff > 43200) {
+ if ($lastTime > 0 && $diff > 43_200) {
Log::info(sprintf('It has been %s since the auto budget cron-job has fired. It will fire now!', $diffForHumans));
}
diff --git a/app/Support/Cronjobs/BillWarningCronjob.php b/app/Support/Cronjobs/BillWarningCronjob.php
index c37f2ff54c..6afaaebeaa 100644
--- a/app/Support/Cronjobs/BillWarningCronjob.php
+++ b/app/Support/Cronjobs/BillWarningCronjob.php
@@ -54,7 +54,7 @@ class BillWarningCronjob extends AbstractCronjob
Log::info('The bill notification cron-job has never fired before.');
}
// less than half a day ago:
- if ($lastTime > 0 && $diff <= 43200) {
+ if ($lastTime > 0 && $diff <= 43_200) {
Log::info(sprintf('It has been %s since the bill notification cron-job has fired.', $diffForHumans));
if (false === $this->force) {
Log::info('The cron-job will not fire now.');
@@ -69,7 +69,7 @@ class BillWarningCronjob extends AbstractCronjob
Log::info('Execution of the bill notification cron-job has been FORCED.');
}
- if ($lastTime > 0 && $diff > 43200) {
+ if ($lastTime > 0 && $diff > 43_200) {
Log::info(sprintf('It has been %s since the bill notification cron-job has fired. It will fire now!', $diffForHumans));
}
diff --git a/app/Support/Cronjobs/ExchangeRatesCronjob.php b/app/Support/Cronjobs/ExchangeRatesCronjob.php
index c80b0e4fb5..52bcde3ebb 100644
--- a/app/Support/Cronjobs/ExchangeRatesCronjob.php
+++ b/app/Support/Cronjobs/ExchangeRatesCronjob.php
@@ -47,7 +47,7 @@ class ExchangeRatesCronjob extends AbstractCronjob
Log::info('Exchange rates cron-job has never fired before.');
}
// less than half a day ago:
- if ($lastTime > 0 && $diff <= 43200) {
+ if ($lastTime > 0 && $diff <= 43_200) {
Log::info(sprintf('It has been %s since the exchange rates cron-job has fired.', $diffForHumans));
if (false === $this->force) {
Log::info('The exchange rates cron-job will not fire now.');
@@ -59,7 +59,7 @@ class ExchangeRatesCronjob extends AbstractCronjob
Log::info('Execution of the exchange rates cron-job has been FORCED.');
}
- if ($lastTime > 0 && $diff > 43200) {
+ if ($lastTime > 0 && $diff > 43_200) {
Log::info(sprintf('It has been %s since the exchange rates cron-job has fired. It will fire now!', $diffForHumans));
}
diff --git a/app/Support/Cronjobs/RecurringCronjob.php b/app/Support/Cronjobs/RecurringCronjob.php
index 7c8f6c95ee..4b235f7820 100644
--- a/app/Support/Cronjobs/RecurringCronjob.php
+++ b/app/Support/Cronjobs/RecurringCronjob.php
@@ -54,7 +54,7 @@ class RecurringCronjob extends AbstractCronjob
Log::info('Recurring transactions cron-job has never fired before.');
}
// less than half a day ago:
- if ($lastTime > 0 && $diff <= 43200) {
+ if ($lastTime > 0 && $diff <= 43_200) {
Log::info(sprintf('It has been "%s" since the recurring transactions cron-job has fired.', $diffForHumans));
if (false === $this->force) {
Log::info('The cron-job will not fire now.');
@@ -68,7 +68,7 @@ class RecurringCronjob extends AbstractCronjob
Log::info('Execution of the recurring transaction cron-job has been FORCED.');
}
- if ($lastTime > 0 && $diff > 43200) {
+ if ($lastTime > 0 && $diff > 43_200) {
Log::info(sprintf('It has been "%s" since the recurring transactions cron-job has fired. It will fire now!', $diffForHumans));
}
diff --git a/app/Support/Cronjobs/UpdateCheckCronjob.php b/app/Support/Cronjobs/UpdateCheckCronjob.php
index b234ac62cf..38f9d36618 100644
--- a/app/Support/Cronjobs/UpdateCheckCronjob.php
+++ b/app/Support/Cronjobs/UpdateCheckCronjob.php
@@ -60,7 +60,7 @@ class UpdateCheckCronjob extends AbstractCronjob
$now = Carbon::now()->getTimestamp();
$diff = $now - $lastCheckTime->data;
Log::debug(sprintf('Last check time is %d, current time is %d, difference is %d', $lastCheckTime->data, $now, $diff));
- if ($diff < 604800 && false === $this->force) {
+ if ($diff < 604_800 && false === $this->force) {
// get stuff from job:
$this->jobFired = false;
$this->jobErrored = false;
diff --git a/app/Support/Http/Controllers/GetConfigurationData.php b/app/Support/Http/Controllers/GetConfigurationData.php
index c7dba77d2b..d8c7111a72 100644
--- a/app/Support/Http/Controllers/GetConfigurationData.php
+++ b/app/Support/Http/Controllers/GetConfigurationData.php
@@ -221,7 +221,7 @@ trait GetConfigurationData
return;
}
- if (($now - $lastTime) > 129600) {
+ if (($now - $lastTime) > 129_600) {
request()->session()->flash('warning', trans('firefly.recurring_cron_long_ago'));
}
}
diff --git a/app/TransactionRules/Engine/SearchRuleEngine.php b/app/TransactionRules/Engine/SearchRuleEngine.php
index bd2e1e814e..4e4217e8d2 100644
--- a/app/TransactionRules/Engine/SearchRuleEngine.php
+++ b/app/TransactionRules/Engine/SearchRuleEngine.php
@@ -255,7 +255,7 @@ class SearchRuleEngine implements RuleEngineInterface
$searchEngine = app(SearchInterface::class);
$searchEngine->setUser($this->user);
$searchEngine->setPage(1);
- $searchEngine->setLimit(31337);
+ $searchEngine->setLimit(31_337);
foreach ($searchArray as $type => $value) {
$searchEngine->parseQuery(sprintf('%s:%s', $type, $value));
@@ -345,7 +345,7 @@ class SearchRuleEngine implements RuleEngineInterface
$searchEngine = app(SearchInterface::class);
$searchEngine->setUser($this->user);
$searchEngine->setPage(1);
- $searchEngine->setLimit(31337);
+ $searchEngine->setLimit(31_337);
$searchEngine->setDate($date);
Log::debug('Search array', $searchArray);
diff --git a/app/Validation/AutoBudget/ValidatesAutoBudgetRequest.php b/app/Validation/AutoBudget/ValidatesAutoBudgetRequest.php
index 28bad253e3..7fd52c66ac 100644
--- a/app/Validation/AutoBudget/ValidatesAutoBudgetRequest.php
+++ b/app/Validation/AutoBudget/ValidatesAutoBudgetRequest.php
@@ -72,7 +72,7 @@ trait ValidatesAutoBudgetRequest
$validator->errors()->add('auto_budget_amount', (string) trans('validation.require_currency_info'));
}
// too big amount
- if ((int) $amount > 268435456) {
+ if ((int) $amount > 268_435_456) {
$validator->errors()->add('auto_budget_amount', (string) trans('validation.amount_required_for_auto_budget'));
}
}