Various code fixes.

This commit is contained in:
James Cole
2022-11-04 05:11:05 +01:00
parent 8d8f81c27d
commit f16b679049
48 changed files with 226 additions and 246 deletions

View File

@@ -190,7 +190,7 @@ class BoxController extends Controller
$incomes[$currencyId] = app('amount')->formatAnything($currency, $incomes[$currencyId] ?? '0', false);
$expenses[$currencyId] = app('amount')->formatAnything($currency, $expenses[$currencyId] ?? '0', false);
}
if (empty($sums)) {
if (0 === count($sums)) {
$currency = app('amount')->getDefaultCurrency();
$sums[$currency->id] = app('amount')->formatAnything($currency, '0', false);
$incomes[$currency->id] = app('amount')->formatAnything($currency, '0', false);

View File

@@ -68,7 +68,7 @@ class FrontpageController extends Controller
}
}
$html = '';
if (!empty($info)) {
if (0 !== count($info)) {
try {
$html = view('json.piggy-banks', compact('info'))->render();
} catch (Throwable $e) {

View File

@@ -43,13 +43,13 @@ class IntroController extends Controller
*
* @return JsonResponse
*/
public function getIntroSteps(string $route, string $specificPage = null): JsonResponse
public function getIntroSteps(string $route, string $specificPage = null): JsonResponse // @phpstan-ignore-line
{
Log::debug(sprintf('getIntroSteps for route "%s" and page "%s"', $route, $specificPage));
$specificPage = $specificPage ?? '';
$steps = $this->getBasicSteps($route);
$specificSteps = $this->getSpecificSteps($route, $specificPage);
if (empty($specificSteps)) {
if (0 === count($specificSteps)) {
Log::debug(sprintf('No specific steps for route "%s" and page "%s"', $route, $specificPage));
return response()->json($steps);
@@ -104,7 +104,7 @@ class IntroController extends Controller
* @return JsonResponse
* @throws FireflyException
*/
public function postEnable(string $route, string $specialPage = null): JsonResponse
public function postEnable(string $route, string $specialPage = null): JsonResponse // @phpstan-ignore-line
{
$specialPage = $specialPage ?? '';
$route = str_replace('.', '_', $route);
@@ -128,7 +128,7 @@ class IntroController extends Controller
* @return JsonResponse
* @throws FireflyException
*/
public function postFinished(string $route, string $specialPage = null): JsonResponse
public function postFinished(string $route, string $specialPage = null): JsonResponse // @phpstan-ignore-line
{
$specialPage = $specialPage ?? '';
$key = 'shown_demo_' . $route;

View File

@@ -85,7 +85,7 @@ class ReconcileController extends Controller
* @throws FireflyException
* @throws JsonException
*/
public function overview(Request $request, Account $account = null, Carbon $start = null, Carbon $end = null): JsonResponse
public function overview(Request $request, Account $account = null, Carbon $start = null, Carbon $end = null): JsonResponse // @phpstan-ignore-line
{
$startBalance = $request->get('startBalance');
$endBalance = $request->get('endBalance');
@@ -226,7 +226,7 @@ class ReconcileController extends Controller
* @throws FireflyException
* @throws JsonException
*/
public function transactions(Account $account, Carbon $start = null, Carbon $end = null)
public function transactions(Account $account, Carbon $start = null, Carbon $end = null) // @phpstan-ignore-line
{
if (null === $start || null === $end) {
throw new FireflyException('Invalid dates submitted.');