Skip to content

Firefly III: a personal finances manager

Do some code cleanup courtesy of Mago.

James Cole1d41fc98458d
diff --git a/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php b/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php
index bb98322c9b..08bda85dbe 100644
--- a/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php
+++ b/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php
@@ -262,7 +262,7 @@ class ListController extends Controller
// filter selection
$collection = $unfiltered->filter(
static function (Recurrence $recurrence) use ($currency): ?Recurrence { // @phpstan-ignore-line
- if (array_any($recurrence->recurrenceTransactions, fn ($transaction): bool => $transaction->transaction_currency_id === $currency->id || $transaction->foreign_currency_id === $currency->id)) {
+ if (array_any($recurrence->recurrenceTransactions, static fn ($transaction): bool => $transaction->transaction_currency_id === $currency->id || $transaction->foreign_currency_id === $currency->id)) {
return $recurrence;
}
@@ -311,7 +311,7 @@ class ListController extends Controller
$collection = $unfiltered->filter(
static function (Rule $rule) use ($currency): ?Rule { // @phpstan-ignore-line
- if (array_any($rule->ruleTriggers, fn ($trigger): bool => 'currency_is' === $trigger->trigger_type && $currency->name === $trigger->trigger_value)) {
+ if (array_any($rule->ruleTriggers, static fn ($trigger): bool => 'currency_is' === $trigger->trigger_type && $currency->name === $trigger->trigger_value)) {
return $rule;
}
diff --git a/app/Console/Commands/Correction/ConvertsDatesToUTC.php b/app/Console/Commands/Correction/ConvertsDatesToUTC.php
index 657d8a0a83..43fe906dc6 100644
--- a/app/Console/Commands/Correction/ConvertsDatesToUTC.php
+++ b/app/Console/Commands/Correction/ConvertsDatesToUTC.php
@@ -91,7 +91,7 @@ class ConvertsDatesToUTC extends Command
}
$this->friendlyInfo(sprintf('Converting field "%s" of model "%s" to UTC.', $field, $shortModel));
$items->each(
- function ($item) use ($field, $timezoneField): void {
+ static function ($item) use ($field, $timezoneField): void {
$date = Carbon::parse($item->{$field}, $item->{$timezoneField}); // @phpstan-ignore-line
$date->setTimezone('UTC');
$item->{$field} = $date->format('Y-m-d H:i:s'); // @phpstan-ignore-line
diff --git a/app/Console/Commands/Correction/CorrectsPrimaryCurrencyAmounts.php b/app/Console/Commands/Correction/CorrectsPrimaryCurrencyAmounts.php
index ab19957bd2..2e7249096f 100644
--- a/app/Console/Commands/Correction/CorrectsPrimaryCurrencyAmounts.php
+++ b/app/Console/Commands/Correction/CorrectsPrimaryCurrencyAmounts.php
@@ -103,7 +103,7 @@ class CorrectsPrimaryCurrencyAmounts extends Command
private function recalculateAccounts(UserGroup $userGroup): void
{
- $set = $userGroup->accounts()->where(function (EloquentBuilder $q): void {
+ $set = $userGroup->accounts()->where(static function (EloquentBuilder $q): void {
$q->whereNotNull('virtual_balance');
// this needs a different piece of code for postgres.
@@ -226,10 +226,10 @@ class CorrectsPrimaryCurrencyAmounts extends Command
$set = DB::table('transactions')
->join('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
->where('transaction_journals.user_group_id', $userGroup->id)
- ->where(function (DatabaseBuilder $q1) use ($currency): void {
- $q1->where(function (DatabaseBuilder $q2) use ($currency): void {
+ ->where(static function (DatabaseBuilder $q1) use ($currency): void {
+ $q1->where(static function (DatabaseBuilder $q2) use ($currency): void {
$q2->whereNot('transactions.transaction_currency_id', $currency->id)->whereNull('transactions.foreign_currency_id');
- })->orWhere(function (DatabaseBuilder $q3) use ($currency): void {
+ })->orWhere(static function (DatabaseBuilder $q3) use ($currency): void {
$q3->whereNot('transactions.transaction_currency_id', $currency->id)->whereNot('transactions.foreign_currency_id', $currency->id);
});
})
diff --git a/app/Events/RequestedNewPassword.php b/app/Events/RequestedNewPassword.php
index 71634ce001..22feca1826 100644
--- a/app/Events/RequestedNewPassword.php
+++ b/app/Events/RequestedNewPassword.php
@@ -46,7 +46,7 @@ class RequestedNewPassword extends Event
/**
* Create a new event instance. This event is triggered when a users tries to reset his or her password.
*/
- public function __construct(User $user, string $token, string $ipAddress)
+ public function __construct(User $user, #[\SensitiveParameter] string $token, string $ipAddress)
{
$this->user = $user;
$this->token = $token;
diff --git a/app/Helpers/Collector/GroupCollector.php b/app/Helpers/Collector/GroupCollector.php
index b684a4b6df..0d2b7793c4 100644
--- a/app/Helpers/Collector/GroupCollector.php
+++ b/app/Helpers/Collector/GroupCollector.php
@@ -828,7 +828,7 @@ class GroupCollector implements GroupCollectorInterface
*/
foreach ($this->sorting as $field => $direction) {
$func = 'ASC' === $direction ? 'sortBy' : 'sortByDesc';
- $collection = $collection->{$func}(function (array $product, int $key) use ($field) { // @phpstan-ignore-line
+ $collection = $collection->{$func}(static function (array $product, int $key) use ($field) { // @phpstan-ignore-line
// depends on $field:
if ('description' === $field) {
if (1 === count($product['transactions'])) {
diff --git a/app/Http/Controllers/Auth/ResetPasswordController.php b/app/Http/Controllers/Auth/ResetPasswordController.php
index 8e4d7eb7f7..f4227fb038 100644
--- a/app/Http/Controllers/Auth/ResetPasswordController.php
+++ b/app/Http/Controllers/Auth/ResetPasswordController.php
@@ -97,7 +97,7 @@ class ResetPasswordController extends Controller
// database. Otherwise, we will parse the error and return the response.
$response = $this->broker()->reset(
$this->credentials($request),
- function ($user, $password): void {
+ function ($user, #[\SensitiveParameter] $password): void {
$this->resetPassword($user, $password);
}
);
@@ -123,7 +123,7 @@ class ResetPasswordController extends Controller
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
- public function showResetForm(Request $request, $token = null)
+ public function showResetForm(Request $request, #[\SensitiveParameter] $token = null)
{
if ('web' !== config('firefly.authentication_guard')) {
$message = sprintf('Cannot reset password when authenticating over "%s".', config('firefly.authentication_guard'));
diff --git a/app/Http/Controllers/ExchangeRates/IndexController.php b/app/Http/Controllers/ExchangeRates/IndexController.php
index 31c763e241..cb3c431ba8 100644
--- a/app/Http/Controllers/ExchangeRates/IndexController.php
+++ b/app/Http/Controllers/ExchangeRates/IndexController.php
@@ -41,7 +41,7 @@ class IndexController extends Controller
// translations:
$this->middleware(
- function ($request, $next) {
+ static function ($request, $next) {
app('view')->share('mainTitleIcon', 'fa-exchange');
app('view')->share('title', (string) trans('firefly.header_exchange_rates'));
diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php
index b50a552ff5..4de3d88167 100644
--- a/app/Http/Controllers/ProfileController.php
+++ b/app/Http/Controllers/ProfileController.php
@@ -91,7 +91,7 @@ class ProfileController extends Controller
*
* @throws FireflyException
*/
- public function confirmEmailChange(UserRepositoryInterface $repository, string $token): Redirector|RedirectResponse
+ public function confirmEmailChange(UserRepositoryInterface $repository, #[\SensitiveParameter] string $token): Redirector|RedirectResponse
{
if (!$this->internalAuth) {
throw new FireflyException(trans('firefly.external_user_mgt_disabled'));
@@ -388,7 +388,7 @@ class ProfileController extends Controller
*
* @throws FireflyException
*/
- public function undoEmailChange(UserRepositoryInterface $repository, string $token, string $hash): Redirector|RedirectResponse
+ public function undoEmailChange(UserRepositoryInterface $repository, #[\SensitiveParameter] string $token, string $hash): Redirector|RedirectResponse
{
if (!$this->internalAuth) {
throw new FireflyException(trans('firefly.external_user_mgt_disabled'));
diff --git a/app/Models/AccountMeta.php b/app/Models/AccountMeta.php
index 4932c3a54f..4f52be9dd9 100644
--- a/app/Models/AccountMeta.php
+++ b/app/Models/AccountMeta.php
@@ -53,6 +53,6 @@ class AccountMeta extends Model
protected function data(): Attribute
{
- return Attribute::make(get: fn (mixed $value): string => (string)json_decode((string)$value, true), set: fn (mixed $value): array => ['data' => json_encode($value)]);
+ return Attribute::make(get: static fn (mixed $value): string => (string)json_decode((string)$value, true), set: static fn (mixed $value): array => ['data' => json_encode($value)]);
}
}
diff --git a/app/Models/AvailableBudget.php b/app/Models/AvailableBudget.php
index 92d177961e..db806fd472 100644
--- a/app/Models/AvailableBudget.php
+++ b/app/Models/AvailableBudget.php
@@ -103,16 +103,16 @@ class AvailableBudget extends Model
protected function endDate(): Attribute
{
return Attribute::make(
- get: fn (string $value): Carbon => Carbon::parse($value),
- set: fn (Carbon $value): string => $value->format('Y-m-d'),
+ get: static fn (string $value): Carbon => Carbon::parse($value),
+ set: static fn (Carbon $value): string => $value->format('Y-m-d'),
);
}
protected function startDate(): Attribute
{
return Attribute::make(
- get: fn (string $value): Carbon => Carbon::parse($value),
- set: fn (Carbon $value): string => $value->format('Y-m-d'),
+ get: static fn (string $value): Carbon => Carbon::parse($value),
+ set: static fn (Carbon $value): string => $value->format('Y-m-d'),
);
}
diff --git a/app/Models/Configuration.php b/app/Models/Configuration.php
index 47fc0f8a28..98216193e1 100644
--- a/app/Models/Configuration.php
+++ b/app/Models/Configuration.php
@@ -52,6 +52,6 @@ class Configuration extends Model
*/
protected function data(): Attribute
{
- return Attribute::make(get: fn ($value): mixed => json_decode((string)$value), set: fn ($value): array => ['data' => json_encode($value)]);
+ return Attribute::make(get: static fn ($value): mixed => json_decode((string)$value), set: static fn ($value): array => ['data' => json_encode($value)]);
}
}
diff --git a/app/Models/Rule.php b/app/Models/Rule.php
index cffe9515e3..71c126cf9a 100644
--- a/app/Models/Rule.php
+++ b/app/Models/Rule.php
@@ -113,7 +113,7 @@ class Rule extends Model
protected function description(): Attribute
{
- return Attribute::make(set: fn ($value): array => ['description' => e($value)]);
+ return Attribute::make(set: static fn ($value): array => ['description' => e($value)]);
}
protected function order(): Attribute
diff --git a/app/Models/TransactionJournalMeta.php b/app/Models/TransactionJournalMeta.php
index 25272f084b..01eca70642 100644
--- a/app/Models/TransactionJournalMeta.php
+++ b/app/Models/TransactionJournalMeta.php
@@ -57,7 +57,7 @@ class TransactionJournalMeta extends Model
protected function data(): Attribute
{
- return Attribute::make(get: fn ($value): mixed => json_decode((string)$value, false), set: function ($value): array {
+ return Attribute::make(get: static fn ($value): mixed => json_decode((string)$value, false), set: static function ($value): array {
$data = json_encode($value);
return ['data' => $data, 'hash' => hash('sha256', $data)];
diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php
index 60b90efad6..5c35149884 100644
--- a/app/Providers/AppServiceProvider.php
+++ b/app/Providers/AppServiceProvider.php
@@ -45,7 +45,7 @@ class AppServiceProvider extends ServiceProvider
{
Schema::defaultStringLength(191);
// Passport::$clientUuids = false;
- Response::macro('api', function (array $value) {
+ Response::macro('api', static function (array $value) {
$headers = [
'Cache-Control' => 'no-store',
];
@@ -61,7 +61,7 @@ class AppServiceProvider extends ServiceProvider
});
// blade extension
- Blade::directive('activeXRoutePartial', function (string $route): string {
+ Blade::directive('activeXRoutePartial', static function (string $route): string {
$name = Route::getCurrentRoute()->getName() ?? '';
if (str_contains($name, $route)) {
return 'menu-open';
@@ -69,7 +69,7 @@ class AppServiceProvider extends ServiceProvider
return '';
});
- Blade::if('partialroute', function (string $route, string $firstParam = ''): bool {
+ Blade::if('partialroute', static function (string $route, string $firstParam = ''): bool {
$name = Route::getCurrentRoute()->getName() ?? '';
if ('' === $firstParam && str_contains($name, $route)) {
return true;
diff --git a/app/Providers/SearchServiceProvider.php b/app/Providers/SearchServiceProvider.php
index 32f4850864..6c02351d74 100644
--- a/app/Providers/SearchServiceProvider.php
+++ b/app/Providers/SearchServiceProvider.php
@@ -24,7 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Providers;
use FireflyIII\Support\Search\OperatorQuerySearch;
-use FireflyIII\Support\Search\QueryParser\GdbotsQueryParser;
+
use FireflyIII\Support\Search\QueryParser\QueryParser;
use FireflyIII\Support\Search\QueryParser\QueryParserInterface;
use FireflyIII\Support\Search\SearchInterface;
diff --git a/app/Repositories/ExchangeRate/ExchangeRateRepository.php b/app/Repositories/ExchangeRate/ExchangeRateRepository.php
index 1fecb036fd..dc77777069 100644
--- a/app/Repositories/ExchangeRate/ExchangeRateRepository.php
+++ b/app/Repositories/ExchangeRate/ExchangeRateRepository.php
@@ -55,12 +55,12 @@ class ExchangeRateRepository implements ExchangeRateRepositoryInterface, UserGro
// orderBy('date', 'DESC')->toRawSql();
return
$this->userGroup->currencyExchangeRates()
- ->where(function (Builder $q1) use ($from, $to): void {
- $q1->where(function (Builder $q) use ($from, $to): void {
+ ->where(static function (Builder $q1) use ($from, $to): void {
+ $q1->where(static function (Builder $q) use ($from, $to): void {
$q->where('from_currency_id', $from->id)
->where('to_currency_id', $to->id)
;
- })->orWhere(function (Builder $q) use ($from, $to): void {
+ })->orWhere(static function (Builder $q) use ($from, $to): void {
$q->where('from_currency_id', $to->id)
->where('to_currency_id', $from->id)
;
diff --git a/app/Repositories/User/UserRepository.php b/app/Repositories/User/UserRepository.php
index 2069994bcf..fd0818495c 100644
--- a/app/Repositories/User/UserRepository.php
+++ b/app/Repositories/User/UserRepository.php
@@ -74,7 +74,7 @@ class UserRepository implements UserRepositoryInterface
return true;
}
- public function changePassword(User $user, string $password): bool
+ public function changePassword(User $user, #[\SensitiveParameter] string $password): bool
{
$user->password = bcrypt($password);
$user->save();
diff --git a/app/Repositories/User/UserRepositoryInterface.php b/app/Repositories/User/UserRepositoryInterface.php
index 4b2ad0b9a9..21e53c5151 100644
--- a/app/Repositories/User/UserRepositoryInterface.php
+++ b/app/Repositories/User/UserRepositoryInterface.php
@@ -64,7 +64,7 @@ interface UserRepositoryInterface
/**
* @return mixed
*/
- public function changePassword(User $user, string $password);
+ public function changePassword(User $user, #[\SensitiveParameter] string $password);
public function changeStatus(User $user, bool $isBlocked, string $code): bool;
diff --git a/app/Services/Password/PwndVerifierV2.php b/app/Services/Password/PwndVerifierV2.php
index 874e5e80a5..cf06efea3e 100644
--- a/app/Services/Password/PwndVerifierV2.php
+++ b/app/Services/Password/PwndVerifierV2.php
@@ -36,7 +36,7 @@ class PwndVerifierV2 implements Verifier
/**
* Verify the given password against (some) service.
*/
- public function validPassword(string $password): bool
+ public function validPassword(#[\SensitiveParameter] string $password): bool
{
// Yes SHA1 is unsafe but in this context its fine.
$hash = sha1($password);
diff --git a/app/Services/Password/Verifier.php b/app/Services/Password/Verifier.php
index 705053bbfb..a5992f4915 100644
--- a/app/Services/Password/Verifier.php
+++ b/app/Services/Password/Verifier.php
@@ -31,5 +31,5 @@ interface Verifier
/**
* Verify the given password against (some) service.
*/
- public function validPassword(string $password): bool;
+ public function validPassword(#[\SensitiveParameter] string $password): bool;
}
diff --git a/app/Support/Authentication/RemoteUserProvider.php b/app/Support/Authentication/RemoteUserProvider.php
index 1b42607fef..b57c563e84 100644
--- a/app/Support/Authentication/RemoteUserProvider.php
+++ b/app/Support/Authentication/RemoteUserProvider.php
@@ -100,7 +100,7 @@ class RemoteUserProvider implements UserProvider
*
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
- public function retrieveByToken($identifier, $token): ?Authenticatable
+ public function retrieveByToken($identifier, #[\SensitiveParameter] $token): ?Authenticatable
{
Log::debug(sprintf('Now at %s', __METHOD__));
@@ -114,7 +114,7 @@ class RemoteUserProvider implements UserProvider
*
* @throws FireflyException
*/
- public function updateRememberToken(Authenticatable $user, $token): void
+ public function updateRememberToken(Authenticatable $user, #[\SensitiveParameter] $token): void
{
Log::debug(sprintf('Now at %s', __METHOD__));
diff --git a/app/Support/Http/Controllers/PeriodOverview.php b/app/Support/Http/Controllers/PeriodOverview.php
index 897f8da732..225e4033f0 100644
--- a/app/Support/Http/Controllers/PeriodOverview.php
+++ b/app/Support/Http/Controllers/PeriodOverview.php
@@ -331,7 +331,7 @@ trait PeriodOverview
}
return $this->statistics->filter(
- fn (PeriodStatistic $statistic): bool => $statistic->start->eq($start) && $statistic->end->eq($end) && $statistic->type === $type
+ static fn (PeriodStatistic $statistic): bool => $statistic->start->eq($start) && $statistic->end->eq($end) && $statistic->type === $type
);
}
@@ -344,7 +344,7 @@ trait PeriodOverview
}
return $this->statistics->filter(
- fn (PeriodStatistic $statistic): bool => $statistic->start->eq($start) && $statistic->end->eq($end) && str_starts_with($statistic->type, $prefix)
+ static fn (PeriodStatistic $statistic): bool => $statistic->start->eq($start) && $statistic->end->eq($end) && str_starts_with($statistic->type, $prefix)
);
}
diff --git a/app/Support/JsonApi/Enrichments/BudgetLimitEnrichment.php b/app/Support/JsonApi/Enrichments/BudgetLimitEnrichment.php
index b5ebb7ca7f..5a94106a48 100644
--- a/app/Support/JsonApi/Enrichments/BudgetLimitEnrichment.php
+++ b/app/Support/JsonApi/Enrichments/BudgetLimitEnrichment.php
@@ -179,7 +179,7 @@ class BudgetLimitEnrichment implements EnrichmentInterface
private function filterToBudget(array $expenses, int $budget): array
{
- $result = array_filter($expenses, fn (array $item): bool => (int)$item['budget_id'] === $budget);
+ $result = array_filter($expenses, static fn (array $item): bool => (int)$item['budget_id'] === $budget);
Log::debug(sprintf('filterToBudget for budget #%d, from %d to %d items', $budget, count($expenses), count($result)));
return $result;
@@ -187,13 +187,13 @@ class BudgetLimitEnrichment implements EnrichmentInterface
private function stringifyIds(): void
{
- $this->expenses = array_map(fn ($first): array => array_map(function (array $second): array {
+ $this->expenses = array_map(static fn ($first): array => array_map(static function (array $second): array {
$second['currency_id'] = (string)($second['currency_id'] ?? 0);
return $second;
}, $first), $this->expenses);
- $this->pcExpenses = array_map(fn (array $first): array => array_map(function (array $second): array {
+ $this->pcExpenses = array_map(static fn (array $first): array => array_map(static function (array $second): array {
$second['currency_id'] ??= 0;
return $second;
diff --git a/app/Support/JsonApi/Enrichments/RecurringEnrichment.php b/app/Support/JsonApi/Enrichments/RecurringEnrichment.php
index 7010a1de18..c033225c58 100644
--- a/app/Support/JsonApi/Enrichments/RecurringEnrichment.php
+++ b/app/Support/JsonApi/Enrichments/RecurringEnrichment.php
@@ -339,7 +339,7 @@ class RecurringEnrichment implements EnrichmentInterface
/** @var RecurrenceRepetition $repetition */
foreach ($set as $repetition) {
- $recurrence = $this->collection->filter(fn (Recurrence $item): bool => (int)$item->id === (int)$repetition->recurrence_id)->first();
+ $recurrence = $this->collection->filter(static fn (Recurrence $item): bool => (int)$item->id === (int)$repetition->recurrence_id)->first();
$fromDate = clone ($recurrence->latest_date ?? $recurrence->first_date);
$recurrenceId = (int)$repetition->recurrence_id;
$repId = (int)$repetition->id;
diff --git a/app/Support/JsonApi/Enrichments/SubscriptionEnrichment.php b/app/Support/JsonApi/Enrichments/SubscriptionEnrichment.php
index 60bf82b7c4..76780dec0b 100644
--- a/app/Support/JsonApi/Enrichments/SubscriptionEnrichment.php
+++ b/app/Support/JsonApi/Enrichments/SubscriptionEnrichment.php
@@ -173,7 +173,7 @@ class SubscriptionEnrichment implements EnrichmentInterface
*/
protected function lastPaidDate(Bill $subscription, Collection $dates, Carbon $default): Carbon
{
- $filtered = $dates->filter(fn (TransactionJournal $journal): bool => (int)$journal->bill_id === (int)$subscription->id);
+ $filtered = $dates->filter(static fn (TransactionJournal $journal): bool => (int)$journal->bill_id === (int)$subscription->id);
Log::debug(sprintf('Filtered down from %d to %d entries for bill #%d.', $dates->count(), $filtered->count(), $subscription->id));
if (0 === $filtered->count()) {
return $default;
@@ -294,7 +294,7 @@ class SubscriptionEnrichment implements EnrichmentInterface
// At this point the "next match" is exactly after the last time the bill was paid.
$result = [];
- $filtered = $set->filter(fn (TransactionJournal $journal): bool => (int)$journal->bill_id === (int)$subscription->id);
+ $filtered = $set->filter(static fn (TransactionJournal $journal): bool => (int)$journal->bill_id === (int)$subscription->id);
foreach ($filtered as $entry) {
$array = [
'transaction_group_id' => (string)$entry->transaction_group_id,
@@ -385,7 +385,7 @@ class SubscriptionEnrichment implements EnrichmentInterface
private function filterPaidDates(array $entries): array
{
- return array_map(function (array $entry): array {
+ return array_map(static function (array $entry): array {
unset($entry['date_object']);
return $entry;
diff --git a/app/Support/Preferences.php b/app/Support/Preferences.php
index 943d48b117..2b841aa520 100644
--- a/app/Support/Preferences.php
+++ b/app/Support/Preferences.php
@@ -49,7 +49,7 @@ class Preferences
return Preference::where('user_id', $user->id)
->where('name', '!=', 'currencyPreference')
- ->where(function (Builder $q) use ($user): void {
+ ->where(static function (Builder $q) use ($user): void {
$q->whereNull('user_group_id');
$q->orWhere('user_group_id', $user->user_group_id);
})
@@ -108,7 +108,7 @@ class Preferences
{
$result = [];
$preferences = Preference::where('user_id', $user->id)
- ->where(function (Builder $q) use ($user): void {
+ ->where(static function (Builder $q) use ($user): void {
$q->whereNull('user_group_id');
$q->orWhere('user_group_id', $user->user_group_id);
})
diff --git a/app/Support/Request/ValidatesWebhooks.php b/app/Support/Request/ValidatesWebhooks.php
index 331eecc552..38ad9cb9e9 100644
--- a/app/Support/Request/ValidatesWebhooks.php
+++ b/app/Support/Request/ValidatesWebhooks.php
@@ -35,7 +35,7 @@ trait ValidatesWebhooks
public function withValidator(Validator $validator): void
{
$validator->after(
- function (Validator $validator): void {
+ static function (Validator $validator): void {
Log::debug('Validating webhook');
if (count($validator->failed()) > 0) {
return;
diff --git a/app/Support/Search/OperatorQuerySearch.php b/app/Support/Search/OperatorQuerySearch.php
index 2ecbf3eace..bc4f068a60 100644
--- a/app/Support/Search/OperatorQuerySearch.php
+++ b/app/Support/Search/OperatorQuerySearch.php
@@ -1245,9 +1245,9 @@ class OperatorQuerySearch implements SearchInterface
return false;
- //
+
// all account related searches:
- //
+
case 'account_is':
$this->searchAccount($value, SearchDirection::BOTH, StringPosition::IS);
@@ -1608,9 +1608,9 @@ class OperatorQuerySearch implements SearchInterface
break;
- //
+
// cash account
- //
+
case 'source_is_cash':
$account = $this->getCashAccount();
$this->collector->setSourceAccounts(new Collection()->push($account));
@@ -1647,9 +1647,9 @@ class OperatorQuerySearch implements SearchInterface
break;
- //
+
// description
- //
+
case 'description_starts':
$this->collector->descriptionStarts([$value]);
@@ -1690,9 +1690,9 @@ class OperatorQuerySearch implements SearchInterface
break;
- //
+
// currency
- //
+
case 'currency_is':
$currency = $this->findCurrency($value);
if ($currency instanceof TransactionCurrency) {
@@ -1741,9 +1741,9 @@ class OperatorQuerySearch implements SearchInterface
break;
- //
+
// attachments
- //
+
case 'has_attachments':
case '-has_no_attachments':
Log::debug('Set collector to filter on attachments.');
@@ -1758,7 +1758,7 @@ class OperatorQuerySearch implements SearchInterface
break;
- //
+
// categories
case '-has_any_category':
case 'has_no_category':
@@ -1866,9 +1866,9 @@ class OperatorQuerySearch implements SearchInterface
break;
- //
+
// budgets
- //
+
case '-has_any_budget':
case 'has_no_budget':
$this->collector->withoutBudget();
@@ -1977,9 +1977,9 @@ class OperatorQuerySearch implements SearchInterface
break;
- //
+
// bill
- //
+
case '-has_any_bill':
case 'has_no_bill':
$this->collector->withoutBill();
@@ -2088,9 +2088,9 @@ class OperatorQuerySearch implements SearchInterface
break;
- //
+
// tags
- //
+
case '-has_any_tag':
case 'has_no_tag':
$this->collector->withoutTags();
@@ -2216,9 +2216,9 @@ class OperatorQuerySearch implements SearchInterface
break;
- //
+
// notes
- //
+
case 'notes_contains':
$this->collector->notesContain($value);
@@ -2281,9 +2281,9 @@ class OperatorQuerySearch implements SearchInterface
break;
- //
+
// amount
- //
+
case 'amount_is':
// strip comma's, make dots.
Log::debug(sprintf('Original value "%s"', $value));
@@ -2368,9 +2368,9 @@ class OperatorQuerySearch implements SearchInterface
break;
- //
+
// transaction type
- //
+
case 'transaction_type':
$this->collector->setTypes([ucfirst($value)]);
Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $value));
@@ -2383,9 +2383,9 @@ class OperatorQuerySearch implements SearchInterface
break;
- //
+
// dates
- //
+
case '-date_on':
case 'date_on':
$range = $this->parseDateRange($operator, $value);
@@ -2581,9 +2581,9 @@ class OperatorQuerySearch implements SearchInterface
return false;
- //
+
// external URL
- //
+
case '-any_external_url':
case 'no_external_url':
$this->collector->withoutExternalUrl();
@@ -2648,9 +2648,9 @@ class OperatorQuerySearch implements SearchInterface
break;
- //
+
// other fields
- //
+
case 'external_id_is':
$this->collector->setExternalId($value);
diff --git a/app/Support/Search/QueryParser/QueryParser.php b/app/Support/Search/QueryParser/QueryParser.php
index e9d5b7c914..2d7a865d62 100644
--- a/app/Support/Search/QueryParser/QueryParser.php
+++ b/app/Support/Search/QueryParser/QueryParser.php
@@ -202,7 +202,7 @@ class QueryParser implements QueryParserInterface
return new NodeGroup($nodes, $prohibited);
}
- private function createNode(string $token, string $fieldName, bool $prohibited): Node
+ private function createNode(#[\SensitiveParameter] string $token, string $fieldName, bool $prohibited): Node
{
if ('' !== $fieldName) {
// OK dus hoe trim je \" correct?
diff --git a/app/Support/Steam.php b/app/Support/Steam.php
index 43f960f0c6..3b7f6062ce 100644
--- a/app/Support/Steam.php
+++ b/app/Support/Steam.php
@@ -80,7 +80,7 @@ class Steam
$currency = $currencies[$account->id];
// second array
- $accountSums = array_filter($arrayOfSums, fn (array $entry): bool => $entry['account_id'] === $account->id);
+ $accountSums = array_filter($arrayOfSums, static fn (array $entry): bool => $entry['account_id'] === $account->id);
if (0 === count($accountSums)) {
$result[$account->id] = $return;
diff --git a/app/TransactionRules/Expressions/ActionExpressionLanguageProvider.php b/app/TransactionRules/Expressions/ActionExpressionLanguageProvider.php
index f1e2758d9f..0daaafb332 100644
--- a/app/TransactionRules/Expressions/ActionExpressionLanguageProvider.php
+++ b/app/TransactionRules/Expressions/ActionExpressionLanguageProvider.php
@@ -34,7 +34,7 @@ class ActionExpressionLanguageProvider implements ExpressionFunctionProviderInte
{
public function getFunctions(): array
{
- $function = function ($arguments, $str): string {
+ $function = static function ($arguments, $str): string {
if (!is_string($str)) {
return (string) $str;
}
diff --git a/app/User.php b/app/User.php
index 4d1a0c55bd..fe57e62c98 100644
--- a/app/User.php
+++ b/app/User.php
@@ -452,7 +452,7 @@ class User extends Authenticatable
*
* @param string $token
*/
- public function sendPasswordResetNotification($token): void
+ public function sendPasswordResetNotification(#[\SensitiveParameter] $token): void
{
$ipAddress = Request::ip();