Skip to content

Firefly III: a personal finances manager

Clean up more errors.

James Cole5d1fde9cf750
diff --git a/.ci/phpstan.neon b/.ci/phpstan.neon
index a7ea28a1f6..39b1f233bb 100644
--- a/.ci/phpstan.neon
+++ b/.ci/phpstan.neon
@@ -34,8 +34,6 @@ parameters:
reportUnmatchedIgnoredErrors: true
ignoreErrors:
# these are actually interesting but not right now:
- - identifier: nullCoalesce.offset
- - identifier: nullCoalesce.variable
- identifier: larastan.noUnnecessaryCollectionCall
- identifier: varTag.differentVariable
- identifier: identical.alwaysTrue
diff --git a/app/Factory/PiggyBankFactory.php b/app/Factory/PiggyBankFactory.php
index 209c7aad27..0bd782cded 100644
--- a/app/Factory/PiggyBankFactory.php
+++ b/app/Factory/PiggyBankFactory.php
@@ -158,9 +158,9 @@ class PiggyBankFactory
// event(new ChangedAmount($piggyBank, $diff, null, null));
}
- // no amount set, use previous amount or go to ZERO.
- $toBeLinked[$account->id] = ['current_amount' => $toBeLinked[$account->id]['current_amount'] ?? '0'];
- Log::debug(sprintf('[b] Will link account #%d with amount %s', $account->id, $toBeLinked[$account->id]['current_amount'] ?? '0'));
+ // no amount set, use previous amount
+ $toBeLinked[$account->id] = ['current_amount' => $toBeLinked[$account->id]['current_amount']];
+ Log::debug(sprintf('[b] Will link account #%d with amount %s', $account->id, $toBeLinked[$account->id]['current_amount']));
// create event:
Log::debug('linkToAccountIds: Trigger change for positive amount [b].');
diff --git a/app/Http/Controllers/Json/ReconcileController.php b/app/Http/Controllers/Json/ReconcileController.php
index 27e675a53b..0e98caec5a 100644
--- a/app/Http/Controllers/Json/ReconcileController.php
+++ b/app/Http/Controllers/Json/ReconcileController.php
@@ -128,10 +128,10 @@ final class ReconcileController extends Controller
Log::debug(sprintf('End balance: "%s"', $endBalance));
Log::debug(sprintf('Cleared amount: "%s"', $clearedAmount));
Log::debug(sprintf('Amount: "%s"', $amount));
- $difference = bcadd(bcadd(bcsub($startBalance ?? '0', $endBalance ?? '0'), $clearedAmount), $amount);
+ $difference = bcadd(bcadd(bcsub($startBalance, $endBalance), $clearedAmount), $amount);
$diffCompare = bccomp($difference, '0');
$countCleared = count($clearedJournals);
- $reconSum = bcadd(bcadd($startBalance ?? '0', $amount), $clearedAmount);
+ $reconSum = bcadd(bcadd($startBalance, $amount), $clearedAmount);
try {
$view = view('accounts.reconcile.overview', [
diff --git a/app/Support/JsonApi/Enrichments/BudgetLimitEnrichment.php b/app/Support/JsonApi/Enrichments/BudgetLimitEnrichment.php
index 1e07644fd1..3e51b6a4ce 100644
--- a/app/Support/JsonApi/Enrichments/BudgetLimitEnrichment.php
+++ b/app/Support/JsonApi/Enrichments/BudgetLimitEnrichment.php
@@ -208,14 +208,8 @@ class BudgetLimitEnrichment implements EnrichmentInterface
private function stringifyIds(): void
{
- $this->expenses = array_map(static fn ($first): array => array_map(static function (array $second): array {
- $second['currency_id'] = (string) ($second['currency_id'] ?? 0);
-
- return $second;
- }, $first), $this->expenses);
-
- $this->pcExpenses = array_map(static fn (array $first): array => array_map(static function (array $second): array {
- $second['currency_id'] ??= 0;
+ $this->expenses = array_map(static fn($first): array => array_map(static function (array $second): array {
+ $second['currency_id'] = (string)($second['currency_id'] ?? 0);
return $second;
}, $first), $this->expenses);