mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fix code
This commit is contained in:
parent
1f7ceb6df6
commit
a445bc53cd
@ -85,7 +85,7 @@ class StoreRequest extends FormRequest
|
||||
public function withValidator(Validator $validator): void
|
||||
{
|
||||
$validator->after(
|
||||
function (Validator $validator) {
|
||||
function (Validator $validator): void {
|
||||
// validate all account info
|
||||
$this->validateAutoBudgetAmount($validator);
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ class UpdateRequest extends FormRequest
|
||||
public function withValidator(Validator $validator): void
|
||||
{
|
||||
$validator->after(
|
||||
function (Validator $validator) {
|
||||
function (Validator $validator): void {
|
||||
// validate all account info
|
||||
$this->validateAutoBudgetAmount($validator);
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ class UpdateRequest extends FormRequest
|
||||
public function withValidator(Validator $validator): void
|
||||
{
|
||||
$validator->after(
|
||||
static function (Validator $validator) {
|
||||
static function (Validator $validator): void {
|
||||
// validate start before end only if both are there.
|
||||
$data = $validator->getData();
|
||||
if (array_key_exists('start', $data) && array_key_exists('end', $data)) {
|
||||
|
@ -120,7 +120,7 @@ class StoreRequest extends FormRequest
|
||||
public function withValidator(Validator $validator): void
|
||||
{
|
||||
$validator->after(
|
||||
function (Validator $validator) {
|
||||
function (Validator $validator): void {
|
||||
$this->validateRecurringConfig($validator);
|
||||
$this->validateOneRecurrenceTransaction($validator);
|
||||
$this->validateOneRepetition($validator);
|
||||
|
@ -127,7 +127,7 @@ class UpdateRequest extends FormRequest
|
||||
public function withValidator(Validator $validator): void
|
||||
{
|
||||
$validator->after(
|
||||
function (Validator $validator) {
|
||||
function (Validator $validator): void {
|
||||
// $this->validateOneRecurrenceTransaction($validator);
|
||||
// $this->validateOneRepetitionUpdate($validator);
|
||||
|
||||
|
@ -101,7 +101,7 @@ class StoreRequest extends FormRequest
|
||||
public function withValidator(Validator $validator): void
|
||||
{
|
||||
$validator->after(
|
||||
function (Validator $validator) {
|
||||
function (Validator $validator): void {
|
||||
$this->atLeastOneTrigger($validator);
|
||||
$this->atLeastOneAction($validator);
|
||||
$this->atLeastOneActiveTrigger($validator);
|
||||
|
@ -111,7 +111,7 @@ class UpdateRequest extends FormRequest
|
||||
public function withValidator(Validator $validator): void
|
||||
{
|
||||
$validator->after(
|
||||
function (Validator $validator) {
|
||||
function (Validator $validator): void {
|
||||
$this->atLeastOneTrigger($validator);
|
||||
$this->atLeastOneValidTrigger($validator);
|
||||
$this->atLeastOneAction($validator);
|
||||
|
@ -160,7 +160,7 @@ class StoreRequest extends FormRequest
|
||||
public function withValidator(Validator $validator): void
|
||||
{
|
||||
$validator->after(
|
||||
function (Validator $validator) {
|
||||
function (Validator $validator): void {
|
||||
// must be valid array.
|
||||
$this->validateTransactionArray($validator);
|
||||
|
||||
|
@ -239,7 +239,7 @@ class UpdateRequest extends FormRequest
|
||||
/** @var TransactionGroup $transactionGroup */
|
||||
$transactionGroup = $this->route()->parameter('transactionGroup');
|
||||
$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.
|
||||
$this->validateJournalIds($validator, $transactionGroup);
|
||||
|
||||
|
@ -73,7 +73,7 @@ class StoreRequest extends FormRequest
|
||||
public function withValidator(Validator $validator): void
|
||||
{
|
||||
$validator->after(
|
||||
function (Validator $validator) {
|
||||
function (Validator $validator): void {
|
||||
$this->validateExistingLink($validator);
|
||||
}
|
||||
);
|
||||
|
@ -73,7 +73,7 @@ class UpdateRequest extends FormRequest
|
||||
public function withValidator(Validator $validator): void
|
||||
{
|
||||
$validator->after(
|
||||
function (Validator $validator) {
|
||||
function (Validator $validator): void {
|
||||
$this->validateUpdate($validator);
|
||||
}
|
||||
);
|
||||
|
@ -89,7 +89,7 @@ class UserUpdateRequest extends FormRequest
|
||||
/** @var null|User $current */
|
||||
$current = $this->route()->parameter('user');
|
||||
$validator->after(
|
||||
static function (Validator $validator) use ($current) {
|
||||
static function (Validator $validator) use ($current): void {
|
||||
$isAdmin = auth()->user()->hasRole('owner');
|
||||
// not admin, and not own user?
|
||||
if (auth()->check() && false === $isAdmin && $current?->id !== auth()->user()->id) {
|
||||
|
@ -66,7 +66,7 @@ class BalanceChartRequest extends FormRequest
|
||||
public function withValidator(Validator $validator): void
|
||||
{
|
||||
$validator->after(
|
||||
static function (Validator $validator) {
|
||||
static function (Validator $validator): void {
|
||||
// validate transaction query data.
|
||||
$data = $validator->getData();
|
||||
if (!array_key_exists('accounts', $data)) {
|
||||
|
@ -65,7 +65,7 @@ class DashboardChartRequest extends FormRequest
|
||||
public function withValidator(Validator $validator): void
|
||||
{
|
||||
$validator->after(
|
||||
static function (Validator $validator) {
|
||||
static function (Validator $validator): void {
|
||||
// validate transaction query data.
|
||||
$data = $validator->getData();
|
||||
if (!array_key_exists('accounts', $data)) {
|
||||
|
@ -180,7 +180,7 @@ class StoreRequest extends FormRequest
|
||||
/** @var UserGroup $userGroup */
|
||||
$userGroup = $this->getUserGroup();
|
||||
$validator->after(
|
||||
function (Validator $validator) use ($user, $userGroup) {
|
||||
function (Validator $validator) use ($user, $userGroup): void {
|
||||
// must be valid array.
|
||||
$this->validateTransactionArray($validator); // does not need group validation.
|
||||
|
||||
|
@ -63,13 +63,13 @@ class FixAccountTypes extends Command
|
||||
$query = TransactionJournal::leftJoin('transaction_types', 'transaction_journals.transaction_type_id', '=', 'transaction_types.id')
|
||||
->leftJoin(
|
||||
'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);
|
||||
}
|
||||
)
|
||||
->leftJoin(
|
||||
'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);
|
||||
}
|
||||
)
|
||||
@ -80,11 +80,11 @@ class FixAccountTypes extends Command
|
||||
;
|
||||
|
||||
// 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 ($info as $source => $destinations) {
|
||||
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('source_account_type.type', $source);
|
||||
$q1->where('destination_account_type.type', $destination);
|
||||
|
@ -237,7 +237,7 @@ class ForceDecimalSize extends Command
|
||||
->where('account_meta.name', '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) {
|
||||
$q->orWhere(
|
||||
DB::raw(sprintf('CAST(accounts.%s AS %s)', $field, $cast)), // @phpstan-ignore-line
|
||||
@ -283,7 +283,7 @@ class ForceDecimalSize extends Command
|
||||
|
||||
/** @var Builder $query */
|
||||
$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 */
|
||||
foreach ($fields as $field) {
|
||||
$q->orWhere(
|
||||
@ -334,7 +334,7 @@ class ForceDecimalSize extends Command
|
||||
->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id')
|
||||
->where('account_meta.name', '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) {
|
||||
$q->orWhere(
|
||||
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')
|
||||
->where('account_meta.name', '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) {
|
||||
$q->orWhere(
|
||||
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')
|
||||
->where('account_meta.name', '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) {
|
||||
$q->orWhere(
|
||||
DB::raw(sprintf('CAST(piggy_banks.%s AS %s)', $field, $cast)), // @phpstan-ignore-line
|
||||
|
@ -157,7 +157,7 @@ class AccountCurrencies extends Command
|
||||
$openingBalance->transaction_currency_id = $accountCurrency;
|
||||
$openingBalance->save();
|
||||
$openingBalance->transactions->each(
|
||||
static function (Transaction $transaction) use ($accountCurrency) {
|
||||
static function (Transaction $transaction) use ($accountCurrency): void {
|
||||
$transaction->transaction_currency_id = $accountCurrency;
|
||||
$transaction->save();
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ class OtherCurrenciesCorrections extends Command
|
||||
}
|
||||
// fix each transaction:
|
||||
$journal->transactions->each(
|
||||
static function (Transaction $transaction) use ($currency) {
|
||||
static function (Transaction $transaction) use ($currency): void {
|
||||
if (null === $transaction->transaction_currency_id) {
|
||||
$transaction->transaction_currency_id = $currency->id;
|
||||
$transaction->save();
|
||||
|
@ -48,7 +48,7 @@ class Kernel extends ConsoleKernel
|
||||
protected function schedule(Schedule $schedule): void
|
||||
{
|
||||
$schedule->call(
|
||||
static function () {
|
||||
static function (): void {
|
||||
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/'
|
||||
);
|
||||
|
@ -179,7 +179,7 @@ class Handler extends ExceptionHandler
|
||||
*
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function report(\Throwable $e)
|
||||
public function report(\Throwable $e): void
|
||||
{
|
||||
$doMailError = (bool)config('firefly.send_error_message');
|
||||
if ($this->shouldntReportLocal($e) || !$doMailError) {
|
||||
|
@ -35,7 +35,7 @@ class TransactionJournalObserver
|
||||
app('log')->debug('Observe "deleting" of a transaction journal.');
|
||||
|
||||
// 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) {
|
||||
$transaction->delete();
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ trait AccountCollection
|
||||
if ($accounts->count() > 0) {
|
||||
$accountIds = $accounts->pluck('id')->toArray();
|
||||
$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->orWhereIn('destination.account_id', $accountIds);
|
||||
}
|
||||
@ -106,7 +106,7 @@ trait AccountCollection
|
||||
if ($accounts->count() > 0) {
|
||||
$accountIds = $accounts->pluck('id')->toArray();
|
||||
$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('destination.account_id', $accountIds);
|
||||
}
|
||||
@ -140,7 +140,7 @@ trait AccountCollection
|
||||
if ($accounts->count() > 0) {
|
||||
$accountIds = $accounts->pluck('id')->toArray();
|
||||
$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('destination.account_id', $accountIds);
|
||||
}
|
||||
@ -174,18 +174,18 @@ trait AccountCollection
|
||||
if ($accounts->count() > 0) {
|
||||
$accountIds = $accounts->pluck('id')->toArray();
|
||||
$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.
|
||||
|
||||
$q1->where(
|
||||
static function (EloquentBuilder $q2) use ($accountIds) {
|
||||
static function (EloquentBuilder $q2) use ($accountIds): void {
|
||||
$q2->whereIn('source.account_id', $accountIds);
|
||||
$q2->whereNotIn('destination.account_id', $accountIds);
|
||||
}
|
||||
);
|
||||
// destination is in the set, and source is NOT
|
||||
$q1->orWhere(
|
||||
static function (EloquentBuilder $q3) use ($accountIds) {
|
||||
static function (EloquentBuilder $q3) use ($accountIds): void {
|
||||
$q3->whereNotIn('source.account_id', $accountIds);
|
||||
$q3->whereIn('destination.account_id', $accountIds);
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ trait AmountCollection
|
||||
public function amountIs(string $amount): GroupCollectorInterface
|
||||
{
|
||||
$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));
|
||||
}
|
||||
);
|
||||
@ -49,7 +49,7 @@ trait AmountCollection
|
||||
public function amountIsNot(string $amount): GroupCollectorInterface
|
||||
{
|
||||
$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));
|
||||
}
|
||||
);
|
||||
@ -63,7 +63,7 @@ trait AmountCollection
|
||||
public function amountLess(string $amount): GroupCollectorInterface
|
||||
{
|
||||
$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));
|
||||
}
|
||||
);
|
||||
@ -77,7 +77,7 @@ trait AmountCollection
|
||||
public function amountMore(string $amount): GroupCollectorInterface
|
||||
{
|
||||
$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));
|
||||
}
|
||||
);
|
||||
@ -91,7 +91,7 @@ trait AmountCollection
|
||||
public function foreignAmountIs(string $amount): GroupCollectorInterface
|
||||
{
|
||||
$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->where('source.foreign_amount', app('steam')->negative($amount));
|
||||
}
|
||||
@ -106,7 +106,7 @@ trait AmountCollection
|
||||
public function foreignAmountIsNot(string $amount): GroupCollectorInterface
|
||||
{
|
||||
$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->orWhere('source.foreign_amount', '!=', app('steam')->negative($amount));
|
||||
}
|
||||
@ -121,7 +121,7 @@ trait AmountCollection
|
||||
public function foreignAmountLess(string $amount): GroupCollectorInterface
|
||||
{
|
||||
$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->where('destination.foreign_amount', '<=', app('steam')->positive($amount));
|
||||
}
|
||||
@ -136,7 +136,7 @@ trait AmountCollection
|
||||
public function foreignAmountMore(string $amount): GroupCollectorInterface
|
||||
{
|
||||
$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->where('destination.foreign_amount', '>=', app('steam')->positive($amount));
|
||||
}
|
||||
|
@ -495,10 +495,10 @@ trait AttachmentCollection
|
||||
app('log')->debug('Add filter on no attachments.');
|
||||
$this->joinAttachmentTables();
|
||||
|
||||
$this->query->where(static function (Builder $q1) { // @phpstan-ignore-line
|
||||
$this->query->where(static function (Builder $q1): void { // @phpstan-ignore-line
|
||||
$q1
|
||||
->whereNull('attachments.attachable_id')
|
||||
->orWhere(static function (Builder $q2) {
|
||||
->orWhere(static function (Builder $q2): void {
|
||||
$q2
|
||||
->whereNotNull('attachments.attachable_id')
|
||||
->whereNotNull('attachments.deleted_at')
|
||||
@ -522,7 +522,7 @@ trait AttachmentCollection
|
||||
$this->hasJoinedAttTables = true;
|
||||
$this->query->leftJoin('attachments', 'attachments.attachable_id', '=', 'transaction_journals.id')
|
||||
->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.uploaded', true);
|
||||
$q1->whereNull('attachments.deleted_at');
|
||||
|
@ -42,7 +42,7 @@ trait MetaCollection
|
||||
public function excludeBills(Collection $bills): GroupCollectorInterface
|
||||
{
|
||||
$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->orWhereNull('transaction_journals.bill_id');
|
||||
});
|
||||
@ -74,7 +74,7 @@ trait MetaCollection
|
||||
{
|
||||
$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->orWhereNull('budgets.id');
|
||||
});
|
||||
@ -105,7 +105,7 @@ trait MetaCollection
|
||||
{
|
||||
if ($budgets->count() > 0) {
|
||||
$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->orWhereNull('budgets.id');
|
||||
});
|
||||
@ -118,7 +118,7 @@ trait MetaCollection
|
||||
{
|
||||
if ($categories->count() > 0) {
|
||||
$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->orWhereNull('categories.id');
|
||||
});
|
||||
@ -153,7 +153,7 @@ trait MetaCollection
|
||||
{
|
||||
$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->orWhereNull('categories.id');
|
||||
});
|
||||
@ -456,7 +456,7 @@ trait MetaCollection
|
||||
// join bill table
|
||||
$this->query->leftJoin(
|
||||
'notes',
|
||||
static function (JoinClause $join) {
|
||||
static function (JoinClause $join): void {
|
||||
$join->on('notes.noteable_id', '=', 'transaction_journals.id');
|
||||
$join->where('notes.noteable_type', '=', 'FireflyIII\Models\TransactionJournal');
|
||||
$join->whereNull('notes.deleted_at');
|
||||
@ -473,7 +473,7 @@ trait MetaCollection
|
||||
public function notesDoNotContain(string $value): GroupCollectorInterface
|
||||
{
|
||||
$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->orWhere('notes.text', 'NOT LIKE', sprintf('%%%s%%', $value));
|
||||
});
|
||||
@ -484,7 +484,7 @@ trait MetaCollection
|
||||
public function notesDontEndWith(string $value): GroupCollectorInterface
|
||||
{
|
||||
$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->orWhere('notes.text', 'NOT LIKE', sprintf('%%%s', $value));
|
||||
});
|
||||
@ -495,7 +495,7 @@ trait MetaCollection
|
||||
public function notesDontStartWith(string $value): GroupCollectorInterface
|
||||
{
|
||||
$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->orWhere('notes.text', 'NOT LIKE', sprintf('%s%%', $value));
|
||||
});
|
||||
@ -522,7 +522,7 @@ trait MetaCollection
|
||||
public function notesExactlyNot(string $value): GroupCollectorInterface
|
||||
{
|
||||
$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->orWhere('notes.text', '!=', sprintf('%s', $value));
|
||||
});
|
||||
@ -801,13 +801,13 @@ trait MetaCollection
|
||||
{
|
||||
$this->joinMetaDataTables();
|
||||
// TODO not sure if this will work properly.
|
||||
$this->query->where(static function (Builder $q1) { // @phpstan-ignore-line
|
||||
$q1->where(static function (Builder $q2) {
|
||||
$this->query->where(static function (Builder $q1): void { // @phpstan-ignore-line
|
||||
$q1->where(static function (Builder $q2): void {
|
||||
$q2->where('journal_meta.name', '=', 'external_id');
|
||||
$q2->whereNull('journal_meta.data');
|
||||
})->orWhere(static function (Builder $q3) {
|
||||
})->orWhere(static function (Builder $q3): void {
|
||||
$q3->where('journal_meta.name', '!=', 'external_id');
|
||||
})->orWhere(static function (Builder $q4) {
|
||||
})->orWhere(static function (Builder $q4): void {
|
||||
$q4->whereNull('journal_meta.name');
|
||||
});
|
||||
});
|
||||
@ -819,13 +819,13 @@ trait MetaCollection
|
||||
{
|
||||
$this->joinMetaDataTables();
|
||||
// TODO not sure if this will work properly.
|
||||
$this->query->where(static function (Builder $q1) { // @phpstan-ignore-line
|
||||
$q1->where(static function (Builder $q2) {
|
||||
$this->query->where(static function (Builder $q1): void { // @phpstan-ignore-line
|
||||
$q1->where(static function (Builder $q2): void {
|
||||
$q2->where('journal_meta.name', '=', 'external_url');
|
||||
$q2->whereNull('journal_meta.data');
|
||||
})->orWhere(static function (Builder $q3) {
|
||||
})->orWhere(static function (Builder $q3): void {
|
||||
$q3->where('journal_meta.name', '!=', 'external_url');
|
||||
})->orWhere(static function (Builder $q4) {
|
||||
})->orWhere(static function (Builder $q4): void {
|
||||
$q4->whereNull('journal_meta.name');
|
||||
});
|
||||
});
|
||||
@ -836,7 +836,7 @@ trait MetaCollection
|
||||
public function withoutNotes(): GroupCollectorInterface
|
||||
{
|
||||
$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->orWhere('notes.text', '');
|
||||
});
|
||||
|
@ -145,9 +145,9 @@ class GroupCollector implements GroupCollectorInterface
|
||||
public function descriptionDoesNotEnd(array $array): GroupCollectorInterface
|
||||
{
|
||||
$this->query->where(
|
||||
static function (EloquentBuilder $q) use ($array) { // @phpstan-ignore-line
|
||||
static function (EloquentBuilder $q) use ($array): void { // @phpstan-ignore-line
|
||||
$q->where(
|
||||
static function (EloquentBuilder $q1) use ($array) {
|
||||
static function (EloquentBuilder $q1) use ($array): void {
|
||||
foreach ($array as $word) {
|
||||
$keyword = sprintf('%%%s', $word);
|
||||
$q1->where('transaction_journals.description', 'NOT LIKE', $keyword);
|
||||
@ -155,7 +155,7 @@ class GroupCollector implements GroupCollectorInterface
|
||||
}
|
||||
);
|
||||
$q->where(
|
||||
static function (EloquentBuilder $q2) use ($array) {
|
||||
static function (EloquentBuilder $q2) use ($array): void {
|
||||
foreach ($array as $word) {
|
||||
$keyword = sprintf('%%%s', $word);
|
||||
$q2->where('transaction_groups.title', 'NOT LIKE', $keyword);
|
||||
@ -172,9 +172,9 @@ class GroupCollector implements GroupCollectorInterface
|
||||
public function descriptionDoesNotStart(array $array): GroupCollectorInterface
|
||||
{
|
||||
$this->query->where(
|
||||
static function (EloquentBuilder $q) use ($array) { // @phpstan-ignore-line
|
||||
static function (EloquentBuilder $q) use ($array): void { // @phpstan-ignore-line
|
||||
$q->where(
|
||||
static function (EloquentBuilder $q1) use ($array) {
|
||||
static function (EloquentBuilder $q1) use ($array): void {
|
||||
foreach ($array as $word) {
|
||||
$keyword = sprintf('%s%%', $word);
|
||||
$q1->where('transaction_journals.description', 'NOT LIKE', $keyword);
|
||||
@ -182,7 +182,7 @@ class GroupCollector implements GroupCollectorInterface
|
||||
}
|
||||
);
|
||||
$q->where(
|
||||
static function (EloquentBuilder $q2) use ($array) {
|
||||
static function (EloquentBuilder $q2) use ($array): void {
|
||||
foreach ($array as $word) {
|
||||
$keyword = sprintf('%s%%', $word);
|
||||
$q2->where('transaction_groups.title', 'NOT LIKE', $keyword);
|
||||
@ -199,9 +199,9 @@ class GroupCollector implements GroupCollectorInterface
|
||||
public function descriptionEnds(array $array): GroupCollectorInterface
|
||||
{
|
||||
$this->query->where(
|
||||
static function (EloquentBuilder $q) use ($array) { // @phpstan-ignore-line
|
||||
static function (EloquentBuilder $q) use ($array): void { // @phpstan-ignore-line
|
||||
$q->where(
|
||||
static function (EloquentBuilder $q1) use ($array) {
|
||||
static function (EloquentBuilder $q1) use ($array): void {
|
||||
foreach ($array as $word) {
|
||||
$keyword = sprintf('%%%s', $word);
|
||||
$q1->where('transaction_journals.description', 'LIKE', $keyword);
|
||||
@ -209,7 +209,7 @@ class GroupCollector implements GroupCollectorInterface
|
||||
}
|
||||
);
|
||||
$q->orWhere(
|
||||
static function (EloquentBuilder $q2) use ($array) {
|
||||
static function (EloquentBuilder $q2) use ($array): void {
|
||||
foreach ($array as $word) {
|
||||
$keyword = sprintf('%%%s', $word);
|
||||
$q2->where('transaction_groups.title', 'LIKE', $keyword);
|
||||
@ -225,7 +225,7 @@ class GroupCollector implements GroupCollectorInterface
|
||||
public function descriptionIs(string $value): GroupCollectorInterface
|
||||
{
|
||||
$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->orWhere('transaction_groups.title', '=', $value);
|
||||
}
|
||||
@ -237,10 +237,10 @@ class GroupCollector implements GroupCollectorInterface
|
||||
public function descriptionIsNot(string $value): GroupCollectorInterface
|
||||
{
|
||||
$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(
|
||||
static function (EloquentBuilder $q2) use ($value) {
|
||||
static function (EloquentBuilder $q2) use ($value): void {
|
||||
$q2->where('transaction_groups.title', '!=', $value);
|
||||
$q2->orWhereNull('transaction_groups.title');
|
||||
}
|
||||
@ -254,9 +254,9 @@ class GroupCollector implements GroupCollectorInterface
|
||||
public function descriptionStarts(array $array): GroupCollectorInterface
|
||||
{
|
||||
$this->query->where(
|
||||
static function (EloquentBuilder $q) use ($array) { // @phpstan-ignore-line
|
||||
static function (EloquentBuilder $q) use ($array): void { // @phpstan-ignore-line
|
||||
$q->where(
|
||||
static function (EloquentBuilder $q1) use ($array) {
|
||||
static function (EloquentBuilder $q1) use ($array): void {
|
||||
foreach ($array as $word) {
|
||||
$keyword = sprintf('%s%%', $word);
|
||||
$q1->where('transaction_journals.description', 'LIKE', $keyword);
|
||||
@ -264,7 +264,7 @@ class GroupCollector implements GroupCollectorInterface
|
||||
}
|
||||
);
|
||||
$q->orWhere(
|
||||
static function (EloquentBuilder $q2) use ($array) {
|
||||
static function (EloquentBuilder $q2) use ($array): void {
|
||||
foreach ($array as $word) {
|
||||
$keyword = sprintf('%s%%', $word);
|
||||
$q2->where('transaction_groups.title', 'LIKE', $keyword);
|
||||
@ -310,10 +310,10 @@ class GroupCollector implements GroupCollectorInterface
|
||||
public function excludeCurrency(TransactionCurrency $currency): GroupCollectorInterface
|
||||
{
|
||||
$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(
|
||||
static function (EloquentBuilder $q2) use ($currency) {
|
||||
static function (EloquentBuilder $q2) use ($currency): void {
|
||||
$q2->where('source.foreign_currency_id', '!=', $currency->id);
|
||||
$q2->orWhereNull('source.foreign_currency_id');
|
||||
}
|
||||
@ -326,7 +326,7 @@ class GroupCollector implements 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->orWhereNull('source.foreign_currency_id');
|
||||
});
|
||||
@ -368,9 +368,9 @@ class GroupCollector implements GroupCollectorInterface
|
||||
return $this;
|
||||
}
|
||||
$this->query->where(
|
||||
static function (EloquentBuilder $q) use ($array) { // @phpstan-ignore-line
|
||||
static function (EloquentBuilder $q) use ($array): void { // @phpstan-ignore-line
|
||||
$q->where(
|
||||
static function (EloquentBuilder $q1) use ($array) {
|
||||
static function (EloquentBuilder $q1) use ($array): void {
|
||||
foreach ($array as $word) {
|
||||
$keyword = sprintf('%%%s%%', $word);
|
||||
$q1->where('transaction_journals.description', 'NOT LIKE', $keyword);
|
||||
@ -378,7 +378,7 @@ class GroupCollector implements GroupCollectorInterface
|
||||
}
|
||||
);
|
||||
$q->where(
|
||||
static function (EloquentBuilder $q2) use ($array) {
|
||||
static function (EloquentBuilder $q2) use ($array): void {
|
||||
foreach ($array as $word) {
|
||||
$keyword = sprintf('%%%s%%', $word);
|
||||
$q2->where('transaction_groups.title', 'NOT LIKE', $keyword);
|
||||
@ -519,7 +519,7 @@ class GroupCollector implements GroupCollectorInterface
|
||||
public function setCurrency(TransactionCurrency $currency): GroupCollectorInterface
|
||||
{
|
||||
$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->orWhere('source.foreign_currency_id', $currency->id);
|
||||
}
|
||||
@ -588,9 +588,9 @@ class GroupCollector implements GroupCollectorInterface
|
||||
return $this;
|
||||
}
|
||||
$this->query->where(
|
||||
static function (EloquentBuilder $q) use ($array) { // @phpstan-ignore-line
|
||||
static function (EloquentBuilder $q) use ($array): void { // @phpstan-ignore-line
|
||||
$q->where(
|
||||
static function (EloquentBuilder $q1) use ($array) {
|
||||
static function (EloquentBuilder $q1) use ($array): void {
|
||||
foreach ($array as $word) {
|
||||
$keyword = sprintf('%%%s%%', $word);
|
||||
$q1->where('transaction_journals.description', 'LIKE', $keyword);
|
||||
@ -598,7 +598,7 @@ class GroupCollector implements GroupCollectorInterface
|
||||
}
|
||||
);
|
||||
$q->orWhere(
|
||||
static function (EloquentBuilder $q2) use ($array) {
|
||||
static function (EloquentBuilder $q2) use ($array): void {
|
||||
foreach ($array as $word) {
|
||||
$keyword = sprintf('%%%s%%', $word);
|
||||
$q2->where('transaction_groups.title', 'LIKE', $keyword);
|
||||
@ -972,7 +972,7 @@ class GroupCollector implements GroupCollectorInterface
|
||||
// join source transaction.
|
||||
->leftJoin(
|
||||
'transactions as source',
|
||||
static function (JoinClause $join) {
|
||||
static function (JoinClause $join): void {
|
||||
$join->on('source.transaction_journal_id', '=', 'transaction_journals.id')
|
||||
->where('source.amount', '<', 0)
|
||||
;
|
||||
@ -981,7 +981,7 @@ class GroupCollector implements GroupCollectorInterface
|
||||
// join destination transaction
|
||||
->leftJoin(
|
||||
'transactions as destination',
|
||||
static function (JoinClause $join) {
|
||||
static function (JoinClause $join): void {
|
||||
$join->on('destination.transaction_journal_id', '=', 'transaction_journals.id')
|
||||
->where('destination.amount', '>', 0)
|
||||
;
|
||||
@ -1016,7 +1016,7 @@ class GroupCollector implements GroupCollectorInterface
|
||||
// join source transaction.
|
||||
->leftJoin(
|
||||
'transactions as source',
|
||||
static function (JoinClause $join) {
|
||||
static function (JoinClause $join): void {
|
||||
$join->on('source.transaction_journal_id', '=', 'transaction_journals.id')
|
||||
->where('source.amount', '<', 0)
|
||||
;
|
||||
@ -1025,7 +1025,7 @@ class GroupCollector implements GroupCollectorInterface
|
||||
// join destination transaction
|
||||
->leftJoin(
|
||||
'transactions as destination',
|
||||
static function (JoinClause $join) {
|
||||
static function (JoinClause $join): void {
|
||||
$join->on('destination.transaction_journal_id', '=', 'transaction_journals.id')
|
||||
->where('destination.amount', '>', 0)
|
||||
;
|
||||
|
@ -99,7 +99,7 @@ class IndexController extends Controller
|
||||
$activities = app('steam')->getLastActivities($ids);
|
||||
|
||||
$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->startBalance = $this->isInArray($startBalances, $account->id);
|
||||
$account->endBalance = $this->isInArray($endBalances, $account->id);
|
||||
@ -162,7 +162,7 @@ class IndexController extends Controller
|
||||
$activities = app('steam')->getLastActivities($ids);
|
||||
|
||||
$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 = '' === $interest ? '0' : $interest;
|
||||
|
||||
|
@ -171,7 +171,7 @@ class LinkController extends Controller
|
||||
|
||||
Log::channel('audit')->info('User on index of link types in admin.');
|
||||
$linkTypes->each(
|
||||
function (LinkType $linkType) {
|
||||
function (LinkType $linkType): void {
|
||||
$linkType->journalCount = $this->repository->countJournals($linkType);
|
||||
}
|
||||
);
|
||||
|
@ -173,7 +173,7 @@ class UserController extends Controller
|
||||
|
||||
// add meta stuff.
|
||||
$users->each(
|
||||
function (User $user) {
|
||||
function (User $user): void {
|
||||
$user->isAdmin = $this->repository->hasRole($user, 'owner');
|
||||
$user->has2FA = null !== $user->mfa_secret;
|
||||
}
|
||||
|
@ -95,7 +95,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) {
|
||||
function ($user, $password): void {
|
||||
$this->resetPassword($user, $password);
|
||||
}
|
||||
);
|
||||
|
@ -77,7 +77,7 @@ class IndexController extends Controller
|
||||
$collection = $collection->slice(($page - 1) * $pageSize, $pageSize);
|
||||
|
||||
$collection->each(
|
||||
function (Category $category) {
|
||||
function (Category $category): void {
|
||||
$category->lastActivity = $this->repository->lastUseDate($category, new Collection());
|
||||
}
|
||||
);
|
||||
|
@ -74,7 +74,7 @@ class BudgetFormStoreRequest extends FormRequest
|
||||
public function withValidator(Validator $validator): void
|
||||
{
|
||||
$validator->after(
|
||||
function (Validator $validator) {
|
||||
function (Validator $validator): void {
|
||||
// validate all account info
|
||||
$this->validateAutoBudgetAmount($validator);
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ class BudgetFormUpdateRequest extends FormRequest
|
||||
public function withValidator(Validator $validator): void
|
||||
{
|
||||
$validator->after(
|
||||
function (Validator $validator) {
|
||||
function (Validator $validator): void {
|
||||
// validate all account info
|
||||
$this->validateAutoBudgetAmount($validator);
|
||||
}
|
||||
|
@ -237,7 +237,7 @@ class RecurrenceFormRequest extends FormRequest
|
||||
public function withValidator(Validator $validator): void
|
||||
{
|
||||
$validator->after(
|
||||
function (Validator $validator) {
|
||||
function (Validator $validator): void {
|
||||
// validate all account info
|
||||
$this->validateAccountInformation($validator);
|
||||
}
|
||||
|
@ -141,7 +141,8 @@ class ReportFormRequest extends FormRequest
|
||||
// validate as date
|
||||
// if regex for YYYY-MM-DD:
|
||||
$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 {
|
||||
$date = new Carbon($parts[1]);
|
||||
} catch (\Exception $e) { // intentional generic exception
|
||||
@ -178,7 +179,8 @@ class ReportFormRequest extends FormRequest
|
||||
// validate as date
|
||||
// if regex for YYYY-MM-DD:
|
||||
$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 {
|
||||
$date = new Carbon($parts[0]);
|
||||
} catch (\Exception $e) { // intentional generic exception
|
||||
|
@ -73,7 +73,7 @@ class MailError extends Job implements ShouldQueue
|
||||
\Mail::send(
|
||||
['emails.error-html', 'emails.error-text'],
|
||||
$args,
|
||||
static function (Message $message) use ($email) {
|
||||
static function (Message $message) use ($email): void {
|
||||
if ('mail@example.com' !== $email) {
|
||||
$message->to($email, $email)->subject((string)trans('email.error_subject'));
|
||||
}
|
||||
|
@ -88,13 +88,13 @@ class PiggyBankRepetition extends Model
|
||||
public function scopeRelevantOnDate(EloquentBuilder $query, Carbon $date)
|
||||
{
|
||||
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->orWhereNull('startdate');
|
||||
}
|
||||
)
|
||||
->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->orWhereNull('targetdate');
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ class TransactionCurrency extends Model
|
||||
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();
|
||||
$default = app('amount')->getDefaultCurrencyByUserGroup($user->userGroup);
|
||||
|
@ -91,7 +91,7 @@ class VersionCheckResult extends Notification
|
||||
public function toSlack($notifiable)
|
||||
{
|
||||
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');
|
||||
})
|
||||
;
|
||||
|
@ -110,7 +110,7 @@ class BillReminder extends Notification
|
||||
|
||||
return (new SlackMessage())
|
||||
->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);
|
||||
})
|
||||
->content($message)
|
||||
|
@ -87,9 +87,9 @@ class RuleActionFailed extends Notification
|
||||
$ruleTitle = $this->ruleTitle;
|
||||
$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(static function ($attachment) use ($ruleTitle, $ruleLink) {
|
||||
})->attachment(static function ($attachment) use ($ruleTitle, $ruleLink): void {
|
||||
$attachment->title((string)trans('rules.inspect_rule', ['title' => $ruleTitle]), $ruleLink);
|
||||
});
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ class RouteServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
$this->routes(function () {
|
||||
$this->routes(function (): void {
|
||||
Route::prefix('api')
|
||||
->middleware('api')
|
||||
->namespace($this->namespace)
|
||||
|
@ -104,7 +104,7 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id')
|
||||
->where('accounts.active', true)
|
||||
->where(
|
||||
static function (EloquentBuilder $q1) use ($number) { // @phpstan-ignore-line
|
||||
static function (EloquentBuilder $q1) use ($number): void { // @phpstan-ignore-line
|
||||
$json = json_encode($number);
|
||||
$q1->where('account_meta.name', '=', 'account_number');
|
||||
$q1->where('account_meta.data', '=', $json);
|
||||
@ -184,7 +184,7 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
{
|
||||
$query = $this->user->accounts()->with(
|
||||
[
|
||||
'accountmeta' => static function (HasMany $query) {
|
||||
'accountmeta' => static function (HasMany $query): void {
|
||||
$query->where('name', 'account_role');
|
||||
},
|
||||
'attachments',
|
||||
@ -257,7 +257,7 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
{
|
||||
$query = $this->user->accounts()->with(
|
||||
[
|
||||
'accountmeta' => static function (HasMany $query) {
|
||||
'accountmeta' => static function (HasMany $query): void {
|
||||
$query->where('name', 'account_role');
|
||||
},
|
||||
]
|
||||
@ -597,10 +597,10 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
foreach ($parts as $part) {
|
||||
$search = sprintf('%%%s%%', $part);
|
||||
$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->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.data', 'LIKE', $search);
|
||||
}
|
||||
|
@ -203,13 +203,13 @@ class BillRepository implements BillRepositoryInterface
|
||||
return $this->user->bills()
|
||||
->leftJoin(
|
||||
'transaction_journals',
|
||||
static function (JoinClause $join) {
|
||||
static function (JoinClause $join): void {
|
||||
$join->on('transaction_journals.bill_id', '=', 'bills.id')->whereNull('transaction_journals.deleted_at');
|
||||
}
|
||||
)
|
||||
->leftJoin(
|
||||
'transactions',
|
||||
static function (JoinClause $join) {
|
||||
static function (JoinClause $join): void {
|
||||
$join->on('transaction_journals.id', '=', 'transactions.transaction_journal_id')->where('transactions.amount', '<', 0);
|
||||
}
|
||||
)
|
||||
|
@ -64,7 +64,7 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
|
||||
$query = $this->user->availableBudgets()->with(['transactionCurrency']);
|
||||
if (null !== $start && null !== $end) {
|
||||
$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('end_date', '=', $end->format('Y-m-d'));
|
||||
}
|
||||
|
@ -51,17 +51,17 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
|
||||
|
||||
// same complex where query as below.
|
||||
->where(
|
||||
static function (Builder $q5) use ($start, $end) {
|
||||
static function (Builder $q5) use ($start, $end): void {
|
||||
$q5->where(
|
||||
static function (Builder $q1) use ($start, $end) {
|
||||
static function (Builder $q1) use ($start, $end): void {
|
||||
$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', '<=', $end->format('Y-m-d'));
|
||||
}
|
||||
)
|
||||
->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', '<=', $end->format('Y-m-d'));
|
||||
}
|
||||
@ -70,7 +70,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
|
||||
}
|
||||
)
|
||||
->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.
|
||||
$q4->where('budget_limits.start_date', '<=', $start->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)
|
||||
->whereNull('budgets.deleted_at')
|
||||
->where(
|
||||
static function (Builder $q5) use ($start, $end) {
|
||||
static function (Builder $q5) use ($start, $end): void {
|
||||
$q5->where(
|
||||
static function (Builder $q1) use ($start, $end) {
|
||||
static function (Builder $q1) use ($start, $end): void {
|
||||
$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', '<=', $end->format('Y-m-d'));
|
||||
}
|
||||
)
|
||||
->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', '<=', $end->format('Y-m-d'));
|
||||
}
|
||||
@ -184,7 +184,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
|
||||
}
|
||||
)
|
||||
->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.
|
||||
$q4->where('budget_limits.start_date', '<=', $start->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:
|
||||
return $budget->budgetlimits()
|
||||
->where(
|
||||
static function (Builder $q5) use ($start, $end) { // @phpstan-ignore-line
|
||||
static function (Builder $q5) use ($start, $end): void { // @phpstan-ignore-line
|
||||
$q5->where(
|
||||
static function (Builder $q1) use ($start, $end) {
|
||||
static function (Builder $q1) use ($start, $end): void {
|
||||
// budget limit ends within period
|
||||
$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', '<=', $end->format('Y-m-d 23:59:59'));
|
||||
}
|
||||
)
|
||||
// budget limit start within period
|
||||
->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', '<=', $end->format('Y-m-d 23:59:59'));
|
||||
}
|
||||
@ -240,7 +240,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
|
||||
}
|
||||
)
|
||||
->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.
|
||||
$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'));
|
||||
|
@ -87,7 +87,7 @@ class JournalAPIRepository implements JournalAPIRepositoryInterface
|
||||
{
|
||||
$events = $journal->piggyBankEvents()->get();
|
||||
$events->each(
|
||||
static function (PiggyBankEvent $event) {
|
||||
static function (PiggyBankEvent $event): void {
|
||||
$event->piggyBank = $event->piggyBank()->withTrashed()->first();
|
||||
}
|
||||
);
|
||||
|
@ -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.
|
||||
$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('data', json_encode((string)$recurrence->id));
|
||||
})->get(['journal_meta.transaction_journal_id']);
|
||||
|
||||
// there are X journals made for this recurrence. Any of them meant for today?
|
||||
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;
|
||||
app('log')->debug(sprintf('Search for date: %s', json_encode($string)));
|
||||
$q2->where('name', 'recurrence_date');
|
||||
|
@ -212,13 +212,13 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
|
||||
->orderBy('order', 'ASC')
|
||||
->with(
|
||||
[
|
||||
'rules' => static function (HasMany $query) {
|
||||
'rules' => static function (HasMany $query): void {
|
||||
$query->orderBy('order', 'ASC');
|
||||
},
|
||||
'rules.ruleTriggers' => static function (HasMany $query) {
|
||||
'rules.ruleTriggers' => static function (HasMany $query): void {
|
||||
$query->orderBy('order', 'ASC');
|
||||
},
|
||||
'rules.ruleActions' => static function (HasMany $query) {
|
||||
'rules.ruleActions' => static function (HasMany $query): void {
|
||||
$query->orderBy('order', 'ASC');
|
||||
},
|
||||
]
|
||||
@ -268,13 +268,13 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
|
||||
->where('active', true)
|
||||
->with(
|
||||
[
|
||||
'rules' => static function (HasMany $query) {
|
||||
'rules' => static function (HasMany $query): void {
|
||||
$query->orderBy('order', 'ASC');
|
||||
},
|
||||
'rules.ruleTriggers' => static function (HasMany $query) {
|
||||
'rules.ruleTriggers' => static function (HasMany $query): void {
|
||||
$query->orderBy('order', 'ASC');
|
||||
},
|
||||
'rules.ruleActions' => static function (HasMany $query) {
|
||||
'rules.ruleActions' => static function (HasMany $query): void {
|
||||
$query->orderBy('order', 'ASC');
|
||||
},
|
||||
]
|
||||
|
@ -121,7 +121,7 @@ class TagRepository implements TagRepositoryInterface
|
||||
$disk = \Storage::disk('upload');
|
||||
|
||||
return $set->each(
|
||||
static function (Attachment $attachment) use ($disk) {
|
||||
static function (Attachment $attachment) use ($disk): void {
|
||||
/** @var null|Note $note */
|
||||
$note = $attachment->notes()->first();
|
||||
// only used in v1 view of tags
|
||||
|
@ -153,7 +153,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface
|
||||
$return = [];
|
||||
$journals = $group->transactionJournals->pluck('id')->toArray();
|
||||
$set = TransactionJournalLink::where(
|
||||
static function (Builder $q) use ($journals) {
|
||||
static function (Builder $q) use ($journals): void {
|
||||
$q->whereIn('source_id', $journals);
|
||||
$q->orWhereIn('destination_id', $journals);
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id')
|
||||
->where('accounts.active', true)
|
||||
->where(
|
||||
static function (EloquentBuilder $q1) use ($number) { // @phpstan-ignore-line
|
||||
static function (EloquentBuilder $q1) use ($number): void { // @phpstan-ignore-line
|
||||
$json = json_encode($number);
|
||||
$q1->where('account_meta.name', '=', 'account_number');
|
||||
$q1->where('account_meta.data', '=', $json);
|
||||
|
@ -158,7 +158,7 @@ class AccountDestroyService
|
||||
private function destroyRecurrences(Account $account): void
|
||||
{
|
||||
$recurrences = RecurrenceTransaction::where(
|
||||
static function (Builder $q) use ($account) {
|
||||
static function (Builder $q) use ($account): void {
|
||||
$q->where('source_id', $account->id);
|
||||
$q->orWhere('destination_id', $account->id);
|
||||
}
|
||||
|
@ -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:
|
||||
*/
|
||||
private function validateOpeningBalance(Account $account, TransactionJournal $openingBalance)
|
||||
private function validateOpeningBalance(Account $account, TransactionJournal $openingBalance): void
|
||||
{
|
||||
/** @var Transaction $source */
|
||||
$source = $openingBalance->transactions()->where('amount', '<', 0)->first();
|
||||
|
@ -232,7 +232,7 @@ class GroupUpdateService
|
||||
);
|
||||
}
|
||||
$collection->each(
|
||||
static function (TransactionJournal $journal) use ($transactionGroup) {
|
||||
static function (TransactionJournal $journal) use ($transactionGroup): void {
|
||||
$transactionGroup->transactionJournals()->save($journal);
|
||||
}
|
||||
);
|
||||
|
@ -151,7 +151,7 @@ class RemoteUserGuard implements Guard
|
||||
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__));
|
||||
if ($user instanceof User) {
|
||||
@ -162,7 +162,7 @@ class RemoteUserGuard implements Guard
|
||||
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__));
|
||||
|
||||
|
@ -36,7 +36,7 @@ use Illuminate\Contracts\Auth\UserProvider;
|
||||
*/
|
||||
class RemoteUserProvider implements UserProvider
|
||||
{
|
||||
public function retrieveByCredentials(array $credentials)
|
||||
public function retrieveByCredentials(array $credentials): void
|
||||
{
|
||||
app('log')->debug(sprintf('Now at %s', __METHOD__));
|
||||
|
||||
@ -70,21 +70,21 @@ class RemoteUserProvider implements UserProvider
|
||||
return $user;
|
||||
}
|
||||
|
||||
public function retrieveByToken($identifier, $token)
|
||||
public function retrieveByToken($identifier, $token): void
|
||||
{
|
||||
app('log')->debug(sprintf('Now at %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__));
|
||||
|
||||
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__));
|
||||
|
||||
|
@ -36,7 +36,7 @@ class AuditLogger
|
||||
/**
|
||||
* Customize the given logger instance.
|
||||
*/
|
||||
public function __invoke(Logger $logger)
|
||||
public function __invoke(Logger $logger): void
|
||||
{
|
||||
$processor = new AuditProcessor();
|
||||
|
||||
|
@ -72,7 +72,7 @@ class AccountSearch implements GenericSearchInterface
|
||||
default:
|
||||
case self::SEARCH_ALL:
|
||||
$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->orWhere('accounts.name', 'LIKE', $like);
|
||||
$q->orWhere('accounts.iban', 'LIKE', $like);
|
||||
@ -80,7 +80,7 @@ class AccountSearch implements GenericSearchInterface
|
||||
);
|
||||
// meta data:
|
||||
$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);
|
||||
$q->where('account_meta.name', '=', 'account_number');
|
||||
$q->where('account_meta.data', 'LIKE', $json);
|
||||
@ -107,7 +107,7 @@ class AccountSearch implements GenericSearchInterface
|
||||
case self::SEARCH_NUMBER:
|
||||
// meta data:
|
||||
$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);
|
||||
$q->where('account_meta.name', 'account_number');
|
||||
$q->where('account_meta.data', $json);
|
||||
|
@ -158,7 +158,7 @@ trait RecurrenceValidation
|
||||
}
|
||||
}
|
||||
|
||||
public function validateRecurringConfig(Validator $validator)
|
||||
public function validateRecurringConfig(Validator $validator): void
|
||||
{
|
||||
$data = $validator->getData();
|
||||
$reps = array_key_exists('nr_of_repetitions', $data) ? (int)$data['nr_of_repetitions'] : null;
|
||||
|
Loading…
Reference in New Issue
Block a user