mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Fix round() call for PHP 8.0
This commit is contained in:
@@ -40,20 +40,14 @@ use Illuminate\Support\Collection;
|
||||
class FrontpageChartGenerator
|
||||
{
|
||||
use AugumentData;
|
||||
/** @var AccountRepositoryInterface */
|
||||
private $accountRepos;
|
||||
/** @var array */
|
||||
private $currencies;
|
||||
/** @var Carbon */
|
||||
private $end;
|
||||
/** @var NoCategoryRepositoryInterface */
|
||||
private $noCatRepos;
|
||||
/** @var OperationsRepositoryInterface */
|
||||
private $opsRepos;
|
||||
/** @var CategoryRepositoryInterface */
|
||||
private $repository;
|
||||
/** @var Carbon */
|
||||
private $start;
|
||||
|
||||
private AccountRepositoryInterface $accountRepos;
|
||||
private array $currencies;
|
||||
private Carbon $end;
|
||||
private NoCategoryRepositoryInterface $noCatRepos;
|
||||
private OperationsRepositoryInterface $opsRepos;
|
||||
private CategoryRepositoryInterface $repository;
|
||||
private Carbon $start;
|
||||
|
||||
/**
|
||||
* FrontpageChartGenerator constructor.
|
||||
@@ -110,7 +104,7 @@ class FrontpageChartGenerator
|
||||
*/
|
||||
private function addCurrency(array $currency): void
|
||||
{
|
||||
$currencyId = (int) $currency['currency_id'];
|
||||
$currencyId = (int)$currency['currency_id'];
|
||||
|
||||
$this->currencies[$currencyId] = $this->currencies[$currencyId] ?? [
|
||||
'currency_id' => $currencyId,
|
||||
@@ -136,8 +130,8 @@ class FrontpageChartGenerator
|
||||
$tempData[] = [
|
||||
'name' => $category->name,
|
||||
'sum' => $currency['sum'],
|
||||
'sum_float' => round($currency['sum'], $currency['currency_decimal_places']),
|
||||
'currency_id' => (int) $currency['currency_id'],
|
||||
'sum_float' => round((float) $currency['sum'], $currency['currency_decimal_places']),
|
||||
'currency_id' => (int)$currency['currency_id'],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -158,8 +152,8 @@ class FrontpageChartGenerator
|
||||
$tempData[] = [
|
||||
'name' => trans('firefly.no_category'),
|
||||
'sum' => $currency['sum'],
|
||||
'sum_float' => round($currency['sum'], $currency['currency_decimal_places'] ?? 2),
|
||||
'currency_id' => (int) $currency['currency_id'],
|
||||
'sum_float' => round((float) $currency['sum'], $currency['currency_decimal_places'] ?? 2),
|
||||
'currency_id' => (int)$currency['currency_id'],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -181,7 +175,7 @@ class FrontpageChartGenerator
|
||||
foreach ($this->currencies as $currencyId => $currency) {
|
||||
$key = sprintf('spent-%d', $currencyId);
|
||||
$return[$key] = [
|
||||
'label' => sprintf('%s (%s)', (string) trans('firefly.spent'), $currency['currency_name']),
|
||||
'label' => sprintf('%s (%s)', (string)trans('firefly.spent'), $currency['currency_name']),
|
||||
'type' => 'bar',
|
||||
'currency_symbol' => $currency['currency_symbol'],
|
||||
'entries' => $names,
|
||||
|
Reference in New Issue
Block a user