More PHP8.4 updates

This commit is contained in:
James Cole
2025-05-04 13:47:00 +02:00
parent e42107c03c
commit 51e86448c7
195 changed files with 524 additions and 715 deletions

View File

@@ -209,19 +209,19 @@ trait AccountServiceTrait
$amount = array_key_exists('opening_balance', $data) ? $data['opening_balance'] : '0';
// amount is positive.
if (1 === bccomp($amount, '0')) {
if (1 === bccomp((string) $amount, '0')) {
app('log')->debug(sprintf('Amount is %s, which is positive. Source is a new IB account, destination is #%d', $amount, $account->id));
$sourceName = trans('firefly.initial_balance_description', ['account' => $account->name], $language);
$destId = $account->id;
}
// amount is not positive
if (-1 === bccomp($amount, '0')) {
if (-1 === bccomp((string) $amount, '0')) {
app('log')->debug(sprintf('Amount is %s, which is negative. Destination is a new IB account, source is #%d', $amount, $account->id));
$destName = trans('firefly.initial_balance_account', ['account' => $account->name], $language);
$sourceId = $account->id;
}
// amount is 0
if (0 === bccomp($amount, '0')) {
if (0 === bccomp((string) $amount, '0')) {
app('log')->debug('Amount is zero, so will not make an OB group.');
throw new FireflyException('Amount for new opening balance was unexpectedly 0.');