mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-18 18:40:12 +00:00
Fix a lot of phpstan things
This commit is contained in:
@@ -120,11 +120,11 @@ class FixPostgresSequences extends Command
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($nextId->nextval < $highestId->max) {
|
||||
if ($nextId->nextval < $highestId->max) { // @phpstan-ignore-line
|
||||
DB::select(sprintf('SELECT setval(\'%s_id_seq\', %d)', $tableToCheck, $highestId->max));
|
||||
$highestId = DB::table($tableToCheck)->select(DB::raw('MAX(id)'))->first();
|
||||
$nextId = DB::table($tableToCheck)->select(DB::raw(sprintf('nextval(\'%s_id_seq\')', $tableToCheck)))->first();
|
||||
if ($nextId->nextval > $highestId->max) {
|
||||
if ($nextId->nextval > $highestId->max) { // @phpstan-ignore-line
|
||||
$this->friendlyInfo(sprintf('Table "%s" autoincrement corrected.', $tableToCheck));
|
||||
}
|
||||
if ($nextId->nextval <= $highestId->max) {
|
||||
|
@@ -48,7 +48,7 @@ class MigrateToRules extends Command
|
||||
|
||||
protected $description = 'Migrate bills to rules.';
|
||||
|
||||
protected $signature = 'firefly-iii:bills-to-rules {--F|force : Force the execution of this command.}';
|
||||
protected $signature = 'firefly-iii:bills-to-rules {--F|force : Force the execution of this command.}';
|
||||
private BillRepositoryInterface $billRepository;
|
||||
private int $count;
|
||||
private RuleGroupRepositoryInterface $ruleGroupRepository;
|
||||
@@ -138,14 +138,15 @@ class MigrateToRules extends Command
|
||||
|
||||
/** @var Preference $lang */
|
||||
$lang = app('preferences')->getForUser($user, 'language', 'en_US');
|
||||
$groupTitle = (string)trans('firefly.rulegroup_for_bills_title', [], $lang->data);
|
||||
$language = null !== $lang->data && !is_array($lang->data) ? (string)$lang->data : 'en_US';
|
||||
$groupTitle = (string)trans('firefly.rulegroup_for_bills_title', [], $language);
|
||||
$ruleGroup = $this->ruleGroupRepository->findByTitle($groupTitle);
|
||||
|
||||
if (null === $ruleGroup) {
|
||||
$ruleGroup = $this->ruleGroupRepository->store(
|
||||
[
|
||||
'title' => (string)trans('firefly.rulegroup_for_bills_title', [], $lang->data),
|
||||
'description' => (string)trans('firefly.rulegroup_for_bills_description', [], $lang->data),
|
||||
'title' => (string)trans('firefly.rulegroup_for_bills_title', [], $language),
|
||||
'description' => (string)trans('firefly.rulegroup_for_bills_description', [], $language),
|
||||
'active' => true,
|
||||
]
|
||||
);
|
||||
@@ -168,6 +169,7 @@ class MigrateToRules extends Command
|
||||
if ('MIGRATED_TO_RULES' === $bill->match) {
|
||||
return;
|
||||
}
|
||||
$languageString = null !== $language->data && !is_array($language->data) ? (string)$language->data : 'en_US';
|
||||
|
||||
// get match thing:
|
||||
$match = implode(' ', explode(',', $bill->match));
|
||||
@@ -176,8 +178,8 @@ class MigrateToRules extends Command
|
||||
'active' => true,
|
||||
'strict' => false,
|
||||
'stop_processing' => false, // field is no longer used.
|
||||
'title' => (string)trans('firefly.rule_for_bill_title', ['name' => $bill->name], $language->data),
|
||||
'description' => (string)trans('firefly.rule_for_bill_description', ['name' => $bill->name], $language->data),
|
||||
'title' => (string)trans('firefly.rule_for_bill_title', ['name' => $bill->name], $languageString),
|
||||
'description' => (string)trans('firefly.rule_for_bill_description', ['name' => $bill->name], $languageString),
|
||||
'trigger' => 'store-journal',
|
||||
'triggers' => [
|
||||
[
|
||||
|
@@ -150,7 +150,7 @@ class UpgradeCurrencyPreferences extends Command
|
||||
{
|
||||
$preference = Preference::where('user_id', $user->id)->where('name', 'currencyPreference')->first(['id', 'user_id', 'name', 'data', 'updated_at', 'created_at']);
|
||||
|
||||
if (null !== $preference) {
|
||||
if (null !== $preference->data && !is_array($preference->data)) {
|
||||
return (string)$preference->data;
|
||||
}
|
||||
return 'EUR';
|
||||
|
Reference in New Issue
Block a user