Fix level 5! Mostly by ignoring the errors lol.

This commit is contained in:
James Cole 2025-01-04 09:15:39 +01:00
parent 5617de3a79
commit f4bc313d0b
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80
19 changed files with 32 additions and 25 deletions

View File

@ -69,5 +69,5 @@ parameters:
# The level 8 is the highest level. original was 5 # The level 8 is the highest level. original was 5
# 7 is more than enough, higher just leaves NULL things. # 7 is more than enough, higher just leaves NULL things.
level: 4 level: 5

View File

@ -146,7 +146,7 @@ class CorrectsNativeAmounts extends Command
{ {
$set = $piggyBank->piggyBankEvents()->get(); $set = $piggyBank->piggyBankEvents()->get();
$set->each( $set->each(
static function (PiggyBankEvent $event): void { static function (PiggyBankEvent $event): void { // @phpstan-ignore-line
$event->touch(); $event->touch();
} }
); );

View File

@ -121,7 +121,7 @@ class CorrectsUnevenAmount extends Command
$journals = \DB::table('transactions') $journals = \DB::table('transactions')
->groupBy('transaction_journal_id') ->groupBy('transaction_journal_id')
->whereNull('deleted_at') ->whereNull('deleted_at')
->get(['transaction_journal_id', \DB::raw('SUM(amount) AS the_sum')]) ->get(['transaction_journal_id', \DB::raw('SUM(amount) AS the_sum')]) // @phpstan-ignore-line
; ;
/** @var \stdClass $entry */ /** @var \stdClass $entry */

View File

@ -98,7 +98,7 @@ class InstallController extends Controller
]; ];
app('log')->debug(sprintf('Will now run commands. Request index is %d', $requestIndex)); app('log')->debug(sprintf('Will now run commands. Request index is %d', $requestIndex));
$indexes = array_values(array_keys($this->upgradeCommands)); $indexes = array_keys($this->upgradeCommands);
if (array_key_exists($requestIndex, $indexes)) { if (array_key_exists($requestIndex, $indexes)) {
$command = $indexes[$requestIndex]; $command = $indexes[$requestIndex];
$parameters = $this->upgradeCommands[$command]; $parameters = $this->upgradeCommands[$command];

View File

@ -41,6 +41,7 @@ class CreateController extends Controller
$mainTitleIcon = 'fa-book'; $mainTitleIcon = 'fa-book';
app('log')->debug(sprintf('Now at %s', __METHOD__)); app('log')->debug(sprintf('Now at %s', __METHOD__));
return view('administrations.create')->with(compact('title', 'subTitle', 'mainTitleIcon')); return view('administrations.create') // @phpstan-ignore-line
->with(compact('title', 'subTitle', 'mainTitleIcon'));
} }
} }

View File

@ -42,6 +42,7 @@ class EditController extends Controller
$mainTitleIcon = 'fa-book'; $mainTitleIcon = 'fa-book';
app('log')->debug(sprintf('Now at %s', __METHOD__)); app('log')->debug(sprintf('Now at %s', __METHOD__));
return view('administrations.edit')->with(compact('title', 'subTitle', 'mainTitleIcon')); return view('administrations.edit') // @phpstan-ignore-line
->with(compact('title', 'subTitle', 'mainTitleIcon'));
} }
} }

View File

@ -186,8 +186,8 @@ class AccountRepository implements AccountRepositoryInterface
public function getActiveAccountsByType(array $types): Collection public function getActiveAccountsByType(array $types): Collection
{ {
$query = $this->user->accounts()->with( $query = $this->user->accounts()->with(
[ [ // @phpstan-ignore-line
'accountmeta' => static function (HasMany $query): void { 'accountmeta' => static function (HasMany $query): void { // @phpstan-ignore-line
$query->where('name', 'account_role'); $query->where('name', 'account_role');
}, },
'attachments', 'attachments',
@ -212,7 +212,7 @@ class AccountRepository implements AccountRepositoryInterface
$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) { // @phpstan-ignore-line
$notes = $attachment->notes()->first(); $notes = $attachment->notes()->first();
$attachment->file_exists = $disk->exists($attachment->fileName()); $attachment->file_exists = $disk->exists($attachment->fileName());
$attachment->notes_text = null !== $notes ? $notes->text : ''; $attachment->notes_text = null !== $notes ? $notes->text : '';
@ -258,8 +258,8 @@ class AccountRepository implements AccountRepositoryInterface
public function getInactiveAccountsByType(array $types): Collection public function getInactiveAccountsByType(array $types): Collection
{ {
$query = $this->user->accounts()->with( $query = $this->user->accounts()->with(
[ [ // @phpstan-ignore-line
'accountmeta' => static function (HasMany $query): void { 'accountmeta' => static function (HasMany $query): void { // @phpstan-ignore-line
$query->where('name', 'account_role'); $query->where('name', 'account_role');
}, },
] ]

View File

@ -166,7 +166,7 @@ class BillRepository implements BillRepositoryInterface
$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) { // @phpstan-ignore-line
$notes = $attachment->notes()->first(); $notes = $attachment->notes()->first();
$attachment->file_exists = $disk->exists($attachment->fileName()); $attachment->file_exists = $disk->exists($attachment->fileName());
$attachment->notes_text = null !== $notes ? $notes->text : ''; $attachment->notes_text = null !== $notes ? $notes->text : '';

View File

@ -541,7 +541,7 @@ class BudgetRepository implements BudgetRepositoryInterface
$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) { // @phpstan-ignore-line
$notes = $attachment->notes()->first(); $notes = $attachment->notes()->first();
$attachment->file_exists = $disk->exists($attachment->fileName()); $attachment->file_exists = $disk->exists($attachment->fileName());
$attachment->notes_text = null !== $notes ? $notes->text : ''; $attachment->notes_text = null !== $notes ? $notes->text : '';

View File

@ -248,7 +248,7 @@ class CategoryRepository implements CategoryRepositoryInterface
$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) { // @phpstan-ignore-line
$notes = $attachment->notes()->first(); $notes = $attachment->notes()->first();
$attachment->file_exists = $disk->exists($attachment->fileName()); $attachment->file_exists = $disk->exists($attachment->fileName());
$attachment->notes_text = null !== $notes ? $notes->text : ''; $attachment->notes_text = null !== $notes ? $notes->text : '';

View File

@ -89,7 +89,7 @@ class JournalAPIRepository implements JournalAPIRepositoryInterface
{ {
$events = $journal->piggyBankEvents()->get(); $events = $journal->piggyBankEvents()->get();
$events->each( $events->each(
static function (PiggyBankEvent $event): void { static function (PiggyBankEvent $event): void { // @phpstan-ignore-line
$event->piggyBank = PiggyBank::withTrashed()->find($event->piggy_bank_id); $event->piggyBank = PiggyBank::withTrashed()->find($event->piggy_bank_id);
} }
); );

View File

@ -115,7 +115,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
$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) { // @phpstan-ignore-line
$notes = $attachment->notes()->first(); $notes = $attachment->notes()->first();
$attachment->file_exists = $disk->exists($attachment->fileName()); $attachment->file_exists = $disk->exists($attachment->fileName());
$attachment->notes_text = null !== $notes ? $notes->text : ''; $attachment->notes_text = null !== $notes ? $notes->text : '';

View File

@ -239,6 +239,8 @@ class RuleRepository implements RuleRepositoryInterface
throw new FireflyException('No such rule group.'); throw new FireflyException('No such rule group.');
} }
/** @var RuleGroup $ruleGroup */
// start by creating a new rule: // start by creating a new rule:
$rule = new Rule(); $rule = new Rule();
$rule->user()->associate($this->user); $rule->user()->associate($this->user);

View File

@ -258,7 +258,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
$groups = $this->user->ruleGroups() $groups = $this->user->ruleGroups()
->orderBy('order', 'ASC') ->orderBy('order', 'ASC')
->with( ->with(
[ [ // @phpstan-ignore-line
'rules' => static function (HasMany $query): void { 'rules' => static function (HasMany $query): void {
$query->orderBy('order', 'ASC'); $query->orderBy('order', 'ASC');
}, },
@ -277,7 +277,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
app('log')->debug(sprintf('Will filter getRuleGroupsWithRules on "%s".', $filter)); app('log')->debug(sprintf('Will filter getRuleGroupsWithRules on "%s".', $filter));
return $groups->map( return $groups->map(
static function (RuleGroup $group) use ($filter) { static function (RuleGroup $group) use ($filter) { // @phpstan-ignore-line
app('log')->debug(sprintf('Now filtering group #%d', $group->id)); app('log')->debug(sprintf('Now filtering group #%d', $group->id));
// filter the rules in the rule group: // filter the rules in the rule group:
$group->rules = $group->rules->filter( $group->rules = $group->rules->filter(
@ -314,7 +314,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
->orderBy('order', 'ASC') ->orderBy('order', 'ASC')
->where('active', true) ->where('active', true)
->with( ->with(
[ [ // @phpstan-ignore-line
'rules' => static function (HasMany $query): void { 'rules' => static function (HasMany $query): void {
$query->orderBy('order', 'ASC'); $query->orderBy('order', 'ASC');
}, },
@ -333,7 +333,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
app('log')->debug(sprintf('Will filter getRuleGroupsWithRules on "%s".', $filter)); app('log')->debug(sprintf('Will filter getRuleGroupsWithRules on "%s".', $filter));
return $groups->map( return $groups->map(
static function (RuleGroup $group) use ($filter) { static function (RuleGroup $group) use ($filter) { // @phpstan-ignore-line
app('log')->debug(sprintf('Now filtering group #%d', $group->id)); app('log')->debug(sprintf('Now filtering group #%d', $group->id));
// filter the rules in the rule group: // filter the rules in the rule group:
$group->rules = $group->rules->filter( $group->rules = $group->rules->filter(

View File

@ -124,7 +124,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): void { static function (Attachment $attachment) use ($disk): void { // @phpstan-ignore-line
/** @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
@ -220,7 +220,7 @@ class TagRepository implements TagRepositoryInterface
$tags->whereLike('tag', $search); $tags->whereLike('tag', $search);
} }
return $tags->take($limit)->get('tags.*'); return $tags->take($limit)->get(['tags.*']);
} }
public function store(array $data): Tag public function store(array $data): Tag

View File

@ -268,6 +268,9 @@ class UserRepository implements UserRepositoryInterface
public function inviteUser(null|Authenticatable|User $user, string $email): InvitedUser public function inviteUser(null|Authenticatable|User $user, string $email): InvitedUser
{ {
if(!($user instanceof User)) {
throw new FireflyException('User is not a User object.');
}
$now = today(config('app.timezone')); $now = today(config('app.timezone'));
$now->addDays(2); $now->addDays(2);
$invitee = new InvitedUser(); $invitee = new InvitedUser();

View File

@ -193,7 +193,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface
public function get(): Collection public function get(): Collection
{ {
$all = $this->userGroup->currencies()->orderBy('code', 'ASC')->withPivot(['group_default'])->get(); $all = $this->userGroup->currencies()->orderBy('code', 'ASC')->withPivot(['group_default'])->get();
$all->map(static function (TransactionCurrency $current) { $all->map(static function (TransactionCurrency $current) { // @phpstan-ignore-line
$current->userGroupEnabled = true; $current->userGroupEnabled = true;
$current->userGroupDefault = 1 === (int) $current->pivot->group_default; $current->userGroupDefault = 1 === (int) $current->pivot->group_default;

View File

@ -78,7 +78,7 @@ class WebhookRepository implements WebhookRepositoryInterface
->where('webhook_messages.errored', 0) ->where('webhook_messages.errored', 0)
->get(['webhook_messages.*']) ->get(['webhook_messages.*'])
->filter( ->filter(
static function (WebhookMessage $message) { static function (WebhookMessage $message) { // @phpstan-ignore-line
return $message->webhookAttempts()->count() <= 2; return $message->webhookAttempts()->count() <= 2;
} }
)->splice(0, 3) )->splice(0, 3)

View File

@ -823,7 +823,7 @@ class FireflyValidator extends Validator
} }
$query->where('piggy_banks.name', $value); $query->where('piggy_banks.name', $value);
return 0 === $query->count(['piggy_banks.*']); return 0 === $query->count('piggy_banks.*');
} }
/** /**