diff --git a/app/Console/Commands/Correction/FixFrontpageAccounts.php b/app/Console/Commands/Correction/FixFrontpageAccounts.php index 884b4d43e1..875519fa3b 100644 --- a/app/Console/Commands/Correction/FixFrontpageAccounts.php +++ b/app/Console/Commands/Correction/FixFrontpageAccounts.php @@ -52,7 +52,7 @@ class FixFrontpageAccounts extends Command $users = User::get(); /** @var User $user */ foreach ($users as $user) { - $preference = Preferences::getForUser($user, 'frontPageAccounts'); + $preference = app('preferences')->getForUser($user, 'frontPageAccounts'); if (null !== $preference) { $this->fixPreference($preference); } diff --git a/app/Console/Commands/Correction/FixTransactionTypes.php b/app/Console/Commands/Correction/FixTransactionTypes.php index 9fbd8a42ce..c6d083f3a9 100644 --- a/app/Console/Commands/Correction/FixTransactionTypes.php +++ b/app/Console/Commands/Correction/FixTransactionTypes.php @@ -60,7 +60,7 @@ class FixTransactionTypes extends Command } } if ($count > 0) { - $this->friendlyInfo('Corrected transaction type of %d transaction journals.', $count); + $this->friendlyInfo(sprintf('Corrected transaction type of %d transaction journals.', $count)); return 0; } diff --git a/app/Console/Commands/System/UpgradeFireflyInstructions.php b/app/Console/Commands/System/UpgradeFireflyInstructions.php index 3623a42956..e5313066cc 100644 --- a/app/Console/Commands/System/UpgradeFireflyInstructions.php +++ b/app/Console/Commands/System/UpgradeFireflyInstructions.php @@ -26,8 +26,6 @@ namespace FireflyIII\Console\Commands\System; use FireflyIII\Support\System\GeneratesInstallationId; use Illuminate\Console\Command; -use function FireflyIII\Console\Commands\str_starts_with; - /** * Class UpgradeFireflyInstructions. * @@ -77,7 +75,7 @@ class UpgradeFireflyInstructions extends Command $text = ''; foreach (array_keys($config) as $compare) { // if string starts with: - if (\str_starts_with($version, $compare)) { + if (str_starts_with($version, $compare)) { $text = $config[$compare]; } } @@ -190,7 +188,7 @@ class UpgradeFireflyInstructions extends Command $text = ''; foreach (array_keys($config) as $compare) { // if string starts with: - if (\str_starts_with($version, $compare)) { + if (str_starts_with($version, $compare)) { $text = $config[$compare]; } } diff --git a/app/Console/Commands/System/VerifySecurityAlerts.php b/app/Console/Commands/System/VerifySecurityAlerts.php index 3c82bb45bd..09c4f3f110 100644 --- a/app/Console/Commands/System/VerifySecurityAlerts.php +++ b/app/Console/Commands/System/VerifySecurityAlerts.php @@ -65,7 +65,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/Upgrade/UpgradeCurrencyPreferences.php b/app/Console/Commands/Upgrade/UpgradeCurrencyPreferences.php index b78ff5c57b..79df2b2af9 100644 --- a/app/Console/Commands/Upgrade/UpgradeCurrencyPreferences.php +++ b/app/Console/Commands/Upgrade/UpgradeCurrencyPreferences.php @@ -142,7 +142,7 @@ class UpgradeCurrencyPreferences extends Command // set the default currency for the user and for the group: $preference = $this->getPreference($user); $defaultCurrency = TransactionCurrency::where('code', $preference)->first(); - if (null === $currency) { + if (null === $defaultCurrency) { // get EUR $defaultCurrency = TransactionCurrency::where('code', 'EUR')->first(); } diff --git a/app/Events/DestroyedTransactionLink.php b/app/Events/DestroyedTransactionLink.php index fee5c47c9e..1c9629f526 100644 --- a/app/Events/DestroyedTransactionLink.php +++ b/app/Events/DestroyedTransactionLink.php @@ -33,7 +33,7 @@ class DestroyedTransactionLink extends Event { use SerializesModels; - private TransactionJournalLink $link; /// @phpstan-ignore-line PHPStan thinks this property is never read. + private TransactionJournalLink $link; /** * DestroyedTransactionLink constructor. diff --git a/app/Generator/Report/Audit/MonthReportGenerator.php b/app/Generator/Report/Audit/MonthReportGenerator.php index 30f5c162c9..4be0eb5313 100644 --- a/app/Generator/Report/Audit/MonthReportGenerator.php +++ b/app/Generator/Report/Audit/MonthReportGenerator.php @@ -135,7 +135,7 @@ class MonthReportGenerator implements ReportGeneratorInterface $journals = array_reverse($journals, true); $dayBeforeBalance = app('steam')->balance($account, $date); $startBalance = $dayBeforeBalance; - $defaultCurrency = app('amount')->getDefaultCurrencyByUser($account->user); + $defaultCurrency = app('amount')->getDefaultCurrencyByUserGroup($account->user->userGroup); $currency = $accountRepository->getAccountCurrency($account) ?? $defaultCurrency; foreach ($journals as $index => $journal) { diff --git a/app/Generator/Webhook/StandardMessageGenerator.php b/app/Generator/Webhook/StandardMessageGenerator.php index f71c0a8ecb..d4fdbd8788 100644 --- a/app/Generator/Webhook/StandardMessageGenerator.php +++ b/app/Generator/Webhook/StandardMessageGenerator.php @@ -127,7 +127,7 @@ class StandardMessageGenerator implements MessageGeneratorInterface { $class = get_class($model); // Line is ignored because all of Firefly III's Models have an id property. - Log::debug(sprintf('Now in generateMessage(#%d, %s#%d)', $webhook->id, $class, $model->id)); // @phpstan-ignore-line + Log::debug(sprintf('Now in generateMessage(#%d, %s#%d)', $webhook->id, $class, $model->id)); $uuid = Uuid::uuid4(); $basicMessage = [ @@ -146,7 +146,7 @@ class StandardMessageGenerator implements MessageGeneratorInterface // Line is ignored because all of Firefly III's Models have an id property. Log::error( sprintf('Webhook #%d was given %s#%d to deal with but can\'t extract user ID from it.', $webhook->id, $class, $model->id) - ); // @phpstan-ignore-line + ); return; case TransactionGroup::class: diff --git a/app/Handlers/Events/BillEventHandler.php b/app/Handlers/Events/BillEventHandler.php index f360c1e4a6..a7b58a4102 100644 --- a/app/Handlers/Events/BillEventHandler.php +++ b/app/Handlers/Events/BillEventHandler.php @@ -47,7 +47,7 @@ class BillEventHandler $bill = $event->bill; /** @var bool $preference */ - $preference = Preferences::getForUser($bill->user, 'notification_bill_reminder', true)->data; + $preference = app('preferences')->getForUser($bill->user, 'notification_bill_reminder', true)->data; if (true === $preference) { Log::debug('Bill reminder is true!'); diff --git a/app/Handlers/Events/Model/RuleHandler.php b/app/Handlers/Events/Model/RuleHandler.php index 99f9aa208b..c93eeeeb27 100644 --- a/app/Handlers/Events/Model/RuleHandler.php +++ b/app/Handlers/Events/Model/RuleHandler.php @@ -45,7 +45,7 @@ class RuleHandler { $ruleAction = $event->ruleAction; $rule = $ruleAction->rule; - $preference = Preferences::getForUser($rule->user, 'notification_rule_action_failures', true)->data; + $preference = app('preferences')->getForUser($rule->user, 'notification_rule_action_failures', true)->data; if (false === $preference) { return; } @@ -74,7 +74,7 @@ class RuleHandler { $ruleAction = $event->ruleAction; $rule = $ruleAction->rule; - $preference = Preferences::getForUser($rule->user, 'notification_rule_action_failures', true)->data; + $preference = app('preferences')->getForUser($rule->user, 'notification_rule_action_failures', true)->data; if (false === $preference) { return; }