Fix various level 4 issues [skip ci]

This commit is contained in:
James Cole
2025-01-04 08:02:05 +01:00
parent ea9f635b1a
commit d4942efd8e
13 changed files with 18 additions and 28 deletions

View File

@@ -62,7 +62,11 @@ class ConvertsDatesToUTC extends Command
{
$this->friendlyWarning('Please do not use this command right now.');
return 0;
// this variable is ALWAYS en_US.
// stops phpstan complaining about dead code.
if (config('app.fallback_locale') === 'en_US') {
return Command::SUCCESS;
}
/**
* @var string $model
@@ -108,10 +112,10 @@ class ConvertsDatesToUTC extends Command
$items->each(
function ($item) use ($field, $timezoneField): void {
/** @var Carbon $date */
$date = Carbon::parse($item->{$field}, $item->{$timezoneField}); // @phpstan-ignore-line
$date = Carbon::parse($item->{$field}, $item->{$timezoneField}); // @phpstan-ignore-line
$date->setTimezone('UTC');
$item->{$field} = $date->format('Y-m-d H:i:s'); // @phpstan-ignore-line
$item->{$timezoneField} = 'UTC'; // @phpstan-ignore-line
$item->{$timezoneField} = 'UTC'; // @phpstan-ignore-line
$item->save();
}
);

View File

@@ -61,12 +61,7 @@ class ReportsSums extends Command
$sum = '' === $sum ? '0' : $sum;
$foreign = '' === $foreign ? '0' : $foreign;
$total = bcadd($sum, $foreign);
if (!is_numeric($total)) {
$message = sprintf('Error: Transactions for user #%d (%s) have an invalid sum ("%s").', $user->id, $user->email, $total);
$this->friendlyError($message);
continue;
}
if (0 !== bccomp($total, '0')) {
$message = sprintf('Error: Transactions for user #%d (%s) are off by %s!', $user->id, $user->email, $total);
$this->friendlyError($message);

View File

@@ -240,7 +240,7 @@ class UpgradesVariousCurrencyInformation extends Command
private function isMultiCurrency(Account $account): bool
{
$value = $this->accountRepos->getMetaValue($account, 'is_multi_currency');
if (false === $value || null === $value) {
if (null === $value) {
return false;
}