mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-18 10:16:49 +00:00
More PHP8.4 updates
This commit is contained in:
@@ -92,9 +92,9 @@ class BoxController extends Controller
|
||||
$currencyId = $this->convertToNative && $this->defaultCurrency->id !== (int) $journal['currency_id'] ? $this->defaultCurrency->id : (int) $journal['currency_id'];
|
||||
$amount = Amount::getAmountFromJournal($journal);
|
||||
$incomes[$currencyId] ??= '0';
|
||||
$incomes[$currencyId] = bcadd($incomes[$currencyId], app('steam')->positive($amount));
|
||||
$incomes[$currencyId] = bcadd($incomes[$currencyId], (string) app('steam')->positive($amount));
|
||||
$sums[$currencyId] ??= '0';
|
||||
$sums[$currencyId] = bcadd($sums[$currencyId], app('steam')->positive($amount));
|
||||
$sums[$currencyId] = bcadd($sums[$currencyId], (string) app('steam')->positive($amount));
|
||||
}
|
||||
|
||||
// collect expenses
|
||||
|
@@ -55,8 +55,8 @@ class FrontpageController extends Controller
|
||||
if (1 === bccomp($amount, '0')) {
|
||||
// percentage!
|
||||
$pct = 0;
|
||||
if (0 !== bccomp($piggyBank->target_amount, '0')) {
|
||||
$pct = (int) bcmul(bcdiv($amount, $piggyBank->target_amount), '100');
|
||||
if (0 !== bccomp((string) $piggyBank->target_amount, '0')) {
|
||||
$pct = (int) bcmul(bcdiv($amount, (string) $piggyBank->target_amount), '100');
|
||||
}
|
||||
|
||||
$entry = [
|
||||
@@ -82,9 +82,7 @@ class FrontpageController extends Controller
|
||||
// sort by current percentage (lowest at the top)
|
||||
uasort(
|
||||
$info,
|
||||
static function (array $a, array $b) {
|
||||
return $a['percentage'] <=> $b['percentage'];
|
||||
}
|
||||
static fn(array $a, array $b) => $a['percentage'] <=> $b['percentage']
|
||||
);
|
||||
|
||||
$html = '';
|
||||
|
@@ -160,15 +160,15 @@ class ReconcileController extends Controller
|
||||
}
|
||||
if ($account->id === $journal['destination_account_id']) {
|
||||
if ($currency->id === $journal['currency_id']) {
|
||||
$toAdd = bcmul($journal['amount'], '-1');
|
||||
$toAdd = bcmul((string) $journal['amount'], '-1');
|
||||
}
|
||||
if (null !== $journal['foreign_currency_id'] && $journal['foreign_currency_id'] === $currency->id) {
|
||||
$toAdd = bcmul($journal['foreign_amount'], '-1');
|
||||
$toAdd = bcmul((string) $journal['foreign_amount'], '-1');
|
||||
}
|
||||
}
|
||||
|
||||
app('log')->debug(sprintf('Going to add %s to %s', $toAdd, $amount));
|
||||
$amount = bcadd($amount, $toAdd);
|
||||
$amount = bcadd($amount, (string) $toAdd);
|
||||
app('log')->debug(sprintf('Result is %s', $amount));
|
||||
|
||||
return $amount;
|
||||
|
@@ -74,7 +74,7 @@ class RecurrenceController extends Controller
|
||||
$firstDate = Carbon::createFromFormat('Y-m-d', $request->get('first_date'));
|
||||
$endDate = '' !== (string) $request->get('end_date') ? Carbon::createFromFormat('Y-m-d', $request->get('end_date')) : null;
|
||||
$endsAt = (string) $request->get('ends');
|
||||
$repetitionType = explode(',', $request->get('type'))[0];
|
||||
$repetitionType = explode(',', (string) $request->get('type'))[0];
|
||||
$repetitions = (int) $request->get('reps');
|
||||
$weekend = (int) $request->get('weekend');
|
||||
$repetitionMoment = '';
|
||||
@@ -101,13 +101,13 @@ class RecurrenceController extends Controller
|
||||
$actualStart = clone $firstDate;
|
||||
|
||||
if ('weekly' === $repetitionType || 'monthly' === $repetitionType) {
|
||||
$repetitionMoment = explode(',', $request->get('type'))[1] ?? '1';
|
||||
$repetitionMoment = explode(',', (string) $request->get('type'))[1] ?? '1';
|
||||
}
|
||||
if ('ndom' === $repetitionType) {
|
||||
$repetitionMoment = str_ireplace('ndom,', '', $request->get('type'));
|
||||
}
|
||||
if ('yearly' === $repetitionType) {
|
||||
$repetitionMoment = explode(',', $request->get('type'))[1] ?? '2018-01-01';
|
||||
$repetitionMoment = explode(',', (string) $request->get('type'))[1] ?? '2018-01-01';
|
||||
}
|
||||
$actualStart->startOfDay();
|
||||
$repetition = new RecurrenceRepetition();
|
||||
@@ -158,7 +158,7 @@ class RecurrenceController extends Controller
|
||||
|
||||
try {
|
||||
$date = Carbon::createFromFormat('Y-m-d', $string, config('app.timezone'));
|
||||
} catch (InvalidFormatException $e) {
|
||||
} catch (InvalidFormatException) {
|
||||
$date = Carbon::today(config('app.timezone'));
|
||||
}
|
||||
if (null === $date) {
|
||||
|
Reference in New Issue
Block a user