[chore] fix phpstan errors.

This commit is contained in:
James Cole
2025-01-19 19:07:19 +01:00
parent 6e836aceec
commit 053b46ae63
52 changed files with 68 additions and 108 deletions

View File

@@ -355,7 +355,7 @@ class AccountRepository implements AccountRepositoryInterface
if (AccountTypeEnum::ASSET->value !== $account->accountType->type) {
throw new FireflyException(sprintf('%s is not an asset account.', $account->name));
}
$currency = $this->getAccountCurrency($account) ?? app('amount')->getDefaultCurrency();
$currency = $this->getAccountCurrency($account) ?? app('amount')->getNativeCurrency();
$name = trans('firefly.reconciliation_account_name', ['name' => $account->name, 'currency' => $currency->code]);
/** @var AccountType $type */

View File

@@ -275,7 +275,7 @@ class BillRepository implements BillRepositoryInterface
];
$result[$currencyId]['sum'] = bcadd($result[$currencyId]['sum'], $transaction->amount);
$result[$currencyId]['native_sum'] = bcadd($result[$currencyId]['native_sum'], $transaction->native_amount ?? '0');
if ($journal->foreign_currency_id === Amount::getDefaultCurrency()->id) {
if ($journal->foreign_currency_id === Amount::getNativeCurrency()->id) {
$result[$currencyId]['native_sum'] = bcadd($result[$currencyId]['native_sum'], $transaction->amount);
}
++$result[$currencyId]['count'];
@@ -406,7 +406,7 @@ class BillRepository implements BillRepositoryInterface
];
$result[$currencyId]['sum'] = bcadd($result[$currencyId]['sum'], $transaction->amount);
$result[$currencyId]['native_sum'] = bcadd($result[$currencyId]['native_sum'], $transaction->native_amount ?? '0');
if ($journal->foreign_currency_id === Amount::getDefaultCurrency()->id) {
if ($journal->foreign_currency_id === Amount::getNativeCurrency()->id) {
$result[$currencyId]['native_sum'] = bcadd($result[$currencyId]['native_sum'], $transaction->amount);
}
++$result[$currencyId]['count'];
@@ -530,7 +530,7 @@ class BillRepository implements BillRepositoryInterface
$bills = $this->getActiveBills();
$return = [];
$convertToNative = Amount::convertToNative($this->user);
$default = app('amount')->getDefaultCurrency();
$default = app('amount')->getNativeCurrency();
/** @var Bill $bill */
foreach ($bills as $bill) {
@@ -575,7 +575,7 @@ class BillRepository implements BillRepositoryInterface
$bills = $this->getActiveBills();
$return = [];
$convertToNative = Amount::convertToNative($this->user);
$default = app('amount')->getDefaultCurrency();
$default = app('amount')->getNativeCurrency();
/** @var Bill $bill */
foreach ($bills as $bill) {

View File

@@ -142,7 +142,7 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
// use native amount if necessary?
$convertToNative = Amount::convertToNative($this->user);
$default = Amount::getDefaultCurrency();
$default = Amount::getNativeCurrency();
/** @var AvailableBudget $availableBudget */
foreach ($availableBudgets as $availableBudget) {

View File

@@ -89,7 +89,7 @@ class BudgetRepository implements BudgetRepositoryInterface
$limitRepository = app(BudgetLimitRepository::class);
$limitRepository->setUser($this->user);
$budgets = $this->getActiveBudgets();
$defaultCurrency = app('amount')->getDefaultCurrency();
$defaultCurrency = app('amount')->getNativeCurrency();
$converter = new ExchangeRateConverter();
/** @var Budget $budget */

View File

@@ -364,7 +364,7 @@ class OperationsRepository implements OperationsRepositoryInterface
$collector->setCategories($categories);
$journals = $collector->getExtractedJournals();
$convertToNative = Amount::convertToNative($this->user);
$default = Amount::getDefaultCurrency();
$default = Amount::getNativeCurrency();
$array = [];
foreach ($journals as $journal) {

View File

@@ -69,7 +69,7 @@ class BillRepository implements BillRepositoryInterface
{
Log::debug(sprintf('Created new ExchangeRateConverter in %s', __METHOD__));
$bills = $this->getActiveBills();
$default = app('amount')->getDefaultCurrency();
$default = app('amount')->getNativeCurrency();
$return = [];
$converter = new ExchangeRateConverter();
@@ -139,7 +139,7 @@ class BillRepository implements BillRepositoryInterface
Log::debug(sprintf('Created new ExchangeRateConverter in %s', __METHOD__));
$bills = $this->getActiveBills();
$return = [];
$default = app('amount')->getDefaultCurrency();
$default = app('amount')->getNativeCurrency();
$converter = new ExchangeRateConverter();
/** @var Bill $bill */

View File

@@ -42,7 +42,7 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface
Log::debug(sprintf('Created new ExchangeRateConverter in %s', __METHOD__));
$return = [];
$converter = new ExchangeRateConverter();
$default = app('amount')->getDefaultCurrency();
$default = app('amount')->getNativeCurrency();
$availableBudgets = $this->userGroup->availableBudgets()
->where('start_date', $start->format('Y-m-d'))
->where('end_date', $end->format('Y-m-d'))->get()