From 6ed5892cf9b63c271bdcb16c1edde963f6b7261a Mon Sep 17 00:00:00 2001 From: James Cole Date: Mon, 29 May 2023 14:17:10 +0200 Subject: [PATCH] chore: fix various small sonacloud issues to see if the actions run correctly. --- app/Http/Controllers/Transaction/ShowController.php | 6 +++--- app/Repositories/LinkType/LinkTypeRepository.php | 2 +- app/Services/Internal/Update/RecurrenceUpdateService.php | 5 ++--- app/Support/Search/OperatorQuerySearch.php | 4 ++-- bootstrap/app.php | 4 ++-- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/app/Http/Controllers/Transaction/ShowController.php b/app/Http/Controllers/Transaction/ShowController.php index 60d5ec957c..bb182c7d10 100644 --- a/app/Http/Controllers/Transaction/ShowController.php +++ b/app/Http/Controllers/Transaction/ShowController.php @@ -41,7 +41,7 @@ use Symfony\Component\HttpFoundation\ParameterBag; */ class ShowController extends Controller { - private ALERepositoryInterface $ALERepository; + private ALERepositoryInterface $aleRepository; private TransactionGroupRepositoryInterface $repository; /** @@ -55,7 +55,7 @@ class ShowController extends Controller $this->middleware( function ($request, $next) { $this->repository = app(TransactionGroupRepositoryInterface::class); - $this->ALERepository = app(ALERepositoryInterface::class); + $this->aleRepository = app(ALERepositoryInterface::class); app('view')->share('title', (string)trans('firefly.transactions')); app('view')->share('mainTitleIcon', 'fa-exchange'); @@ -112,7 +112,7 @@ class ShowController extends Controller // get audit log entries: $logEntries = []; foreach ($transactionGroup->transactionJournals as $journal) { - $logEntries[$journal->id] = $this->ALERepository->getForObject($journal); + $logEntries[$journal->id] = $this->aleRepository->getForObject($journal); } $events = $this->repository->getPiggyEvents($transactionGroup); diff --git a/app/Repositories/LinkType/LinkTypeRepository.php b/app/Repositories/LinkType/LinkTypeRepository.php index 83cf35e81b..596990606a 100644 --- a/app/Repositories/LinkType/LinkTypeRepository.php +++ b/app/Repositories/LinkType/LinkTypeRepository.php @@ -212,7 +212,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface return $merged->filter( function (TransactionJournalLink $link) { - return (null !== $link->source && null !== $link->destination); + return null !== $link->source && null !== $link->destination; } ); } diff --git a/app/Services/Internal/Update/RecurrenceUpdateService.php b/app/Services/Internal/Update/RecurrenceUpdateService.php index 455de69768..9ee14e9156 100644 --- a/app/Services/Internal/Update/RecurrenceUpdateService.php +++ b/app/Services/Internal/Update/RecurrenceUpdateService.php @@ -125,9 +125,8 @@ class RecurrenceUpdateService $originalCount = $recurrence->recurrenceRepetitions()->count(); if (1 === $originalCount) { Log::debug('Return the first one'); - /** @var RecurrenceRepetition $result */ - $result = $recurrence->recurrenceRepetitions()->first(); - return $result; + /** @var RecurrenceRepetition|null */ + return $recurrence->recurrenceRepetitions()->first(); } // find it: $fields = [ diff --git a/app/Support/Search/OperatorQuerySearch.php b/app/Support/Search/OperatorQuerySearch.php index 76c9c7d8b1..9081d6c219 100644 --- a/app/Support/Search/OperatorQuerySearch.php +++ b/app/Support/Search/OperatorQuerySearch.php @@ -437,7 +437,7 @@ class OperatorQuerySearch implements SearchInterface $stringMethod = 'str_contains'; } if (4 === $stringPosition) { - $stringMethod = 'str_is_equal'; + $stringMethod = 'stringIsEqual'; } // get accounts: @@ -515,7 +515,7 @@ class OperatorQuerySearch implements SearchInterface $stringMethod = 'str_contains'; } if (4 === $stringPosition) { - $stringMethod = 'str_is_equal'; + $stringMethod = 'stringIsEqual'; } // search for accounts: diff --git a/bootstrap/app.php b/bootstrap/app.php index 96ecd9288a..7180e36c15 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -52,14 +52,14 @@ if (!function_exists('envNonEmpty')) { } } -if (!function_exists('str_is_equal')) { +if (!function_exists('stringIsEqual')) { /** * @param string $left * @param string $right * * @return bool */ - function str_is_equal(string $left, string $right): bool + function stringIsEqual(string $left, string $right): bool { return $left === $right; }