Skip to content

Firefly III: a personal finances manager

Various code cleanup.

James Coleb12872e5de3e
diff --git a/app/Api/V1/Controllers/TransactionController.php b/app/Api/V1/Controllers/TransactionController.php
index 9d2794e311..894dc950b3 100644
--- a/app/Api/V1/Controllers/TransactionController.php
+++ b/app/Api/V1/Controllers/TransactionController.php
@@ -171,7 +171,9 @@ class TransactionController extends Controller
}
/**
- * @param TransactionRequest $request
+ * @param TransactionRequest $request
+ *
+ * @param JournalRepositoryInterface $repository
*
* @return \Illuminate\Http\JsonResponse
*/
diff --git a/app/Http/Controllers/Account/ReconcileController.php b/app/Http/Controllers/Account/ReconcileController.php
index c8bd3631cc..c31e55a948 100644
--- a/app/Http/Controllers/Account/ReconcileController.php
+++ b/app/Http/Controllers/Account/ReconcileController.php
@@ -244,12 +244,12 @@ class ReconcileController extends Controller
/**
* @param ReconciliationStoreRequest $request
+ * @param JournalRepositoryInterface $repository
* @param Account $account
* @param Carbon $start
* @param Carbon $end
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
- * @throws FireflyException
*/
public function submit(ReconciliationStoreRequest $request, JournalRepositoryInterface $repository, Account $account, Carbon $start, Carbon $end)
{
diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php
index da103a5bde..299b32e385 100644
--- a/app/Http/Controllers/AccountController.php
+++ b/app/Http/Controllers/AccountController.php
@@ -128,9 +128,8 @@ class AccountController extends Controller
}
/**
- * @param Request $request
- * @param AccountRepositoryInterface $repository
- * @param Account $account
+ * @param Request $request
+ * @param Account $account
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
@@ -152,15 +151,16 @@ class AccountController extends Controller
/**
* Edit an account.
*
- * @param Request $request
- * @param Account $account
+ * @param Request $request
+ * @param Account $account
*
- * @SuppressWarnings(PHPMD.CyclomaticComplexity) // long and complex but not that excessively so.
- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
+ * @param AccountRepositoryInterface $repository
*
* @return View
*
- * @throws FireflyException
+ * @SuppressWarnings(PHPMD.CyclomaticComplexity) // long and complex but not that excessively so.
+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
+ *
*/
public function edit(Request $request, Account $account, AccountRepositoryInterface $repository)
{
@@ -277,16 +277,16 @@ class AccountController extends Controller
/**
* Show an account.
*
- * @param Request $request
- * @param Account $account
- * @param string $moment
- *
+ * @param Request $request
+ * @param Account $account
+ * @param Carbon|null $start
+ * @param Carbon|null $end
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View
*
+ * @throws FireflyException
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // long and complex but not that excessively so.
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*
- * @throws FireflyException
*/
public function show(Request $request, Account $account, Carbon $start = null, Carbon $end = null)
{
@@ -365,9 +365,8 @@ class AccountController extends Controller
}
/**
- * @param AccountFormRequest $request
- * @param AccountRepositoryInterface $repository
- * @param Account $account
+ * @param AccountFormRequest $request
+ * @param Account $account
*
* @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
@@ -410,8 +409,9 @@ class AccountController extends Controller
* and for each period, the amount of money spent and earned. This is a complex operation which is cached for
* performance reasons.
*
- * @param Account $account the account involved
+ * @param Account $account the account involved
*
+ * @param Carbon|null $date
* @return Collection
*
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
diff --git a/app/Http/Controllers/BudgetController.php b/app/Http/Controllers/BudgetController.php
index f9a40b002e..bdb5062d24 100644
--- a/app/Http/Controllers/BudgetController.php
+++ b/app/Http/Controllers/BudgetController.php
@@ -167,6 +167,7 @@ class BudgetController extends Controller
}
/**
+ * @param Request $request
* @param string|null $moment
*
* @return View
@@ -545,8 +546,9 @@ class BudgetController extends Controller
}
/**
- * @param Carbon $start
- * @param Carbon $end
+ * @param Request $request
+ * @param Carbon $start
+ * @param Carbon $end
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
diff --git a/app/Http/Controllers/CategoryController.php b/app/Http/Controllers/CategoryController.php
index ea797583f2..2212ead0df 100644
--- a/app/Http/Controllers/CategoryController.php
+++ b/app/Http/Controllers/CategoryController.php
@@ -424,6 +424,8 @@ class CategoryController extends Controller
/**
* @param Category $category
*
+ * @param Carbon $date
+ *
* @return Collection
*/
private function getPeriodOverview(Category $category, Carbon $date): Collection
diff --git a/app/Http/Controllers/Chart/AccountController.php b/app/Http/Controllers/Chart/AccountController.php
index 4e405e1ce0..6006316482 100644
--- a/app/Http/Controllers/Chart/AccountController.php
+++ b/app/Http/Controllers/Chart/AccountController.php
@@ -299,6 +299,8 @@ class AccountController extends Controller
* @param Account $account
* @param Carbon $start
*
+ * @param Carbon $end
+ *
* @return \Illuminate\Http\JsonResponse
*/
public function period(Account $account, Carbon $start, Carbon $end)
diff --git a/app/Http/Controllers/Json/BoxController.php b/app/Http/Controllers/Json/BoxController.php
index e4e1ad911e..8d0eebcd32 100644
--- a/app/Http/Controllers/Json/BoxController.php
+++ b/app/Http/Controllers/Json/BoxController.php
@@ -198,7 +198,9 @@ class BoxController extends Controller
}
/**
- * @param AccountRepositoryInterface $repository
+ * @param AccountRepositoryInterface $repository
+ *
+ * @param CurrencyRepositoryInterface $currencyRepos
*
* @return \Illuminate\Http\JsonResponse
*/
diff --git a/app/Http/Controllers/PiggyBankController.php b/app/Http/Controllers/PiggyBankController.php
index 75804ad438..15c7c86d75 100644
--- a/app/Http/Controllers/PiggyBankController.php
+++ b/app/Http/Controllers/PiggyBankController.php
@@ -59,7 +59,9 @@ class PiggyBankController extends Controller
/**
* Add money to piggy bank.
*
- * @param PiggyBank $piggyBank
+ * @param PiggyBank $piggyBank
+ *
+ * @param PiggyBankRepositoryInterface $repository
*
* @return View
*/
@@ -78,8 +80,9 @@ class PiggyBankController extends Controller
/**
* Add money to piggy bank (for mobile devices).
*
- * @param PiggyBank $piggyBank
+ * @param PiggyBank $piggyBank
*
+ * @param PiggyBankRepositoryInterface $repository
* @return View
*/
public function addMobile(PiggyBank $piggyBank, PiggyBankRepositoryInterface $repository)
@@ -180,6 +183,7 @@ class PiggyBankController extends Controller
}
/**
+ * @param Request $request
* @param PiggyBankRepositoryInterface $piggyRepository
*
* @return View
diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php
index 1b8d474ce6..e2988e0b18 100644
--- a/app/Http/Controllers/ProfileController.php
+++ b/app/Http/Controllers/ProfileController.php
@@ -170,6 +170,8 @@ class ProfileController extends Controller
}
/**
+ * @param UserRepositoryInterface $repository
+ *
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function enable2FA(UserRepositoryInterface $repository)
diff --git a/app/Http/Controllers/Transaction/BulkController.php b/app/Http/Controllers/Transaction/BulkController.php
index 6f0805961d..4ed21079dc 100644
--- a/app/Http/Controllers/Transaction/BulkController.php
+++ b/app/Http/Controllers/Transaction/BulkController.php
@@ -66,6 +66,7 @@ class BulkController extends Controller
}
/**
+ * @param Request $request
* @param Collection $journals
*
* @return View
diff --git a/app/Http/Controllers/Transaction/SingleController.php b/app/Http/Controllers/Transaction/SingleController.php
index d2b36e97e9..68288fa699 100644
--- a/app/Http/Controllers/Transaction/SingleController.php
+++ b/app/Http/Controllers/Transaction/SingleController.php
@@ -238,7 +238,9 @@ class SingleController extends Controller
}
/**
- * @param TransactionJournal $journal
+ * @param TransactionJournal $journal
+ *
+ * @param JournalRepositoryInterface $repository
*
* @return mixed
*/
diff --git a/app/Http/Controllers/Transaction/SplitController.php b/app/Http/Controllers/Transaction/SplitController.php
index 8bc6123e54..a22d913b1d 100644
--- a/app/Http/Controllers/Transaction/SplitController.php
+++ b/app/Http/Controllers/Transaction/SplitController.php
@@ -37,7 +37,6 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
-use FireflyIII\Repositories\Journal\JournalTaskerInterface;
use FireflyIII\Transformers\TransactionTransformer;
use Illuminate\Http\Request;
use Illuminate\Support\Collection;
@@ -65,8 +64,6 @@ class SplitController extends Controller
private $currencies;
/** @var JournalRepositoryInterface */
private $repository;
- /** @var JournalTaskerInterface */
- private $tasker;
/**
*
@@ -80,7 +77,6 @@ class SplitController extends Controller
function ($request, $next) {
$this->accounts = app(AccountRepositoryInterface::class);
$this->budgets = app(BudgetRepositoryInterface::class);
- $this->tasker = app(JournalTaskerInterface::class);
$this->attachments = app(AttachmentHelperInterface::class);
$this->currencies = app(CurrencyRepositoryInterface::class);
$this->repository = app(JournalRepositoryInterface::class);
diff --git a/app/Http/Controllers/TransactionController.php b/app/Http/Controllers/TransactionController.php
index c8ee87e0eb..2b7178c678 100644
--- a/app/Http/Controllers/TransactionController.php
+++ b/app/Http/Controllers/TransactionController.php
@@ -30,7 +30,6 @@ use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
-use FireflyIII\Repositories\Journal\JournalTaskerInterface;
use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface;
use FireflyIII\Support\CacheProperties;
use FireflyIII\Transformers\TransactionTransformer;
@@ -71,7 +70,6 @@ class TransactionController extends Controller
*
* @return View
*
- * @throws FireflyException
*/
public function index(Request $request, JournalRepositoryInterface $repository, string $what, string $moment = '')
{
@@ -176,13 +174,13 @@ class TransactionController extends Controller
/**
* @param TransactionJournal $journal
- * @param JournalTaskerInterface $tasker
+ * @param JournalRepositoryInterface $repository
* @param LinkTypeRepositoryInterface $linkTypeRepository
*
- * @throws FireflyException
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View
+ * @throws FireflyException
*/
- public function show(TransactionJournal $journal, JournalTaskerInterface $tasker, LinkTypeRepositoryInterface $linkTypeRepository)
+ public function show(TransactionJournal $journal, JournalRepositoryInterface $repository, LinkTypeRepositoryInterface $linkTypeRepository)
{
if ($this->isOpeningBalance($journal)) {
return $this->redirectToAccount($journal);
@@ -208,7 +206,7 @@ class TransactionController extends Controller
$transactions[] = $transformer->transform($transaction);
}
- $events = $tasker->getPiggyBankEvents($journal);
+ $events = $repository->getPiggyBankEvents($journal);
$what = strtolower($transactionType);
$subTitle = trans('firefly.' . $what) . ' "' . $journal->description . '"';
diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php
index 9d5e3c0006..372655d233 100644
--- a/app/Http/Middleware/Authenticate.php
+++ b/app/Http/Middleware/Authenticate.php
@@ -74,8 +74,7 @@ class Authenticate
*
* @param array $guards
*
- * @return void
- *
+ * @return mixed
* @throws \Illuminate\Auth\AuthenticationException
*/
protected function authenticate(array $guards)
diff --git a/app/Http/Middleware/Binder.php b/app/Http/Middleware/Binder.php
index 415dbe2474..7b018ac80a 100644
--- a/app/Http/Middleware/Binder.php
+++ b/app/Http/Middleware/Binder.php
@@ -63,7 +63,6 @@ class Binder
*
* @return mixed
*
- * @throws \Illuminate\Auth\AuthenticationException
*/
public function handle($request, Closure $next, ...$guards)
{
diff --git a/app/Http/Requests/SplitJournalFormRequest.php b/app/Http/Requests/SplitJournalFormRequest.php
index 4de85dca6e..9f549dbfe7 100644
--- a/app/Http/Requests/SplitJournalFormRequest.php
+++ b/app/Http/Requests/SplitJournalFormRequest.php
@@ -146,7 +146,7 @@ class SplitJournalFormRequest extends Request
}
/**
- *
+ * @param Validator $validator
*/
protected function sameAccounts(Validator $validator): void
{
diff --git a/app/Import/FileProcessor/CsvProcessor.php b/app/Import/FileProcessor/CsvProcessor.php
index 79de2ec118..d3f15ed9b7 100644
--- a/app/Import/FileProcessor/CsvProcessor.php
+++ b/app/Import/FileProcessor/CsvProcessor.php
@@ -78,9 +78,8 @@ class CsvProcessor implements FileProcessorInterface
*
* @return bool
*
- * @throws \League\Csv\Exception
- * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
* @throws FireflyException
+ * @throws \League\Csv\Exception
*/
public function run(): bool
{
diff --git a/app/Import/Routine/SpectreRoutine.php b/app/Import/Routine/SpectreRoutine.php
index dfc29781bb..58d0b28c58 100644
--- a/app/Import/Routine/SpectreRoutine.php
+++ b/app/Import/Routine/SpectreRoutine.php
@@ -117,8 +117,10 @@ class SpectreRoutine implements RoutineInterface
* have-account-mapping: start downloading transactions?
*
*
- * @throws \FireflyIII\Exceptions\FireflyException
- * @throws \FireflyIII\Services\Spectre\Exception\SpectreException
+ * @return bool
+ * @throws FireflyException
+ * @throws SpectreException
+ * @throws \Illuminate\Container\EntryNotFoundException
*/
public function run(): bool
{
@@ -166,6 +168,7 @@ class SpectreRoutine implements RoutineInterface
* @return Customer
* @throws \FireflyIII\Exceptions\FireflyException
* @throws \FireflyIII\Services\Spectre\Exception\SpectreException
+ * @throws \Illuminate\Container\EntryNotFoundException
*/
protected function createCustomer(): Customer
{
@@ -201,7 +204,8 @@ class SpectreRoutine implements RoutineInterface
/**
* @return Customer
* @throws FireflyException
- * @throws \FireflyIII\Services\Spectre\Exception\SpectreException
+ * @throws SpectreException
+ * @throws \Illuminate\Container\EntryNotFoundException
*/
protected function getCustomer(): Customer
{
@@ -230,6 +234,7 @@ class SpectreRoutine implements RoutineInterface
* @return Token
* @throws \FireflyIII\Exceptions\FireflyException
* @throws \FireflyIII\Services\Spectre\Exception\SpectreException
+ * @throws \Illuminate\Container\EntryNotFoundException
*/
protected function getToken(Customer $customer, string $returnUri): Token
{
@@ -246,6 +251,7 @@ class SpectreRoutine implements RoutineInterface
/**
* @throws FireflyException
* @throws SpectreException
+ * @throws \Illuminate\Container\EntryNotFoundException
*/
protected function runStageInitial(): void
{
@@ -280,6 +286,7 @@ class SpectreRoutine implements RoutineInterface
/**
* @throws FireflyException
* @throws SpectreException
+ * @throws \Illuminate\Container\EntryNotFoundException
*/
protected function runStageLoggedIn(): void
{
@@ -521,6 +528,7 @@ class SpectreRoutine implements RoutineInterface
/**
* @throws FireflyException
* @throws SpectreException
+ * @throws \Illuminate\Container\EntryNotFoundException
*/
private function runStageHaveMapping()
{
diff --git a/app/Providers/JournalServiceProvider.php b/app/Providers/JournalServiceProvider.php
index b839730664..6d3e1e8ad0 100644
--- a/app/Providers/JournalServiceProvider.php
+++ b/app/Providers/JournalServiceProvider.php
@@ -26,8 +26,6 @@ use FireflyIII\Helpers\Collector\JournalCollector;
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
use FireflyIII\Repositories\Journal\JournalRepository;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
-use FireflyIII\Repositories\Journal\JournalTasker;
-use FireflyIII\Repositories\Journal\JournalTaskerInterface;
use Illuminate\Foundation\Application;
use Illuminate\Support\ServiceProvider;
@@ -50,7 +48,6 @@ class JournalServiceProvider extends ServiceProvider
public function register()
{
$this->registerRepository();
- $this->registerTasker();
$this->registerCollector();
}
@@ -91,24 +88,4 @@ class JournalServiceProvider extends ServiceProvider
}
);
}
-
- /**
- * Register the tasker.
- */
- private function registerTasker()
- {
- $this->app->bind(
- JournalTaskerInterface::class,
- function (Application $app) {
- /** @var JournalTaskerInterface $tasker */
- $tasker = app(JournalTasker::class);
-
- if ($app->auth->check()) {
- $tasker->setUser(auth()->user());
- }
-
- return $tasker;
- }
- );
- }
}
diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php
index 16592f0c40..5137a1d651 100644
--- a/app/Repositories/Account/AccountRepository.php
+++ b/app/Repositories/Account/AccountRepository.php
@@ -228,8 +228,6 @@ class AccountRepository implements AccountRepositoryInterface
* @param array $data
*
* @return Account
- * @throws FireflyException
- * @throws Exception
*/
public function store(array $data): Account
{
@@ -245,8 +243,6 @@ class AccountRepository implements AccountRepositoryInterface
* @param Account $account
* @param array $data
*
- * @throws FireflyException
- * @throws Exception
* @return Account
*/
public function update(Account $account, array $data): Account
@@ -263,8 +259,6 @@ class AccountRepository implements AccountRepositoryInterface
* @param array $data
*
* @return TransactionJournal
- * @throws FireflyException
- * @throws Exception
*/
public function updateReconciliation(TransactionJournal $journal, array $data): TransactionJournal
{
diff --git a/app/Repositories/Account/FindAccountsTrait.php b/app/Repositories/Account/FindAccountsTrait.php
index dca6580210..62e30db382 100644
--- a/app/Repositories/Account/FindAccountsTrait.php
+++ b/app/Repositories/Account/FindAccountsTrait.php
@@ -216,8 +216,6 @@ trait FindAccountsTrait
/**
* @return Account
*
- * @throws FireflyException
- * @throws \Exception
*/
public function getCashAccount(): Account
{
diff --git a/app/Repositories/Bill/BillRepository.php b/app/Repositories/Bill/BillRepository.php
index 62513a643c..704f668df3 100644
--- a/app/Repositories/Bill/BillRepository.php
+++ b/app/Repositories/Bill/BillRepository.php
@@ -306,7 +306,6 @@ class BillRepository implements BillRepositoryInterface
* @param Carbon $end
*
* @return Collection
- * @throws \FireflyIII\Exceptions\FireflyException
*/
public function getPayDatesInRange(Bill $bill, Carbon $start, Carbon $end): Collection
{
diff --git a/app/Repositories/Journal/JournalRepository.php b/app/Repositories/Journal/JournalRepository.php
index 112b25a5f0..3a3b0d2444 100644
--- a/app/Repositories/Journal/JournalRepository.php
+++ b/app/Repositories/Journal/JournalRepository.php
@@ -28,6 +28,7 @@ use FireflyIII\Factory\TransactionJournalFactory;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\Note;
+use FireflyIII\Models\PiggyBankEvent;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\TransactionType;
@@ -470,6 +471,24 @@ class JournalRepository implements JournalRepositoryInterface
return $note->text;
}
+ /**
+ * @param TransactionJournal $journal
+ *
+ * @return Collection
+ */
+ public function getPiggyBankEvents(TransactionJournal $journal): Collection
+ {
+ /** @var Collection $set */
+ $events = $journal->piggyBankEvents()->get();
+ $events->each(
+ function (PiggyBankEvent $event) {
+ $event->piggyBank = $event->piggyBank()->withTrashed()->first();
+ }
+ );
+
+ return $events;
+ }
+
/**
* Return all tags as strings in an array.
*
@@ -623,7 +642,6 @@ class JournalRepository implements JournalRepositoryInterface
*
* @return TransactionJournal
*
- * @throws \FireflyIII\Exceptions\FireflyException
*/
public function update(TransactionJournal $journal, array $data): TransactionJournal
{
diff --git a/app/Repositories/Journal/JournalRepositoryInterface.php b/app/Repositories/Journal/JournalRepositoryInterface.php
index 445a14f2c2..393a38d8ed 100644
--- a/app/Repositories/Journal/JournalRepositoryInterface.php
+++ b/app/Repositories/Journal/JournalRepositoryInterface.php
@@ -37,6 +37,7 @@ use Illuminate\Support\MessageBag;
*/
interface JournalRepositoryInterface
{
+
/**
* @param TransactionJournal $journal
* @param TransactionType $type
@@ -201,6 +202,13 @@ interface JournalRepositoryInterface
*/
public function getNoteText(TransactionJournal $journal): string;
+ /**
+ * @param TransactionJournal $journal
+ *
+ * @return Collection
+ */
+ public function getPiggyBankEvents(TransactionJournal $journal): Collection;
+
/**
* Return all tags as strings in an array.
*
diff --git a/app/Repositories/Journal/JournalTasker.php b/app/Repositories/Journal/JournalTasker.php
deleted file mode 100644
index 141a8e707f..0000000000
--- a/app/Repositories/Journal/JournalTasker.php
+++ /dev/null
@@ -1,71 +0,0 @@
-<?php
-/**
- * JournalTasker.php
- * Copyright (c) 2017 [email protected]
- *
- * This file is part of Firefly III.
- *
- * Firefly III is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Firefly III is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
- */
-declare(strict_types=1);
-
-namespace FireflyIII\Repositories\Journal;
-
-use DB;
-use FireflyIII\Models\AccountType;
-use FireflyIII\Models\PiggyBankEvent;
-use FireflyIII\Models\Transaction;
-use FireflyIII\Models\TransactionJournal;
-use FireflyIII\User;
-use Illuminate\Database\Eloquent\Builder;
-use Illuminate\Database\Query\JoinClause;
-use Illuminate\Support\Collection;
-use Steam;
-
-/**
- * Class JournalTasker.
- */
-class JournalTasker implements JournalTaskerInterface
-{
- /** @var User */
- private $user;
-
- /**
- * @deprecated
- *
- * @param TransactionJournal $journal
- *
- * @return Collection
- */
- public function getPiggyBankEvents(TransactionJournal $journal): Collection
- {
- /** @var Collection $set */
- $events = $journal->piggyBankEvents()->get();
- $events->each(
- function (PiggyBankEvent $event) {
- $event->piggyBank = $event->piggyBank()->withTrashed()->first();
- }
- );
-
- return $events;
- }
-
- /**
- * @param User $user
- */
- public function setUser(User $user)
- {
- $this->user = $user;
- }
-}
diff --git a/app/Repositories/Journal/JournalTaskerInterface.php b/app/Repositories/Journal/JournalTaskerInterface.php
deleted file mode 100644
index 85cb8050eb..0000000000
--- a/app/Repositories/Journal/JournalTaskerInterface.php
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-/**
- * JournalTaskerInterface.php
- * Copyright (c) 2017 [email protected]
- *
- * This file is part of Firefly III.
- *
- * Firefly III is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Firefly III is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
- */
-declare(strict_types=1);
-
-namespace FireflyIII\Repositories\Journal;
-
-use FireflyIII\Models\TransactionJournal;
-use FireflyIII\User;
-use Illuminate\Support\Collection;
-
-/**
- * Interface JournalTaskerInterface.
- */
-interface JournalTaskerInterface
-{
- /**
- * @param TransactionJournal $journal
- *
- * @deprecated
- * @return Collection
- */
- public function getPiggyBankEvents(TransactionJournal $journal): Collection;
-
- /**
- * @param User $user
- */
- public function setUser(User $user);
-}
diff --git a/app/Rules/UniqueIban.php b/app/Rules/UniqueIban.php
index 63bd4319af..1b3da76d17 100644
--- a/app/Rules/UniqueIban.php
+++ b/app/Rules/UniqueIban.php
@@ -38,7 +38,7 @@ class UniqueIban implements Rule
/**
* Create a new rule instance.
*
- * @return void
+ * @param Account|null $account
*/
public function __construct(?Account $account)
{
diff --git a/app/Services/Internal/Support/AccountServiceTrait.php b/app/Services/Internal/Support/AccountServiceTrait.php
index bad188a803..045453a486 100644
--- a/app/Services/Internal/Support/AccountServiceTrait.php
+++ b/app/Services/Internal/Support/AccountServiceTrait.php
@@ -127,6 +127,7 @@ trait AccountServiceTrait
* @param array $data
*
* @return TransactionJournal|null
+ * @throws \FireflyIII\Exceptions\FireflyException
*/
public function storeIBJournal(Account $account, array $data): ?TransactionJournal
{
diff --git a/app/Services/Spectre/Request/SpectreRequest.php b/app/Services/Spectre/Request/SpectreRequest.php
index 5f00a09200..6dd6b61d19 100644
--- a/app/Services/Spectre/Request/SpectreRequest.php
+++ b/app/Services/Spectre/Request/SpectreRequest.php
@@ -258,7 +258,6 @@ abstract class SpectreRequest
* @param Requests_Response $response
*
* @throws FireflyException
- * @throws SpectreException
*/
private function detectError(Requests_Response $response): void
{
diff --git a/app/Support/ExpandedForm.php b/app/Support/ExpandedForm.php
index 6af1139624..560fe16bad 100644
--- a/app/Support/ExpandedForm.php
+++ b/app/Support/ExpandedForm.php
@@ -46,6 +46,7 @@ class ExpandedForm
*
* @return string
* @throws \FireflyIII\Exceptions\FireflyException
+ * @throws \Throwable
*/
public function amount(string $name, $value = null, array $options = []): string
{
@@ -53,12 +54,13 @@ class ExpandedForm
}
/**
- * @param $name
- * @param null $value
- * @param array $options
+ * @param string $name
+ * @param null $value
+ * @param array $options
*
* @return string
* @throws \FireflyIII\Exceptions\FireflyException
+ * @throws \Throwable
*/
public function amountSmall(string $name, $value = null, array $options = []): string
{
@@ -118,13 +120,13 @@ class ExpandedForm
}
/**
- * @param $name
- * @param null $value
- * @param array $options
+ * @param string $name
+ * @param null $value
+ * @param array $options
*
* @return string
* @throws \FireflyIII\Exceptions\FireflyException
- *
+ * @throws \Throwable
*/
public function balance(string $name, $value = null, array $options = []): string
{
@@ -653,6 +655,7 @@ class ExpandedForm
* @return string
*
* @throws \FireflyIII\Exceptions\FireflyException
+ * @throws \Throwable
*/
private function currencyField(string $name, string $view, $value = null, array $options = []): string
{
diff --git a/app/Support/Import/Configuration/File/Map.php b/app/Support/Import/Configuration/File/Map.php
index 6770d5fa6d..670f3c8dbf 100644
--- a/app/Support/Import/Configuration/File/Map.php
+++ b/app/Support/Import/Configuration/File/Map.php
@@ -52,7 +52,6 @@ class Map implements ConfigurationInterface
*
* @throws FireflyException
* @throws \League\Csv\Exception
- * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
*/
public function getData(): array
{
diff --git a/app/Support/Import/Configuration/File/Roles.php b/app/Support/Import/Configuration/File/Roles.php
index 68910c0937..aa111c41b7 100644
--- a/app/Support/Import/Configuration/File/Roles.php
+++ b/app/Support/Import/Configuration/File/Roles.php
@@ -52,7 +52,6 @@ class Roles implements ConfigurationInterface
* @return array
*
* @throws \League\Csv\Exception
- * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
*/
public function getData(): array
{
diff --git a/app/Support/Search/Search.php b/app/Support/Search/Search.php
index 0b2e0c2b2e..30c259200d 100644
--- a/app/Support/Search/Search.php
+++ b/app/Support/Search/Search.php
@@ -261,7 +261,6 @@ class Search implements SearchInterface
*
* @return bool
*
- * @throws FireflyException
*/
private function matchModifiers(Transaction $transaction): bool
{
diff --git a/app/TransactionRules/Processor.php b/app/TransactionRules/Processor.php
index 0c35753533..2c97e755a0 100644
--- a/app/TransactionRules/Processor.php
+++ b/app/TransactionRules/Processor.php
@@ -67,6 +67,7 @@ final class Processor
* @param bool $includeActions
*
* @return Processor
+ * @throws \FireflyIII\Exceptions\FireflyException
*/
public static function make(Rule $rule, $includeActions = true)
{
@@ -229,6 +230,7 @@ final class Processor
* Run the actions
*
* @return bool
+ * @throws \FireflyIII\Exceptions\FireflyException
*/
private function actions()
{
diff --git a/app/TransactionRules/TransactionMatcher.php b/app/TransactionRules/TransactionMatcher.php
index 11a8ed8a9d..d08ac27ad6 100644
--- a/app/TransactionRules/TransactionMatcher.php
+++ b/app/TransactionRules/TransactionMatcher.php
@@ -26,7 +26,6 @@ use FireflyIII\Helpers\Collector\JournalCollectorInterface;
use FireflyIII\Models\Rule;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionType;
-use FireflyIII\Repositories\Journal\JournalTaskerInterface;
use Illuminate\Support\Collection;
use Log;
@@ -42,29 +41,18 @@ class TransactionMatcher
private $range = 200;
/** @var Rule The rule to apply */
private $rule;
- /** @var JournalTaskerInterface Tasker for some related tasks */
- private $tasker;
/** @var array Types that can be matched using this matcher */
private $transactionTypes = [TransactionType::DEPOSIT, TransactionType::WITHDRAWAL, TransactionType::TRANSFER];
/** @var array List of triggers to match */
private $triggers = [];
- /**
- * TransactionMatcher constructor. Typehint the repository.
- *
- * @param JournalTaskerInterface $tasker
- */
- public function __construct(JournalTaskerInterface $tasker)
- {
- $this->tasker = $tasker;
- }
-
/**
* This method will search the user's transaction journal (with an upper limit of $range) for
* transaction journals matching the given rule. This is accomplished by trying to fire these
* triggers onto each transaction journal until enough matches are found ($limit).
*
* @return Collection
+ * @throws \FireflyIII\Exceptions\FireflyException
*/
public function findTransactionsByRule()
{
@@ -89,6 +77,7 @@ class TransactionMatcher
* triggers onto each transaction journal until enough matches are found ($limit).
*
* @return Collection
+ * @throws \FireflyIII\Exceptions\FireflyException
*/
public function findTransactionsByTriggers(): Collection
{
diff --git a/app/TransactionRules/Triggers/AbstractTrigger.php b/app/TransactionRules/Triggers/AbstractTrigger.php
index 0177db9860..fcf626618b 100644
--- a/app/TransactionRules/Triggers/AbstractTrigger.php
+++ b/app/TransactionRules/Triggers/AbstractTrigger.php
@@ -29,7 +29,7 @@ use FireflyIII\Models\TransactionJournal;
* This class will be magical!
*
* Class AbstractTrigger
- * @method triggered
+ * @method bool triggered($object)
*/
class AbstractTrigger
{
diff --git a/bootstrap/app.php b/bootstrap/app.php
index 8848f99d89..f1d4085827 100644
--- a/bootstrap/app.php
+++ b/bootstrap/app.php
@@ -33,9 +33,6 @@ declare(strict_types=1);
|
*/
-use Monolog\Formatter\LineFormatter;
-use Monolog\Handler\RotatingFileHandler;
-use Monolog\Logger;
bcscale(12);
diff --git a/resources/views/transactions/split/edit.twig b/resources/views/transactions/split/edit.twig
index c12514d5a1..111529da7f 100644
--- a/resources/views/transactions/split/edit.twig
+++ b/resources/views/transactions/split/edit.twig
@@ -219,7 +219,7 @@
{# description #}
<div class="col-lg-3 col-md-5 col-sm-12 col-xs-12">
- <input autocomplete="off" type="text" name="transactions[{{ loop.index0 }}][description]"
+ <input autocomplete="off" type="text" name="transactions[{{ loop.index0 }}][transaction_description]"
value="{{ transaction.transaction_description }}"
class="form-control"/>
</div>
@@ -227,7 +227,7 @@
{# destination for withdrawals: #}
{% if preFilled.what == 'withdrawal' %}
<div class="col-lg-2 col-md-5 col-sm-12 col-xs-12">
- <input autocomplete="off" type="text" name="transactions[{{ loop.index0 }}][destination_account_name]"
+ <input autocomplete="off" type="text" name="transactions[{{ loop.index0 }}][destination_name]"
value="{{ transaction.destination_name }}" class="form-control"/>
</div>
{% endif %}
@@ -235,7 +235,7 @@
{# source for deposits #}
{% if preFilled.what == 'deposit' %}
<div class="col-lg-2 col-md-5 col-sm-12 col-xs-12">
- <input autocomplete="off" type="text" name="transactions[{{ loop.index0 }}][source_account_name]"
+ <input autocomplete="off" type="text" name="transactions[{{ loop.index0 }}][source_name]"
value="{{ transaction.source_name }}" class="form-control"/>
</div>
{% endif %}
@@ -285,7 +285,7 @@
{# category #}
<div class="col-lg-2 col-md-6 col-sm-12 col-xs-12">
- <input autocomplete="off" type="text" name="transactions[{{ loop.index0 }}][category]"
+ <input autocomplete="off" type="text" name="transactions[{{ loop.index0 }}][category_name]"
value="{{ transaction.category_name}}"
class="form-control"/>
</div>
diff --git a/tests/Feature/Controllers/BudgetControllerTest.php b/tests/Feature/Controllers/BudgetControllerTest.php
index faed7e71b7..bb942aa02f 100644
--- a/tests/Feature/Controllers/BudgetControllerTest.php
+++ b/tests/Feature/Controllers/BudgetControllerTest.php
@@ -309,6 +309,8 @@ class BudgetControllerTest extends TestCase
/**
* @covers \FireflyIII\Http\Controllers\BudgetController::infoIncome
* @dataProvider dateRangeProvider
+ *
+ * @param string $range
*/
public function testInfoIncomeExpanded(string $range)
{
diff --git a/tests/Feature/Controllers/PreferencesControllerTest.php b/tests/Feature/Controllers/PreferencesControllerTest.php
index 7aef05dbd8..fe15974bf6 100644
--- a/tests/Feature/Controllers/PreferencesControllerTest.php
+++ b/tests/Feature/Controllers/PreferencesControllerTest.php
@@ -27,9 +27,9 @@ use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\Repositories\User\UserRepositoryInterface;
-use Google2FA;
+
use Illuminate\Support\Collection;
-use Preferences;
+
use Tests\TestCase;
/**