diff --git a/.ci/phpstan.neon b/.ci/phpstan.neon index b98f1857f3..67f32eff3e 100644 --- a/.ci/phpstan.neon +++ b/.ci/phpstan.neon @@ -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. diff --git a/app/Api/V1/Controllers/Models/Transaction/StoreController.php b/app/Api/V1/Controllers/Models/Transaction/StoreController.php index 613ecef4d3..5e42c1e744 100644 --- a/app/Api/V1/Controllers/Models/Transaction/StoreController.php +++ b/app/Api/V1/Controllers/Models/Transaction/StoreController.php @@ -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; diff --git a/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php b/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php index c96e04ff98..7b094c96c7 100644 --- a/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php +++ b/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php @@ -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) { diff --git a/app/Api/V2/Controllers/Model/Transaction/StoreController.php b/app/Api/V2/Controllers/Model/Transaction/StoreController.php index d41596d714..70988387b1 100644 --- a/app/Api/V2/Controllers/Model/Transaction/StoreController.php +++ b/app/Api/V2/Controllers/Model/Transaction/StoreController.php @@ -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; diff --git a/app/Console/Commands/System/ForcesDecimalSize.php b/app/Console/Commands/System/ForcesDecimalSize.php index 4605fee6c1..a774b5e8de 100644 --- a/app/Console/Commands/System/ForcesDecimalSize.php +++ b/app/Console/Commands/System/ForcesDecimalSize.php @@ -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)) ); diff --git a/app/Factory/TransactionJournalFactory.php b/app/Factory/TransactionJournalFactory.php index d2d0d50fda..ff0af908cc 100644 --- a/app/Factory/TransactionJournalFactory.php +++ b/app/Factory/TransactionJournalFactory.php @@ -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)); diff --git a/app/Handlers/Events/APIEventHandler.php b/app/Handlers/Events/APIEventHandler.php index 79f3bfe22e..cad6117f7a 100644 --- a/app/Handlers/Events/APIEventHandler.php +++ b/app/Handlers/Events/APIEventHandler.php @@ -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.'); diff --git a/app/Handlers/Events/AdminEventHandler.php b/app/Handlers/Events/AdminEventHandler.php index 9f622d6fd5..3121a569c9 100644 --- a/app/Handlers/Events/AdminEventHandler.php +++ b/app/Handlers/Events/AdminEventHandler.php @@ -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.'); diff --git a/app/Handlers/Events/AutomationHandler.php b/app/Handlers/Events/AutomationHandler.php index edb48fe6c4..4d5b4e8006 100644 --- a/app/Handlers/Events/AutomationHandler.php +++ b/app/Handlers/Events/AutomationHandler.php @@ -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.'); diff --git a/app/Handlers/Events/BillEventHandler.php b/app/Handlers/Events/BillEventHandler.php index 7d87e6727f..b600fe2dbe 100644 --- a/app/Handlers/Events/BillEventHandler.php +++ b/app/Handlers/Events/BillEventHandler.php @@ -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.'); diff --git a/app/Handlers/Events/Security/MFAHandler.php b/app/Handlers/Events/Security/MFAHandler.php index 1320ac2080..9b24cc0495 100644 --- a/app/Handlers/Events/Security/MFAHandler.php +++ b/app/Handlers/Events/Security/MFAHandler.php @@ -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.'); diff --git a/app/Handlers/Events/UserEventHandler.php b/app/Handlers/Events/UserEventHandler.php index 76fe89588d..62643d884e 100644 --- a/app/Handlers/Events/UserEventHandler.php +++ b/app/Handlers/Events/UserEventHandler.php @@ -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.'); diff --git a/app/Helpers/Collector/GroupCollector.php b/app/Helpers/Collector/GroupCollector.php index 5c0c176afd..8b330ce8ca 100644 --- a/app/Helpers/Collector/GroupCollector.php +++ b/app/Helpers/Collector/GroupCollector.php @@ -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) { diff --git a/app/Http/Controllers/DebugController.php b/app/Http/Controllers/DebugController.php index 11599e1a09..94053a0b95 100644 --- a/app/Http/Controllers/DebugController.php +++ b/app/Http/Controllers/DebugController.php @@ -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()); } diff --git a/app/Jobs/MailError.php b/app/Jobs/MailError.php index 16c9ad02a1..72e45fa30e 100644 --- a/app/Jobs/MailError.php +++ b/app/Jobs/MailError.php @@ -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.'); diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php index cfaf7463d5..7566f3bdeb 100644 --- a/app/Repositories/Account/AccountRepository.php +++ b/app/Repositories/Account/AccountRepository.php @@ -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 { diff --git a/app/Repositories/AuditLogEntry/ALERepository.php b/app/Repositories/AuditLogEntry/ALERepository.php index 92b84f9e37..02f60db94e 100644 --- a/app/Repositories/AuditLogEntry/ALERepository.php +++ b/app/Repositories/AuditLogEntry/ALERepository.php @@ -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 diff --git a/app/Repositories/Budget/AvailableBudgetRepository.php b/app/Repositories/Budget/AvailableBudgetRepository.php index e9f604a5e4..fd9f1f4d5b 100644 --- a/app/Repositories/Budget/AvailableBudgetRepository.php +++ b/app/Repositories/Budget/AvailableBudgetRepository.php @@ -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')); } diff --git a/app/Repositories/Budget/BudgetLimitRepository.php b/app/Repositories/Budget/BudgetLimitRepository.php index 59faf9ae5c..19822fb4c7 100644 --- a/app/Repositories/Budget/BudgetLimitRepository.php +++ b/app/Repositories/Budget/BudgetLimitRepository.php @@ -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 diff --git a/app/Repositories/TransactionGroup/TransactionGroupRepository.php b/app/Repositories/TransactionGroup/TransactionGroupRepository.php index 21e95f023f..88b64dd255 100644 --- a/app/Repositories/TransactionGroup/TransactionGroupRepository.php +++ b/app/Repositories/TransactionGroup/TransactionGroupRepository.php @@ -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, ]; diff --git a/app/Repositories/UserGroups/Account/AccountRepository.php b/app/Repositories/UserGroups/Account/AccountRepository.php index 3811e3293c..6e70c4cf94 100644 --- a/app/Repositories/UserGroups/Account/AccountRepository.php +++ b/app/Repositories/UserGroups/Account/AccountRepository.php @@ -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); diff --git a/app/Rules/IsDateOrTime.php b/app/Rules/IsDateOrTime.php index f976cdaac8..209d64ce12 100644 --- a/app/Rules/IsDateOrTime.php +++ b/app/Rules/IsDateOrTime.php @@ -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(); diff --git a/app/Rules/ValidRecurrenceRepetitionValue.php b/app/Rules/ValidRecurrenceRepetitionValue.php index 73353560e9..71576e9cf1 100644 --- a/app/Rules/ValidRecurrenceRepetitionValue.php +++ b/app/Rules/ValidRecurrenceRepetitionValue.php @@ -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; diff --git a/app/Support/ExpandedForm.php b/app/Support/ExpandedForm.php index 737c41a081..f5cbb3b6e1 100644 --- a/app/Support/ExpandedForm.php +++ b/app/Support/ExpandedForm.php @@ -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) { diff --git a/app/Support/Navigation.php b/app/Support/Navigation.php index fa3e4bff73..5e66d680fc 100644 --- a/app/Support/Navigation.php +++ b/app/Support/Navigation.php @@ -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]); } diff --git a/app/Support/ParseDateString.php b/app/Support/ParseDateString.php index 8cfee34c10..6ddde18a15 100644 --- a/app/Support/ParseDateString.php +++ b/app/Support/ParseDateString.php @@ -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) { diff --git a/app/Support/Search/AccountSearch.php b/app/Support/Search/AccountSearch.php index 6ff1a42d0c..ec5ef15e58 100644 --- a/app/Support/Search/AccountSearch.php +++ b/app/Support/Search/AccountSearch.php @@ -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);