This commit is contained in:
James Cole 2023-12-21 05:07:26 +01:00
parent 1f7ceb6df6
commit a445bc53cd
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80
61 changed files with 165 additions and 163 deletions

View File

@ -85,7 +85,7 @@ class StoreRequest extends FormRequest
public function withValidator(Validator $validator): void public function withValidator(Validator $validator): void
{ {
$validator->after( $validator->after(
function (Validator $validator) { function (Validator $validator): void {
// validate all account info // validate all account info
$this->validateAutoBudgetAmount($validator); $this->validateAutoBudgetAmount($validator);
} }

View File

@ -97,7 +97,7 @@ class UpdateRequest extends FormRequest
public function withValidator(Validator $validator): void public function withValidator(Validator $validator): void
{ {
$validator->after( $validator->after(
function (Validator $validator) { function (Validator $validator): void {
// validate all account info // validate all account info
$this->validateAutoBudgetAmount($validator); $this->validateAutoBudgetAmount($validator);
} }

View File

@ -76,7 +76,7 @@ class UpdateRequest extends FormRequest
public function withValidator(Validator $validator): void public function withValidator(Validator $validator): void
{ {
$validator->after( $validator->after(
static function (Validator $validator) { static function (Validator $validator): void {
// validate start before end only if both are there. // validate start before end only if both are there.
$data = $validator->getData(); $data = $validator->getData();
if (array_key_exists('start', $data) && array_key_exists('end', $data)) { if (array_key_exists('start', $data) && array_key_exists('end', $data)) {

View File

@ -120,7 +120,7 @@ class StoreRequest extends FormRequest
public function withValidator(Validator $validator): void public function withValidator(Validator $validator): void
{ {
$validator->after( $validator->after(
function (Validator $validator) { function (Validator $validator): void {
$this->validateRecurringConfig($validator); $this->validateRecurringConfig($validator);
$this->validateOneRecurrenceTransaction($validator); $this->validateOneRecurrenceTransaction($validator);
$this->validateOneRepetition($validator); $this->validateOneRepetition($validator);

View File

@ -127,7 +127,7 @@ class UpdateRequest extends FormRequest
public function withValidator(Validator $validator): void public function withValidator(Validator $validator): void
{ {
$validator->after( $validator->after(
function (Validator $validator) { function (Validator $validator): void {
// $this->validateOneRecurrenceTransaction($validator); // $this->validateOneRecurrenceTransaction($validator);
// $this->validateOneRepetitionUpdate($validator); // $this->validateOneRepetitionUpdate($validator);

View File

@ -101,7 +101,7 @@ class StoreRequest extends FormRequest
public function withValidator(Validator $validator): void public function withValidator(Validator $validator): void
{ {
$validator->after( $validator->after(
function (Validator $validator) { function (Validator $validator): void {
$this->atLeastOneTrigger($validator); $this->atLeastOneTrigger($validator);
$this->atLeastOneAction($validator); $this->atLeastOneAction($validator);
$this->atLeastOneActiveTrigger($validator); $this->atLeastOneActiveTrigger($validator);

View File

@ -111,7 +111,7 @@ class UpdateRequest extends FormRequest
public function withValidator(Validator $validator): void public function withValidator(Validator $validator): void
{ {
$validator->after( $validator->after(
function (Validator $validator) { function (Validator $validator): void {
$this->atLeastOneTrigger($validator); $this->atLeastOneTrigger($validator);
$this->atLeastOneValidTrigger($validator); $this->atLeastOneValidTrigger($validator);
$this->atLeastOneAction($validator); $this->atLeastOneAction($validator);

View File

@ -160,7 +160,7 @@ class StoreRequest extends FormRequest
public function withValidator(Validator $validator): void public function withValidator(Validator $validator): void
{ {
$validator->after( $validator->after(
function (Validator $validator) { function (Validator $validator): void {
// must be valid array. // must be valid array.
$this->validateTransactionArray($validator); $this->validateTransactionArray($validator);

View File

@ -239,7 +239,7 @@ class UpdateRequest extends FormRequest
/** @var TransactionGroup $transactionGroup */ /** @var TransactionGroup $transactionGroup */
$transactionGroup = $this->route()->parameter('transactionGroup'); $transactionGroup = $this->route()->parameter('transactionGroup');
$validator->after( $validator->after(
function (Validator $validator) use ($transactionGroup) { function (Validator $validator) use ($transactionGroup): void {
// if more than one, verify that there are journal ID's present. // if more than one, verify that there are journal ID's present.
$this->validateJournalIds($validator, $transactionGroup); $this->validateJournalIds($validator, $transactionGroup);

View File

@ -73,7 +73,7 @@ class StoreRequest extends FormRequest
public function withValidator(Validator $validator): void public function withValidator(Validator $validator): void
{ {
$validator->after( $validator->after(
function (Validator $validator) { function (Validator $validator): void {
$this->validateExistingLink($validator); $this->validateExistingLink($validator);
} }
); );

View File

@ -73,7 +73,7 @@ class UpdateRequest extends FormRequest
public function withValidator(Validator $validator): void public function withValidator(Validator $validator): void
{ {
$validator->after( $validator->after(
function (Validator $validator) { function (Validator $validator): void {
$this->validateUpdate($validator); $this->validateUpdate($validator);
} }
); );

View File

@ -89,7 +89,7 @@ class UserUpdateRequest extends FormRequest
/** @var null|User $current */ /** @var null|User $current */
$current = $this->route()->parameter('user'); $current = $this->route()->parameter('user');
$validator->after( $validator->after(
static function (Validator $validator) use ($current) { static function (Validator $validator) use ($current): void {
$isAdmin = auth()->user()->hasRole('owner'); $isAdmin = auth()->user()->hasRole('owner');
// not admin, and not own user? // not admin, and not own user?
if (auth()->check() && false === $isAdmin && $current?->id !== auth()->user()->id) { if (auth()->check() && false === $isAdmin && $current?->id !== auth()->user()->id) {

View File

@ -66,7 +66,7 @@ class BalanceChartRequest extends FormRequest
public function withValidator(Validator $validator): void public function withValidator(Validator $validator): void
{ {
$validator->after( $validator->after(
static function (Validator $validator) { static function (Validator $validator): void {
// validate transaction query data. // validate transaction query data.
$data = $validator->getData(); $data = $validator->getData();
if (!array_key_exists('accounts', $data)) { if (!array_key_exists('accounts', $data)) {

View File

@ -65,7 +65,7 @@ class DashboardChartRequest extends FormRequest
public function withValidator(Validator $validator): void public function withValidator(Validator $validator): void
{ {
$validator->after( $validator->after(
static function (Validator $validator) { static function (Validator $validator): void {
// validate transaction query data. // validate transaction query data.
$data = $validator->getData(); $data = $validator->getData();
if (!array_key_exists('accounts', $data)) { if (!array_key_exists('accounts', $data)) {

View File

@ -180,7 +180,7 @@ class StoreRequest extends FormRequest
/** @var UserGroup $userGroup */ /** @var UserGroup $userGroup */
$userGroup = $this->getUserGroup(); $userGroup = $this->getUserGroup();
$validator->after( $validator->after(
function (Validator $validator) use ($user, $userGroup) { function (Validator $validator) use ($user, $userGroup): void {
// must be valid array. // must be valid array.
$this->validateTransactionArray($validator); // does not need group validation. $this->validateTransactionArray($validator); // does not need group validation.

View File

@ -63,13 +63,13 @@ class FixAccountTypes extends Command
$query = TransactionJournal::leftJoin('transaction_types', 'transaction_journals.transaction_type_id', '=', 'transaction_types.id') $query = TransactionJournal::leftJoin('transaction_types', 'transaction_journals.transaction_type_id', '=', 'transaction_types.id')
->leftJoin( ->leftJoin(
'transactions as source', 'transactions as source',
static function (JoinClause $join) { static function (JoinClause $join): void {
$join->on('transaction_journals.id', '=', 'source.transaction_journal_id')->where('source.amount', '<', 0); $join->on('transaction_journals.id', '=', 'source.transaction_journal_id')->where('source.amount', '<', 0);
} }
) )
->leftJoin( ->leftJoin(
'transactions as destination', 'transactions as destination',
static function (JoinClause $join) { static function (JoinClause $join): void {
$join->on('transaction_journals.id', '=', 'destination.transaction_journal_id')->where('destination.amount', '>', 0); $join->on('transaction_journals.id', '=', 'destination.transaction_journal_id')->where('destination.amount', '>', 0);
} }
) )
@ -80,11 +80,11 @@ class FixAccountTypes extends Command
; ;
// list all valid combinations, those are allowed. So we select those which are broken. // list all valid combinations, those are allowed. So we select those which are broken.
$query->where(static function (Builder $q) use ($expected) { $query->where(static function (Builder $q) use ($expected): void {
foreach ($expected as $transactionType => $info) { foreach ($expected as $transactionType => $info) {
foreach ($info as $source => $destinations) { foreach ($info as $source => $destinations) {
foreach ($destinations as $destination) { foreach ($destinations as $destination) {
$q->whereNot(static function (Builder $q1) use ($transactionType, $source, $destination) { $q->whereNot(static function (Builder $q1) use ($transactionType, $source, $destination): void {
$q1->where('transaction_types.type', $transactionType); $q1->where('transaction_types.type', $transactionType);
$q1->where('source_account_type.type', $source); $q1->where('source_account_type.type', $source);
$q1->where('destination_account_type.type', $destination); $q1->where('destination_account_type.type', $destination);

View File

@ -237,7 +237,7 @@ class ForceDecimalSize extends Command
->where('account_meta.name', 'currency_id') ->where('account_meta.name', 'currency_id')
->where('account_meta.data', json_encode((string)$currency->id)) ->where('account_meta.data', json_encode((string)$currency->id))
; ;
$query->where(static function (Builder $q) use ($fields, $currency, $operator, $cast, $regularExpression) { $query->where(static function (Builder $q) use ($fields, $currency, $operator, $cast, $regularExpression): void {
foreach ($fields as $field) { foreach ($fields as $field) {
$q->orWhere( $q->orWhere(
DB::raw(sprintf('CAST(accounts.%s AS %s)', $field, $cast)), // @phpstan-ignore-line DB::raw(sprintf('CAST(accounts.%s AS %s)', $field, $cast)), // @phpstan-ignore-line
@ -283,7 +283,7 @@ class ForceDecimalSize extends Command
/** @var Builder $query */ /** @var Builder $query */
$query = $class::where('transaction_currency_id', $currency->id)->where( $query = $class::where('transaction_currency_id', $currency->id)->where(
static function (Builder $q) use ($fields, $currency, $operator, $cast, $regularExpression) { static function (Builder $q) use ($fields, $currency, $operator, $cast, $regularExpression): void {
/** @var string $field */ /** @var string $field */
foreach ($fields as $field) { foreach ($fields as $field) {
$q->orWhere( $q->orWhere(
@ -334,7 +334,7 @@ class ForceDecimalSize extends Command
->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id') ->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id')
->where('account_meta.name', 'currency_id') ->where('account_meta.name', 'currency_id')
->where('account_meta.data', json_encode((string)$currency->id)) ->where('account_meta.data', json_encode((string)$currency->id))
->where(static function (Builder $q) use ($fields, $currency, $cast, $operator, $regularExpression) { ->where(static function (Builder $q) use ($fields, $currency, $cast, $operator, $regularExpression): void {
foreach ($fields as $field) { foreach ($fields as $field) {
$q->orWhere( $q->orWhere(
DB::raw(sprintf('CAST(piggy_bank_events.%s AS %s)', $field, $cast)), // @phpstan-ignore-line DB::raw(sprintf('CAST(piggy_bank_events.%s AS %s)', $field, $cast)), // @phpstan-ignore-line
@ -387,7 +387,7 @@ class ForceDecimalSize extends Command
->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id') ->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id')
->where('account_meta.name', 'currency_id') ->where('account_meta.name', 'currency_id')
->where('account_meta.data', json_encode((string)$currency->id)) ->where('account_meta.data', json_encode((string)$currency->id))
->where(static function (Builder $q) use ($fields, $currency, $operator, $cast, $regularExpression) { ->where(static function (Builder $q) use ($fields, $currency, $operator, $cast, $regularExpression): void {
foreach ($fields as $field) { foreach ($fields as $field) {
$q->orWhere( $q->orWhere(
DB::raw(sprintf('CAST(piggy_bank_repetitions.%s AS %s)', $field, $cast)), // @phpstan-ignore-line DB::raw(sprintf('CAST(piggy_bank_repetitions.%s AS %s)', $field, $cast)), // @phpstan-ignore-line
@ -438,7 +438,7 @@ class ForceDecimalSize extends Command
->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id') ->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id')
->where('account_meta.name', 'currency_id') ->where('account_meta.name', 'currency_id')
->where('account_meta.data', json_encode((string)$currency->id)) ->where('account_meta.data', json_encode((string)$currency->id))
->where(static function (Builder $q) use ($fields, $currency, $operator, $cast, $regularExpression) { ->where(static function (Builder $q) use ($fields, $currency, $operator, $cast, $regularExpression): void {
foreach ($fields as $field) { foreach ($fields as $field) {
$q->orWhere( $q->orWhere(
DB::raw(sprintf('CAST(piggy_banks.%s AS %s)', $field, $cast)), // @phpstan-ignore-line DB::raw(sprintf('CAST(piggy_banks.%s AS %s)', $field, $cast)), // @phpstan-ignore-line

View File

@ -157,7 +157,7 @@ class AccountCurrencies extends Command
$openingBalance->transaction_currency_id = $accountCurrency; $openingBalance->transaction_currency_id = $accountCurrency;
$openingBalance->save(); $openingBalance->save();
$openingBalance->transactions->each( $openingBalance->transactions->each(
static function (Transaction $transaction) use ($accountCurrency) { static function (Transaction $transaction) use ($accountCurrency): void {
$transaction->transaction_currency_id = $accountCurrency; $transaction->transaction_currency_id = $accountCurrency;
$transaction->save(); $transaction->save();
} }

View File

@ -154,7 +154,7 @@ class OtherCurrenciesCorrections extends Command
} }
// fix each transaction: // fix each transaction:
$journal->transactions->each( $journal->transactions->each(
static function (Transaction $transaction) use ($currency) { static function (Transaction $transaction) use ($currency): void {
if (null === $transaction->transaction_currency_id) { if (null === $transaction->transaction_currency_id) {
$transaction->transaction_currency_id = $currency->id; $transaction->transaction_currency_id = $currency->id;
$transaction->save(); $transaction->save();

View File

@ -48,7 +48,7 @@ class Kernel extends ConsoleKernel
protected function schedule(Schedule $schedule): void protected function schedule(Schedule $schedule): void
{ {
$schedule->call( $schedule->call(
static function () { static function (): void {
app('log')->error( app('log')->error(
'Firefly III no longer users the Laravel scheduler to do cron jobs! Please read the instructions at https://docs.firefly-iii.org/' 'Firefly III no longer users the Laravel scheduler to do cron jobs! Please read the instructions at https://docs.firefly-iii.org/'
); );

View File

@ -179,7 +179,7 @@ class Handler extends ExceptionHandler
* *
* @throws \Throwable * @throws \Throwable
*/ */
public function report(\Throwable $e) public function report(\Throwable $e): void
{ {
$doMailError = (bool)config('firefly.send_error_message'); $doMailError = (bool)config('firefly.send_error_message');
if ($this->shouldntReportLocal($e) || !$doMailError) { if ($this->shouldntReportLocal($e) || !$doMailError) {

View File

@ -35,7 +35,7 @@ class TransactionJournalObserver
app('log')->debug('Observe "deleting" of a transaction journal.'); app('log')->debug('Observe "deleting" of a transaction journal.');
// to make sure the listener doesn't get back to use and loop // to make sure the listener doesn't get back to use and loop
TransactionJournal::withoutEvents(static function () use ($transactionJournal) { TransactionJournal::withoutEvents(static function () use ($transactionJournal): void {
foreach ($transactionJournal->transactions()->get() as $transaction) { foreach ($transactionJournal->transactions()->get() as $transaction) {
$transaction->delete(); $transaction->delete();
} }

View File

@ -87,7 +87,7 @@ trait AccountCollection
if ($accounts->count() > 0) { if ($accounts->count() > 0) {
$accountIds = $accounts->pluck('id')->toArray(); $accountIds = $accounts->pluck('id')->toArray();
$this->query->where( $this->query->where(
static function (EloquentBuilder $query) use ($accountIds) { // @phpstan-ignore-line static function (EloquentBuilder $query) use ($accountIds): void { // @phpstan-ignore-line
$query->whereIn('source.account_id', $accountIds); $query->whereIn('source.account_id', $accountIds);
$query->orWhereIn('destination.account_id', $accountIds); $query->orWhereIn('destination.account_id', $accountIds);
} }
@ -106,7 +106,7 @@ trait AccountCollection
if ($accounts->count() > 0) { if ($accounts->count() > 0) {
$accountIds = $accounts->pluck('id')->toArray(); $accountIds = $accounts->pluck('id')->toArray();
$this->query->where( $this->query->where(
static function (EloquentBuilder $query) use ($accountIds) { // @phpstan-ignore-line static function (EloquentBuilder $query) use ($accountIds): void { // @phpstan-ignore-line
$query->whereIn('source.account_id', $accountIds); $query->whereIn('source.account_id', $accountIds);
$query->whereIn('destination.account_id', $accountIds); $query->whereIn('destination.account_id', $accountIds);
} }
@ -140,7 +140,7 @@ trait AccountCollection
if ($accounts->count() > 0) { if ($accounts->count() > 0) {
$accountIds = $accounts->pluck('id')->toArray(); $accountIds = $accounts->pluck('id')->toArray();
$this->query->where( $this->query->where(
static function (EloquentBuilder $query) use ($accountIds) { // @phpstan-ignore-line static function (EloquentBuilder $query) use ($accountIds): void { // @phpstan-ignore-line
$query->whereNotIn('source.account_id', $accountIds); $query->whereNotIn('source.account_id', $accountIds);
$query->whereNotIn('destination.account_id', $accountIds); $query->whereNotIn('destination.account_id', $accountIds);
} }
@ -174,18 +174,18 @@ trait AccountCollection
if ($accounts->count() > 0) { if ($accounts->count() > 0) {
$accountIds = $accounts->pluck('id')->toArray(); $accountIds = $accounts->pluck('id')->toArray();
$this->query->where( $this->query->where(
static function (EloquentBuilder $q1) use ($accountIds) { // @phpstan-ignore-line static function (EloquentBuilder $q1) use ($accountIds): void { // @phpstan-ignore-line
// sourceAccount is in the set, and destination is NOT. // sourceAccount is in the set, and destination is NOT.
$q1->where( $q1->where(
static function (EloquentBuilder $q2) use ($accountIds) { static function (EloquentBuilder $q2) use ($accountIds): void {
$q2->whereIn('source.account_id', $accountIds); $q2->whereIn('source.account_id', $accountIds);
$q2->whereNotIn('destination.account_id', $accountIds); $q2->whereNotIn('destination.account_id', $accountIds);
} }
); );
// destination is in the set, and source is NOT // destination is in the set, and source is NOT
$q1->orWhere( $q1->orWhere(
static function (EloquentBuilder $q3) use ($accountIds) { static function (EloquentBuilder $q3) use ($accountIds): void {
$q3->whereNotIn('source.account_id', $accountIds); $q3->whereNotIn('source.account_id', $accountIds);
$q3->whereIn('destination.account_id', $accountIds); $q3->whereIn('destination.account_id', $accountIds);
} }

View File

@ -38,7 +38,7 @@ trait AmountCollection
public function amountIs(string $amount): GroupCollectorInterface public function amountIs(string $amount): GroupCollectorInterface
{ {
$this->query->where( $this->query->where(
static function (EloquentBuilder $q) use ($amount) { // @phpstan-ignore-line static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line
$q->where('source.amount', app('steam')->negative($amount)); $q->where('source.amount', app('steam')->negative($amount));
} }
); );
@ -49,7 +49,7 @@ trait AmountCollection
public function amountIsNot(string $amount): GroupCollectorInterface public function amountIsNot(string $amount): GroupCollectorInterface
{ {
$this->query->where( $this->query->where(
static function (EloquentBuilder $q) use ($amount) { // @phpstan-ignore-line static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line
$q->where('source.amount', '!=', app('steam')->negative($amount)); $q->where('source.amount', '!=', app('steam')->negative($amount));
} }
); );
@ -63,7 +63,7 @@ trait AmountCollection
public function amountLess(string $amount): GroupCollectorInterface public function amountLess(string $amount): GroupCollectorInterface
{ {
$this->query->where( $this->query->where(
static function (EloquentBuilder $q) use ($amount) { // @phpstan-ignore-line static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line
$q->where('destination.amount', '<=', app('steam')->positive($amount)); $q->where('destination.amount', '<=', app('steam')->positive($amount));
} }
); );
@ -77,7 +77,7 @@ trait AmountCollection
public function amountMore(string $amount): GroupCollectorInterface public function amountMore(string $amount): GroupCollectorInterface
{ {
$this->query->where( $this->query->where(
static function (EloquentBuilder $q) use ($amount) { // @phpstan-ignore-line static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line
$q->where('destination.amount', '>=', app('steam')->positive($amount)); $q->where('destination.amount', '>=', app('steam')->positive($amount));
} }
); );
@ -91,7 +91,7 @@ trait AmountCollection
public function foreignAmountIs(string $amount): GroupCollectorInterface public function foreignAmountIs(string $amount): GroupCollectorInterface
{ {
$this->query->where( $this->query->where(
static function (EloquentBuilder $q) use ($amount) { // @phpstan-ignore-line static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line
$q->whereNotNull('source.foreign_amount'); $q->whereNotNull('source.foreign_amount');
$q->where('source.foreign_amount', app('steam')->negative($amount)); $q->where('source.foreign_amount', app('steam')->negative($amount));
} }
@ -106,7 +106,7 @@ trait AmountCollection
public function foreignAmountIsNot(string $amount): GroupCollectorInterface public function foreignAmountIsNot(string $amount): GroupCollectorInterface
{ {
$this->query->where( $this->query->where(
static function (EloquentBuilder $q) use ($amount) { // @phpstan-ignore-line static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line
$q->whereNull('source.foreign_amount'); $q->whereNull('source.foreign_amount');
$q->orWhere('source.foreign_amount', '!=', app('steam')->negative($amount)); $q->orWhere('source.foreign_amount', '!=', app('steam')->negative($amount));
} }
@ -121,7 +121,7 @@ trait AmountCollection
public function foreignAmountLess(string $amount): GroupCollectorInterface public function foreignAmountLess(string $amount): GroupCollectorInterface
{ {
$this->query->where( $this->query->where(
static function (EloquentBuilder $q) use ($amount) { // @phpstan-ignore-line static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line
$q->whereNotNull('destination.foreign_amount'); $q->whereNotNull('destination.foreign_amount');
$q->where('destination.foreign_amount', '<=', app('steam')->positive($amount)); $q->where('destination.foreign_amount', '<=', app('steam')->positive($amount));
} }
@ -136,7 +136,7 @@ trait AmountCollection
public function foreignAmountMore(string $amount): GroupCollectorInterface public function foreignAmountMore(string $amount): GroupCollectorInterface
{ {
$this->query->where( $this->query->where(
static function (EloquentBuilder $q) use ($amount) { // @phpstan-ignore-line static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line
$q->whereNotNull('destination.foreign_amount'); $q->whereNotNull('destination.foreign_amount');
$q->where('destination.foreign_amount', '>=', app('steam')->positive($amount)); $q->where('destination.foreign_amount', '>=', app('steam')->positive($amount));
} }

View File

@ -495,10 +495,10 @@ trait AttachmentCollection
app('log')->debug('Add filter on no attachments.'); app('log')->debug('Add filter on no attachments.');
$this->joinAttachmentTables(); $this->joinAttachmentTables();
$this->query->where(static function (Builder $q1) { // @phpstan-ignore-line $this->query->where(static function (Builder $q1): void { // @phpstan-ignore-line
$q1 $q1
->whereNull('attachments.attachable_id') ->whereNull('attachments.attachable_id')
->orWhere(static function (Builder $q2) { ->orWhere(static function (Builder $q2): void {
$q2 $q2
->whereNotNull('attachments.attachable_id') ->whereNotNull('attachments.attachable_id')
->whereNotNull('attachments.deleted_at') ->whereNotNull('attachments.deleted_at')
@ -522,7 +522,7 @@ trait AttachmentCollection
$this->hasJoinedAttTables = true; $this->hasJoinedAttTables = true;
$this->query->leftJoin('attachments', 'attachments.attachable_id', '=', 'transaction_journals.id') $this->query->leftJoin('attachments', 'attachments.attachable_id', '=', 'transaction_journals.id')
->where( ->where(
static function (EloquentBuilder $q1) { // @phpstan-ignore-line static function (EloquentBuilder $q1): void { // @phpstan-ignore-line
$q1->where('attachments.attachable_type', TransactionJournal::class); $q1->where('attachments.attachable_type', TransactionJournal::class);
$q1->where('attachments.uploaded', true); $q1->where('attachments.uploaded', true);
$q1->whereNull('attachments.deleted_at'); $q1->whereNull('attachments.deleted_at');

View File

@ -42,7 +42,7 @@ trait MetaCollection
public function excludeBills(Collection $bills): GroupCollectorInterface public function excludeBills(Collection $bills): GroupCollectorInterface
{ {
$this->withBillInformation(); $this->withBillInformation();
$this->query->where(static function (EloquentBuilder $q1) use ($bills) { // @phpstan-ignore-line $this->query->where(static function (EloquentBuilder $q1) use ($bills): void { // @phpstan-ignore-line
$q1->whereNotIn('transaction_journals.bill_id', $bills->pluck('id')->toArray()); $q1->whereNotIn('transaction_journals.bill_id', $bills->pluck('id')->toArray());
$q1->orWhereNull('transaction_journals.bill_id'); $q1->orWhereNull('transaction_journals.bill_id');
}); });
@ -74,7 +74,7 @@ trait MetaCollection
{ {
$this->withBudgetInformation(); $this->withBudgetInformation();
$this->query->where(static function (EloquentBuilder $q2) use ($budget) { // @phpstan-ignore-line $this->query->where(static function (EloquentBuilder $q2) use ($budget): void { // @phpstan-ignore-line
$q2->where('budgets.id', '!=', $budget->id); $q2->where('budgets.id', '!=', $budget->id);
$q2->orWhereNull('budgets.id'); $q2->orWhereNull('budgets.id');
}); });
@ -105,7 +105,7 @@ trait MetaCollection
{ {
if ($budgets->count() > 0) { if ($budgets->count() > 0) {
$this->withBudgetInformation(); $this->withBudgetInformation();
$this->query->where(static function (EloquentBuilder $q1) use ($budgets) { // @phpstan-ignore-line $this->query->where(static function (EloquentBuilder $q1) use ($budgets): void { // @phpstan-ignore-line
$q1->whereNotIn('budgets.id', $budgets->pluck('id')->toArray()); $q1->whereNotIn('budgets.id', $budgets->pluck('id')->toArray());
$q1->orWhereNull('budgets.id'); $q1->orWhereNull('budgets.id');
}); });
@ -118,7 +118,7 @@ trait MetaCollection
{ {
if ($categories->count() > 0) { if ($categories->count() > 0) {
$this->withCategoryInformation(); $this->withCategoryInformation();
$this->query->where(static function (EloquentBuilder $q1) use ($categories) { // @phpstan-ignore-line $this->query->where(static function (EloquentBuilder $q1) use ($categories): void { // @phpstan-ignore-line
$q1->whereNotIn('categories.id', $categories->pluck('id')->toArray()); $q1->whereNotIn('categories.id', $categories->pluck('id')->toArray());
$q1->orWhereNull('categories.id'); $q1->orWhereNull('categories.id');
}); });
@ -153,7 +153,7 @@ trait MetaCollection
{ {
$this->withCategoryInformation(); $this->withCategoryInformation();
$this->query->where(static function (EloquentBuilder $q2) use ($category) { // @phpstan-ignore-line $this->query->where(static function (EloquentBuilder $q2) use ($category): void { // @phpstan-ignore-line
$q2->where('categories.id', '!=', $category->id); $q2->where('categories.id', '!=', $category->id);
$q2->orWhereNull('categories.id'); $q2->orWhereNull('categories.id');
}); });
@ -456,7 +456,7 @@ trait MetaCollection
// join bill table // join bill table
$this->query->leftJoin( $this->query->leftJoin(
'notes', 'notes',
static function (JoinClause $join) { static function (JoinClause $join): void {
$join->on('notes.noteable_id', '=', 'transaction_journals.id'); $join->on('notes.noteable_id', '=', 'transaction_journals.id');
$join->where('notes.noteable_type', '=', 'FireflyIII\Models\TransactionJournal'); $join->where('notes.noteable_type', '=', 'FireflyIII\Models\TransactionJournal');
$join->whereNull('notes.deleted_at'); $join->whereNull('notes.deleted_at');
@ -473,7 +473,7 @@ trait MetaCollection
public function notesDoNotContain(string $value): GroupCollectorInterface public function notesDoNotContain(string $value): GroupCollectorInterface
{ {
$this->withNotes(); $this->withNotes();
$this->query->where(static function (Builder $q) use ($value) { // @phpstan-ignore-line $this->query->where(static function (Builder $q) use ($value): void { // @phpstan-ignore-line
$q->whereNull('notes.text'); $q->whereNull('notes.text');
$q->orWhere('notes.text', 'NOT LIKE', sprintf('%%%s%%', $value)); $q->orWhere('notes.text', 'NOT LIKE', sprintf('%%%s%%', $value));
}); });
@ -484,7 +484,7 @@ trait MetaCollection
public function notesDontEndWith(string $value): GroupCollectorInterface public function notesDontEndWith(string $value): GroupCollectorInterface
{ {
$this->withNotes(); $this->withNotes();
$this->query->where(static function (Builder $q) use ($value) { // @phpstan-ignore-line $this->query->where(static function (Builder $q) use ($value): void { // @phpstan-ignore-line
$q->whereNull('notes.text'); $q->whereNull('notes.text');
$q->orWhere('notes.text', 'NOT LIKE', sprintf('%%%s', $value)); $q->orWhere('notes.text', 'NOT LIKE', sprintf('%%%s', $value));
}); });
@ -495,7 +495,7 @@ trait MetaCollection
public function notesDontStartWith(string $value): GroupCollectorInterface public function notesDontStartWith(string $value): GroupCollectorInterface
{ {
$this->withNotes(); $this->withNotes();
$this->query->where(static function (Builder $q) use ($value) { // @phpstan-ignore-line $this->query->where(static function (Builder $q) use ($value): void { // @phpstan-ignore-line
$q->whereNull('notes.text'); $q->whereNull('notes.text');
$q->orWhere('notes.text', 'NOT LIKE', sprintf('%s%%', $value)); $q->orWhere('notes.text', 'NOT LIKE', sprintf('%s%%', $value));
}); });
@ -522,7 +522,7 @@ trait MetaCollection
public function notesExactlyNot(string $value): GroupCollectorInterface public function notesExactlyNot(string $value): GroupCollectorInterface
{ {
$this->withNotes(); $this->withNotes();
$this->query->where(static function (Builder $q) use ($value) { // @phpstan-ignore-line $this->query->where(static function (Builder $q) use ($value): void { // @phpstan-ignore-line
$q->whereNull('notes.text'); $q->whereNull('notes.text');
$q->orWhere('notes.text', '!=', sprintf('%s', $value)); $q->orWhere('notes.text', '!=', sprintf('%s', $value));
}); });
@ -801,13 +801,13 @@ trait MetaCollection
{ {
$this->joinMetaDataTables(); $this->joinMetaDataTables();
// TODO not sure if this will work properly. // TODO not sure if this will work properly.
$this->query->where(static function (Builder $q1) { // @phpstan-ignore-line $this->query->where(static function (Builder $q1): void { // @phpstan-ignore-line
$q1->where(static function (Builder $q2) { $q1->where(static function (Builder $q2): void {
$q2->where('journal_meta.name', '=', 'external_id'); $q2->where('journal_meta.name', '=', 'external_id');
$q2->whereNull('journal_meta.data'); $q2->whereNull('journal_meta.data');
})->orWhere(static function (Builder $q3) { })->orWhere(static function (Builder $q3): void {
$q3->where('journal_meta.name', '!=', 'external_id'); $q3->where('journal_meta.name', '!=', 'external_id');
})->orWhere(static function (Builder $q4) { })->orWhere(static function (Builder $q4): void {
$q4->whereNull('journal_meta.name'); $q4->whereNull('journal_meta.name');
}); });
}); });
@ -819,13 +819,13 @@ trait MetaCollection
{ {
$this->joinMetaDataTables(); $this->joinMetaDataTables();
// TODO not sure if this will work properly. // TODO not sure if this will work properly.
$this->query->where(static function (Builder $q1) { // @phpstan-ignore-line $this->query->where(static function (Builder $q1): void { // @phpstan-ignore-line
$q1->where(static function (Builder $q2) { $q1->where(static function (Builder $q2): void {
$q2->where('journal_meta.name', '=', 'external_url'); $q2->where('journal_meta.name', '=', 'external_url');
$q2->whereNull('journal_meta.data'); $q2->whereNull('journal_meta.data');
})->orWhere(static function (Builder $q3) { })->orWhere(static function (Builder $q3): void {
$q3->where('journal_meta.name', '!=', 'external_url'); $q3->where('journal_meta.name', '!=', 'external_url');
})->orWhere(static function (Builder $q4) { })->orWhere(static function (Builder $q4): void {
$q4->whereNull('journal_meta.name'); $q4->whereNull('journal_meta.name');
}); });
}); });
@ -836,7 +836,7 @@ trait MetaCollection
public function withoutNotes(): GroupCollectorInterface public function withoutNotes(): GroupCollectorInterface
{ {
$this->withNotes(); $this->withNotes();
$this->query->where(static function (Builder $q) { // @phpstan-ignore-line $this->query->where(static function (Builder $q): void { // @phpstan-ignore-line
$q->whereNull('notes.text'); $q->whereNull('notes.text');
$q->orWhere('notes.text', ''); $q->orWhere('notes.text', '');
}); });

View File

@ -145,9 +145,9 @@ class GroupCollector implements GroupCollectorInterface
public function descriptionDoesNotEnd(array $array): GroupCollectorInterface public function descriptionDoesNotEnd(array $array): GroupCollectorInterface
{ {
$this->query->where( $this->query->where(
static function (EloquentBuilder $q) use ($array) { // @phpstan-ignore-line static function (EloquentBuilder $q) use ($array): void { // @phpstan-ignore-line
$q->where( $q->where(
static function (EloquentBuilder $q1) use ($array) { static function (EloquentBuilder $q1) use ($array): void {
foreach ($array as $word) { foreach ($array as $word) {
$keyword = sprintf('%%%s', $word); $keyword = sprintf('%%%s', $word);
$q1->where('transaction_journals.description', 'NOT LIKE', $keyword); $q1->where('transaction_journals.description', 'NOT LIKE', $keyword);
@ -155,7 +155,7 @@ class GroupCollector implements GroupCollectorInterface
} }
); );
$q->where( $q->where(
static function (EloquentBuilder $q2) use ($array) { static function (EloquentBuilder $q2) use ($array): void {
foreach ($array as $word) { foreach ($array as $word) {
$keyword = sprintf('%%%s', $word); $keyword = sprintf('%%%s', $word);
$q2->where('transaction_groups.title', 'NOT LIKE', $keyword); $q2->where('transaction_groups.title', 'NOT LIKE', $keyword);
@ -172,9 +172,9 @@ class GroupCollector implements GroupCollectorInterface
public function descriptionDoesNotStart(array $array): GroupCollectorInterface public function descriptionDoesNotStart(array $array): GroupCollectorInterface
{ {
$this->query->where( $this->query->where(
static function (EloquentBuilder $q) use ($array) { // @phpstan-ignore-line static function (EloquentBuilder $q) use ($array): void { // @phpstan-ignore-line
$q->where( $q->where(
static function (EloquentBuilder $q1) use ($array) { static function (EloquentBuilder $q1) use ($array): void {
foreach ($array as $word) { foreach ($array as $word) {
$keyword = sprintf('%s%%', $word); $keyword = sprintf('%s%%', $word);
$q1->where('transaction_journals.description', 'NOT LIKE', $keyword); $q1->where('transaction_journals.description', 'NOT LIKE', $keyword);
@ -182,7 +182,7 @@ class GroupCollector implements GroupCollectorInterface
} }
); );
$q->where( $q->where(
static function (EloquentBuilder $q2) use ($array) { static function (EloquentBuilder $q2) use ($array): void {
foreach ($array as $word) { foreach ($array as $word) {
$keyword = sprintf('%s%%', $word); $keyword = sprintf('%s%%', $word);
$q2->where('transaction_groups.title', 'NOT LIKE', $keyword); $q2->where('transaction_groups.title', 'NOT LIKE', $keyword);
@ -199,9 +199,9 @@ class GroupCollector implements GroupCollectorInterface
public function descriptionEnds(array $array): GroupCollectorInterface public function descriptionEnds(array $array): GroupCollectorInterface
{ {
$this->query->where( $this->query->where(
static function (EloquentBuilder $q) use ($array) { // @phpstan-ignore-line static function (EloquentBuilder $q) use ($array): void { // @phpstan-ignore-line
$q->where( $q->where(
static function (EloquentBuilder $q1) use ($array) { static function (EloquentBuilder $q1) use ($array): void {
foreach ($array as $word) { foreach ($array as $word) {
$keyword = sprintf('%%%s', $word); $keyword = sprintf('%%%s', $word);
$q1->where('transaction_journals.description', 'LIKE', $keyword); $q1->where('transaction_journals.description', 'LIKE', $keyword);
@ -209,7 +209,7 @@ class GroupCollector implements GroupCollectorInterface
} }
); );
$q->orWhere( $q->orWhere(
static function (EloquentBuilder $q2) use ($array) { static function (EloquentBuilder $q2) use ($array): void {
foreach ($array as $word) { foreach ($array as $word) {
$keyword = sprintf('%%%s', $word); $keyword = sprintf('%%%s', $word);
$q2->where('transaction_groups.title', 'LIKE', $keyword); $q2->where('transaction_groups.title', 'LIKE', $keyword);
@ -225,7 +225,7 @@ class GroupCollector implements GroupCollectorInterface
public function descriptionIs(string $value): GroupCollectorInterface public function descriptionIs(string $value): GroupCollectorInterface
{ {
$this->query->where( $this->query->where(
static function (EloquentBuilder $q) use ($value) { // @phpstan-ignore-line static function (EloquentBuilder $q) use ($value): void { // @phpstan-ignore-line
$q->where('transaction_journals.description', '=', $value); $q->where('transaction_journals.description', '=', $value);
$q->orWhere('transaction_groups.title', '=', $value); $q->orWhere('transaction_groups.title', '=', $value);
} }
@ -237,10 +237,10 @@ class GroupCollector implements GroupCollectorInterface
public function descriptionIsNot(string $value): GroupCollectorInterface public function descriptionIsNot(string $value): GroupCollectorInterface
{ {
$this->query->where( $this->query->where(
static function (EloquentBuilder $q) use ($value) { // @phpstan-ignore-line static function (EloquentBuilder $q) use ($value): void { // @phpstan-ignore-line
$q->where('transaction_journals.description', '!=', $value); $q->where('transaction_journals.description', '!=', $value);
$q->where( $q->where(
static function (EloquentBuilder $q2) use ($value) { static function (EloquentBuilder $q2) use ($value): void {
$q2->where('transaction_groups.title', '!=', $value); $q2->where('transaction_groups.title', '!=', $value);
$q2->orWhereNull('transaction_groups.title'); $q2->orWhereNull('transaction_groups.title');
} }
@ -254,9 +254,9 @@ class GroupCollector implements GroupCollectorInterface
public function descriptionStarts(array $array): GroupCollectorInterface public function descriptionStarts(array $array): GroupCollectorInterface
{ {
$this->query->where( $this->query->where(
static function (EloquentBuilder $q) use ($array) { // @phpstan-ignore-line static function (EloquentBuilder $q) use ($array): void { // @phpstan-ignore-line
$q->where( $q->where(
static function (EloquentBuilder $q1) use ($array) { static function (EloquentBuilder $q1) use ($array): void {
foreach ($array as $word) { foreach ($array as $word) {
$keyword = sprintf('%s%%', $word); $keyword = sprintf('%s%%', $word);
$q1->where('transaction_journals.description', 'LIKE', $keyword); $q1->where('transaction_journals.description', 'LIKE', $keyword);
@ -264,7 +264,7 @@ class GroupCollector implements GroupCollectorInterface
} }
); );
$q->orWhere( $q->orWhere(
static function (EloquentBuilder $q2) use ($array) { static function (EloquentBuilder $q2) use ($array): void {
foreach ($array as $word) { foreach ($array as $word) {
$keyword = sprintf('%s%%', $word); $keyword = sprintf('%s%%', $word);
$q2->where('transaction_groups.title', 'LIKE', $keyword); $q2->where('transaction_groups.title', 'LIKE', $keyword);
@ -310,10 +310,10 @@ class GroupCollector implements GroupCollectorInterface
public function excludeCurrency(TransactionCurrency $currency): GroupCollectorInterface public function excludeCurrency(TransactionCurrency $currency): GroupCollectorInterface
{ {
$this->query->where( $this->query->where(
static function (EloquentBuilder $q) use ($currency) { // @phpstan-ignore-line static function (EloquentBuilder $q) use ($currency): void { // @phpstan-ignore-line
$q->where('source.transaction_currency_id', '!=', $currency->id); $q->where('source.transaction_currency_id', '!=', $currency->id);
$q->where( $q->where(
static function (EloquentBuilder $q2) use ($currency) { static function (EloquentBuilder $q2) use ($currency): void {
$q2->where('source.foreign_currency_id', '!=', $currency->id); $q2->where('source.foreign_currency_id', '!=', $currency->id);
$q2->orWhereNull('source.foreign_currency_id'); $q2->orWhereNull('source.foreign_currency_id');
} }
@ -326,7 +326,7 @@ class GroupCollector implements GroupCollectorInterface
public function excludeForeignCurrency(TransactionCurrency $currency): GroupCollectorInterface public function excludeForeignCurrency(TransactionCurrency $currency): GroupCollectorInterface
{ {
$this->query->where(static function (EloquentBuilder $q2) use ($currency) { // @phpstan-ignore-line $this->query->where(static function (EloquentBuilder $q2) use ($currency): void { // @phpstan-ignore-line
$q2->where('source.foreign_currency_id', '!=', $currency->id); $q2->where('source.foreign_currency_id', '!=', $currency->id);
$q2->orWhereNull('source.foreign_currency_id'); $q2->orWhereNull('source.foreign_currency_id');
}); });
@ -368,9 +368,9 @@ class GroupCollector implements GroupCollectorInterface
return $this; return $this;
} }
$this->query->where( $this->query->where(
static function (EloquentBuilder $q) use ($array) { // @phpstan-ignore-line static function (EloquentBuilder $q) use ($array): void { // @phpstan-ignore-line
$q->where( $q->where(
static function (EloquentBuilder $q1) use ($array) { static function (EloquentBuilder $q1) use ($array): void {
foreach ($array as $word) { foreach ($array as $word) {
$keyword = sprintf('%%%s%%', $word); $keyword = sprintf('%%%s%%', $word);
$q1->where('transaction_journals.description', 'NOT LIKE', $keyword); $q1->where('transaction_journals.description', 'NOT LIKE', $keyword);
@ -378,7 +378,7 @@ class GroupCollector implements GroupCollectorInterface
} }
); );
$q->where( $q->where(
static function (EloquentBuilder $q2) use ($array) { static function (EloquentBuilder $q2) use ($array): void {
foreach ($array as $word) { foreach ($array as $word) {
$keyword = sprintf('%%%s%%', $word); $keyword = sprintf('%%%s%%', $word);
$q2->where('transaction_groups.title', 'NOT LIKE', $keyword); $q2->where('transaction_groups.title', 'NOT LIKE', $keyword);
@ -519,7 +519,7 @@ class GroupCollector implements GroupCollectorInterface
public function setCurrency(TransactionCurrency $currency): GroupCollectorInterface public function setCurrency(TransactionCurrency $currency): GroupCollectorInterface
{ {
$this->query->where( $this->query->where(
static function (EloquentBuilder $q) use ($currency) { // @phpstan-ignore-line static function (EloquentBuilder $q) use ($currency): void { // @phpstan-ignore-line
$q->where('source.transaction_currency_id', $currency->id); $q->where('source.transaction_currency_id', $currency->id);
$q->orWhere('source.foreign_currency_id', $currency->id); $q->orWhere('source.foreign_currency_id', $currency->id);
} }
@ -588,9 +588,9 @@ class GroupCollector implements GroupCollectorInterface
return $this; return $this;
} }
$this->query->where( $this->query->where(
static function (EloquentBuilder $q) use ($array) { // @phpstan-ignore-line static function (EloquentBuilder $q) use ($array): void { // @phpstan-ignore-line
$q->where( $q->where(
static function (EloquentBuilder $q1) use ($array) { static function (EloquentBuilder $q1) use ($array): void {
foreach ($array as $word) { foreach ($array as $word) {
$keyword = sprintf('%%%s%%', $word); $keyword = sprintf('%%%s%%', $word);
$q1->where('transaction_journals.description', 'LIKE', $keyword); $q1->where('transaction_journals.description', 'LIKE', $keyword);
@ -598,7 +598,7 @@ class GroupCollector implements GroupCollectorInterface
} }
); );
$q->orWhere( $q->orWhere(
static function (EloquentBuilder $q2) use ($array) { static function (EloquentBuilder $q2) use ($array): void {
foreach ($array as $word) { foreach ($array as $word) {
$keyword = sprintf('%%%s%%', $word); $keyword = sprintf('%%%s%%', $word);
$q2->where('transaction_groups.title', 'LIKE', $keyword); $q2->where('transaction_groups.title', 'LIKE', $keyword);
@ -972,7 +972,7 @@ class GroupCollector implements GroupCollectorInterface
// join source transaction. // join source transaction.
->leftJoin( ->leftJoin(
'transactions as source', 'transactions as source',
static function (JoinClause $join) { static function (JoinClause $join): void {
$join->on('source.transaction_journal_id', '=', 'transaction_journals.id') $join->on('source.transaction_journal_id', '=', 'transaction_journals.id')
->where('source.amount', '<', 0) ->where('source.amount', '<', 0)
; ;
@ -981,7 +981,7 @@ class GroupCollector implements GroupCollectorInterface
// join destination transaction // join destination transaction
->leftJoin( ->leftJoin(
'transactions as destination', 'transactions as destination',
static function (JoinClause $join) { static function (JoinClause $join): void {
$join->on('destination.transaction_journal_id', '=', 'transaction_journals.id') $join->on('destination.transaction_journal_id', '=', 'transaction_journals.id')
->where('destination.amount', '>', 0) ->where('destination.amount', '>', 0)
; ;
@ -1016,7 +1016,7 @@ class GroupCollector implements GroupCollectorInterface
// join source transaction. // join source transaction.
->leftJoin( ->leftJoin(
'transactions as source', 'transactions as source',
static function (JoinClause $join) { static function (JoinClause $join): void {
$join->on('source.transaction_journal_id', '=', 'transaction_journals.id') $join->on('source.transaction_journal_id', '=', 'transaction_journals.id')
->where('source.amount', '<', 0) ->where('source.amount', '<', 0)
; ;
@ -1025,7 +1025,7 @@ class GroupCollector implements GroupCollectorInterface
// join destination transaction // join destination transaction
->leftJoin( ->leftJoin(
'transactions as destination', 'transactions as destination',
static function (JoinClause $join) { static function (JoinClause $join): void {
$join->on('destination.transaction_journal_id', '=', 'transaction_journals.id') $join->on('destination.transaction_journal_id', '=', 'transaction_journals.id')
->where('destination.amount', '>', 0) ->where('destination.amount', '>', 0)
; ;

View File

@ -99,7 +99,7 @@ class IndexController extends Controller
$activities = app('steam')->getLastActivities($ids); $activities = app('steam')->getLastActivities($ids);
$accounts->each( $accounts->each(
function (Account $account) use ($activities, $startBalances, $endBalances) { function (Account $account) use ($activities, $startBalances, $endBalances): void {
$account->lastActivityDate = $this->isInArrayDate($activities, $account->id); $account->lastActivityDate = $this->isInArrayDate($activities, $account->id);
$account->startBalance = $this->isInArray($startBalances, $account->id); $account->startBalance = $this->isInArray($startBalances, $account->id);
$account->endBalance = $this->isInArray($endBalances, $account->id); $account->endBalance = $this->isInArray($endBalances, $account->id);
@ -162,7 +162,7 @@ class IndexController extends Controller
$activities = app('steam')->getLastActivities($ids); $activities = app('steam')->getLastActivities($ids);
$accounts->each( $accounts->each(
function (Account $account) use ($activities, $startBalances, $endBalances) { function (Account $account) use ($activities, $startBalances, $endBalances): void {
$interest = (string)$this->repository->getMetaValue($account, 'interest'); $interest = (string)$this->repository->getMetaValue($account, 'interest');
$interest = '' === $interest ? '0' : $interest; $interest = '' === $interest ? '0' : $interest;

View File

@ -171,7 +171,7 @@ class LinkController extends Controller
Log::channel('audit')->info('User on index of link types in admin.'); Log::channel('audit')->info('User on index of link types in admin.');
$linkTypes->each( $linkTypes->each(
function (LinkType $linkType) { function (LinkType $linkType): void {
$linkType->journalCount = $this->repository->countJournals($linkType); $linkType->journalCount = $this->repository->countJournals($linkType);
} }
); );

View File

@ -173,7 +173,7 @@ class UserController extends Controller
// add meta stuff. // add meta stuff.
$users->each( $users->each(
function (User $user) { function (User $user): void {
$user->isAdmin = $this->repository->hasRole($user, 'owner'); $user->isAdmin = $this->repository->hasRole($user, 'owner');
$user->has2FA = null !== $user->mfa_secret; $user->has2FA = null !== $user->mfa_secret;
} }

View File

@ -95,7 +95,7 @@ class ResetPasswordController extends Controller
// database. Otherwise we will parse the error and return the response. // database. Otherwise we will parse the error and return the response.
$response = $this->broker()->reset( $response = $this->broker()->reset(
$this->credentials($request), $this->credentials($request),
function ($user, $password) { function ($user, $password): void {
$this->resetPassword($user, $password); $this->resetPassword($user, $password);
} }
); );

View File

@ -77,7 +77,7 @@ class IndexController extends Controller
$collection = $collection->slice(($page - 1) * $pageSize, $pageSize); $collection = $collection->slice(($page - 1) * $pageSize, $pageSize);
$collection->each( $collection->each(
function (Category $category) { function (Category $category): void {
$category->lastActivity = $this->repository->lastUseDate($category, new Collection()); $category->lastActivity = $this->repository->lastUseDate($category, new Collection());
} }
); );

View File

@ -74,7 +74,7 @@ class BudgetFormStoreRequest extends FormRequest
public function withValidator(Validator $validator): void public function withValidator(Validator $validator): void
{ {
$validator->after( $validator->after(
function (Validator $validator) { function (Validator $validator): void {
// validate all account info // validate all account info
$this->validateAutoBudgetAmount($validator); $this->validateAutoBudgetAmount($validator);
} }

View File

@ -84,7 +84,7 @@ class BudgetFormUpdateRequest extends FormRequest
public function withValidator(Validator $validator): void public function withValidator(Validator $validator): void
{ {
$validator->after( $validator->after(
function (Validator $validator) { function (Validator $validator): void {
// validate all account info // validate all account info
$this->validateAutoBudgetAmount($validator); $this->validateAutoBudgetAmount($validator);
} }

View File

@ -237,7 +237,7 @@ class RecurrenceFormRequest extends FormRequest
public function withValidator(Validator $validator): void public function withValidator(Validator $validator): void
{ {
$validator->after( $validator->after(
function (Validator $validator) { function (Validator $validator): void {
// validate all account info // validate all account info
$this->validateAccountInformation($validator); $this->validateAccountInformation($validator);
} }

View File

@ -141,7 +141,8 @@ class ReportFormRequest extends FormRequest
// validate as date // validate as date
// if regex for YYYY-MM-DD: // if regex for YYYY-MM-DD:
$pattern = '/^(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][\d]|3[01])$/'; $pattern = '/^(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][\d]|3[01])$/';
if (false !== preg_match($pattern, $string)) { $result = preg_match($pattern, $string);
if (false !== $result && 0 !== $result) {
try { try {
$date = new Carbon($parts[1]); $date = new Carbon($parts[1]);
} catch (\Exception $e) { // intentional generic exception } catch (\Exception $e) { // intentional generic exception
@ -178,7 +179,8 @@ class ReportFormRequest extends FormRequest
// validate as date // validate as date
// if regex for YYYY-MM-DD: // if regex for YYYY-MM-DD:
$pattern = '/^(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][\d]|3[01])$/'; $pattern = '/^(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][\d]|3[01])$/';
if (false !== preg_match($pattern, $string)) { $result = preg_match($pattern, $string);
if (false !== $result && 0 !== $result) {
try { try {
$date = new Carbon($parts[0]); $date = new Carbon($parts[0]);
} catch (\Exception $e) { // intentional generic exception } catch (\Exception $e) { // intentional generic exception

View File

@ -73,7 +73,7 @@ class MailError extends Job implements ShouldQueue
\Mail::send( \Mail::send(
['emails.error-html', 'emails.error-text'], ['emails.error-html', 'emails.error-text'],
$args, $args,
static function (Message $message) use ($email) { static function (Message $message) use ($email): void {
if ('mail@example.com' !== $email) { if ('mail@example.com' !== $email) {
$message->to($email, $email)->subject((string)trans('email.error_subject')); $message->to($email, $email)->subject((string)trans('email.error_subject'));
} }

View File

@ -88,13 +88,13 @@ class PiggyBankRepetition extends Model
public function scopeRelevantOnDate(EloquentBuilder $query, Carbon $date) public function scopeRelevantOnDate(EloquentBuilder $query, Carbon $date)
{ {
return $query->where( return $query->where(
static function (EloquentBuilder $q) use ($date) { static function (EloquentBuilder $q) use ($date): void {
$q->where('startdate', '<=', $date->format('Y-m-d 00:00:00')); $q->where('startdate', '<=', $date->format('Y-m-d 00:00:00'));
$q->orWhereNull('startdate'); $q->orWhereNull('startdate');
} }
) )
->where( ->where(
static function (EloquentBuilder $q) use ($date) { static function (EloquentBuilder $q) use ($date): void {
$q->where('targetdate', '>=', $date->format('Y-m-d 00:00:00')); $q->where('targetdate', '>=', $date->format('Y-m-d 00:00:00'));
$q->orWhereNull('targetdate'); $q->orWhereNull('targetdate');
} }

View File

@ -118,7 +118,7 @@ class TransactionCurrency extends Model
throw new NotFoundHttpException(); throw new NotFoundHttpException();
} }
public function refreshForUser(User $user) public function refreshForUser(User $user): void
{ {
$current = $user->userGroup->currencies()->where('transaction_currencies.id', $this->id)->first(); $current = $user->userGroup->currencies()->where('transaction_currencies.id', $this->id)->first();
$default = app('amount')->getDefaultCurrencyByUserGroup($user->userGroup); $default = app('amount')->getDefaultCurrencyByUserGroup($user->userGroup);

View File

@ -91,7 +91,7 @@ class VersionCheckResult extends Notification
public function toSlack($notifiable) public function toSlack($notifiable)
{ {
return (new SlackMessage())->content($this->message) return (new SlackMessage())->content($this->message)
->attachment(static function ($attachment) { ->attachment(static function ($attachment): void {
$attachment->title('Firefly III @ GitHub', 'https://github.com/firefly-iii/firefly-iii/releases'); $attachment->title('Firefly III @ GitHub', 'https://github.com/firefly-iii/firefly-iii/releases');
}) })
; ;

View File

@ -110,7 +110,7 @@ class BillReminder extends Notification
return (new SlackMessage()) return (new SlackMessage())
->warning() ->warning()
->attachment(static function ($attachment) use ($bill, $url) { ->attachment(static function ($attachment) use ($bill, $url): void {
$attachment->title((string)trans('firefly.visit_bill', ['name' => $bill->name]), $url); $attachment->title((string)trans('firefly.visit_bill', ['name' => $bill->name]), $url);
}) })
->content($message) ->content($message)

View File

@ -87,9 +87,9 @@ class RuleActionFailed extends Notification
$ruleTitle = $this->ruleTitle; $ruleTitle = $this->ruleTitle;
$ruleLink = $this->ruleLink; $ruleLink = $this->ruleLink;
return (new SlackMessage())->content($this->message)->attachment(static function ($attachment) use ($groupTitle, $groupLink) { return (new SlackMessage())->content($this->message)->attachment(static function ($attachment) use ($groupTitle, $groupLink): void {
$attachment->title((string)trans('rules.inspect_transaction', ['title' => $groupTitle]), $groupLink); $attachment->title((string)trans('rules.inspect_transaction', ['title' => $groupTitle]), $groupLink);
})->attachment(static function ($attachment) use ($ruleTitle, $ruleLink) { })->attachment(static function ($attachment) use ($ruleTitle, $ruleLink): void {
$attachment->title((string)trans('rules.inspect_rule', ['title' => $ruleTitle]), $ruleLink); $attachment->title((string)trans('rules.inspect_rule', ['title' => $ruleTitle]), $ruleLink);
}); });
} }

View File

@ -39,7 +39,7 @@ class RouteServiceProvider extends ServiceProvider
*/ */
public function boot(): void public function boot(): void
{ {
$this->routes(function () { $this->routes(function (): void {
Route::prefix('api') Route::prefix('api')
->middleware('api') ->middleware('api')
->namespace($this->namespace) ->namespace($this->namespace)

View File

@ -104,7 +104,7 @@ class AccountRepository implements AccountRepositoryInterface
->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id') ->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id')
->where('accounts.active', true) ->where('accounts.active', true)
->where( ->where(
static function (EloquentBuilder $q1) use ($number) { // @phpstan-ignore-line static function (EloquentBuilder $q1) use ($number): void { // @phpstan-ignore-line
$json = json_encode($number); $json = json_encode($number);
$q1->where('account_meta.name', '=', 'account_number'); $q1->where('account_meta.name', '=', 'account_number');
$q1->where('account_meta.data', '=', $json); $q1->where('account_meta.data', '=', $json);
@ -184,7 +184,7 @@ class AccountRepository implements AccountRepositoryInterface
{ {
$query = $this->user->accounts()->with( $query = $this->user->accounts()->with(
[ [
'accountmeta' => static function (HasMany $query) { 'accountmeta' => static function (HasMany $query): void {
$query->where('name', 'account_role'); $query->where('name', 'account_role');
}, },
'attachments', 'attachments',
@ -257,7 +257,7 @@ class AccountRepository implements AccountRepositoryInterface
{ {
$query = $this->user->accounts()->with( $query = $this->user->accounts()->with(
[ [
'accountmeta' => static function (HasMany $query) { 'accountmeta' => static function (HasMany $query): void {
$query->where('name', 'account_role'); $query->where('name', 'account_role');
}, },
] ]
@ -597,10 +597,10 @@ class AccountRepository implements AccountRepositoryInterface
foreach ($parts as $part) { foreach ($parts as $part) {
$search = sprintf('%%%s%%', $part); $search = sprintf('%%%s%%', $part);
$dbQuery->where( $dbQuery->where(
static function (EloquentBuilder $q1) use ($search) { // @phpstan-ignore-line static function (EloquentBuilder $q1) use ($search): void { // @phpstan-ignore-line
$q1->where('accounts.iban', 'LIKE', $search); $q1->where('accounts.iban', 'LIKE', $search);
$q1->orWhere( $q1->orWhere(
static function (EloquentBuilder $q2) use ($search) { static function (EloquentBuilder $q2) use ($search): void {
$q2->where('account_meta.name', '=', 'account_number'); $q2->where('account_meta.name', '=', 'account_number');
$q2->where('account_meta.data', 'LIKE', $search); $q2->where('account_meta.data', 'LIKE', $search);
} }

View File

@ -203,13 +203,13 @@ class BillRepository implements BillRepositoryInterface
return $this->user->bills() return $this->user->bills()
->leftJoin( ->leftJoin(
'transaction_journals', 'transaction_journals',
static function (JoinClause $join) { static function (JoinClause $join): void {
$join->on('transaction_journals.bill_id', '=', 'bills.id')->whereNull('transaction_journals.deleted_at'); $join->on('transaction_journals.bill_id', '=', 'bills.id')->whereNull('transaction_journals.deleted_at');
} }
) )
->leftJoin( ->leftJoin(
'transactions', 'transactions',
static function (JoinClause $join) { static function (JoinClause $join): void {
$join->on('transaction_journals.id', '=', 'transactions.transaction_journal_id')->where('transactions.amount', '<', 0); $join->on('transaction_journals.id', '=', 'transactions.transaction_journal_id')->where('transactions.amount', '<', 0);
} }
) )

View File

@ -64,7 +64,7 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
$query = $this->user->availableBudgets()->with(['transactionCurrency']); $query = $this->user->availableBudgets()->with(['transactionCurrency']);
if (null !== $start && null !== $end) { if (null !== $start && null !== $end) {
$query->where( $query->where(
static function (Builder $q1) use ($start, $end) { // @phpstan-ignore-line static function (Builder $q1) use ($start, $end): void { // @phpstan-ignore-line
$q1->where('start_date', '=', $start->format('Y-m-d')); $q1->where('start_date', '=', $start->format('Y-m-d'));
$q1->where('end_date', '=', $end->format('Y-m-d')); $q1->where('end_date', '=', $end->format('Y-m-d'));
} }

View File

@ -51,17 +51,17 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
// same complex where query as below. // same complex where query as below.
->where( ->where(
static function (Builder $q5) use ($start, $end) { static function (Builder $q5) use ($start, $end): void {
$q5->where( $q5->where(
static function (Builder $q1) use ($start, $end) { static function (Builder $q1) use ($start, $end): void {
$q1->where( $q1->where(
static function (Builder $q2) use ($start, $end) { static function (Builder $q2) use ($start, $end): void {
$q2->where('budget_limits.end_date', '>=', $start->format('Y-m-d')); $q2->where('budget_limits.end_date', '>=', $start->format('Y-m-d'));
$q2->where('budget_limits.end_date', '<=', $end->format('Y-m-d')); $q2->where('budget_limits.end_date', '<=', $end->format('Y-m-d'));
} }
) )
->orWhere( ->orWhere(
static function (Builder $q3) use ($start, $end) { static function (Builder $q3) use ($start, $end): void {
$q3->where('budget_limits.start_date', '>=', $start->format('Y-m-d')); $q3->where('budget_limits.start_date', '>=', $start->format('Y-m-d'));
$q3->where('budget_limits.start_date', '<=', $end->format('Y-m-d')); $q3->where('budget_limits.start_date', '<=', $end->format('Y-m-d'));
} }
@ -70,7 +70,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
} }
) )
->orWhere( ->orWhere(
static function (Builder $q4) use ($start, $end) { static function (Builder $q4) use ($start, $end): void {
// or start is before start AND end is after end. // or start is before start AND end is after end.
$q4->where('budget_limits.start_date', '<=', $start->format('Y-m-d')); $q4->where('budget_limits.start_date', '<=', $start->format('Y-m-d'));
$q4->where('budget_limits.end_date', '>=', $end->format('Y-m-d')); $q4->where('budget_limits.end_date', '>=', $end->format('Y-m-d'));
@ -165,17 +165,17 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
->where('budgets.user_id', $this->user->id) ->where('budgets.user_id', $this->user->id)
->whereNull('budgets.deleted_at') ->whereNull('budgets.deleted_at')
->where( ->where(
static function (Builder $q5) use ($start, $end) { static function (Builder $q5) use ($start, $end): void {
$q5->where( $q5->where(
static function (Builder $q1) use ($start, $end) { static function (Builder $q1) use ($start, $end): void {
$q1->where( $q1->where(
static function (Builder $q2) use ($start, $end) { static function (Builder $q2) use ($start, $end): void {
$q2->where('budget_limits.end_date', '>=', $start->format('Y-m-d')); $q2->where('budget_limits.end_date', '>=', $start->format('Y-m-d'));
$q2->where('budget_limits.end_date', '<=', $end->format('Y-m-d')); $q2->where('budget_limits.end_date', '<=', $end->format('Y-m-d'));
} }
) )
->orWhere( ->orWhere(
static function (Builder $q3) use ($start, $end) { static function (Builder $q3) use ($start, $end): void {
$q3->where('budget_limits.start_date', '>=', $start->format('Y-m-d')); $q3->where('budget_limits.start_date', '>=', $start->format('Y-m-d'));
$q3->where('budget_limits.start_date', '<=', $end->format('Y-m-d')); $q3->where('budget_limits.start_date', '<=', $end->format('Y-m-d'));
} }
@ -184,7 +184,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
} }
) )
->orWhere( ->orWhere(
static function (Builder $q4) use ($start, $end) { static function (Builder $q4) use ($start, $end): void {
// or start is before start AND end is after end. // or start is before start AND end is after end.
$q4->where('budget_limits.start_date', '<=', $start->format('Y-m-d')); $q4->where('budget_limits.start_date', '<=', $start->format('Y-m-d'));
$q4->where('budget_limits.end_date', '>=', $end->format('Y-m-d')); $q4->where('budget_limits.end_date', '>=', $end->format('Y-m-d'));
@ -219,19 +219,19 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
// when both dates are set: // when both dates are set:
return $budget->budgetlimits() return $budget->budgetlimits()
->where( ->where(
static function (Builder $q5) use ($start, $end) { // @phpstan-ignore-line static function (Builder $q5) use ($start, $end): void { // @phpstan-ignore-line
$q5->where( $q5->where(
static function (Builder $q1) use ($start, $end) { static function (Builder $q1) use ($start, $end): void {
// budget limit ends within period // budget limit ends within period
$q1->where( $q1->where(
static function (Builder $q2) use ($start, $end) { static function (Builder $q2) use ($start, $end): void {
$q2->where('budget_limits.end_date', '>=', $start->format('Y-m-d 00:00:00')); $q2->where('budget_limits.end_date', '>=', $start->format('Y-m-d 00:00:00'));
$q2->where('budget_limits.end_date', '<=', $end->format('Y-m-d 23:59:59')); $q2->where('budget_limits.end_date', '<=', $end->format('Y-m-d 23:59:59'));
} }
) )
// budget limit start within period // budget limit start within period
->orWhere( ->orWhere(
static function (Builder $q3) use ($start, $end) { static function (Builder $q3) use ($start, $end): void {
$q3->where('budget_limits.start_date', '>=', $start->format('Y-m-d 00:00:00')); $q3->where('budget_limits.start_date', '>=', $start->format('Y-m-d 00:00:00'));
$q3->where('budget_limits.start_date', '<=', $end->format('Y-m-d 23:59:59')); $q3->where('budget_limits.start_date', '<=', $end->format('Y-m-d 23:59:59'));
} }
@ -240,7 +240,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
} }
) )
->orWhere( ->orWhere(
static function (Builder $q4) use ($start, $end) { static function (Builder $q4) use ($start, $end): void {
// or start is before start AND end is after end. // or start is before start AND end is after end.
$q4->where('budget_limits.start_date', '<=', $start->format('Y-m-d 23:59:59')); $q4->where('budget_limits.start_date', '<=', $start->format('Y-m-d 23:59:59'));
$q4->where('budget_limits.end_date', '>=', $end->format('Y-m-d 00:00:00')); $q4->where('budget_limits.end_date', '>=', $end->format('Y-m-d 00:00:00'));

View File

@ -87,7 +87,7 @@ class JournalAPIRepository implements JournalAPIRepositoryInterface
{ {
$events = $journal->piggyBankEvents()->get(); $events = $journal->piggyBankEvents()->get();
$events->each( $events->each(
static function (PiggyBankEvent $event) { static function (PiggyBankEvent $event): void {
$event->piggyBank = $event->piggyBank()->withTrashed()->first(); $event->piggyBank = $event->piggyBank()->withTrashed()->first();
} }
); );

View File

@ -64,14 +64,14 @@ class RecurringRepository implements RecurringRepositoryInterface
{ {
// if not, loop set and try to read the recurrence_date. If it matches start or end, return it as well. // if not, loop set and try to read the recurrence_date. If it matches start or end, return it as well.
$set $set
= TransactionJournalMeta::where(static function (Builder $q1) use ($recurrence) { = TransactionJournalMeta::where(static function (Builder $q1) use ($recurrence): void {
$q1->where('name', 'recurrence_id'); $q1->where('name', 'recurrence_id');
$q1->where('data', json_encode((string)$recurrence->id)); $q1->where('data', json_encode((string)$recurrence->id));
})->get(['journal_meta.transaction_journal_id']); })->get(['journal_meta.transaction_journal_id']);
// there are X journals made for this recurrence. Any of them meant for today? // there are X journals made for this recurrence. Any of them meant for today?
foreach ($set as $journalMeta) { foreach ($set as $journalMeta) {
$count = TransactionJournalMeta::where(static function (Builder $q2) use ($date) { $count = TransactionJournalMeta::where(static function (Builder $q2) use ($date): void {
$string = (string)$date; $string = (string)$date;
app('log')->debug(sprintf('Search for date: %s', json_encode($string))); app('log')->debug(sprintf('Search for date: %s', json_encode($string)));
$q2->where('name', 'recurrence_date'); $q2->where('name', 'recurrence_date');

View File

@ -212,13 +212,13 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
->orderBy('order', 'ASC') ->orderBy('order', 'ASC')
->with( ->with(
[ [
'rules' => static function (HasMany $query) { 'rules' => static function (HasMany $query): void {
$query->orderBy('order', 'ASC'); $query->orderBy('order', 'ASC');
}, },
'rules.ruleTriggers' => static function (HasMany $query) { 'rules.ruleTriggers' => static function (HasMany $query): void {
$query->orderBy('order', 'ASC'); $query->orderBy('order', 'ASC');
}, },
'rules.ruleActions' => static function (HasMany $query) { 'rules.ruleActions' => static function (HasMany $query): void {
$query->orderBy('order', 'ASC'); $query->orderBy('order', 'ASC');
}, },
] ]
@ -268,13 +268,13 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
->where('active', true) ->where('active', true)
->with( ->with(
[ [
'rules' => static function (HasMany $query) { 'rules' => static function (HasMany $query): void {
$query->orderBy('order', 'ASC'); $query->orderBy('order', 'ASC');
}, },
'rules.ruleTriggers' => static function (HasMany $query) { 'rules.ruleTriggers' => static function (HasMany $query): void {
$query->orderBy('order', 'ASC'); $query->orderBy('order', 'ASC');
}, },
'rules.ruleActions' => static function (HasMany $query) { 'rules.ruleActions' => static function (HasMany $query): void {
$query->orderBy('order', 'ASC'); $query->orderBy('order', 'ASC');
}, },
] ]

View File

@ -121,7 +121,7 @@ class TagRepository implements TagRepositoryInterface
$disk = \Storage::disk('upload'); $disk = \Storage::disk('upload');
return $set->each( return $set->each(
static function (Attachment $attachment) use ($disk) { static function (Attachment $attachment) use ($disk): void {
/** @var null|Note $note */ /** @var null|Note $note */
$note = $attachment->notes()->first(); $note = $attachment->notes()->first();
// only used in v1 view of tags // only used in v1 view of tags

View File

@ -153,7 +153,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface
$return = []; $return = [];
$journals = $group->transactionJournals->pluck('id')->toArray(); $journals = $group->transactionJournals->pluck('id')->toArray();
$set = TransactionJournalLink::where( $set = TransactionJournalLink::where(
static function (Builder $q) use ($journals) { static function (Builder $q) use ($journals): void {
$q->whereIn('source_id', $journals); $q->whereIn('source_id', $journals);
$q->orWhereIn('destination_id', $journals); $q->orWhereIn('destination_id', $journals);
} }

View File

@ -46,7 +46,7 @@ class AccountRepository implements AccountRepositoryInterface
->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id') ->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id')
->where('accounts.active', true) ->where('accounts.active', true)
->where( ->where(
static function (EloquentBuilder $q1) use ($number) { // @phpstan-ignore-line static function (EloquentBuilder $q1) use ($number): void { // @phpstan-ignore-line
$json = json_encode($number); $json = json_encode($number);
$q1->where('account_meta.name', '=', 'account_number'); $q1->where('account_meta.name', '=', 'account_number');
$q1->where('account_meta.data', '=', $json); $q1->where('account_meta.data', '=', $json);

View File

@ -158,7 +158,7 @@ class AccountDestroyService
private function destroyRecurrences(Account $account): void private function destroyRecurrences(Account $account): void
{ {
$recurrences = RecurrenceTransaction::where( $recurrences = RecurrenceTransaction::where(
static function (Builder $q) use ($account) { static function (Builder $q) use ($account): void {
$q->where('source_id', $account->id); $q->where('source_id', $account->id);
$q->orWhere('destination_id', $account->id); $q->orWhere('destination_id', $account->id);
} }

View File

@ -213,7 +213,7 @@ class CreditRecalculateService
/** /**
* If account direction is "debit" ("I owe this amount") the opening balance must always be AWAY from the account: * If account direction is "debit" ("I owe this amount") the opening balance must always be AWAY from the account:
*/ */
private function validateOpeningBalance(Account $account, TransactionJournal $openingBalance) private function validateOpeningBalance(Account $account, TransactionJournal $openingBalance): void
{ {
/** @var Transaction $source */ /** @var Transaction $source */
$source = $openingBalance->transactions()->where('amount', '<', 0)->first(); $source = $openingBalance->transactions()->where('amount', '<', 0)->first();

View File

@ -232,7 +232,7 @@ class GroupUpdateService
); );
} }
$collection->each( $collection->each(
static function (TransactionJournal $journal) use ($transactionGroup) { static function (TransactionJournal $journal) use ($transactionGroup): void {
$transactionGroup->transactionJournals()->save($journal); $transactionGroup->transactionJournals()->save($journal);
} }
); );

View File

@ -151,7 +151,7 @@ class RemoteUserGuard implements Guard
return $this->user?->id; return $this->user?->id;
} }
public function setUser(null|Authenticatable|User $user) public function setUser(null|Authenticatable|User $user): void
{ {
app('log')->debug(sprintf('Now at %s', __METHOD__)); app('log')->debug(sprintf('Now at %s', __METHOD__));
if ($user instanceof User) { if ($user instanceof User) {
@ -162,7 +162,7 @@ class RemoteUserGuard implements Guard
app('log')->error(sprintf('Did not set user at %s', __METHOD__)); app('log')->error(sprintf('Did not set user at %s', __METHOD__));
} }
public function validate(array $credentials = []) public function validate(array $credentials = []): void
{ {
app('log')->debug(sprintf('Now at %s', __METHOD__)); app('log')->debug(sprintf('Now at %s', __METHOD__));

View File

@ -36,7 +36,7 @@ use Illuminate\Contracts\Auth\UserProvider;
*/ */
class RemoteUserProvider implements UserProvider class RemoteUserProvider implements UserProvider
{ {
public function retrieveByCredentials(array $credentials) public function retrieveByCredentials(array $credentials): void
{ {
app('log')->debug(sprintf('Now at %s', __METHOD__)); app('log')->debug(sprintf('Now at %s', __METHOD__));
@ -70,21 +70,21 @@ class RemoteUserProvider implements UserProvider
return $user; return $user;
} }
public function retrieveByToken($identifier, $token) public function retrieveByToken($identifier, $token): void
{ {
app('log')->debug(sprintf('Now at %s', __METHOD__)); app('log')->debug(sprintf('Now at %s', __METHOD__));
throw new FireflyException(sprintf('A) Did not implement %s', __METHOD__)); throw new FireflyException(sprintf('A) Did not implement %s', __METHOD__));
} }
public function updateRememberToken(Authenticatable $user, $token) public function updateRememberToken(Authenticatable $user, $token): void
{ {
app('log')->debug(sprintf('Now at %s', __METHOD__)); app('log')->debug(sprintf('Now at %s', __METHOD__));
throw new FireflyException(sprintf('B) Did not implement %s', __METHOD__)); throw new FireflyException(sprintf('B) Did not implement %s', __METHOD__));
} }
public function validateCredentials(Authenticatable $user, array $credentials) public function validateCredentials(Authenticatable $user, array $credentials): void
{ {
app('log')->debug(sprintf('Now at %s', __METHOD__)); app('log')->debug(sprintf('Now at %s', __METHOD__));

View File

@ -36,7 +36,7 @@ class AuditLogger
/** /**
* Customize the given logger instance. * Customize the given logger instance.
*/ */
public function __invoke(Logger $logger) public function __invoke(Logger $logger): void
{ {
$processor = new AuditProcessor(); $processor = new AuditProcessor();

View File

@ -72,7 +72,7 @@ class AccountSearch implements GenericSearchInterface
default: default:
case self::SEARCH_ALL: case self::SEARCH_ALL:
$searchQuery->where( $searchQuery->where(
static function (Builder $q) use ($like) { // @phpstan-ignore-line static function (Builder $q) use ($like): void { // @phpstan-ignore-line
$q->where('accounts.id', 'LIKE', $like); $q->where('accounts.id', 'LIKE', $like);
$q->orWhere('accounts.name', 'LIKE', $like); $q->orWhere('accounts.name', 'LIKE', $like);
$q->orWhere('accounts.iban', 'LIKE', $like); $q->orWhere('accounts.iban', 'LIKE', $like);
@ -80,7 +80,7 @@ class AccountSearch implements GenericSearchInterface
); );
// meta data: // meta data:
$searchQuery->orWhere( $searchQuery->orWhere(
static function (Builder $q) use ($originalQuery) { // @phpstan-ignore-line static function (Builder $q) use ($originalQuery): void { // @phpstan-ignore-line
$json = json_encode($originalQuery, JSON_THROW_ON_ERROR); $json = json_encode($originalQuery, JSON_THROW_ON_ERROR);
$q->where('account_meta.name', '=', 'account_number'); $q->where('account_meta.name', '=', 'account_number');
$q->where('account_meta.data', 'LIKE', $json); $q->where('account_meta.data', 'LIKE', $json);
@ -107,7 +107,7 @@ class AccountSearch implements GenericSearchInterface
case self::SEARCH_NUMBER: case self::SEARCH_NUMBER:
// meta data: // meta data:
$searchQuery->Where( $searchQuery->Where(
static function (Builder $q) use ($originalQuery) { // @phpstan-ignore-line static function (Builder $q) use ($originalQuery): void { // @phpstan-ignore-line
$json = json_encode($originalQuery, JSON_THROW_ON_ERROR); $json = json_encode($originalQuery, JSON_THROW_ON_ERROR);
$q->where('account_meta.name', 'account_number'); $q->where('account_meta.name', 'account_number');
$q->where('account_meta.data', $json); $q->where('account_meta.data', $json);

View File

@ -158,7 +158,7 @@ trait RecurrenceValidation
} }
} }
public function validateRecurringConfig(Validator $validator) public function validateRecurringConfig(Validator $validator): void
{ {
$data = $validator->getData(); $data = $validator->getData();
$reps = array_key_exists('nr_of_repetitions', $data) ? (int)$data['nr_of_repetitions'] : null; $reps = array_key_exists('nr_of_repetitions', $data) ? (int)$data['nr_of_repetitions'] : null;