Level 7 yay!

This commit is contained in:
James Cole
2025-01-04 19:43:58 +01:00
parent 1aa8ebe57f
commit 0f69e0d672
27 changed files with 76 additions and 76 deletions

View File

@@ -10,7 +10,7 @@ parameters:
universalObjectCratesClasses:
- Illuminate\Database\Eloquent\Model
# TODO: slowly remove these parameters and fix the issues found.
reportUnmatchedIgnoredErrors: false
reportUnmatchedIgnoredErrors: true
ignoreErrors:
# TODO: slowly remove these exceptions and fix the issues found.
- '#Dynamic call to static method#' # all the Laravel ORM things depend on this.

View File

@@ -88,21 +88,21 @@ class StoreController extends Controller
try {
$transactionGroup = $this->groupRepository->store($data);
} catch (DuplicateTransactionException $e) { // @phpstan-ignore-line
} catch (DuplicateTransactionException $e) {
app('log')->warning('Caught a duplicate transaction. Return error message.');
$validator = \Validator::make(
['transactions' => [['description' => $e->getMessage()]]],
['transactions.0.description' => new IsDuplicateTransaction()]
);
throw new ValidationException($validator); // @phpstan-ignore-line
} catch (FireflyException $e) { // @phpstan-ignore-line
throw new ValidationException($validator);
} catch (FireflyException $e) {
app('log')->warning('Caught an exception. Return error message.');
app('log')->error($e->getMessage());
$message = sprintf('Internal exception: %s', $e->getMessage());
$validator = \Validator::make(['transactions' => [['description' => $message]]], ['transactions.0.description' => new IsDuplicateTransaction()]);
throw new ValidationException($validator); // @phpstan-ignore-line
throw new ValidationException($validator);
}
app('preferences')->mark();
$applyRules = $data['apply_rules'] ?? true;

View File

@@ -239,7 +239,7 @@ class ListController extends Controller
$unfiltered = $recurringRepos->getAll();
// filter selection
$collection = $unfiltered->filter( // @phpstan-ignore-line
$collection = $unfiltered->filter(
static function (Recurrence $recurrence) use ($currency) { // @phpstan-ignore-line
/** @var RecurrenceTransaction $transaction */
foreach ($recurrence->recurrenceTransactions as $transaction) {
@@ -286,7 +286,7 @@ class ListController extends Controller
$ruleRepos = app(RuleRepositoryInterface::class);
$unfiltered = $ruleRepos->getAll();
$collection = $unfiltered->filter( // @phpstan-ignore-line
$collection = $unfiltered->filter(
static function (Rule $rule) use ($currency) { // @phpstan-ignore-line
/** @var RuleTrigger $trigger */
foreach ($rule->ruleTriggers as $trigger) {

View File

@@ -80,21 +80,21 @@ class StoreController extends Controller
try {
$transactionGroup = $this->groupRepository->store($data);
} catch (DuplicateTransactionException $e) { // @phpstan-ignore-line
} catch (DuplicateTransactionException $e) {
app('log')->warning('Caught a duplicate transaction. Return error message.');
$validator = Validator::make(
['transactions' => [['description' => $e->getMessage()]]],
['transactions.0.description' => new IsDuplicateTransaction()]
);
throw new ValidationException($validator); // @phpstan-ignore-line
} catch (FireflyException $e) { // @phpstan-ignore-line
throw new ValidationException($validator);
} catch (FireflyException $e) {
app('log')->warning('Caught an exception. Return error message.');
app('log')->error($e->getMessage());
$message = sprintf('Internal exception: %s', $e->getMessage());
$validator = Validator::make(['transactions' => [['description' => $message]]], ['transactions.0.description' => new IsDuplicateTransaction()]);
throw new ValidationException($validator); // @phpstan-ignore-line
throw new ValidationException($validator);
}
app('preferences')->mark();
$applyRules = $data['apply_rules'] ?? true;

View File

@@ -173,7 +173,7 @@ class ForcesDecimalSize extends Command
* @var array $fields
*/
foreach ($this->tables as $name => $fields) {
switch ($name) { // @phpstan-ignore-line
switch ($name) {
default:
$message = sprintf('Cannot handle table "%s"', $name);
$this->friendlyError($message);
@@ -239,7 +239,7 @@ class ForcesDecimalSize extends Command
$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
DB::raw(sprintf('CAST(accounts.%s AS %s)', $field, $cast)),
$operator,
DB::raw(sprintf($regularExpression, $currency->decimal_places))
);
@@ -288,7 +288,7 @@ class ForcesDecimalSize extends Command
/** @var string $field */
foreach ($fields as $field) {
$q->orWhere(
DB::raw(sprintf('CAST(%s AS %s)', $field, $cast)), // @phpstan-ignore-line
DB::raw(sprintf('CAST(%s AS %s)', $field, $cast)),
$operator,
DB::raw(sprintf($regularExpression, $currency->decimal_places))
);
@@ -340,7 +340,7 @@ class ForcesDecimalSize extends Command
->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
DB::raw(sprintf('CAST(piggy_bank_events.%s AS %s)', $field, $cast)),
$operator,
DB::raw(sprintf($regularExpression, $currency->decimal_places))
);
@@ -395,7 +395,7 @@ class ForcesDecimalSize extends Command
->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
DB::raw(sprintf('CAST(piggy_bank_repetitions.%s AS %s)', $field, $cast)),
$operator,
DB::raw(sprintf($regularExpression, $currency->decimal_places))
);
@@ -448,7 +448,7 @@ class ForcesDecimalSize extends Command
->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
DB::raw(sprintf('CAST(piggy_banks.%s AS %s)', $field, $cast)),
$operator,
DB::raw(sprintf($regularExpression, $currency->decimal_places))
);
@@ -490,7 +490,7 @@ class ForcesDecimalSize extends Command
// select all transactions with this currency and issue.
/** @var Builder $query */
$query = Transaction::where('transaction_currency_id', $currency->id)->where(
DB::raw(sprintf('CAST(amount as %s)', $this->cast)), // @phpstan-ignore-line
DB::raw(sprintf('CAST(amount as %s)', $this->cast)),
$this->operator,
DB::raw(sprintf($this->regularExpression, $currency->decimal_places))
);
@@ -518,7 +518,7 @@ class ForcesDecimalSize extends Command
// select all transactions with this FOREIGN currency and issue.
/** @var Builder $query */
$query = Transaction::where('foreign_currency_id', $currency->id)->where(
DB::raw(sprintf('CAST(foreign_amount as %s)', $this->cast)), // @phpstan-ignore-line
DB::raw(sprintf('CAST(foreign_amount as %s)', $this->cast)),
$this->operator,
DB::raw(sprintf($this->regularExpression, $currency->decimal_places))
);

View File

@@ -422,7 +422,7 @@ class TransactionJournalFactory
return [$sourceAccount, $destinationAccount];
}
if (null === $destinationAccount) { // @phpstan-ignore-line
if (null === $destinationAccount) {
app('log')->debug('Destination account is NULL, source account is not.');
$account = $this->accountRepository->getReconciliation($sourceAccount);
app('log')->debug(sprintf('Will return account #%d ("%s") of type "%s"', $account->id, $account->name, $account->accountType->type));

View File

@@ -48,7 +48,7 @@ class APIEventHandler
if (null !== $user) {
try {
Notification::send($user, new NewAccessToken());
} catch (\Exception $e) { // @phpstan-ignore-line
} catch (\Exception $e) {
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');

View File

@@ -52,7 +52,7 @@ class AdminEventHandler
try {
Notification::send(new OwnerNotifiable(), new UserInvitation($event->invitee));
} catch (\Exception $e) { // @phpstan-ignore-line
} catch (\Exception $e) {
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
@@ -74,7 +74,7 @@ class AdminEventHandler
try {
$owner = new OwnerNotifiable();
Notification::send($owner, new UnknownUserLoginAttempt($event->address));
} catch (\Exception $e) { // @phpstan-ignore-line
} catch (\Exception $e) {
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
@@ -104,7 +104,7 @@ class AdminEventHandler
try {
$owner = new OwnerNotifiable();
Notification::send($owner, new VersionCheckResult($event->message));
} catch (\Exception $e) {// @phpstan-ignore-line
} catch (\Exception $e) {
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
@@ -158,7 +158,7 @@ class AdminEventHandler
try {
Notification::send($event->owner, new $class());
} catch (\Exception $e) { // @phpstan-ignore-line
} catch (\Exception $e) {
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');

View File

@@ -78,7 +78,7 @@ class AutomationHandler
try {
Notification::send($user, new TransactionCreation($groups));
} catch (\Exception $e) { // @phpstan-ignore-line
} catch (\Exception $e) {
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');

View File

@@ -47,7 +47,7 @@ class BillEventHandler
try {
Notification::send($bill->user, new BillReminder($bill, $event->field, $event->diff));
} catch (\Exception $e) { // @phpstan-ignore-line
} catch (\Exception $e) {
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');

View File

@@ -51,7 +51,7 @@ class MFAHandler
try {
Notification::send($user, new MFABackupFewLeftNotification($user, $count));
} catch (\Exception $e) { // @phpstan-ignore-line
} catch (\Exception $e) {
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
@@ -76,7 +76,7 @@ class MFAHandler
try {
Notification::send($user, new MFABackupNoLeftNotification($user));
} catch (\Exception $e) { // @phpstan-ignore-line
} catch (\Exception $e) {
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
@@ -101,7 +101,7 @@ class MFAHandler
try {
Notification::send($user, new DisabledMFANotification($user));
} catch (\Exception $e) { // @phpstan-ignore-line
} catch (\Exception $e) {
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
@@ -126,7 +126,7 @@ class MFAHandler
try {
Notification::send($user, new EnabledMFANotification($user));
} catch (\Exception $e) { // @phpstan-ignore-line
} catch (\Exception $e) {
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
@@ -152,7 +152,7 @@ class MFAHandler
try {
Notification::send($user, new MFAManyFailedAttemptsNotification($user, $count));
} catch (\Exception $e) { // @phpstan-ignore-line
} catch (\Exception $e) {
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
@@ -177,7 +177,7 @@ class MFAHandler
try {
Notification::send($user, new NewBackupCodesNotification($user));
} catch (\Exception $e) { // @phpstan-ignore-line
} catch (\Exception $e) {
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
@@ -202,7 +202,7 @@ class MFAHandler
try {
Notification::send($user, new MFAUsedBackupCodeNotification($user));
} catch (\Exception $e) { // @phpstan-ignore-line
} catch (\Exception $e) {
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');

View File

@@ -203,7 +203,7 @@ class UserEventHandler
if (false === $entry['notified']) {
try {
Notification::send($user, new UserLogin());
} catch (\Exception $e) { // @phpstan-ignore-line
} catch (\Exception $e) {
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
@@ -233,7 +233,7 @@ class UserEventHandler
try {
Notification::send($owner, new AdminRegistrationNotification($event->user));
} catch (\Exception $e) { // @phpstan-ignore-line
} catch (\Exception $e) {
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
@@ -304,7 +304,7 @@ class UserEventHandler
{
try {
Notification::send($event->user, new UserFailedLoginAttempt($event->user));
} catch (\Exception $e) { // @phpstan-ignore-line
} catch (\Exception $e) {
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
@@ -328,7 +328,7 @@ class UserEventHandler
{
try {
Notification::send($event->user, new UserNewPassword(route('password.reset', [$event->token])));
} catch (\Exception $e) { // @phpstan-ignore-line
} catch (\Exception $e) {
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
@@ -374,7 +374,7 @@ class UserEventHandler
if ($sendMail) {
try {
Notification::send($event->user, new UserRegistrationNotification());
} catch (\Exception $e) { // @phpstan-ignore-line
} catch (\Exception $e) {
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');
@@ -429,7 +429,7 @@ class UserEventHandler
try {
Notification::send($event->user, new $class());
} catch (\Exception $e) { // @phpstan-ignore-line
} catch (\Exception $e) {
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');

View File

@@ -155,7 +155,7 @@ class GroupCollector implements GroupCollectorInterface
public function descriptionDoesNotEnd(array $array): GroupCollectorInterface
{
$this->query->where(
static function (EloquentBuilder $q) use ($array): void { // @phpstan-ignore-line
static function (EloquentBuilder $q) use ($array): void {
$q->where(
static function (EloquentBuilder $q1) use ($array): void {
foreach ($array as $word) {
@@ -182,7 +182,7 @@ class GroupCollector implements GroupCollectorInterface
public function descriptionDoesNotStart(array $array): GroupCollectorInterface
{
$this->query->where(
static function (EloquentBuilder $q) use ($array): void { // @phpstan-ignore-line
static function (EloquentBuilder $q) use ($array): void {
$q->where(
static function (EloquentBuilder $q1) use ($array): void {
foreach ($array as $word) {
@@ -209,7 +209,7 @@ class GroupCollector implements GroupCollectorInterface
public function descriptionEnds(array $array): GroupCollectorInterface
{
$this->query->where(
static function (EloquentBuilder $q) use ($array): void { // @phpstan-ignore-line
static function (EloquentBuilder $q) use ($array): void {
$q->where(
static function (EloquentBuilder $q1) use ($array): void {
foreach ($array as $word) {
@@ -235,7 +235,7 @@ class GroupCollector implements GroupCollectorInterface
public function descriptionIs(string $value): GroupCollectorInterface
{
$this->query->where(
static function (EloquentBuilder $q) use ($value): void { // @phpstan-ignore-line
static function (EloquentBuilder $q) use ($value): void {
$q->where('transaction_journals.description', '=', $value);
$q->orWhere('transaction_groups.title', '=', $value);
}
@@ -247,7 +247,7 @@ class GroupCollector implements GroupCollectorInterface
public function descriptionIsNot(string $value): GroupCollectorInterface
{
$this->query->where(
static function (EloquentBuilder $q) use ($value): void { // @phpstan-ignore-line
static function (EloquentBuilder $q) use ($value): void {
$q->where('transaction_journals.description', '!=', $value);
$q->where(
static function (EloquentBuilder $q2) use ($value): void {
@@ -264,7 +264,7 @@ class GroupCollector implements GroupCollectorInterface
public function descriptionStarts(array $array): GroupCollectorInterface
{
$this->query->where(
static function (EloquentBuilder $q) use ($array): void { // @phpstan-ignore-line
static function (EloquentBuilder $q) use ($array): void {
$q->where(
static function (EloquentBuilder $q1) use ($array): void {
foreach ($array as $word) {
@@ -320,7 +320,7 @@ class GroupCollector implements GroupCollectorInterface
public function excludeCurrency(TransactionCurrency $currency): GroupCollectorInterface
{
$this->query->where(
static function (EloquentBuilder $q) use ($currency): void { // @phpstan-ignore-line
static function (EloquentBuilder $q) use ($currency): void {
$q->where('source.transaction_currency_id', '!=', $currency->id);
$q->where(
static function (EloquentBuilder $q2) use ($currency): void {
@@ -378,7 +378,7 @@ class GroupCollector implements GroupCollectorInterface
return $this;
}
$this->query->where(
static function (EloquentBuilder $q) use ($array): void { // @phpstan-ignore-line
static function (EloquentBuilder $q) use ($array): void {
$q->where(
static function (EloquentBuilder $q1) use ($array): void {
foreach ($array as $word) {
@@ -515,7 +515,7 @@ class GroupCollector implements GroupCollectorInterface
'user_id' => $augumentedJournal->user_id,
'user_group_id' => $augumentedJournal->user_group_id,
// Field transaction_group_title was added by the query.
'title' => $augumentedJournal->transaction_group_title, // @phpstan-ignore-line
'title' => $augumentedJournal->transaction_group_title,
'created_at' => new Carbon($augumentedJournal->group_created_at, config('app.timezone')),
'updated_at' => new Carbon($augumentedJournal->group_updated_at, config('app.timezone')),
'transaction_type' => $parsedGroup['transaction_type_type'],
@@ -524,7 +524,7 @@ class GroupCollector implements GroupCollectorInterface
'transactions' => [],
];
// Field transaction_journal_id was added by the query.
$journalId = (int) $augumentedJournal->transaction_journal_id; // @phpstan-ignore-line
$journalId = (int) $augumentedJournal->transaction_journal_id;
$groupArray['transactions'][$journalId] = $parsedGroup;
$groups[$groupId] = $groupArray;
@@ -532,7 +532,7 @@ class GroupCollector implements GroupCollectorInterface
}
// or parse the rest.
// Field transaction_journal_id was added by the query.
$journalId = (int) $augumentedJournal->transaction_journal_id; // @phpstan-ignore-line
$journalId = (int) $augumentedJournal->transaction_journal_id;
if (array_key_exists($journalId, $groups[$groupId]['transactions'])) {
// append data to existing group + journal (for multiple tags or multiple attachments)
$groups[$groupId]['transactions'][$journalId] = $this->mergeTags($groups[$groupId]['transactions'][$journalId], $augumentedJournal);
@@ -865,7 +865,7 @@ class GroupCollector implements GroupCollectorInterface
public function setCurrency(TransactionCurrency $currency): GroupCollectorInterface
{
$this->query->where(
static function (EloquentBuilder $q) use ($currency): void { // @phpstan-ignore-line
static function (EloquentBuilder $q) use ($currency): void {
$q->where('source.transaction_currency_id', $currency->id);
$q->orWhere('source.foreign_currency_id', $currency->id);
}
@@ -952,7 +952,7 @@ class GroupCollector implements GroupCollectorInterface
return $this;
}
$this->query->where(
static function (EloquentBuilder $q) use ($array): void { // @phpstan-ignore-line
static function (EloquentBuilder $q) use ($array): void {
$q->where(
static function (EloquentBuilder $q1) use ($array): void {
foreach ($array as $word) {

View File

@@ -258,7 +258,7 @@ class DebugController extends Controller
$return['build'] = trim((string) file_get_contents('/var/www/counter-main.txt'));
app('log')->debug(sprintf('build is now "%s"', $return['build']));
}
} catch (\Exception $e) { // @phpstan-ignore-line
} catch (\Exception $e) {
app('log')->debug('Could not check build counter, but thats ok.');
app('log')->warning($e->getMessage());
}
@@ -267,7 +267,7 @@ class DebugController extends Controller
if (file_exists('/var/www/build-date-main.txt')) {
$return['build_date'] = trim((string) file_get_contents('/var/www/build-date-main.txt'));
}
} catch (\Exception $e) { // @phpstan-ignore-line
} catch (\Exception $e) {
app('log')->debug('Could not check build date, but thats ok.');
app('log')->warning($e->getMessage());
}

View File

@@ -88,7 +88,7 @@ class MailError extends Job implements ShouldQueue
}
}
);
} catch (\Exception|TransportException $e) { // @phpstan-ignore-line
} catch (\Exception|TransportException $e) {
$message = $e->getMessage();
if (str_contains($message, 'Bcc')) {
app('log')->warning('[Bcc] Could not email or log the error. Please validate your email settings, use the .env.example file as a guide.');

View File

@@ -107,7 +107,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): void { // @phpstan-ignore-line
static function (EloquentBuilder $q1) use ($number): void {
$json = json_encode($number);
$q1->where('account_meta.name', '=', 'account_number');
$q1->where('account_meta.data', '=', $json);
@@ -188,7 +188,7 @@ class AccountRepository implements AccountRepositoryInterface
{
$query = $this->user->accounts()->with(
[ // @phpstan-ignore-line
'accountmeta' => static function (HasMany $query): void { // @phpstan-ignore-line
'accountmeta' => static function (HasMany $query): void {
$query->where('name', 'account_role');
},
'attachments',
@@ -260,7 +260,7 @@ class AccountRepository implements AccountRepositoryInterface
{
$query = $this->user->accounts()->with(
[ // @phpstan-ignore-line
'accountmeta' => static function (HasMany $query): void { // @phpstan-ignore-line
'accountmeta' => static function (HasMany $query): void {
$query->where('name', 'account_role');
},
]
@@ -617,7 +617,7 @@ class AccountRepository implements AccountRepositoryInterface
foreach ($parts as $part) {
$search = sprintf('%%%s%%', $part);
$dbQuery->where(
static function (EloquentBuilder $q1) use ($search): void { // @phpstan-ignore-line
static function (EloquentBuilder $q1) use ($search): void {
$q1->whereLike('accounts.iban', $search);
$q1->orWhere(
static function (EloquentBuilder $q2) use ($search): void {

View File

@@ -36,7 +36,7 @@ class ALERepository implements ALERepositoryInterface
public function getForObject(Model $model): Collection
{
// all Models have an ID.
return AuditLogEntry::where('auditable_id', $model->id)->where('auditable_type', get_class($model))->get(); // @phpstan-ignore-line
return AuditLogEntry::where('auditable_id', $model->id)->where('auditable_type', get_class($model))->get();
}
public function store(array $data): AuditLogEntry

View File

@@ -67,7 +67,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): void { // @phpstan-ignore-line
static function (Builder $q1) use ($start, $end): void {
$q1->where('start_date', '=', $start->format('Y-m-d'));
$q1->where('end_date', '=', $end->format('Y-m-d'));
}

View File

@@ -223,7 +223,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface
// when both dates are set:
return $budget->budgetlimits()
->where(
static function (Builder $q5) use ($start, $end): void { // @phpstan-ignore-line
static function (Builder $q5) use ($start, $end): void {
$q5->where(
static function (Builder $q1) use ($start, $end): void {
// budget limit ends within period

View File

@@ -156,7 +156,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface
$current['file_exists'] = true;
$current['notes'] = $repository->getNoteText($attachment);
// already determined that this attachable is a TransactionJournal.
$current['journal_title'] = $attachment->attachable->description; // @phpstan-ignore-line
$current['journal_title'] = $attachment->attachable->description;
$result[$journalId][] = $current;
}
@@ -220,7 +220,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface
'link' => $entry->outward,
'group' => $entry->destination->transaction_group_id,
'description' => $entry->destination->description,
'editable' => 1 === (int) $entry->editable, // @phpstan-ignore-line
'editable' => 1 === (int) $entry->editable,
'amount' => $amount,
'foreign_amount' => $foreignAmount,
];
@@ -233,7 +233,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface
'link' => $entry->inward,
'group' => $entry->source->transaction_group_id,
'description' => $entry->source->description,
'editable' => 1 === (int) $entry->editable, // @phpstan-ignore-line
'editable' => 1 === (int) $entry->editable,
'amount' => $amount,
'foreign_amount' => $foreignAmount,
];

View File

@@ -63,7 +63,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): void { // @phpstan-ignore-line
static function (EloquentBuilder $q1) use ($number): void {
$json = json_encode($number);
$q1->where('account_meta.name', '=', 'account_number');
$q1->where('account_meta.data', '=', $json);

View File

@@ -55,7 +55,7 @@ class IsDateOrTime implements ValidationRule
$fail('validation.date_or_time')->translate();
return;
} catch (InvalidFormatException $e) { // @phpstan-ignore-line
} catch (InvalidFormatException $e) {
app('log')->error(sprintf('"%s" is of an invalid format: %s', $value, $e->getMessage()));
$fail('validation.date_or_time')->translate();

View File

@@ -102,7 +102,7 @@ class ValidRecurrenceRepetitionValue implements ValidationRule
try {
Carbon::createFromFormat('Y-m-d', $dateString);
} catch (\InvalidArgumentException $e) { // @phpstan-ignore-line
} catch (\InvalidArgumentException $e) {
app('log')->debug(sprintf('Could not parse date %s: %s', $dateString, $e->getMessage()));
return false;

View File

@@ -208,7 +208,7 @@ class ExpandedForm
/** @var \Eloquent $entry */
foreach ($set as $entry) {
// All Eloquent models have an ID
$entryId = $entry->id; // @phpstan-ignore-line
$entryId = $entry->id;
$current = $entry->toArray();
$title = null;
foreach ($fields as $field) {

View File

@@ -93,7 +93,7 @@ class Navigation
return $this->calculator->nextDateByInterval($epoch, $periodicity, $skipInterval);
} catch (IntervalException $exception) {
Log::warning($exception->getMessage(), ['exception' => $exception]);
} catch (\Throwable $exception) { // @phpstan-ignore-line
} catch (\Throwable $exception) {
Log::error($exception->getMessage(), ['exception' => $exception]);
}

View File

@@ -123,7 +123,7 @@ class ParseDateString
{
$today = today(config('app.timezone'))->startOfDay();
return match ($keyword) { // @phpstan-ignore-line
return match ($keyword) {
default => $today,
'yesterday' => $today->subDay(),
'tomorrow' => $today->addDay(),
@@ -144,7 +144,7 @@ class ParseDateString
try {
$result = Carbon::createFromFormat('Y-m-d', $date);
} catch (InvalidFormatException $e) { // @phpstan-ignore-line
} catch (InvalidFormatException $e) {
Log::error(sprintf('parseDefaultDate("%s") ran into an error, but dont mind: %s', $date, $e->getMessage()));
}
if (false === $result) {

View File

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