mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 16:57:09 +00:00
Function no longer returns nulls.
This commit is contained in:
@@ -214,7 +214,7 @@ class BudgetController extends Controller
|
|||||||
$return = [];
|
$return = [];
|
||||||
/** @var array|null $arr */
|
/** @var array|null $arr */
|
||||||
foreach ($expenses as $arr) {
|
foreach ($expenses as $arr) {
|
||||||
if (null !== $arr) {
|
if ([] !== $arr) {
|
||||||
$return[] = $arr;
|
$return[] = $arr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -263,9 +263,9 @@ class BudgetController extends Controller
|
|||||||
/**
|
/**
|
||||||
* @param BudgetLimit $limit
|
* @param BudgetLimit $limit
|
||||||
*
|
*
|
||||||
* @return array|null
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function getExpensesForLimit(BudgetLimit $limit): ?array
|
private function getExpensesForLimit(BudgetLimit $limit): array
|
||||||
{
|
{
|
||||||
$budget = $limit->budget;
|
$budget = $limit->budget;
|
||||||
$spent = $this->opsRepository->sumExpenses($limit->start_date, $limit->end_date, null, new Collection([$budget]), $limit->transactionCurrency);
|
$spent = $this->opsRepository->sumExpenses($limit->start_date, $limit->end_date, null, new Collection([$budget]), $limit->transactionCurrency);
|
||||||
@@ -273,7 +273,7 @@ class BudgetController extends Controller
|
|||||||
// when limited to a currency, the count is always one. Or it's empty.
|
// when limited to a currency, the count is always one. Or it's empty.
|
||||||
$set = array_shift($spent);
|
$set = array_shift($spent);
|
||||||
if (null === $set) {
|
if (null === $set) {
|
||||||
return null;
|
return [];
|
||||||
}
|
}
|
||||||
$return = [
|
$return = [
|
||||||
'label' => sprintf('%s (%s)', $budget->name, $set['currency_name']),
|
'label' => sprintf('%s (%s)', $budget->name, $set['currency_name']),
|
||||||
|
Reference in New Issue
Block a user