diff --git a/.ci/phpstan.neon b/.ci/phpstan.neon index 06b38ad022..bf3cd4402c 100644 --- a/.ci/phpstan.neon +++ b/.ci/phpstan.neon @@ -1,4 +1,29 @@ parameters: + ergebnis: + noExtends: + enabled: false + final: + enabled: false + noParameterWithNullDefaultValue: + enabled: false + noParameterWithNullableTypeDeclaration: + enabled: false + noCompact: + enabled: false + noSwitch: + enabled: false + noNullableReturnTypeDeclaration: + enabled: false + privateInFinalClass: + enabled: false + noIsset: + enabled: false + finalInAbstractClass: + enabled: false + noConstructorParameterWithDefaultValue: + enabled: false + noNamedArgument: + enabled: false paths: - ../app - ../database diff --git a/app/Api/V1/Controllers/Controller.php b/app/Api/V1/Controllers/Controller.php index 28fd0308df..dd8fb72d3b 100644 --- a/app/Api/V1/Controllers/Controller.php +++ b/app/Api/V1/Controllers/Controller.php @@ -224,7 +224,7 @@ abstract class Controller extends BaseController } if ( null === $value - && 'limit' === $integer // @phpstan-ignore-line + && 'limit' === $integer && auth()->check() ) { // set default for user: diff --git a/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php b/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php index 6b9a9505a7..8d67a2bced 100644 --- a/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php +++ b/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php @@ -256,7 +256,7 @@ final class ListController extends Controller $unfiltered = $recurringRepos->get(); // filter selection - $collection = $unfiltered->filter(static function (Recurrence $recurrence) use ($currency): null|Recurrence { // @phpstan-ignore-line + $collection = $unfiltered->filter(static function (Recurrence $recurrence) use ($currency): null|Recurrence { if (array_any( $recurrence->recurrenceTransactions, static fn ($transaction): bool => $transaction->transaction_currency_id === $currency->id || $transaction->foreign_currency_id === $currency->id @@ -306,7 +306,7 @@ final class ListController extends Controller $ruleRepos = app(RuleRepositoryInterface::class); $unfiltered = $ruleRepos->getAll(); - $collection = $unfiltered->filter(static function (Rule $rule) use ($currency): null|Rule { // @phpstan-ignore-line + $collection = $unfiltered->filter(static function (Rule $rule) use ($currency): null|Rule { if (array_any( $rule->ruleTriggers, static fn ($trigger): bool => 'currency_is' === $trigger->trigger_type && $currency->name === $trigger->trigger_value diff --git a/app/Console/Commands/Correction/ConvertsDatesToUTC.php b/app/Console/Commands/Correction/ConvertsDatesToUTC.php index 145f9117f6..09a2867284 100644 --- a/app/Console/Commands/Correction/ConvertsDatesToUTC.php +++ b/app/Console/Commands/Correction/ConvertsDatesToUTC.php @@ -83,10 +83,10 @@ class ConvertsDatesToUTC extends Command } $this->friendlyInfo(sprintf('Converting field "%s" of model "%s" to UTC.', $field, $shortModel)); $items->each(static function ($item) use ($field, $timezoneField): void { - $date = Carbon::parse($item->{$field}, $item->{$timezoneField}); // @phpstan-ignore-line + $date = Carbon::parse($item->{$field}, $item->{$timezoneField}); $date->setTimezone('UTC'); - $item->{$field} = $date->format('Y-m-d H:i:s'); // @phpstan-ignore-line - $item->{$timezoneField} = 'UTC'; // @phpstan-ignore-line + $item->{$field} = $date->format('Y-m-d H:i:s'); + $item->{$timezoneField} = 'UTC'; $item->save(); }); } diff --git a/app/Console/Commands/Correction/CorrectsUnevenAmount.php b/app/Console/Commands/Correction/CorrectsUnevenAmount.php index 25a0971182..c9ea3e7399 100644 --- a/app/Console/Commands/Correction/CorrectsUnevenAmount.php +++ b/app/Console/Commands/Correction/CorrectsUnevenAmount.php @@ -324,7 +324,7 @@ class CorrectsUnevenAmount extends Command $sum = Steam::floatalize($sum); if ( !is_numeric($sum) - || '' === $sum // @phpstan-ignore-line + || '' === $sum || str_contains($sum, 'e') || str_contains($sum, ',') ) { diff --git a/app/Console/Commands/System/VerifySecurityAlerts.php b/app/Console/Commands/System/VerifySecurityAlerts.php index 2872b071b7..9ee03478a9 100644 --- a/app/Console/Commands/System/VerifySecurityAlerts.php +++ b/app/Console/Commands/System/VerifySecurityAlerts.php @@ -57,7 +57,7 @@ class VerifySecurityAlerts extends Command $version = config('firefly.version'); $disk = Storage::disk('resources'); // Next line is ignored because it's a Laravel Facade. - if (!$disk->has('alerts.json')) { // @phpstan-ignore-line + if (!$disk->has('alerts.json')) { Log::debug('No alerts.json file present.'); return 0; diff --git a/app/Console/Commands/Tools/Cron.php b/app/Console/Commands/Tools/Cron.php index 0588491877..71a3b6aa02 100644 --- a/app/Console/Commands/Tools/Cron.php +++ b/app/Console/Commands/Tools/Cron.php @@ -70,7 +70,7 @@ class Cron extends Command } catch (InvalidArgumentException $e) { $this->friendlyError(sprintf('"%s" is not a valid date', $this->option('date'))); } - $force = (bool) $this->option('force'); // @phpstan-ignore-line + $force = (bool) $this->option('force'); // Fire exchange rates cron job. if (true === FireflyConfig::get('enable_external_rates', config('cer.download_enabled'))->data && ($doAll || $this->option('download-cer'))) { diff --git a/app/Console/Commands/Upgrade/RemovesDatabaseDecryption.php b/app/Console/Commands/Upgrade/RemovesDatabaseDecryption.php index 80eecc91a2..b6b741e58e 100644 --- a/app/Console/Commands/Upgrade/RemovesDatabaseDecryption.php +++ b/app/Console/Commands/Upgrade/RemovesDatabaseDecryption.php @@ -68,7 +68,7 @@ class RemovesDatabaseDecryption extends Command * @var string $table * @var array $fields */ - foreach ($tables as $table => $fields) { // @phpstan-ignore-line + foreach ($tables as $table => $fields) { $this->decryptTable($table, $fields); } diff --git a/app/Factory/TransactionJournalFactory.php b/app/Factory/TransactionJournalFactory.php index b14a6dc06b..0db469a258 100644 --- a/app/Factory/TransactionJournalFactory.php +++ b/app/Factory/TransactionJournalFactory.php @@ -574,14 +574,14 @@ class TransactionJournalFactory return [$sourceAccount, $account]; } - if (!$sourceAccount instanceof Account) { // @phpstan-ignore-line + if (!$sourceAccount instanceof Account) { Log::debug('Source account is NULL, destination account is not.'); $account = $this->accountRepository->getReconciliation($destinationAccount); Log::debug(sprintf('Will return account #%d ("%s") of type "%s"', $account->id, $account->name, $account->accountType->type)); return [$account, $destinationAccount]; } - Log::debug('Unused fallback'); // @phpstan-ignore-line + Log::debug('Unused fallback'); return [$sourceAccount, $destinationAccount]; } diff --git a/app/Helpers/Collector/Extensions/AccountCollection.php b/app/Helpers/Collector/Extensions/AccountCollection.php index 8a57ff8ca8..c0c4aef551 100644 --- a/app/Helpers/Collector/Extensions/AccountCollection.php +++ b/app/Helpers/Collector/Extensions/AccountCollection.php @@ -178,7 +178,7 @@ trait AccountCollection { if ($accounts->count() > 0) { $accountIds = $accounts->pluck('id')->toArray(); - $this->query->where(static function (EloquentBuilder $query) use ($accountIds): void { // @phpstan-ignore-line + $this->query->where(static function (EloquentBuilder $query) use ($accountIds): void { $query->whereIn('source.account_id', $accountIds); $query->orWhereIn('destination.account_id', $accountIds); }); @@ -196,7 +196,7 @@ trait AccountCollection { if ($accounts->count() > 0) { $accountIds = $accounts->pluck('id')->toArray(); - $this->query->where(static function (EloquentBuilder $query) use ($accountIds): void { // @phpstan-ignore-line + $this->query->where(static function (EloquentBuilder $query) use ($accountIds): void { $query->whereIn('source.account_id', $accountIds); $query->whereIn('destination.account_id', $accountIds); }); @@ -228,7 +228,7 @@ trait AccountCollection { if ($accounts->count() > 0) { $accountIds = $accounts->pluck('id')->toArray(); - $this->query->where(static function (EloquentBuilder $query) use ($accountIds): void { // @phpstan-ignore-line + $this->query->where(static function (EloquentBuilder $query) use ($accountIds): void { $query->whereNotIn('source.account_id', $accountIds); $query->whereNotIn('destination.account_id', $accountIds); }); @@ -261,7 +261,7 @@ trait AccountCollection { if ($accounts->count() > 0) { $accountIds = $accounts->pluck('id')->toArray(); - $this->query->where(static function (EloquentBuilder $q1) use ($accountIds): void { // @phpstan-ignore-line + $this->query->where(static function (EloquentBuilder $q1) use ($accountIds): void { // sourceAccount is in the set, and destination is NOT. $q1->where(static function (EloquentBuilder $q2) use ($accountIds): void { diff --git a/app/Helpers/Collector/Extensions/AmountCollection.php b/app/Helpers/Collector/Extensions/AmountCollection.php index 2ccf598e10..ecaf44c986 100644 --- a/app/Helpers/Collector/Extensions/AmountCollection.php +++ b/app/Helpers/Collector/Extensions/AmountCollection.php @@ -38,7 +38,7 @@ trait AmountCollection */ public function amountIs(string $amount): GroupCollectorInterface { - $this->query->where(static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line + $this->query->where(static function (EloquentBuilder $q) use ($amount): void { $q->where('source.amount', Steam::negative($amount)); }); @@ -47,7 +47,7 @@ trait AmountCollection public function amountIsNot(string $amount): GroupCollectorInterface { - $this->query->where(static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line + $this->query->where(static function (EloquentBuilder $q) use ($amount): void { $q->where('source.amount', '!=', Steam::negative($amount)); }); @@ -59,7 +59,7 @@ trait AmountCollection */ public function amountLess(string $amount): GroupCollectorInterface { - $this->query->where(static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line + $this->query->where(static function (EloquentBuilder $q) use ($amount): void { $q->where('destination.amount', '<=', Steam::positive($amount)); }); @@ -71,7 +71,7 @@ trait AmountCollection */ public function amountMore(string $amount): GroupCollectorInterface { - $this->query->where(static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line + $this->query->where(static function (EloquentBuilder $q) use ($amount): void { $q->where('destination.amount', '>=', Steam::positive($amount)); }); @@ -83,7 +83,7 @@ trait AmountCollection */ public function foreignAmountIs(string $amount): GroupCollectorInterface { - $this->query->where(static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line + $this->query->where(static function (EloquentBuilder $q) use ($amount): void { $q->whereNotNull('source.foreign_amount'); $q->where('source.foreign_amount', Steam::negative($amount)); }); @@ -96,7 +96,7 @@ trait AmountCollection */ public function foreignAmountIsNot(string $amount): GroupCollectorInterface { - $this->query->where(static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line + $this->query->where(static function (EloquentBuilder $q) use ($amount): void { $q->whereNull('source.foreign_amount'); $q->orWhere('source.foreign_amount', '!=', Steam::negative($amount)); }); @@ -109,7 +109,7 @@ trait AmountCollection */ public function foreignAmountLess(string $amount): GroupCollectorInterface { - $this->query->where(static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line + $this->query->where(static function (EloquentBuilder $q) use ($amount): void { $q->whereNotNull('destination.foreign_amount'); $q->where('destination.foreign_amount', '<=', Steam::positive($amount)); }); @@ -122,7 +122,7 @@ trait AmountCollection */ public function foreignAmountMore(string $amount): GroupCollectorInterface { - $this->query->where(static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line + $this->query->where(static function (EloquentBuilder $q) use ($amount): void { $q->whereNotNull('destination.foreign_amount'); $q->where('destination.foreign_amount', '>=', Steam::positive($amount)); }); diff --git a/app/Helpers/Collector/Extensions/AttachmentCollection.php b/app/Helpers/Collector/Extensions/AttachmentCollection.php index cc5e024eaa..795e48d9ed 100644 --- a/app/Helpers/Collector/Extensions/AttachmentCollection.php +++ b/app/Helpers/Collector/Extensions/AttachmentCollection.php @@ -483,7 +483,7 @@ trait AttachmentCollection Log::debug('Add filter on no attachments.'); $this->joinAttachmentTables(); - $this->query->where(static function (EloquentBuilder $q1): void { // @phpstan-ignore-line + $this->query->where(static function (EloquentBuilder $q1): void { $q1->whereNull('attachments.attachable_id')->orWhere(static function (EloquentBuilder $q2): void { $q2->whereNotNull('attachments.attachable_id')->whereNotNull('attachments.deleted_at'); @@ -517,7 +517,7 @@ trait AttachmentCollection $this->hasJoinedAttTables = true; $this->query ->leftJoin('attachments', 'attachments.attachable_id', '=', 'transaction_journals.id') - ->where(static function (EloquentBuilder $q1): void { // @phpstan-ignore-line + ->where(static function (EloquentBuilder $q1): void { $q1->where('attachments.attachable_type', TransactionJournal::class); // $q1->where('attachments.uploaded', true); // $q1->whereNull('attachments.deleted_at'); diff --git a/app/Helpers/Collector/Extensions/MetaCollection.php b/app/Helpers/Collector/Extensions/MetaCollection.php index c69cbe079f..03fcb4ceec 100644 --- a/app/Helpers/Collector/Extensions/MetaCollection.php +++ b/app/Helpers/Collector/Extensions/MetaCollection.php @@ -46,7 +46,7 @@ trait MetaCollection public function excludeBills(Collection $bills): GroupCollectorInterface { $this->withBillInformation(); - $this->query->where(static function (EloquentBuilder $q1) use ($bills): void { // @phpstan-ignore-line + $this->query->where(static function (EloquentBuilder $q1) use ($bills): void { $q1->whereNotIn('transaction_journals.bill_id', $bills->pluck('id')->toArray()); $q1->orWhereNull('transaction_journals.bill_id'); }); @@ -61,7 +61,7 @@ trait MetaCollection { $this->withBudgetInformation(); - $this->query->where(static function (EloquentBuilder $q2) use ($budget): void { // @phpstan-ignore-line + $this->query->where(static function (EloquentBuilder $q2) use ($budget): void { $q2->where('budgets.id', '!=', $budget->id); $q2->orWhereNull('budgets.id'); }); @@ -73,7 +73,7 @@ trait MetaCollection { if ($budgets->count() > 0) { $this->withBudgetInformation(); - $this->query->where(static function (EloquentBuilder $q1) use ($budgets): void { // @phpstan-ignore-line + $this->query->where(static function (EloquentBuilder $q1) use ($budgets): void { $q1->whereNotIn('budgets.id', $budgets->pluck('id')->toArray()); $q1->orWhereNull('budgets.id'); }); @@ -86,7 +86,7 @@ trait MetaCollection { if ($categories->count() > 0) { $this->withCategoryInformation(); - $this->query->where(static function (EloquentBuilder $q1) use ($categories): void { // @phpstan-ignore-line + $this->query->where(static function (EloquentBuilder $q1) use ($categories): void { $q1->whereNotIn('categories.id', $categories->pluck('id')->toArray()); $q1->orWhereNull('categories.id'); }); @@ -102,7 +102,7 @@ trait MetaCollection { $this->withCategoryInformation(); - $this->query->where(static function (EloquentBuilder $q2) use ($category): void { // @phpstan-ignore-line + $this->query->where(static function (EloquentBuilder $q2) use ($category): void { $q2->where('categories.id', '!=', $category->id); $q2->orWhereNull('categories.id'); }); @@ -394,7 +394,7 @@ trait MetaCollection public function notesDoNotContain(string $value): GroupCollectorInterface { $this->withNotes(); - $this->query->where(static function (EloquentBuilder $q) use ($value): void { // @phpstan-ignore-line + $this->query->where(static function (EloquentBuilder $q) use ($value): void { $q->whereNull('notes.text'); $q->orWhereNotLike('notes.text', sprintf('%%%s%%', $value)); }); @@ -405,7 +405,7 @@ trait MetaCollection public function notesDontEndWith(string $value): GroupCollectorInterface { $this->withNotes(); - $this->query->where(static function (EloquentBuilder $q) use ($value): void { // @phpstan-ignore-line + $this->query->where(static function (EloquentBuilder $q) use ($value): void { $q->whereNull('notes.text'); $q->orWhereNotLike('notes.text', sprintf('%%%s', $value)); }); @@ -416,7 +416,7 @@ trait MetaCollection public function notesDontStartWith(string $value): GroupCollectorInterface { $this->withNotes(); - $this->query->where(static function (EloquentBuilder $q) use ($value): void { // @phpstan-ignore-line + $this->query->where(static function (EloquentBuilder $q) use ($value): void { $q->whereNull('notes.text'); $q->orWhereNotLike('notes.text', sprintf('%s%%', $value)); }); @@ -443,7 +443,7 @@ trait MetaCollection public function notesExactlyNot(string $value): GroupCollectorInterface { $this->withNotes(); - $this->query->where(static function (EloquentBuilder $q) use ($value): void { // @phpstan-ignore-line + $this->query->where(static function (EloquentBuilder $q) use ($value): void { $q->whereNull('notes.text'); $q->orWhere('notes.text', '!=', $value); }); @@ -889,7 +889,7 @@ trait MetaCollection { $this->joinMetaDataTables(); // TODO not sure if this will work properly. - $this->query->where(static function (EloquentBuilder $q1): void { // @phpstan-ignore-line + $this->query->where(static function (EloquentBuilder $q1): void { $q1->where(static function (EloquentBuilder $q2): void { $q2->where('journal_meta.name', '=', 'external_id'); $q2->whereNull('journal_meta.data'); @@ -910,7 +910,7 @@ trait MetaCollection { $this->joinMetaDataTables(); // TODO not sure if this will work properly. - $this->query->where(static function (EloquentBuilder $q1): void { // @phpstan-ignore-line + $this->query->where(static function (EloquentBuilder $q1): void { $q1->where(static function (EloquentBuilder $q2): void { $q2->where('journal_meta.name', '=', 'external_url'); $q2->whereNull('journal_meta.data'); @@ -930,7 +930,7 @@ trait MetaCollection public function withoutNotes(): GroupCollectorInterface { $this->withNotes(); - $this->query->where(static function (EloquentBuilder $q): void { // @phpstan-ignore-line + $this->query->where(static function (EloquentBuilder $q): void { $q->whereNull('notes.text'); $q->orWhere('notes.text', ''); }); diff --git a/app/Helpers/Collector/GroupCollector.php b/app/Helpers/Collector/GroupCollector.php index d9d00cd6ea..497b99ed58 100644 --- a/app/Helpers/Collector/GroupCollector.php +++ b/app/Helpers/Collector/GroupCollector.php @@ -314,7 +314,7 @@ class GroupCollector implements GroupCollectorInterface public function excludeForeignCurrency(TransactionCurrency $currency): GroupCollectorInterface { - $this->query->where(static function (EloquentBuilder $q2) use ($currency): void { // @phpstan-ignore-line + $this->query->where(static function (EloquentBuilder $q2) use ($currency): void { $q2->where('source.foreign_currency_id', '!=', $currency->id); $q2->orWhereNull('source.foreign_currency_id'); }); @@ -698,7 +698,7 @@ class GroupCollector implements GroupCollectorInterface */ foreach ($this->sorting as $field => $direction) { $func = 'ASC' === $direction ? 'sortBy' : 'sortByDesc'; - $collection = $collection->{$func}(static function (array $product, int $key) use ($field) { // @phpstan-ignore-line + $collection = $collection->{$func}(static function (array $product, int $key) use ($field) { // depends on $field: if ('description' === $field) { if (1 === count($product['transactions'])) { diff --git a/app/Http/Controllers/Chart/ExpenseReportController.php b/app/Http/Controllers/Chart/ExpenseReportController.php index bb1cc16b86..c6debcdaee 100644 --- a/app/Http/Controllers/Chart/ExpenseReportController.php +++ b/app/Http/Controllers/Chart/ExpenseReportController.php @@ -135,7 +135,7 @@ final class ExpenseReportController extends Controller while ($currentStart < $end) { $currentEnd = clone $currentStart; - $currentEnd = $currentEnd->{$function}(); // @phpstan-ignore-line + $currentEnd = $currentEnd->{$function}(); // get expenses grouped by opposing name: $expenses = $this->groupByName($this->getExpensesForOpposing($accounts, $all, $currentStart, $currentEnd)); diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index a9496cd550..d99f878a27 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -102,7 +102,7 @@ abstract class Controller extends BaseController if ('true' === request()->get('force_default_layout') && 'v2' === config('view.layout')) { // config('view.layout','v1'); Config::set('view.layout', 'v1'); - View::getFinder()->setPaths([realpath(base_path('resources/views'))]); // @phpstan-ignore-line + View::getFinder()->setPaths([realpath(base_path('resources/views'))]); } View::share('authGuard', $authGuard); diff --git a/app/Http/Controllers/DebugController.php b/app/Http/Controllers/DebugController.php index 215adfae22..de4cc0edbc 100644 --- a/app/Http/Controllers/DebugController.php +++ b/app/Http/Controllers/DebugController.php @@ -149,7 +149,7 @@ final class DebugController extends Controller // get latest log file: $logger = Log::driver(); // PHPstan doesn't recognize the method because of its polymorphic nature. - $handlers = $logger->getHandlers(); // @phpstan-ignore-line + $handlers = $logger->getHandlers(); $logContent = ''; foreach ($handlers as $handler) { if ($handler instanceof RotatingFileHandler) { @@ -323,7 +323,7 @@ final class DebugController extends Controller private function getBuildInfo(): array { $return = [ - 'is_docker' => env('IS_DOCKER', false), // @phpstan-ignore-line + 'is_docker' => env('IS_DOCKER', false), 'build' => '(unknown)', 'build_date' => '(unknown)', 'base_build' => '(unknown)', @@ -348,11 +348,11 @@ final class DebugController extends Controller Log::debug('Could not check build date, but thats ok.'); Log::warning($e->getMessage()); } - if ('' !== (string) env('BASE_IMAGE_BUILD')) { // @phpstan-ignore-line - $return['base_build'] = env('BASE_IMAGE_BUILD'); // @phpstan-ignore-line + if ('' !== (string) env('BASE_IMAGE_BUILD')) { + $return['base_build'] = env('BASE_IMAGE_BUILD'); } - if ('' !== (string) env('BASE_IMAGE_DATE')) { // @phpstan-ignore-line - $return['base_build_date'] = env('BASE_IMAGE_DATE'); // @phpstan-ignore-line + if ('' !== (string) env('BASE_IMAGE_DATE')) { + $return['base_build_date'] = env('BASE_IMAGE_DATE'); } return $return; diff --git a/app/Http/Controllers/PreferencesController.php b/app/Http/Controllers/PreferencesController.php index 3e4db560f2..c30ae0bd94 100644 --- a/app/Http/Controllers/PreferencesController.php +++ b/app/Http/Controllers/PreferencesController.php @@ -86,7 +86,7 @@ final class PreferencesController extends Controller AccountTypeEnum::DEBT->value, AccountTypeEnum::MORTGAGE->value, ]); - $isDocker = env('IS_DOCKER', false); // @phpstan-ignore-line + $isDocker = env('IS_DOCKER', false); $groupedAccounts = []; /** @var Account $account */ diff --git a/app/Http/Controllers/UserGroup/CreateController.php b/app/Http/Controllers/UserGroup/CreateController.php index 3ab342db6a..59197dfda1 100644 --- a/app/Http/Controllers/UserGroup/CreateController.php +++ b/app/Http/Controllers/UserGroup/CreateController.php @@ -42,6 +42,6 @@ final class CreateController extends Controller $mainTitleIcon = 'fa-book'; Log::debug(sprintf('Now at %s', __METHOD__)); - return view('administrations.create')->with(['title' => $title, 'subTitle' => $subTitle, 'mainTitleIcon' => $mainTitleIcon]); // @phpstan-ignore-line + return view('administrations.create')->with(['title' => $title, 'subTitle' => $subTitle, 'mainTitleIcon' => $mainTitleIcon]); } } diff --git a/app/Http/Middleware/SecureHeaders.php b/app/Http/Middleware/SecureHeaders.php index 246a9bf4a3..8950f6b45d 100644 --- a/app/Http/Middleware/SecureHeaders.php +++ b/app/Http/Middleware/SecureHeaders.php @@ -67,7 +67,7 @@ class SecureHeaders ]; // overrule in development mode - if (true === env('IS_LOCAL_DEV')) { // @phpstan-ignore-line + if (true === env('IS_LOCAL_DEV')) { $csp = [ "default-src 'none'", "object-src 'none'", diff --git a/app/Http/Requests/RecurrenceFormRequest.php b/app/Http/Requests/RecurrenceFormRequest.php index 415dcd9b69..71d745f9e2 100644 --- a/app/Http/Requests/RecurrenceFormRequest.php +++ b/app/Http/Requests/RecurrenceFormRequest.php @@ -134,7 +134,7 @@ class RecurrenceFormRequest extends FormRequest * @var int $index * @var array $transaction */ - foreach ($return['transactions'] as $index => $transaction) { // @phpstan-ignore-line + foreach ($return['transactions'] as $index => $transaction) { $categoryName = $transaction['category_name'] ?? null; if (null !== $categoryName) { $category = $factory->findOrCreate(null, $categoryName); diff --git a/app/Notifications/Notifiables/OwnerNotifiable.php b/app/Notifications/Notifiables/OwnerNotifiable.php index 7a1c7799e1..04161c5f5e 100644 --- a/app/Notifications/Notifiables/OwnerNotifiable.php +++ b/app/Notifications/Notifiables/OwnerNotifiable.php @@ -46,7 +46,7 @@ class OwnerNotifiable if (method_exists($this, $method)) { Log::debug(sprintf('Redirect for settings to "%s".', $method)); - return $this->{$method}($notification); // @phpstan-ignore-line + return $this->{$method}($notification); } Log::debug(sprintf('No method "%s" found, return generic settings.', $method)); diff --git a/app/Providers/AccountServiceProvider.php b/app/Providers/AccountServiceProvider.php index bdff7d1eee..3bb7e7fdfd 100644 --- a/app/Providers/AccountServiceProvider.php +++ b/app/Providers/AccountServiceProvider.php @@ -63,7 +63,7 @@ class AccountServiceProvider extends ServiceProvider $repository = app(AccountRepository::class); // phpstan thinks auth does not exist. - if ($app->auth->check()) { // @phpstan-ignore-line + if ($app->auth->check()) { $repository->setUser(auth()->user()); } @@ -75,7 +75,7 @@ class AccountServiceProvider extends ServiceProvider $repository = app(OperationsRepository::class); // phpstan thinks auth does not exist. - if ($app->auth->check()) { // @phpstan-ignore-line + if ($app->auth->check()) { $repository->setUser(auth()->user()); } @@ -93,7 +93,7 @@ class AccountServiceProvider extends ServiceProvider $tasker = app(AccountTasker::class); // phpstan thinks auth does not exist. - if ($app->auth->check()) { // @phpstan-ignore-line + if ($app->auth->check()) { $tasker->setUser(auth()->user()); } diff --git a/app/Providers/AdminServiceProvider.php b/app/Providers/AdminServiceProvider.php index 3333bd65bf..172bb71d81 100644 --- a/app/Providers/AdminServiceProvider.php +++ b/app/Providers/AdminServiceProvider.php @@ -57,7 +57,7 @@ class AdminServiceProvider extends ServiceProvider /** @var LinkTypeRepository $repository */ $repository = app(LinkTypeRepository::class); // reference to auth is not understood by phpstan. - if ($app->auth->check()) { // @phpstan-ignore-line + if ($app->auth->check()) { $repository->setUser(auth()->user()); } diff --git a/app/Providers/AttachmentServiceProvider.php b/app/Providers/AttachmentServiceProvider.php index f6a649c7ec..acaf02d274 100644 --- a/app/Providers/AttachmentServiceProvider.php +++ b/app/Providers/AttachmentServiceProvider.php @@ -49,7 +49,7 @@ class AttachmentServiceProvider extends ServiceProvider /** @var AttachmentRepositoryInterface $repository */ $repository = app(AttachmentRepository::class); // reference to auth is not understood by phpstan. - if ($app->auth->check()) { // @phpstan-ignore-line + if ($app->auth->check()) { $repository->setUser(auth()->user()); } diff --git a/app/Providers/BillServiceProvider.php b/app/Providers/BillServiceProvider.php index 13c9320201..5540075567 100644 --- a/app/Providers/BillServiceProvider.php +++ b/app/Providers/BillServiceProvider.php @@ -50,7 +50,7 @@ class BillServiceProvider extends ServiceProvider $repository = app(BillRepository::class); // reference to auth is not understood by phpstan. - if ($app->auth->check()) { // @phpstan-ignore-line + if ($app->auth->check()) { $repository->setUser(auth()->user()); } diff --git a/app/Providers/BudgetServiceProvider.php b/app/Providers/BudgetServiceProvider.php index d62f7282f7..05debbab30 100644 --- a/app/Providers/BudgetServiceProvider.php +++ b/app/Providers/BudgetServiceProvider.php @@ -59,7 +59,7 @@ class BudgetServiceProvider extends ServiceProvider $this->app->bind(static function (Application $app): BudgetRepositoryInterface { /** @var BudgetRepositoryInterface $repository */ $repository = app(BudgetRepository::class); - if ($app->auth->check()) { // @phpstan-ignore-line + if ($app->auth->check()) { $repository->setUser(auth()->user()); } @@ -70,7 +70,7 @@ class BudgetServiceProvider extends ServiceProvider $this->app->bind(static function (Application $app): AvailableBudgetRepositoryInterface { /** @var AvailableBudgetRepositoryInterface $repository */ $repository = app(AvailableBudgetRepository::class); - if ($app->auth->check()) { // @phpstan-ignore-line + if ($app->auth->check()) { $repository->setUser(auth()->user()); } @@ -81,7 +81,7 @@ class BudgetServiceProvider extends ServiceProvider $this->app->bind(static function (Application $app): BudgetLimitRepositoryInterface { /** @var BudgetLimitRepositoryInterface $repository */ $repository = app(BudgetLimitRepository::class); - if ($app->auth->check()) { // @phpstan-ignore-line + if ($app->auth->check()) { $repository->setUser(auth()->user()); } @@ -92,7 +92,7 @@ class BudgetServiceProvider extends ServiceProvider $this->app->bind(static function (Application $app): NoBudgetRepositoryInterface { /** @var NoBudgetRepositoryInterface $repository */ $repository = app(NoBudgetRepository::class); - if ($app->auth->check()) { // @phpstan-ignore-line + if ($app->auth->check()) { $repository->setUser(auth()->user()); } @@ -103,7 +103,7 @@ class BudgetServiceProvider extends ServiceProvider $this->app->bind(static function (Application $app): OperationsRepositoryInterface { /** @var OperationsRepositoryInterface $repository */ $repository = app(OperationsRepository::class); - if ($app->auth->check()) { // @phpstan-ignore-line + if ($app->auth->check()) { $repository->setUser(auth()->user()); } diff --git a/app/Providers/CategoryServiceProvider.php b/app/Providers/CategoryServiceProvider.php index 6cebd465fd..e9a569d95b 100644 --- a/app/Providers/CategoryServiceProvider.php +++ b/app/Providers/CategoryServiceProvider.php @@ -53,7 +53,7 @@ class CategoryServiceProvider extends ServiceProvider $this->app->bind(static function (Application $app): CategoryRepositoryInterface { /** @var CategoryRepository $repository */ $repository = app(CategoryRepository::class); - if ($app->auth->check()) { // @phpstan-ignore-line + if ($app->auth->check()) { $repository->setUser(auth()->user()); } @@ -63,7 +63,7 @@ class CategoryServiceProvider extends ServiceProvider $this->app->bind(static function (Application $app): OperationsRepositoryInterface { /** @var OperationsRepository $repository */ $repository = app(OperationsRepository::class); - if ($app->auth->check()) { // @phpstan-ignore-line + if ($app->auth->check()) { $repository->setUser(auth()->user()); } @@ -73,7 +73,7 @@ class CategoryServiceProvider extends ServiceProvider $this->app->bind(static function (Application $app): NoCategoryRepositoryInterface { /** @var NoCategoryRepository $repository */ $repository = app(NoCategoryRepository::class); - if ($app->auth->check()) { // @phpstan-ignore-line + if ($app->auth->check()) { $repository->setUser(auth()->user()); } diff --git a/app/Providers/CurrencyServiceProvider.php b/app/Providers/CurrencyServiceProvider.php index 053978b2ee..9f81555353 100644 --- a/app/Providers/CurrencyServiceProvider.php +++ b/app/Providers/CurrencyServiceProvider.php @@ -52,7 +52,7 @@ class CurrencyServiceProvider extends ServiceProvider /** @var CurrencyRepository $repository */ $repository = app(GroupCurrencyRepository::class); // phpstan does not get the reference to auth - if ($app->auth->check()) { // @phpstan-ignore-line + if ($app->auth->check()) { $repository->setUser(auth()->user()); } @@ -62,7 +62,7 @@ class CurrencyServiceProvider extends ServiceProvider /** @var GroupCurrencyRepository $repository */ $repository = app(GroupCurrencyRepository::class); // phpstan does not get the reference to auth - if ($app->auth->check()) { // @phpstan-ignore-line + if ($app->auth->check()) { $repository->setUser(auth()->user()); } @@ -73,7 +73,7 @@ class CurrencyServiceProvider extends ServiceProvider /** @var ExchangeRateRepository $repository */ $repository = app(ExchangeRateRepository::class); // phpstan does not get the reference to auth - if ($app->auth->check()) { // @phpstan-ignore-line + if ($app->auth->check()) { $repository->setUserGroup(auth()->user()->userGroup); } diff --git a/app/Providers/FireflyServiceProvider.php b/app/Providers/FireflyServiceProvider.php index 7e1b56da05..9484f9fb7b 100644 --- a/app/Providers/FireflyServiceProvider.php +++ b/app/Providers/FireflyServiceProvider.php @@ -132,7 +132,7 @@ class FireflyServiceProvider extends ServiceProvider $this->app->bind(static function (Application $app): ObjectGroupRepositoryInterface { /** @var ObjectGroupRepository $repository */ $repository = app(ObjectGroupRepository::class); - if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth) + if ($app->auth->check()) { (phpstan does not understand the reference to auth) $repository->setUser(auth()->user()); } @@ -142,7 +142,7 @@ class FireflyServiceProvider extends ServiceProvider $this->app->bind(static function (Application $app): PeriodStatisticRepositoryInterface { /** @var PeriodStatisticRepository $repository */ $repository = app(PeriodStatisticRepository::class); - if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth) + if ($app->auth->check()) { (phpstan does not understand the reference to auth) $repository->setUser(auth()->user()); } @@ -152,7 +152,7 @@ class FireflyServiceProvider extends ServiceProvider $this->app->bind(static function (Application $app): WebhookRepositoryInterface { /** @var WebhookRepository $repository */ $repository = app(WebhookRepository::class); - if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth) + if ($app->auth->check()) { (phpstan does not understand the reference to auth) $repository->setUser(auth()->user()); } @@ -170,7 +170,7 @@ class FireflyServiceProvider extends ServiceProvider $this->app->bind(static function (Application $app): RuleEngineInterface { /** @var SearchRuleEngine $engine */ $engine = app(SearchRuleEngine::class); - if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth) + if ($app->auth->check()) { (phpstan does not understand the reference to auth) $engine->setUser(auth()->user()); } @@ -180,7 +180,7 @@ class FireflyServiceProvider extends ServiceProvider $this->app->bind(static function (Application $app): UserGroupRepositoryInterface { /** @var UserGroupRepository $repository */ $repository = app(UserGroupRepository::class); - if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth) + if ($app->auth->check()) { (phpstan does not understand the reference to auth) $repository->setUser(auth()->user()); } diff --git a/app/Providers/JournalServiceProvider.php b/app/Providers/JournalServiceProvider.php index 2eaefa317e..8ebade3a63 100644 --- a/app/Providers/JournalServiceProvider.php +++ b/app/Providers/JournalServiceProvider.php @@ -63,7 +63,7 @@ class JournalServiceProvider extends ServiceProvider $this->app->bind(static function (Application $app): GroupCollectorInterface { /** @var GroupCollectorInterface $collector */ $collector = app(GroupCollector::class); - if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth) + if ($app->auth->check()) { (phpstan does not understand the reference to auth) $collector->setUser(auth()->user()); } @@ -79,7 +79,7 @@ class JournalServiceProvider extends ServiceProvider $this->app->bind(static function (Application $app): TransactionGroupRepositoryInterface { /** @var TransactionGroupRepositoryInterface $repository */ $repository = app(TransactionGroupRepository::class); - if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth) + if ($app->auth->check()) { (phpstan does not understand the reference to auth) $repository->setUser(auth()->user()); } @@ -95,7 +95,7 @@ class JournalServiceProvider extends ServiceProvider $this->app->bind(static function (Application $app): JournalRepositoryInterface { /** @var JournalRepositoryInterface $repository */ $repository = app(JournalRepository::class); - if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth) + if ($app->auth->check()) { (phpstan does not understand the reference to auth) $repository->setUser(auth()->user()); } @@ -106,7 +106,7 @@ class JournalServiceProvider extends ServiceProvider $this->app->bind(static function (Application $app): JournalAPIRepositoryInterface { /** @var JournalAPIRepositoryInterface $repository */ $repository = app(JournalAPIRepository::class); - if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth) + if ($app->auth->check()) { (phpstan does not understand the reference to auth) $repository->setUser(auth()->user()); } @@ -117,7 +117,7 @@ class JournalServiceProvider extends ServiceProvider $this->app->bind(static function (Application $app): JournalCLIRepositoryInterface { /** @var JournalCLIRepositoryInterface $repository */ $repository = app(JournalCLIRepository::class); - if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth) + if ($app->auth->check()) { (phpstan does not understand the reference to auth) $repository->setUser(auth()->user()); } diff --git a/app/Providers/PiggyBankServiceProvider.php b/app/Providers/PiggyBankServiceProvider.php index c2c3c16ba6..51911e16f6 100644 --- a/app/Providers/PiggyBankServiceProvider.php +++ b/app/Providers/PiggyBankServiceProvider.php @@ -48,7 +48,7 @@ class PiggyBankServiceProvider extends ServiceProvider $this->app->bind(static function (Application $app): PiggyBankRepositoryInterface { /** @var PiggyBankRepository $repository */ $repository = app(PiggyBankRepository::class); - if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth) + if ($app->auth->check()) { (phpstan does not understand the reference to auth) $repository->setUser(auth()->user()); } diff --git a/app/Providers/RecurringServiceProvider.php b/app/Providers/RecurringServiceProvider.php index b4f4e49070..7fa059421f 100644 --- a/app/Providers/RecurringServiceProvider.php +++ b/app/Providers/RecurringServiceProvider.php @@ -49,7 +49,7 @@ class RecurringServiceProvider extends ServiceProvider /** @var RecurringRepositoryInterface $repository */ $repository = app(RecurringRepository::class); - if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth) + if ($app->auth->check()) { (phpstan does not understand the reference to auth) $repository->setUser(auth()->user()); } diff --git a/app/Providers/RuleGroupServiceProvider.php b/app/Providers/RuleGroupServiceProvider.php index 021d6c1c62..050c043c51 100644 --- a/app/Providers/RuleGroupServiceProvider.php +++ b/app/Providers/RuleGroupServiceProvider.php @@ -48,7 +48,7 @@ class RuleGroupServiceProvider extends ServiceProvider $this->app->bind(static function (Application $app): RuleGroupRepositoryInterface { /** @var RuleGroupRepository $repository */ $repository = app(RuleGroupRepository::class); - if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth) + if ($app->auth->check()) { (phpstan does not understand the reference to auth) $repository->setUser(auth()->user()); } diff --git a/app/Providers/RuleServiceProvider.php b/app/Providers/RuleServiceProvider.php index d5e5943e77..5ca88c5db1 100644 --- a/app/Providers/RuleServiceProvider.php +++ b/app/Providers/RuleServiceProvider.php @@ -48,7 +48,7 @@ class RuleServiceProvider extends ServiceProvider $this->app->bind(static function (Application $app): RuleRepositoryInterface { /** @var RuleRepository $repository */ $repository = app(RuleRepository::class); - if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth) + if ($app->auth->check()) { (phpstan does not understand the reference to auth) $repository->setUser(auth()->user()); } diff --git a/app/Providers/SearchServiceProvider.php b/app/Providers/SearchServiceProvider.php index 0d7bc43853..36401c9034 100644 --- a/app/Providers/SearchServiceProvider.php +++ b/app/Providers/SearchServiceProvider.php @@ -52,7 +52,7 @@ class SearchServiceProvider extends ServiceProvider $this->app->bind(static function (Application $app): SearchInterface { /** @var OperatorQuerySearch $search */ $search = app(OperatorQuerySearch::class); - if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth) + if ($app->auth->check()) { (phpstan does not understand the reference to auth) $search->setUser(auth()->user()); } diff --git a/app/Providers/TagServiceProvider.php b/app/Providers/TagServiceProvider.php index 2ac65fabd4..9f21938c6c 100644 --- a/app/Providers/TagServiceProvider.php +++ b/app/Providers/TagServiceProvider.php @@ -51,7 +51,7 @@ class TagServiceProvider extends ServiceProvider /** @var TagRepository $repository */ $repository = app(TagRepository::class); - if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth) + if ($app->auth->check()) { (phpstan does not understand the reference to auth) $repository->setUser(auth()->user()); } @@ -62,7 +62,7 @@ class TagServiceProvider extends ServiceProvider /** @var OperationsRepository $repository */ $repository = app(OperationsRepository::class); - if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth) + if ($app->auth->check()) { (phpstan does not understand the reference to auth) $repository->setUser(auth()->user()); } diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php index c19476ed37..154e91886e 100644 --- a/app/Repositories/Account/AccountRepository.php +++ b/app/Repositories/Account/AccountRepository.php @@ -271,7 +271,7 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac { $query = $this->user ->accounts() - ->with([ // @phpstan-ignore-line + ->with([ 'accountmeta' => static function (HasMany $query): void { $query->where('name', 'account_role'); }, @@ -296,7 +296,7 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac /** @var Storage $disk */ $disk = Storage::disk('upload'); - return $set->each(static function (Attachment $attachment) use ($disk): Attachment { // @phpstan-ignore-line + return $set->each(static function (Attachment $attachment) use ($disk): Attachment { $notes = $attachment->notes()->first(); $attachment->file_exists = $disk->exists($attachment->fileName()); $attachment->notes_text = null !== $notes ? $notes->text : ''; @@ -335,7 +335,7 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac { $query = $this->user ->accounts() - ->with(['accountmeta' => static function (HasMany $query): void { // @phpstan-ignore-line + ->with(['accountmeta' => static function (HasMany $query): void { $query->where('name', 'account_role'); }]) ; diff --git a/app/Repositories/Account/OperationsRepository.php b/app/Repositories/Account/OperationsRepository.php index e896c23a62..2bcf1b9778 100644 --- a/app/Repositories/Account/OperationsRepository.php +++ b/app/Repositories/Account/OperationsRepository.php @@ -394,7 +394,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn ]; $array[$currencyId]['transaction_journals'][$journalId] = [ - 'amount' => Steam::{$direction}((string) $journal['amount']), // @phpstan-ignore-line + 'amount' => Steam::{$direction}((string) $journal['amount']), 'date' => $journal['date'], 'transaction_journal_id' => $journalId, 'budget_name' => $journal['budget_name'], diff --git a/app/Repositories/Bill/BillRepository.php b/app/Repositories/Bill/BillRepository.php index 05e2683b14..de63854d2d 100644 --- a/app/Repositories/Bill/BillRepository.php +++ b/app/Repositories/Bill/BillRepository.php @@ -187,7 +187,7 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface ->bills() ->where('active', true) ->orderBy('bills.name', 'ASC') - ->get(['bills.*', DB::raw('((bills.amount_min + bills.amount_max) / 2) AS expectedAmount')]) // @phpstan-ignore-line + ->get(['bills.*', DB::raw('((bills.amount_min + bills.amount_max) / 2) AS expectedAmount')]) ; } @@ -199,7 +199,7 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface $set = $bill->attachments()->get(); $disk = Storage::disk('upload'); - return $set->each(static function (Attachment $attachment) use ($disk): Attachment { // @phpstan-ignore-line + return $set->each(static function (Attachment $attachment) use ($disk): Attachment { $notes = $attachment->notes()->first(); $attachment->file_exists = $disk->exists($attachment->fileName()); $attachment->notes_text = null !== $notes ? $notes->text : ''; diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.php index 89c9f731bf..6b26d1fcc0 100644 --- a/app/Repositories/Budget/BudgetRepository.php +++ b/app/Repositories/Budget/BudgetRepository.php @@ -345,7 +345,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface $disk = Storage::disk('upload'); - return $set->each(static function (Attachment $attachment) use ($disk): Attachment { // @phpstan-ignore-line + return $set->each(static function (Attachment $attachment) use ($disk): Attachment { $notes = $attachment->notes()->first(); $attachment->file_exists = $disk->exists($attachment->fileName()); $attachment->notes_text = null !== $notes ? $notes->text : ''; diff --git a/app/Repositories/Category/CategoryRepository.php b/app/Repositories/Category/CategoryRepository.php index 373bc13db8..e0ff091c38 100644 --- a/app/Repositories/Category/CategoryRepository.php +++ b/app/Repositories/Category/CategoryRepository.php @@ -170,7 +170,7 @@ class CategoryRepository implements CategoryRepositoryInterface, UserGroupInterf $disk = Storage::disk('upload'); - return $set->each(static function (Attachment $attachment) use ($disk): Attachment { // @phpstan-ignore-line + return $set->each(static function (Attachment $attachment) use ($disk): Attachment { $notes = $attachment->notes()->first(); $attachment->file_exists = $disk->exists($attachment->fileName()); $attachment->notes_text = null !== $notes ? $notes->text : ''; diff --git a/app/Repositories/Currency/CurrencyRepository.php b/app/Repositories/Currency/CurrencyRepository.php index a16287a666..171db76759 100644 --- a/app/Repositories/Currency/CurrencyRepository.php +++ b/app/Repositories/Currency/CurrencyRepository.php @@ -298,7 +298,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf ->withPivot(['group_default']) ->get() ; - $all->map(static function (TransactionCurrency $current): TransactionCurrency { // @phpstan-ignore-line + $all->map(static function (TransactionCurrency $current): TransactionCurrency { $current->userGroupEnabled = true; $current->userGroupNative = 1 === (int) $current->pivot->group_default; diff --git a/app/Repositories/Journal/JournalAPIRepository.php b/app/Repositories/Journal/JournalAPIRepository.php index b3ea94e462..4d880039d7 100644 --- a/app/Repositories/Journal/JournalAPIRepository.php +++ b/app/Repositories/Journal/JournalAPIRepository.php @@ -86,7 +86,7 @@ class JournalAPIRepository implements JournalAPIRepositoryInterface, UserGroupIn public function getPiggyBankEvents(TransactionJournal $journal): Collection { $events = $journal->piggyBankEvents()->get(); - $events->each(static function (PiggyBankEvent $event): void { // @phpstan-ignore-line + $events->each(static function (PiggyBankEvent $event): void { $event->piggyBank = PiggyBank::withTrashed()->find($event->piggy_bank_id); }); diff --git a/app/Repositories/PiggyBank/PiggyBankRepository.php b/app/Repositories/PiggyBank/PiggyBankRepository.php index 864764a2f5..0413b989e2 100644 --- a/app/Repositories/PiggyBank/PiggyBankRepository.php +++ b/app/Repositories/PiggyBank/PiggyBankRepository.php @@ -120,7 +120,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte $disk = Storage::disk('upload'); - return $set->each(static function (Attachment $attachment) use ($disk): Attachment { // @phpstan-ignore-line + return $set->each(static function (Attachment $attachment) use ($disk): Attachment { $notes = $attachment->notes()->first(); $attachment->file_exists = $disk->exists($attachment->fileName()); $attachment->notes_text = null !== $notes ? $notes->text : ''; @@ -239,11 +239,11 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte $amount = null; if ((int) $source->transaction_currency_id === $currency->id) { Log::debug('Use normal amount'); - $amount = Steam::{$operator}($source->amount); // @phpstan-ignore-line + $amount = Steam::{$operator}($source->amount); } if ((int) $source->foreign_currency_id === $currency->id) { Log::debug('Use foreign amount'); - $amount = Steam::{$operator}($source->foreign_amount); // @phpstan-ignore-line + $amount = Steam::{$operator}($source->foreign_amount); } if (null === $amount) { Log::debug('No match on currency, so amount remains null, return "0".'); diff --git a/app/Repositories/RuleGroup/RuleGroupRepository.php b/app/Repositories/RuleGroup/RuleGroupRepository.php index 5eb5212917..4a44211c90 100644 --- a/app/Repositories/RuleGroup/RuleGroupRepository.php +++ b/app/Repositories/RuleGroup/RuleGroupRepository.php @@ -177,7 +177,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface, UserGroupInte $groups = $this->user ->ruleGroups() ->orderBy('order', 'ASC') - ->with([ // @phpstan-ignore-line + ->with([ 'rules' => static function (HasMany $query): void { $query->orderBy('order', 'ASC'); @@ -197,7 +197,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface, UserGroupInte } // Log::debug(sprintf('Will filter getRuleGroupsWithRules on "%s".', $filter)); - return $groups->map(static function (RuleGroup $group) use ($filter): RuleGroup { // @phpstan-ignore-line + return $groups->map(static function (RuleGroup $group) use ($filter): RuleGroup { // Log::debug(sprintf('Now filtering group #%d', $group->id)); // filter the rules in the rule group: $group->rules = $group->rules->filter(static function (Rule $rule) use ($filter): bool { @@ -231,7 +231,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface, UserGroupInte ->ruleGroups() ->orderBy('order', 'ASC') ->where('active', true) - ->with([ // @phpstan-ignore-line + ->with([ 'rules' => static function (HasMany $query): void { $query->orderBy('order', 'ASC'); $query->where('rules.active', true); @@ -250,7 +250,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface, UserGroupInte } Log::debug(sprintf('Will filter getRuleGroupsWithRules on "%s".', $filter)); - return $groups->map(static function (RuleGroup $group) use ($filter): RuleGroup { // @phpstan-ignore-line + return $groups->map(static function (RuleGroup $group) use ($filter): RuleGroup { // Log::debug(sprintf('Now filtering group #%d', $group->id)); // filter the rules in the rule group: $group->rules = $group->rules->filter(static function (Rule $rule) use ($filter): bool { diff --git a/app/Repositories/Tag/TagRepository.php b/app/Repositories/Tag/TagRepository.php index efef221896..d3db6c9039 100644 --- a/app/Repositories/Tag/TagRepository.php +++ b/app/Repositories/Tag/TagRepository.php @@ -126,7 +126,7 @@ class TagRepository implements TagRepositoryInterface, UserGroupInterface $set = $tag->attachments()->get(); $disk = Storage::disk('upload'); - return $set->each(static function (Attachment $attachment) use ($disk): void { // @phpstan-ignore-line + return $set->each(static function (Attachment $attachment) use ($disk): void { /** @var null|Note $note */ $note = $attachment->notes()->first(); // only used in v1 view of tags diff --git a/app/Repositories/UserGroup/UserGroupRepository.php b/app/Repositories/UserGroup/UserGroupRepository.php index 882f8394b5..0933633a02 100644 --- a/app/Repositories/UserGroup/UserGroupRepository.php +++ b/app/Repositories/UserGroup/UserGroupRepository.php @@ -101,7 +101,7 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte 'webhooks', ]; foreach ($objects as $object) { - foreach ($userGroup->{$object}()->get() as $item) { // @phpstan-ignore-line + foreach ($userGroup->{$object}()->get() as $item) { $item->delete(); } } @@ -257,7 +257,7 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte 0 === $ownerCount && ( 0 === count($data['roles']) - || count($data['roles']) > 0 // @phpstan-ignore-line + || count($data['roles']) > 0 && !in_array(UserRoleEnum::OWNER->value, $data['roles'], true) ) ) { diff --git a/app/Repositories/Webhook/WebhookRepository.php b/app/Repositories/Webhook/WebhookRepository.php index f29ba0c7fe..356a1716f6 100644 --- a/app/Repositories/Webhook/WebhookRepository.php +++ b/app/Repositories/Webhook/WebhookRepository.php @@ -90,7 +90,7 @@ class WebhookRepository implements WebhookRepositoryInterface, UserGroupInterfac ->where('webhook_messages.sent', 0) ->where('webhook_messages.errored', 0) ->get(['webhook_messages.*']) - ->filter(static fn (WebhookMessage $message): bool => $message->webhookAttempts()->count() <= 2) // @phpstan-ignore-line + ->filter(static fn (WebhookMessage $message): bool => $message->webhookAttempts()->count() <= 2) ->splice(0, 3) ; } diff --git a/app/Rules/BelongsUser.php b/app/Rules/BelongsUser.php index cdcbcb9a6f..9bbcd8fd6e 100644 --- a/app/Rules/BelongsUser.php +++ b/app/Rules/BelongsUser.php @@ -82,7 +82,7 @@ class BelongsUser implements ValidationRule } $count = 0; foreach ($objects as $object) { - $objectValue = trim((string) $object->{$field}); // @phpstan-ignore-line + $objectValue = trim((string) $object->{$field}); Log::debug(sprintf('Comparing object "%s" with value "%s"', $objectValue, $value)); if ($objectValue === $value) { ++$count; diff --git a/app/Rules/BelongsUserGroup.php b/app/Rules/BelongsUserGroup.php index 7827cb7456..ca3215d037 100644 --- a/app/Rules/BelongsUserGroup.php +++ b/app/Rules/BelongsUserGroup.php @@ -95,7 +95,7 @@ class BelongsUserGroup implements ValidationRule } $count = 0; foreach ($objects as $object) { - $objectValue = trim((string) $object->{$field}); // @phpstan-ignore-line + $objectValue = trim((string) $object->{$field}); Log::debug(sprintf('Comparing object "%s" with value "%s"', $objectValue, $value)); if ($objectValue === $value) { ++$count; diff --git a/app/Rules/IsDateOrTime.php b/app/Rules/IsDateOrTime.php index 6aa54ad1a0..b03e750c67 100644 --- a/app/Rules/IsDateOrTime.php +++ b/app/Rules/IsDateOrTime.php @@ -51,7 +51,7 @@ class IsDateOrTime implements ValidationRule // probably a date format. try { Carbon::createFromFormat('Y-m-d', $value); - } catch (InvalidDateException $e) { // @phpstan-ignore-line + } catch (InvalidDateException $e) { Log::error(sprintf('"%s" is not a valid date: %s', $value, $e->getMessage())); $fail('validation.date_or_time')->translate(); @@ -71,7 +71,7 @@ class IsDateOrTime implements ValidationRule // is an atom string, I hope? try { Carbon::parse($value); - } catch (InvalidDateException $e) { // @phpstan-ignore-line + } catch (InvalidDateException $e) { Log::error(sprintf('"%s" is not a valid date or time: %s', $value, $e->getMessage())); $fail('validation.date_or_time')->translate(); diff --git a/app/Rules/IsValidBulkClause.php b/app/Rules/IsValidBulkClause.php index c43e178cec..c676c683a4 100644 --- a/app/Rules/IsValidBulkClause.php +++ b/app/Rules/IsValidBulkClause.php @@ -94,7 +94,7 @@ class IsValidBulkClause implements ValidationRule // validate! $validator = Validator::make(['value' => $arrayValue], ['value' => $this->rules[$clause][$arrayKey]]); if ($validator->fails()) { - $this->error = sprintf('%s: %s: %s', $clause, $arrayKey, implode(', ', $validator->errors()->get('value'))); // @phpstan-ignore-line + $this->error = sprintf('%s: %s: %s', $clause, $arrayKey, implode(', ', $validator->errors()->get('value'))); return false; } diff --git a/app/Rules/IsValidDateRange.php b/app/Rules/IsValidDateRange.php index b50de3f95f..00aaf377e4 100644 --- a/app/Rules/IsValidDateRange.php +++ b/app/Rules/IsValidDateRange.php @@ -54,7 +54,7 @@ class IsValidDateRange implements ValidationRule try { $left = Carbon::parse($value); $right = Carbon::parse($otherValue); - } catch (InvalidDateException $e) { // @phpstan-ignore-line + } catch (InvalidDateException $e) { Log::error(sprintf('"%s" or "%s" is not a valid date or time: %s', $value, $otherValue, $e->getMessage())); $fail('validation.date_or_time')->translate(); diff --git a/app/Services/Internal/Recalculate/PrimaryAmountRecalculationService.php b/app/Services/Internal/Recalculate/PrimaryAmountRecalculationService.php index b5a930ae3e..119cabbab6 100644 --- a/app/Services/Internal/Recalculate/PrimaryAmountRecalculationService.php +++ b/app/Services/Internal/Recalculate/PrimaryAmountRecalculationService.php @@ -198,7 +198,7 @@ class PrimaryAmountRecalculationService private function recalculatePiggyBankEvents(PiggyBank $piggyBank): void { $set = $piggyBank->piggyBankEvents()->get(); - $set->each(static function (PiggyBankEvent $event): void { // @phpstan-ignore-line + $set->each(static function (PiggyBankEvent $event): void { $event->touch(); }); Log::debug(sprintf('Recalculated %d piggy bank events.', $set->count())); diff --git a/app/Services/Internal/Update/JournalUpdateService.php b/app/Services/Internal/Update/JournalUpdateService.php index 7052888cb9..4c5eaa9e3b 100644 --- a/app/Services/Internal/Update/JournalUpdateService.php +++ b/app/Services/Internal/Update/JournalUpdateService.php @@ -675,7 +675,7 @@ class JournalUpdateService ) ); - $this->transactionJournal->{$fieldName} = $value; // @phpstan-ignore-line + $this->transactionJournal->{$fieldName} = $value; Log::debug(sprintf('Updated %s', $fieldName)); } } @@ -822,7 +822,7 @@ class JournalUpdateService if ($this->hasFields([$field])) { try { $value = '' === (string) $this->data[$field] ? null : new Carbon($this->data[$field]); - } catch (InvalidDateException|InvalidFormatException $e) { // @phpstan-ignore-line + } catch (InvalidDateException|InvalidFormatException $e) { Log::debug(sprintf('%s is not a valid date value: %s', $this->data[$field], $e->getMessage())); return; diff --git a/app/Support/Authentication/RemoteUserGuard.php b/app/Support/Authentication/RemoteUserGuard.php index d42f25e9ea..f78bb0270e 100644 --- a/app/Support/Authentication/RemoteUserGuard.php +++ b/app/Support/Authentication/RemoteUserGuard.php @@ -144,7 +144,7 @@ class RemoteUserGuard implements Guard return $this->user?->id; } - public function setUser(Authenticatable|User|null $user): void // @phpstan-ignore-line + public function setUser(Authenticatable|User|null $user): void { // Log::debug(sprintf('Now at %s', __METHOD__)); if ($user instanceof User) { diff --git a/app/Support/Binder/BudgetList.php b/app/Support/Binder/BudgetList.php index 29d756356d..89d4cb6131 100644 --- a/app/Support/Binder/BudgetList.php +++ b/app/Support/Binder/BudgetList.php @@ -46,7 +46,7 @@ class BudgetList implements BinderInterface $list = array_unique(array_map(\intval(...), explode(',', $value))); - if (0 === count($list)) { // @phpstan-ignore-line + if (0 === count($list)) { Log::warning('Budget list count is zero, return 404.'); throw new NotFoundHttpException(); diff --git a/app/Support/Binder/CategoryList.php b/app/Support/Binder/CategoryList.php index e7f14bd6b6..3f7ecffac9 100644 --- a/app/Support/Binder/CategoryList.php +++ b/app/Support/Binder/CategoryList.php @@ -44,7 +44,7 @@ class CategoryList implements BinderInterface } $list = array_unique(array_map(\intval(...), explode(',', $value))); - if (0 === count($list)) { // @phpstan-ignore-line + if (0 === count($list)) { throw new NotFoundHttpException(); } diff --git a/app/Support/Binder/Date.php b/app/Support/Binder/Date.php index a89cc8f2a3..6e2890fdd5 100644 --- a/app/Support/Binder/Date.php +++ b/app/Support/Binder/Date.php @@ -69,7 +69,7 @@ class Date implements BinderInterface try { $result = new Carbon($value); - } catch (InvalidDateException|InvalidFormatException $e) { // @phpstan-ignore-line + } catch (InvalidDateException|InvalidFormatException $e) { $message = sprintf('Could not parse date "%s" for user #%d: %s', $value, auth()->user()->id, $e->getMessage()); Log::error($message); diff --git a/app/Support/Binder/JournalList.php b/app/Support/Binder/JournalList.php index 394ad2feea..2afa514696 100644 --- a/app/Support/Binder/JournalList.php +++ b/app/Support/Binder/JournalList.php @@ -66,7 +66,7 @@ class JournalList implements BinderInterface protected static function parseList(string $value): array { $list = array_unique(array_map(\intval(...), explode(',', $value))); - if (0 === count($list)) { // @phpstan-ignore-line + if (0 === count($list)) { throw new NotFoundHttpException(); } diff --git a/app/Support/Binder/TagList.php b/app/Support/Binder/TagList.php index 7d6e3900e2..d8fff00a01 100644 --- a/app/Support/Binder/TagList.php +++ b/app/Support/Binder/TagList.php @@ -47,7 +47,7 @@ class TagList implements BinderInterface $list = array_unique(array_map(\strtolower(...), explode(',', $value))); Log::debug('List of tags is', $list); - if (0 === count($list)) { // @phpstan-ignore-line + if (0 === count($list)) { Log::error('Tag list is empty.'); throw new NotFoundHttpException(); diff --git a/app/Support/Http/Api/ValidatesUserGroupTrait.php b/app/Support/Http/Api/ValidatesUserGroupTrait.php index 1b67e01658..0a920c3e2f 100644 --- a/app/Support/Http/Api/ValidatesUserGroupTrait.php +++ b/app/Support/Http/Api/ValidatesUserGroupTrait.php @@ -89,7 +89,7 @@ trait ValidatesUserGroupTrait throw new AuthorizationException((string) trans('validation.belongs_user_or_user_group')); } Log::debug(sprintf('validateUserGroup: validate access of user to group #%d ("%s").', $groupId, $group->title)); - $roles = property_exists($this, 'acceptedRoles') ? $this->acceptedRoles : []; // @phpstan-ignore-line + $roles = property_exists($this, 'acceptedRoles') ? $this->acceptedRoles : []; if (0 === count($roles)) { Log::debug('validateUserGroup: no roles defined, so no access.'); diff --git a/app/Support/Models/BillDateCalculator.php b/app/Support/Models/BillDateCalculator.php index 817ecf86be..bf6a8dae2d 100644 --- a/app/Support/Models/BillDateCalculator.php +++ b/app/Support/Models/BillDateCalculator.php @@ -128,7 +128,7 @@ class BillDateCalculator } } Log::debug('end of loop'); - $simple = $set->map( // @phpstan-ignore-line + $simple = $set->map( static fn (Carbon $date) => $date->format('Y-m-d') ); Log::debug(sprintf('Found %d pay dates', $set->count()), $simple->toArray()); diff --git a/app/Support/Navigation.php b/app/Support/Navigation.php index 83f5bf140e..14a60f51af 100644 --- a/app/Support/Navigation.php +++ b/app/Support/Navigation.php @@ -156,7 +156,7 @@ class Navigation } $func = $map[$period]; // first do the diff - $floatDiff = $beginning->{$func}($end, true); // @phpstan-ignore-line + $floatDiff = $beginning->{$func}($end, true); // then correct for quarterly or half-year if ('quarterly' === $period) { @@ -345,7 +345,7 @@ class Navigation $function = $functionMap[$repeatFreq]; if (array_key_exists($repeatFreq, $modifierMap)) { - $currentEnd->{$function}($modifierMap[$repeatFreq])->milli(0); // @phpstan-ignore-line + $currentEnd->{$function}($modifierMap[$repeatFreq])->milli(0); if (in_array($repeatFreq, $subDay, true)) { $currentEnd->subDay(); } @@ -363,7 +363,7 @@ class Navigation return $currentEnd; } - $currentEnd->{$function}(); // @phpstan-ignore-line + $currentEnd->{$function}(); $currentEnd->endOfDay()->milli(0); if (in_array($repeatFreq, $subDay, true)) { $currentEnd->subDay(); @@ -406,7 +406,7 @@ class Navigation if (array_key_exists($repeatFreq, $functionMap)) { $function = $functionMap[$repeatFreq]; - $currentEnd->{$function}(); // @phpstan-ignore-line + $currentEnd->{$function}(); } if ($maxDate instanceof Carbon && $currentEnd > $maxDate) { @@ -470,7 +470,7 @@ class Navigation $formatted = $begin->format($format); $displayed = $begin->isoFormat($displayFormat); $entries[$formatted] = $displayed; - $begin->{$increment}(); // @phpstan-ignore-line + $begin->{$increment}(); } Log::debug('listOfPeriods end of loop.'); @@ -677,13 +677,13 @@ class Navigation // Log::debug(sprintf('Function is ->%s()', $function)); if (array_key_exists($function, $parameterMap)) { // Log::debug(sprintf('Parameter map, function becomes ->%s(%s)', $function, implode(', ', $parameterMap[$function]))); - $date->{$function}($parameterMap[$function][0]); // @phpstan-ignore-line + $date->{$function}($parameterMap[$function][0]); // Log::debug(sprintf('Result is "%s"', $date->toIso8601String())); return $date; } - $date->{$function}(); // @phpstan-ignore-line + $date->{$function}(); // Log::debug(sprintf('Result is "%s"', $date->toIso8601String())); return $date; @@ -747,7 +747,7 @@ class Navigation $modifierMap = ['quarter' => 3, '3M' => 3, 'quarterly' => 3, 'half-year' => 6, '6M' => 6]; if (array_key_exists($repeatFreq, $functionMap)) { $function = $functionMap[$repeatFreq]; - $date->{$function}($subtract); // @phpstan-ignore-line + $date->{$function}($subtract); return $date; } @@ -826,7 +826,7 @@ class Navigation if (array_key_exists($range, $functionMap)) { $function = $functionMap[$range]; - $end->{$function}(); // @phpstan-ignore-line + $end->{$function}(); Log::debug(sprintf('updateEndDate returns "%s"', $end->format('Y-m-d'))); @@ -877,7 +877,7 @@ class Navigation ]; if (array_key_exists($range, $functionMap)) { $function = $functionMap[$range]; - $start->{$function}(); // @phpstan-ignore-line + $start->{$function}(); Log::debug(sprintf('updateStartDate returns "%s"', $start->format('Y-m-d'))); return $start; diff --git a/app/Support/ParseDateString.php b/app/Support/ParseDateString.php index f4dbc7f7d2..8251a149df 100644 --- a/app/Support/ParseDateString.php +++ b/app/Support/ParseDateString.php @@ -353,7 +353,7 @@ class ParseDateString } $func = $functions[$direction][$period]; Log::debug(sprintf('Will now do %s(%d) on %s', $func, $number, $today->format('Y-m-d'))); - $today->{$func}($number); // @phpstan-ignore-line + $today->{$func}($number); Log::debug(sprintf('Resulting date is %s', $today->format('Y-m-d'))); } diff --git a/app/Support/Report/Summarizer/TransactionSummarizer.php b/app/Support/Report/Summarizer/TransactionSummarizer.php index 74cc7fc08f..0463de30fa 100644 --- a/app/Support/Report/Summarizer/TransactionSummarizer.php +++ b/app/Support/Report/Summarizer/TransactionSummarizer.php @@ -195,7 +195,7 @@ class TransactionSummarizer ]; // add the data from the $field to the array. - $array[$key]['sum'] = bcadd($array[$key]['sum'], (string) Steam::{$method}((string) ($journal[$field] ?? '0'))); // @phpstan-ignore-line + $array[$key]['sum'] = bcadd($array[$key]['sum'], (string) Steam::{$method}((string) ($journal[$field] ?? '0'))); Log::debug(sprintf( 'Field for transaction #%d is "%s" (%s). Sum: %s', $journal['transaction_group_id'], @@ -225,7 +225,7 @@ class TransactionSummarizer 'currency_code' => $journal['foreign_currency_code'], 'currency_decimal_places' => $journal['foreign_currency_decimal_places'], ]; - $array[$key]['sum'] = bcadd($array[$key]['sum'], (string) Steam::{$method}((string) $journal['foreign_amount'])); // @phpstan-ignore-line + $array[$key]['sum'] = bcadd($array[$key]['sum'], (string) Steam::{$method}((string) $journal['foreign_amount'])); } } diff --git a/app/Support/Request/ChecksLogin.php b/app/Support/Request/ChecksLogin.php index 43b9161984..73bc0dfe84 100644 --- a/app/Support/Request/ChecksLogin.php +++ b/app/Support/Request/ChecksLogin.php @@ -45,7 +45,7 @@ trait ChecksLogin if (!$check) { return false; } - if (!property_exists($this, 'acceptedRoles')) { // @phpstan-ignore-line + if (!property_exists($this, 'acceptedRoles')) { Log::debug(sprintf('Request class %s has no acceptedRoles array', static::class)); return true; // check for false already took place. diff --git a/app/Support/Request/ConvertsDataTypes.php b/app/Support/Request/ConvertsDataTypes.php index ea4248652a..9982564930 100644 --- a/app/Support/Request/ConvertsDataTypes.php +++ b/app/Support/Request/ConvertsDataTypes.php @@ -205,7 +205,7 @@ trait ConvertsDataTypes /** @var AccountRepositoryInterface $repository */ $repository = app(AccountRepositoryInterface::class); - if (method_exists($this, 'validateUserGroup')) { // @phpstan-ignore-line + if (method_exists($this, 'validateUserGroup')) { $userGroup = $this->validateUserGroup($this); $repository->setUserGroup($userGroup); } @@ -290,11 +290,11 @@ trait ConvertsDataTypes // probably a date format. try { $carbon = Carbon::createFromFormat('Y-m-d', $value, config('app.timezone')); - } catch (InvalidDateException $e) { // @phpstan-ignore-line + } catch (InvalidDateException $e) { Log::error(sprintf('[1] "%s" is not a valid date: %s', $value, $e->getMessage())); return null; - } catch (InvalidFormatException $e) { // @phpstan-ignore-line + } catch (InvalidFormatException $e) { Log::error(sprintf('[2] "%s" is of an invalid format: %s', $value, $e->getMessage())); return null; @@ -312,7 +312,7 @@ trait ConvertsDataTypes try { $carbon = Carbon::parse($value); $carbon->setTimezone(config('app.timezone')); - } catch (InvalidDateException $e) { // @phpstan-ignore-line + } catch (InvalidDateException $e) { Log::error(sprintf('[3] "%s" is not a valid date or time: %s', $value, $e->getMessage())); return null; @@ -385,7 +385,7 @@ trait ConvertsDataTypes foreach ($fields as $field => $info) { if (true === $this->has($info[0])) { $method = $info[1]; - $return[$field] = $this->{$method}($info[0]); // @phpstan-ignore-line + $return[$field] = $this->{$method}($info[0]); } } diff --git a/app/Support/Search/OperatorQuerySearch.php b/app/Support/Search/OperatorQuerySearch.php index e3893578b7..9ffdb42500 100644 --- a/app/Support/Search/OperatorQuerySearch.php +++ b/app/Support/Search/OperatorQuerySearch.php @@ -552,7 +552,7 @@ class OperatorQuerySearch implements SearchInterface return; } Log::debug(sprintf('Left with %d, set as %s().', $filtered->count(), $collectorMethod)); - $this->collector->{$collectorMethod}($filtered); // @phpstan-ignore-line + $this->collector->{$collectorMethod}($filtered); } /** @@ -661,7 +661,7 @@ class OperatorQuerySearch implements SearchInterface return; } Log::debug(sprintf('Left with %d, set as %s().', $filtered->count(), $collectorMethod)); - $this->collector->{$collectorMethod}($filtered); // @phpstan-ignore-line + $this->collector->{$collectorMethod}($filtered); } /** diff --git a/app/Support/Steam.php b/app/Support/Steam.php index aff5d47441..e76ab4e012 100644 --- a/app/Support/Steam.php +++ b/app/Support/Steam.php @@ -475,7 +475,7 @@ class Steam ->groupBy('transactions.transaction_currency_id') ->orderBy('transaction_journals.date', 'ASC') ->whereNull('transaction_journals.deleted_at') - ->get(['transaction_journals.date', 'transactions.transaction_currency_id', DB::raw('SUM(transactions.amount) AS sum_of_day')]) // @phpstan-ignore-line + ->get(['transaction_journals.date', 'transactions.transaction_currency_id', DB::raw('SUM(transactions.amount) AS sum_of_day')]) ; $currentBalance = $startBalance; @@ -619,7 +619,7 @@ class Steam ->transactions() ->whereIn('transactions.account_id', $accounts) ->groupBy(['transactions.account_id', 'transaction_journals.user_id']) - ->get(['transactions.account_id', DB::raw('MAX(transaction_journals.date) AS max_date')]) // @phpstan-ignore-line + ->get(['transactions.account_id', DB::raw('MAX(transaction_journals.date) AS max_date')]) ; /** @var Transaction $entry */ diff --git a/app/TransactionRules/Engine/SearchRuleEngine.php b/app/TransactionRules/Engine/SearchRuleEngine.php index cdcef0ccc9..bd2e1e814e 100644 --- a/app/TransactionRules/Engine/SearchRuleEngine.php +++ b/app/TransactionRules/Engine/SearchRuleEngine.php @@ -99,7 +99,7 @@ class SearchRuleEngine implements RuleEngineInterface Log::debug(sprintf('SearchRuleEngine:: found %d rule(s) to fire.', $this->rules->count())); /** @var Rule $rule */ - foreach ($this->rules as $rule) { // @phpstan-ignore-line + foreach ($this->rules as $rule) { $result = $this->fireRule($rule); if ($result && true === $rule->stop_processing) { Log::debug(sprintf( @@ -120,7 +120,7 @@ class SearchRuleEngine implements RuleEngineInterface // fire each group: /** @var RuleGroup $group */ - foreach ($this->groups as $group) { // @phpstan-ignore-line + foreach ($this->groups as $group) { $this->fireGroup($group); } } diff --git a/app/User.php b/app/User.php index e29d75d038..0e32d1a835 100644 --- a/app/User.php +++ b/app/User.php @@ -319,7 +319,7 @@ class User extends Authenticatable { $method = 'routeNotificationFor'.Str::studly($driver); if (method_exists($this, $method)) { - return $this->{$method}($notification); // @phpstan-ignore-line + return $this->{$method}($notification); } $email = $this->email; // see if user has alternative email address: diff --git a/app/Validation/FireflyValidator.php b/app/Validation/FireflyValidator.php index 8ef36e55d1..649217dacf 100644 --- a/app/Validation/FireflyValidator.php +++ b/app/Validation/FireflyValidator.php @@ -262,7 +262,7 @@ class FireflyValidator extends Validator try { $checksum = bcmod($iban, '97'); - } catch (ValueError $e) { // @phpstan-ignore-line + } catch (ValueError $e) { $message = sprintf('Could not validate IBAN check value "%s" (IBAN "%s")', $iban, $value); Log::error($message); Log::error($e->getTraceAsString()); diff --git a/app/Validation/RecurrenceValidation.php b/app/Validation/RecurrenceValidation.php index 68a1c4e97b..a1617b918a 100644 --- a/app/Validation/RecurrenceValidation.php +++ b/app/Validation/RecurrenceValidation.php @@ -395,7 +395,7 @@ trait RecurrenceValidation { try { Carbon::createFromFormat('Y-m-d', $moment); - } catch (InvalidArgumentException $e) { // @phpstan-ignore-line + } catch (InvalidArgumentException $e) { Log::debug(sprintf('Invalid argument for Carbon: %s', $e->getMessage())); $validator->errors()->add(sprintf('repetitions.%d.moment', $index), (string) trans('validation.valid_recurrence_rep_moment')); } diff --git a/composer.json b/composer.json index 15086df42a..c4156ecef8 100644 --- a/composer.json +++ b/composer.json @@ -125,7 +125,8 @@ "phpstan/phpstan-strict-rules": "^2", "phpunit/phpunit": "^12", "rector/rector": "^2.3", - "thecodingmachine/phpstan-safe-rule": "^1.4" + "thecodingmachine/phpstan-safe-rule": "^1.4", + "ergebnis/phpstan-rules": "^2" }, "suggest": {}, diff --git a/composer.lock b/composer.lock index b3bdda56cc..9ee2e70345 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "94727a98e7468c09f3529378b9cb2457", + "content-hash": "93912463b9c00da1cf4afbd38edd36a1", "packages": [ { "name": "bacon/bacon-qr-code", @@ -10407,6 +10407,79 @@ }, "time": "2026-03-05T19:46:28+00:00" }, + { + "name": "ergebnis/phpstan-rules", + "version": "2.13.1", + "source": { + "type": "git", + "url": "https://github.com/ergebnis/phpstan-rules.git", + "reference": "f69db86b98595c34fc1f61c89fe3b380141aa519" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ergebnis/phpstan-rules/zipball/f69db86b98595c34fc1f61c89fe3b380141aa519", + "reference": "f69db86b98595c34fc1f61c89fe3b380141aa519", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": "~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0", + "phpstan/phpstan": "^2.1.35" + }, + "require-dev": { + "codeception/codeception": "^4.0.0 || ^5.0.0", + "doctrine/orm": "^2.20.0 || ^3.3.0", + "ergebnis/composer-normalize": "^2.49.0", + "ergebnis/license": "^2.7.0", + "ergebnis/php-cs-fixer-config": "^6.59.0", + "ergebnis/phpunit-slow-test-detector": "^2.20.0", + "fakerphp/faker": "^1.24.1", + "phpstan/extension-installer": "^1.4.3", + "phpstan/phpstan-deprecation-rules": "^2.0.3", + "phpstan/phpstan-phpunit": "^2.0.12", + "phpstan/phpstan-strict-rules": "^2.0.8", + "phpunit/phpunit": "^9.6.21", + "psr/container": "^2.0.2", + "symfony/finder": "^5.4.45", + "symfony/process": "^5.4.47" + }, + "type": "phpstan-extension", + "extra": { + "phpstan": { + "includes": [ + "rules.neon" + ] + } + }, + "autoload": { + "psr-4": { + "Ergebnis\\PHPStan\\Rules\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Andreas Möller", + "email": "am@localheinz.com", + "homepage": "https://localheinz.com" + } + ], + "description": "Provides rules for phpstan/phpstan.", + "homepage": "https://github.com/ergebnis/phpstan-rules", + "keywords": [ + "PHPStan", + "phpstan-rules" + ], + "support": { + "issues": "https://github.com/ergebnis/phpstan-rules/issues", + "security": "https://github.com/ergebnis/phpstan-rules/blob/main/.github/SECURITY.md", + "source": "https://github.com/ergebnis/phpstan-rules" + }, + "time": "2026-01-27T17:13:06+00:00" + }, { "name": "fakerphp/faker", "version": "v1.24.1", diff --git a/storage/framework/views/v1/.gitignore b/storage/framework/views/v1/.gitignore deleted file mode 100644 index d6b7ef32c8..0000000000 --- a/storage/framework/views/v1/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore