Skip to content

Firefly III: a personal finances manager

PHP7 compatible function definitions.

James Colec8440af9a5ec
diff --git a/app/Events/TransactionJournalStored.php b/app/Events/TransactionJournalStored.php
index a9b40ee71d..d28e1bc5e1 100644
--- a/app/Events/TransactionJournalStored.php
+++ b/app/Events/TransactionJournalStored.php
@@ -16,7 +16,6 @@ use Illuminate\Queue\SerializesModels;
/**
* Class TransactionJournalStored
*
- * @codeCoverageIgnore
* @package FireflyIII\Events
*/
class TransactionJournalStored extends Event
diff --git a/app/Events/TransactionJournalUpdated.php b/app/Events/TransactionJournalUpdated.php
index edb9a82a12..ad75a4f410 100644
--- a/app/Events/TransactionJournalUpdated.php
+++ b/app/Events/TransactionJournalUpdated.php
@@ -9,7 +9,6 @@ use Illuminate\Queue\SerializesModels;
/**
* Class TransactionJournalUpdated
*
- * @codeCoverageIgnore
* @package FireflyIII\Events
*/
class TransactionJournalUpdated extends Event
diff --git a/app/Exceptions/FireflyException.php b/app/Exceptions/FireflyException.php
index 88714ef34e..c931fa7e3a 100644
--- a/app/Exceptions/FireflyException.php
+++ b/app/Exceptions/FireflyException.php
@@ -6,7 +6,6 @@ namespace FireflyIII\Exceptions;
/**
* Class FireflyException
*
- * @codeCoverageIgnore
* @package FireflyIII\Exceptions
*/
class FireflyException extends \Exception
diff --git a/app/Exceptions/NotImplementedException.php b/app/Exceptions/NotImplementedException.php
index 47c43b9e68..f5960285b8 100644
--- a/app/Exceptions/NotImplementedException.php
+++ b/app/Exceptions/NotImplementedException.php
@@ -6,7 +6,6 @@ namespace FireflyIII\Exceptions;
/**
* Class NotImplementedException
*
- * @codeCoverageIgnore
* @package FireflyIII\Exceptions
*/
class NotImplementedException extends \Exception
diff --git a/app/Exceptions/ValidationException.php b/app/Exceptions/ValidationException.php
index 5da65aab66..a1b2ce127c 100644
--- a/app/Exceptions/ValidationException.php
+++ b/app/Exceptions/ValidationException.php
@@ -5,7 +5,6 @@ namespace FireflyIII\Exceptions;
/**
* Class ValidationExceptions
*
- * @codeCoverageIgnore
* @package FireflyIII\Exception
*/
class ValidationException extends \Exception
diff --git a/app/Generator/Chart/Budget/ChartJsBudgetChartGenerator.php b/app/Generator/Chart/Budget/ChartJsBudgetChartGenerator.php
index f0f3cce9a5..3cdd335b31 100644
--- a/app/Generator/Chart/Budget/ChartJsBudgetChartGenerator.php
+++ b/app/Generator/Chart/Budget/ChartJsBudgetChartGenerator.php
@@ -50,7 +50,6 @@ class ChartJsBudgetChartGenerator implements BudgetChartGeneratorInterface
}
/**
- * @codeCoverageIgnore
*
* @param Collection $entries
*
diff --git a/app/Generator/Chart/Category/ChartJsCategoryChartGenerator.php b/app/Generator/Chart/Category/ChartJsCategoryChartGenerator.php
index f2a2893cf7..e87a4543be 100644
--- a/app/Generator/Chart/Category/ChartJsCategoryChartGenerator.php
+++ b/app/Generator/Chart/Category/ChartJsCategoryChartGenerator.php
@@ -148,7 +148,6 @@ class ChartJsCategoryChartGenerator implements CategoryChartGeneratorInterface
}
/**
- * @codeCoverageIgnore
*
* @param Collection $entries
*
diff --git a/app/Handlers/Events/ScanForBillsAfterStore.php b/app/Handlers/Events/ScanForBillsAfterStore.php
index ae477ed638..584e85160b 100644
--- a/app/Handlers/Events/ScanForBillsAfterStore.php
+++ b/app/Handlers/Events/ScanForBillsAfterStore.php
@@ -16,7 +16,6 @@ use FireflyIII\Support\Events\BillScanner;
/**
* Class RescanJournal
*
- * @codeCoverageIgnore
* @package FireflyIII\Handlers\Events
*/
class ScanForBillsAfterStore
diff --git a/app/Handlers/Events/ScanForBillsAfterUpdate.php b/app/Handlers/Events/ScanForBillsAfterUpdate.php
index 2664cebeee..2f867e832b 100644
--- a/app/Handlers/Events/ScanForBillsAfterUpdate.php
+++ b/app/Handlers/Events/ScanForBillsAfterUpdate.php
@@ -16,7 +16,6 @@ use FireflyIII\Support\Events\BillScanner;
/**
* Class RescanJournal
*
- * @codeCoverageIgnore
* @package FireflyIII\Handlers\Events
*/
class ScanForBillsAfterUpdate
diff --git a/app/Handlers/Events/UpdateJournalConnection.php b/app/Handlers/Events/UpdateJournalConnection.php
index 0a5e5f2804..bf385a6d50 100644
--- a/app/Handlers/Events/UpdateJournalConnection.php
+++ b/app/Handlers/Events/UpdateJournalConnection.php
@@ -10,7 +10,6 @@ use FireflyIII\Models\TransactionJournal;
/**
* Class UpdateJournalConnection
*
- * @codeCoverageIgnore
* @package FireflyIII\Handlers\Events
*/
class UpdateJournalConnection
diff --git a/app/Helpers/Collection/Account.php b/app/Helpers/Collection/Account.php
index 24ef263642..a2bb85a899 100644
--- a/app/Helpers/Collection/Account.php
+++ b/app/Helpers/Collection/Account.php
@@ -5,7 +5,6 @@ namespace FireflyIII\Helpers\Collection;
use Illuminate\Support\Collection;
/**
- * @codeCoverageIgnore
* Class Account
*
* @package FireflyIII\Helpers\Collection
diff --git a/app/Helpers/Collection/Balance.php b/app/Helpers/Collection/Balance.php
index 41db832ef7..cb3b4fa3c8 100644
--- a/app/Helpers/Collection/Balance.php
+++ b/app/Helpers/Collection/Balance.php
@@ -5,7 +5,6 @@ namespace FireflyIII\Helpers\Collection;
use Illuminate\Support\Collection;
/**
- * @codeCoverageIgnore
*
* Class Balance
*
diff --git a/app/Helpers/Collection/BalanceEntry.php b/app/Helpers/Collection/BalanceEntry.php
index baa2f3d17c..3e798189d4 100644
--- a/app/Helpers/Collection/BalanceEntry.php
+++ b/app/Helpers/Collection/BalanceEntry.php
@@ -5,7 +5,6 @@ namespace FireflyIII\Helpers\Collection;
use FireflyIII\Models\Account as AccountModel;
/**
- * @codeCoverageIgnore
*
* Class BalanceEntry
*
diff --git a/app/Helpers/Collection/BalanceHeader.php b/app/Helpers/Collection/BalanceHeader.php
index 60ed221f7b..f49c37a2c5 100644
--- a/app/Helpers/Collection/BalanceHeader.php
+++ b/app/Helpers/Collection/BalanceHeader.php
@@ -6,7 +6,6 @@ use FireflyIII\Models\Account as AccountModel;
use Illuminate\Support\Collection;
/**
- * @codeCoverageIgnore
*
* Class BalanceHeader
*
diff --git a/app/Helpers/Collection/BalanceLine.php b/app/Helpers/Collection/BalanceLine.php
index a57a7b403b..c1544e1578 100644
--- a/app/Helpers/Collection/BalanceLine.php
+++ b/app/Helpers/Collection/BalanceLine.php
@@ -6,7 +6,6 @@ use FireflyIII\Models\Budget as BudgetModel;
use Illuminate\Support\Collection;
/**
- * @codeCoverageIgnore
*
* Class BalanceLine
*
diff --git a/app/Helpers/Collection/Bill.php b/app/Helpers/Collection/Bill.php
index f5b58b36ec..f535385013 100644
--- a/app/Helpers/Collection/Bill.php
+++ b/app/Helpers/Collection/Bill.php
@@ -6,7 +6,6 @@ namespace FireflyIII\Helpers\Collection;
use Illuminate\Support\Collection;
/**
- * @codeCoverageIgnore
* Class Bill
*
* @package FireflyIII\Helpers\Collection
diff --git a/app/Helpers/Collection/BillLine.php b/app/Helpers/Collection/BillLine.php
index 8c3141170e..ef55ef833e 100644
--- a/app/Helpers/Collection/BillLine.php
+++ b/app/Helpers/Collection/BillLine.php
@@ -5,7 +5,6 @@ namespace FireflyIII\Helpers\Collection;
use FireflyIII\Models\Bill as BillModel;
/**
- * @codeCoverageIgnore
*
* Class BillLine
*
@@ -111,7 +110,7 @@ class BillLine
}
/**
- * @return boolean
+ * @return bool
*/
public function isActive(): bool
{
@@ -127,7 +126,7 @@ class BillLine
}
/**
- * @return boolean
+ * @return bool
*/
public function isHit(): bool
{
diff --git a/app/Helpers/Collection/Budget.php b/app/Helpers/Collection/Budget.php
index 92d864eb06..eeaec0e782 100644
--- a/app/Helpers/Collection/Budget.php
+++ b/app/Helpers/Collection/Budget.php
@@ -5,7 +5,6 @@ namespace FireflyIII\Helpers\Collection;
use Illuminate\Support\Collection;
/**
- * @codeCoverageIgnore
*
* Class Budget
*
diff --git a/app/Helpers/Collection/BudgetLine.php b/app/Helpers/Collection/BudgetLine.php
index ecda6ac7ca..73ff155b3c 100644
--- a/app/Helpers/Collection/BudgetLine.php
+++ b/app/Helpers/Collection/BudgetLine.php
@@ -6,7 +6,6 @@ use FireflyIII\Models\Budget as BudgetModel;
use FireflyIII\Models\LimitRepetition;
/**
- * @codeCoverageIgnore
*
* Class BudgetLine
*
diff --git a/app/Helpers/Collection/Category.php b/app/Helpers/Collection/Category.php
index b8196fe05a..c44d4d1560 100644
--- a/app/Helpers/Collection/Category.php
+++ b/app/Helpers/Collection/Category.php
@@ -7,7 +7,6 @@ use Illuminate\Support\Collection;
/**
- * @codeCoverageIgnore
*
* Class Category
*
diff --git a/app/Helpers/Collection/Expense.php b/app/Helpers/Collection/Expense.php
index b241f04f9f..f69a2db8ae 100644
--- a/app/Helpers/Collection/Expense.php
+++ b/app/Helpers/Collection/Expense.php
@@ -8,7 +8,6 @@ use Illuminate\Support\Collection;
use stdClass;
/**
- * @codeCoverageIgnore
*
* Class Expense
*
diff --git a/app/Helpers/Collection/Income.php b/app/Helpers/Collection/Income.php
index 17017e5129..c5cf254b3d 100644
--- a/app/Helpers/Collection/Income.php
+++ b/app/Helpers/Collection/Income.php
@@ -8,7 +8,6 @@ use Illuminate\Support\Collection;
use stdClass;
/**
- * @codeCoverageIgnore
*
* Class Income
*
diff --git a/app/Helpers/Csv/Specifix/AbnAmroDescription.php b/app/Helpers/Csv/Specifix/AbnAmroDescription.php
index c5f0cb1245..19eb273d93 100644
--- a/app/Helpers/Csv/Specifix/AbnAmroDescription.php
+++ b/app/Helpers/Csv/Specifix/AbnAmroDescription.php
@@ -65,7 +65,7 @@ class AbnAmroDescription extends Specifix implements SpecifixInterface
/**
* Parses the current description with costs from ABN AMRO itself
*
- * @return boolean true if the description is GEA/BEA-format, false otherwise
+ * @return bool true if the description is GEA/BEA-format, false otherwise
*/
protected function parseABNAMRODescription()
{
@@ -85,7 +85,7 @@ class AbnAmroDescription extends Specifix implements SpecifixInterface
/**
* Parses the current description in GEA/BEA format
*
- * @return boolean true if the description is GEA/BEAformat, false otherwise
+ * @return bool true if the description is GEA/BEAformat, false otherwise
*/
protected function parseGEABEADescription()
{
@@ -111,7 +111,7 @@ class AbnAmroDescription extends Specifix implements SpecifixInterface
/**
* Parses the current description in SEPA format
*
- * @return boolean true if the description is SEPA format, false otherwise
+ * @return bool true if the description is SEPA format, false otherwise
*/
protected function parseSepaDescription()
{
@@ -168,7 +168,7 @@ class AbnAmroDescription extends Specifix implements SpecifixInterface
/**
* Parses the current description in TRTP format
*
- * @return boolean true if the description is TRTP format, false otherwise
+ * @return bool true if the description is TRTP format, false otherwise
*/
protected function parseTRTPDescription()
{
diff --git a/app/Helpers/FiscalHelper.php b/app/Helpers/FiscalHelper.php
index 224fc5a025..0345f3427e 100644
--- a/app/Helpers/FiscalHelper.php
+++ b/app/Helpers/FiscalHelper.php
@@ -20,7 +20,6 @@ class FiscalHelper implements FiscalHelperInterface
/**
* FiscalHelper constructor.
*
- * @codeCoverageIgnore
*
*/
public function __construct()
diff --git a/app/Helpers/Help/Help.php b/app/Helpers/Help/Help.php
index 881006afe0..36ffa3f9e2 100644
--- a/app/Helpers/Help/Help.php
+++ b/app/Helpers/Help/Help.php
@@ -17,7 +17,6 @@ class Help implements HelpInterface
{
/**
- * @codeCoverageIgnore
*
* @param string $key
*
@@ -68,7 +67,6 @@ class Help implements HelpInterface
}
/**
- * @codeCoverageIgnore
*
* @param string $route
*
@@ -80,7 +78,6 @@ class Help implements HelpInterface
}
/**
- * @codeCoverageIgnore
*
* @param string $route
*
@@ -92,7 +89,6 @@ class Help implements HelpInterface
}
/**
- * @codeCoverageIgnore
*
* @param string $route
* @param array $content
diff --git a/app/Helpers/Report/BalanceReportHelper.php b/app/Helpers/Report/BalanceReportHelper.php
index 290f6896ba..cc5c9c7a0e 100644
--- a/app/Helpers/Report/BalanceReportHelper.php
+++ b/app/Helpers/Report/BalanceReportHelper.php
@@ -40,7 +40,6 @@ class BalanceReportHelper implements BalanceReportHelperInterface
/**
* ReportHelper constructor.
*
- * @codeCoverageIgnore
*
* @param BudgetRepositoryInterface $budgetRepository
* @param TagRepositoryInterface $tagRepository
diff --git a/app/Helpers/Report/ReportHelper.php b/app/Helpers/Report/ReportHelper.php
index 93b7a12e07..8726299a8c 100644
--- a/app/Helpers/Report/ReportHelper.php
+++ b/app/Helpers/Report/ReportHelper.php
@@ -37,7 +37,6 @@ class ReportHelper implements ReportHelperInterface
/**
* ReportHelper constructor.
*
- * @codeCoverageIgnore
*
* @param ReportQueryInterface $query
* @param BudgetRepositoryInterface $budgetRepository
diff --git a/app/Http/Controllers/Chart/AccountController.php b/app/Http/Controllers/Chart/AccountController.php
index 4f0c5d365a..951e9bda4f 100644
--- a/app/Http/Controllers/Chart/AccountController.php
+++ b/app/Http/Controllers/Chart/AccountController.php
@@ -56,7 +56,7 @@ class AccountController extends Controller
$cache->addProperty($reportType);
$cache->addProperty($accounts);
if ($cache->has()) {
- return Response::json($cache->get()); // @codeCoverageIgnore
+ return Response::json($cache->get());
}
// make chart:
@@ -86,7 +86,7 @@ class AccountController extends Controller
$cache->addProperty('expenseAccounts');
$cache->addProperty('accounts');
if ($cache->has()) {
- return Response::json($cache->get()); // @codeCoverageIgnore
+ return Response::json($cache->get());
}
$data = $this->generator->expenseAccounts($accounts, $start, $end);
@@ -117,7 +117,7 @@ class AccountController extends Controller
$cache->addProperty('frontpage');
$cache->addProperty('accounts');
if ($cache->has()) {
- return Response::json($cache->get()); // @codeCoverageIgnore
+ return Response::json($cache->get());
}
$data = $this->generator->frontpage($accounts, $start, $end);
@@ -149,7 +149,7 @@ class AccountController extends Controller
$cache->addProperty('single');
$cache->addProperty($account->id);
if ($cache->has()) {
- return Response::json($cache->get()); // @codeCoverageIgnore
+ return Response::json($cache->get());
}
$data = $this->generator->single($account, $start, $end);
diff --git a/app/Http/Controllers/Chart/BillController.php b/app/Http/Controllers/Chart/BillController.php
index aba1965f05..88c617a621 100644
--- a/app/Http/Controllers/Chart/BillController.php
+++ b/app/Http/Controllers/Chart/BillController.php
@@ -78,7 +78,7 @@ class BillController extends Controller
$cache->addProperty('bill');
$cache->addProperty($bill->id);
if ($cache->has()) {
- return Response::json($cache->get()); // @codeCoverageIgnore
+ return Response::json($cache->get());
}
// get first transaction or today for start:
diff --git a/app/Http/Controllers/Chart/BudgetController.php b/app/Http/Controllers/Chart/BudgetController.php
index 7452997d4c..b7025dd279 100644
--- a/app/Http/Controllers/Chart/BudgetController.php
+++ b/app/Http/Controllers/Chart/BudgetController.php
@@ -57,7 +57,7 @@ class BudgetController extends Controller
$cache->addProperty('budget');
if ($cache->has()) {
- return Response::json($cache->get()); // @codeCoverageIgnore
+ return Response::json($cache->get());
}
$final = clone $last;
@@ -108,7 +108,7 @@ class BudgetController extends Controller
$cache->addProperty($budget->id);
$cache->addProperty($repetition->id);
if ($cache->has()) {
- return Response::json($cache->get()); // @codeCoverageIgnore
+ return Response::json($cache->get());
}
$set = $repository->getExpensesPerDay($budget, $start, $end);
@@ -161,7 +161,7 @@ class BudgetController extends Controller
$cache->addProperty('budget');
$cache->addProperty('all');
if ($cache->has()) {
- return Response::json($cache->get()); // @codeCoverageIgnore
+ return Response::json($cache->get());
}
$budgets = $repository->getBudgetsAndLimitsInRange($start, $end);
@@ -230,7 +230,7 @@ class BudgetController extends Controller
$cache->addProperty('multiYearBudget');
if ($cache->has()) {
- return Response::json($cache->get()); // @codeCoverageIgnore
+ return Response::json($cache->get());
}
/*
@@ -310,7 +310,7 @@ class BudgetController extends Controller
$cache->addProperty('budget');
$cache->addProperty('year');
if ($cache->has()) {
- return Response::json($cache->get()); // @codeCoverageIgnore
+ return Response::json($cache->get());
}
$budgetInformation = $repository->getBudgetsAndExpensesPerMonth($accounts, $start, $end);
diff --git a/app/Http/Controllers/Chart/CategoryController.php b/app/Http/Controllers/Chart/CategoryController.php
index b0e5eaf873..3eb80cf958 100644
--- a/app/Http/Controllers/Chart/CategoryController.php
+++ b/app/Http/Controllers/Chart/CategoryController.php
@@ -67,7 +67,7 @@ class CategoryController extends Controller
$cache->addProperty('all');
$cache->addProperty('categories');
if ($cache->has()) {
- return Response::json($cache->get()); // @codeCoverageIgnore
+ return Response::json($cache->get());
}
$spentArray = $repository->spentPerDay($category, $start, $end);
$earnedArray = $repository->earnedPerDay($category, $start, $end);
@@ -130,7 +130,7 @@ class CategoryController extends Controller
$cache->addProperty('category');
$cache->addProperty('earned-in-period');
if ($cache->has()) {
- return Response::json($cache->get()); // @codeCoverageIgnore
+ return Response::json($cache->get());
}
$set = $repository->earnedForAccountsPerMonth($accounts, $start, $end);
@@ -169,7 +169,7 @@ class CategoryController extends Controller
$cache->addProperty('category');
$cache->addProperty('frontpage');
if ($cache->has()) {
- return Response::json($cache->get()); // @codeCoverageIgnore
+ return Response::json($cache->get());
}
// get data for categories (and "no category"):
@@ -215,7 +215,7 @@ class CategoryController extends Controller
$cache->addProperty('multiYearCategory');
if ($cache->has()) {
- return Response::json($cache->get()); // @codeCoverageIgnore
+ return Response::json($cache->get());
}
$entries = new Collection;
@@ -321,7 +321,7 @@ class CategoryController extends Controller
$cache->addProperty('category');
$cache->addProperty('spent-in-period');
if ($cache->has()) {
- return Response::json($cache->get()); // @codeCoverageIgnore
+ return Response::json($cache->get());
}
diff --git a/app/Http/Controllers/Chart/PiggyBankController.php b/app/Http/Controllers/Chart/PiggyBankController.php
index bf2d91a445..0759c6d5d9 100644
--- a/app/Http/Controllers/Chart/PiggyBankController.php
+++ b/app/Http/Controllers/Chart/PiggyBankController.php
@@ -47,7 +47,7 @@ class PiggyBankController extends Controller
$cache->addProperty('piggy-history');
$cache->addProperty($piggyBank->id);
if ($cache->has()) {
- return Response::json($cache->get()); // @codeCoverageIgnore
+ return Response::json($cache->get());
}
/** @var Collection $set */
diff --git a/app/Http/Controllers/Chart/ReportController.php b/app/Http/Controllers/Chart/ReportController.php
index 7362ae68a8..8bcff1ec36 100644
--- a/app/Http/Controllers/Chart/ReportController.php
+++ b/app/Http/Controllers/Chart/ReportController.php
@@ -54,7 +54,7 @@ class ReportController extends Controller
$cache->addProperty($accounts);
$cache->addProperty($end);
if ($cache->has()) {
- return Response::json($cache->get()); // @codeCoverageIgnore
+ return Response::json($cache->get());
}
$ids = $accounts->pluck('id')->toArray();
$current = clone $start;
@@ -102,7 +102,7 @@ class ReportController extends Controller
$cache->addProperty($accounts);
$cache->addProperty($end);
if ($cache->has()) {
- return Response::json($cache->get()); // @codeCoverageIgnore
+ return Response::json($cache->get());
}
// spent per month, and earned per month. For a specific set of accounts
@@ -146,7 +146,7 @@ class ReportController extends Controller
$cache->addProperty($reportType);
$cache->addProperty($accounts);
if ($cache->has()) {
- return Response::json($cache->get()); // @codeCoverageIgnore
+ return Response::json($cache->get());
}
// spent per month, and earned per month. For a specific set of accounts
// grouped by month
diff --git a/app/Http/Controllers/JsonController.php b/app/Http/Controllers/JsonController.php
index 229879cf1a..02d98879db 100644
--- a/app/Http/Controllers/JsonController.php
+++ b/app/Http/Controllers/JsonController.php
@@ -114,7 +114,7 @@ class JsonController extends Controller
$cache->addProperty($end);
$cache->addProperty('box-in');
if ($cache->has()) {
- return Response::json($cache->get()); // @codeCoverageIgnore
+ return Response::json($cache->get());
}
$accounts = $accountRepository->getAccounts(['Default account', 'Asset account', 'Cash account']);
$amount = $reportQuery->income($accounts, $start, $end)->sum('journalAmount');
@@ -145,7 +145,7 @@ class JsonController extends Controller
$cache->addProperty($end);
$cache->addProperty('box-out');
if ($cache->has()) {
- return Response::json($cache->get()); // @codeCoverageIgnore
+ return Response::json($cache->get());
}
$amount = $reportQuery->expense($accounts, $start, $end)->sum('journalAmount');
diff --git a/app/Jobs/ExecuteRuleGroupOnExistingTransactions.php b/app/Jobs/ExecuteRuleGroupOnExistingTransactions.php
index 242f9d85f1..20b33230e9 100644
--- a/app/Jobs/ExecuteRuleGroupOnExistingTransactions.php
+++ b/app/Jobs/ExecuteRuleGroupOnExistingTransactions.php
@@ -44,7 +44,7 @@ class ExecuteRuleGroupOnExistingTransactions extends Job implements ShouldQueue
/**
* @return Collection
*/
- public function getAccounts()
+ public function getAccounts(): Collection
{
return $this->accounts;
}
@@ -61,7 +61,7 @@ class ExecuteRuleGroupOnExistingTransactions extends Job implements ShouldQueue
/**
* @return \Carbon\Carbon
*/
- public function getEndDate()
+ public function getEndDate(): Carbon
{
return $this->endDate;
}
@@ -78,7 +78,7 @@ class ExecuteRuleGroupOnExistingTransactions extends Job implements ShouldQueue
/**
* @return \Carbon\Carbon
*/
- public function getStartDate()
+ public function getStartDate(): Carbon
{
return $this->startDate;
}
@@ -95,7 +95,7 @@ class ExecuteRuleGroupOnExistingTransactions extends Job implements ShouldQueue
/**
* @return User
*/
- public function getUser()
+ public function getUser(): User
{
return $this->user;
}
diff --git a/app/Models/Account.php b/app/Models/Account.php
index 28a3c904ec..eaddfd0637 100644
--- a/app/Models/Account.php
+++ b/app/Models/Account.php
@@ -4,6 +4,8 @@ use Auth;
use Crypt;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Illuminate\Database\Eloquent\Model;
+use Illuminate\Database\Eloquent\Relations\BelongsTo;
+use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Query\JoinClause;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@@ -146,36 +148,39 @@ class Account extends Model
}
/**
- * @return \Illuminate\Database\Eloquent\Relations\HasMany
+ * @return HasMany
*/
- public function accountMeta()
+ public function accountMeta(): HasMany
{
return $this->hasMany('FireflyIII\Models\AccountMeta');
}
/**
- * @codeCoverageIgnore
- * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
+ * @return BelongsTo
*/
- public function accountType()
+ public function accountType(): BelongsTo
{
return $this->belongsTo('FireflyIII\Models\AccountType');
}
/**
- * @codeCoverageIgnore
+ * FIXME can return null
*
* @param $value
*
* @return string
*/
- public function getIbanAttribute($value)
+ public function getIbanAttribute($value): string
{
if (is_null($value)) {
- return null;
+ return '';
+ }
+ $result = Crypt::decrypt($value);
+ if (is_null($result)) {
+ return '';
}
- return Crypt::decrypt($value);
+ return $result;
}
/**
@@ -184,7 +189,7 @@ class Account extends Model
*
* @return string
*/
- public function getMeta($fieldName): string
+ public function getMeta(string $fieldName): string
{
foreach ($this->accountMeta as $meta) {
if ($meta->name == $fieldName) {
@@ -196,13 +201,12 @@ class Account extends Model
}
/**
- * @codeCoverageIgnore
*
* @param $value
*
* @return string
*/
- public function getNameAttribute($value)
+ public function getNameAttribute($value): string
{
if (intval($this->encrypted) == 1) {
@@ -216,7 +220,7 @@ class Account extends Model
*
* @return string
*/
- public function getNameForEditformAttribute()
+ public function getNameForEditformAttribute(): string
{
$name = $this->name;
if ($this->accountType->type == 'Cash account') {
@@ -227,16 +231,14 @@ class Account extends Model
}
/**
- * @codeCoverageIgnore
- * @return \Illuminate\Database\Eloquent\Relations\HasMany
+ * @return HasMany
*/
- public function piggyBanks()
+ public function piggyBanks(): HasMany
{
return $this->hasMany('FireflyIII\Models\PiggyBank');
}
/**
- * @codeCoverageIgnore
*
* @param EloquentBuilder $query
* @param array $types
@@ -251,7 +253,6 @@ class Account extends Model
}
/**
- * @codeCoverageIgnore
*
* @param EloquentBuilder $query
* @param string $name
@@ -269,7 +270,6 @@ class Account extends Model
}
/**
- * @codeCoverageIgnore
*
* @param $value
*/
@@ -279,7 +279,6 @@ class Account extends Model
}
/**
- * @codeCoverageIgnore
*
* @param $value
*/
@@ -292,7 +291,6 @@ class Account extends Model
/**
* @param $value
*
- * @codeCoverageIgnore
*/
public function setVirtualBalanceAttribute($value)
{
@@ -300,19 +298,17 @@ class Account extends Model
}
/**
- * @codeCoverageIgnore
- * @return \Illuminate\Database\Eloquent\Relations\HasMany
+ * @return HasMany
*/
- public function transactions()
+ public function transactions(): HasMany
{
return $this->hasMany('FireflyIII\Models\Transaction');
}
/**
- * @codeCoverageIgnore
- * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
+ * @return BelongsTo
*/
- public function user()
+ public function user(): BelongsTo
{
return $this->belongsTo('FireflyIII\User');
}
diff --git a/app/Models/AccountMeta.php b/app/Models/AccountMeta.php
index aaa4f2ca44..794c3c2128 100644
--- a/app/Models/AccountMeta.php
+++ b/app/Models/AccountMeta.php
@@ -1,6 +1,7 @@
<?php namespace FireflyIII\Models;
use Illuminate\Database\Eloquent\Model;
+use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* FireflyIII\Models\AccountMeta
@@ -29,9 +30,9 @@ class AccountMeta extends Model
/**
*
- * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
+ * @return BelongsTo
*/
- public function account()
+ public function account(): BelongsTo
{
return $this->belongsTo('FireflyIII\Models\Account');
}
diff --git a/app/Models/AccountType.php b/app/Models/AccountType.php
index 7af6352c90..f9b6757fd1 100644
--- a/app/Models/AccountType.php
+++ b/app/Models/AccountType.php
@@ -1,6 +1,7 @@
<?php namespace FireflyIII\Models;
use Illuminate\Database\Eloquent\Model;
+use Illuminate\Database\Eloquent\Relations\HasMany;
/**
* FireflyIII\Models\AccountType
@@ -25,9 +26,9 @@ class AccountType extends Model
//
/**
- * @return \Illuminate\Database\Eloquent\Relations\HasMany
+ * @return HasMany
*/
- public function accounts()
+ public function accounts(): HasMany
{
return $this->hasMany('FireflyIII\Models\Account');
}
diff --git a/app/Models/Attachment.php b/app/Models/Attachment.php
index 7685847ac2..8252cbf65f 100644
--- a/app/Models/Attachment.php
+++ b/app/Models/Attachment.php
@@ -6,6 +6,8 @@ namespace FireflyIII\Models;
use Auth;
use Crypt;
use Illuminate\Database\Eloquent\Model;
+use Illuminate\Database\Eloquent\Relations\BelongsTo;
+use Illuminate\Database\Eloquent\Relations\MorphTo;
use Illuminate\Database\Eloquent\SoftDeletes;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@@ -70,8 +72,10 @@ class Attachment extends Model
/**
* Get all of the owning imageable models.
+ *
+ * @return MorphTo
*/
- public function attachable()
+ public function attachable(): MorphTo
{
return $this->morphTo();
}
@@ -87,8 +91,6 @@ class Attachment extends Model
}
/**
- * @codeCoverageIgnore
- *
* @param $value
*
* @return null|string
@@ -103,8 +105,6 @@ class Attachment extends Model
}
/**
- * @codeCoverageIgnore
- *
* @param $value
*
* @return null|string
@@ -119,8 +119,6 @@ class Attachment extends Model
}
/**
- * @codeCoverageIgnore
- *
* @param $value
*
* @return null|string
@@ -135,7 +133,6 @@ class Attachment extends Model
}
/**
- * @codeCoverageIgnore
*
* @param $value
*
@@ -151,7 +148,6 @@ class Attachment extends Model
}
/**
- * @codeCoverageIgnore
*
* @param $value
*
@@ -169,7 +165,7 @@ class Attachment extends Model
/**
* @param string $value
*/
- public function setDescriptionAttribute($value)
+ public function setDescriptionAttribute(string $value)
{
$this->attributes['description'] = Crypt::encrypt($value);
}
@@ -177,7 +173,7 @@ class Attachment extends Model
/**
* @param string $value
*/
- public function setFilenameAttribute($value)
+ public function setFilenameAttribute(string $value)
{
$this->attributes['filename'] = Crypt::encrypt($value);
}
@@ -185,7 +181,7 @@ class Attachment extends Model
/**
* @param string $value
*/
- public function setMimeAttribute($value)
+ public function setMimeAttribute(string $value)
{
$this->attributes['mime'] = Crypt::encrypt($value);
}
@@ -193,7 +189,7 @@ class Attachment extends Model
/**
* @param string $value
*/
- public function setNotesAttribute($value)
+ public function setNotesAttribute(string $value)
{
$this->attributes['notes'] = Crypt::encrypt($value);
}
@@ -201,16 +197,15 @@ class Attachment extends Model
/**
* @param string $value
*/
- public function setTitleAttribute($value)
+ public function setTitleAttribute(string $value)
{
$this->attributes['title'] = Crypt::encrypt($value);
}
/**
- * @codeCoverageIgnore
- * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
+ * @return BelongsTo
*/
- public function user()
+ public function user(): BelongsTo
{
return $this->belongsTo('FireflyIII\User');
}
diff --git a/app/Models/Bill.php b/app/Models/Bill.php
index 0742cc8e26..4ceb09a93e 100644
--- a/app/Models/Bill.php
+++ b/app/Models/Bill.php
@@ -3,6 +3,8 @@
use Auth;
use Crypt;
use Illuminate\Database\Eloquent\Model;
+use Illuminate\Database\Eloquent\Relations\BelongsTo;
+use Illuminate\Database\Eloquent\Relations\HasMany;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
@@ -135,17 +137,17 @@ class Bill extends Model
}
/**
- * @return \Illuminate\Database\Eloquent\Relations\HasMany
+ * @return HasMany
*/
- public function transactionjournals()
+ public function transactionjournals(): HasMany
{
return $this->hasMany('FireflyIII\Models\TransactionJournal');
}
/**
- * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
+ * @return BelongsTo
*/
- public function user()
+ public function user(): BelongsTo
{
return $this->belongsTo('FireflyIII\User');
}
diff --git a/app/Models/Budget.php b/app/Models/Budget.php
index 8b26f14c3c..092477fa6b 100644
--- a/app/Models/Budget.php
+++ b/app/Models/Budget.php
@@ -3,6 +3,7 @@
use Auth;
use Crypt;
use Illuminate\Database\Eloquent\Model;
+use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@@ -136,9 +137,9 @@ class Budget extends Model
}
/**
- * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
+ * @return BelongsTo
*/
- public function user()
+ public function user(): BelongsTo
{
return $this->belongsTo('FireflyIII\User');
}
diff --git a/app/Models/Category.php b/app/Models/Category.php
index ef6d20c3f9..f3139fdf7f 100644
--- a/app/Models/Category.php
+++ b/app/Models/Category.php
@@ -3,6 +3,7 @@
use Auth;
use Crypt;
use Illuminate\Database\Eloquent\Model;
+use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@@ -83,7 +84,6 @@ class Category extends Model
}
/**
- * @codeCoverageIgnore
*
* @param $value
*
@@ -100,7 +100,6 @@ class Category extends Model
}
/**
- * @codeCoverageIgnore
*
* @param $value
*/
@@ -111,7 +110,6 @@ class Category extends Model
}
/**
- * @codeCoverageIgnore
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
public function transactionjournals()
@@ -120,10 +118,9 @@ class Category extends Model
}
/**
- * @codeCoverageIgnore
- * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
+ * @return BelongsTo
*/
- public function user()
+ public function user(): BelongsTo
{
return $this->belongsTo('FireflyIII\User');
}
diff --git a/app/Models/Component.php b/app/Models/Component.php
index 5e8214d2aa..f4794eb3f2 100644
--- a/app/Models/Component.php
+++ b/app/Models/Component.php
@@ -25,14 +25,7 @@ use Illuminate\Database\Eloquent\Model;
*/
class Component extends Model
{
+ protected $dates = ['created_at', 'updated_at', 'deleted_at'];
protected $fillable = ['user_id', 'name', 'class'];
- /**
- * @return array
- */
- public function getDates()
- {
- return ['created_at', 'updated_at', 'deleted_at'];
- }
-
}
diff --git a/app/Models/ExportJob.php b/app/Models/ExportJob.php
index 22a6d4020e..e571bbfea0 100644
--- a/app/Models/ExportJob.php
+++ b/app/Models/ExportJob.php
@@ -64,7 +64,6 @@ class ExportJob extends Model
}
/**
- * @codeCoverageIgnore
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function user()
diff --git a/app/Models/Tag.php b/app/Models/Tag.php
index c7bcd66d71..9646cd855e 100644
--- a/app/Models/Tag.php
+++ b/app/Models/Tag.php
@@ -109,7 +109,6 @@ class Tag extends Model
}
/**
- * @codeCoverageIgnore
*
* @param $value
*
@@ -125,7 +124,6 @@ class Tag extends Model
}
/**
- * @codeCoverageIgnore
*
* @param $value
*
@@ -155,7 +153,6 @@ class Tag extends Model
}
/**
- * @codeCoverageIgnore
*
* @param $value
*/
@@ -165,7 +162,6 @@ class Tag extends Model
}
/**
- * @codeCoverageIgnore
*
* @param $value
*/
@@ -175,7 +171,6 @@ class Tag extends Model
}
/**
- * @codeCoverageIgnore
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
public function transactionjournals()
@@ -184,7 +179,6 @@ class Tag extends Model
}
/**
- * @codeCoverageIgnore
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function user()
diff --git a/app/Models/TransactionJournal.php b/app/Models/TransactionJournal.php
index 77e7601115..cae98cc4d3 100644
--- a/app/Models/TransactionJournal.php
+++ b/app/Models/TransactionJournal.php
@@ -158,7 +158,6 @@ class TransactionJournal extends TransactionJournalSupport
}
/**
- * @codeCoverageIgnore
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function bill()
@@ -167,7 +166,6 @@ class TransactionJournal extends TransactionJournalSupport
}
/**
- * @codeCoverageIgnore
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
public function budgets()
@@ -176,7 +174,6 @@ class TransactionJournal extends TransactionJournalSupport
}
/**
- * @codeCoverageIgnore
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
public function categories()
@@ -185,7 +182,6 @@ class TransactionJournal extends TransactionJournalSupport
}
/**
- * @codeCoverageIgnore
*
* @param $value
*
@@ -298,7 +294,6 @@ class TransactionJournal extends TransactionJournalSupport
}
/**
- * @codeCoverageIgnore
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function piggyBankEvents()
@@ -322,7 +317,6 @@ class TransactionJournal extends TransactionJournalSupport
}
/**
- * @codeCoverageIgnore
*
* @param EloquentBuilder $query
* @param Carbon $date
@@ -335,7 +329,6 @@ class TransactionJournal extends TransactionJournalSupport
}
/**
- * @codeCoverageIgnore
*
* @param EloquentBuilder $query
* @param Carbon $date
@@ -391,7 +384,6 @@ class TransactionJournal extends TransactionJournalSupport
}
/**
- * @codeCoverageIgnore
*
* @param EloquentBuilder $query
* @param array $types
@@ -406,7 +398,6 @@ class TransactionJournal extends TransactionJournalSupport
}
/**
- * @codeCoverageIgnore
*
* @param $value
*/
@@ -417,7 +408,6 @@ class TransactionJournal extends TransactionJournalSupport
}
/**
- * @codeCoverageIgnore
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
public function tags()
@@ -426,7 +416,6 @@ class TransactionJournal extends TransactionJournalSupport
}
/**
- * @codeCoverageIgnore
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function transactionCurrency()
@@ -435,7 +424,6 @@ class TransactionJournal extends TransactionJournalSupport
}
/**
- * @codeCoverageIgnore
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function transactionType()
@@ -444,7 +432,6 @@ class TransactionJournal extends TransactionJournalSupport
}
/**
- * @codeCoverageIgnore
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
public function transactiongroups()
@@ -461,7 +448,6 @@ class TransactionJournal extends TransactionJournalSupport
}
/**
- * @codeCoverageIgnore
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function transactions()
@@ -470,7 +456,6 @@ class TransactionJournal extends TransactionJournalSupport
}
/**
- * @codeCoverageIgnore
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function user()
diff --git a/app/Models/TransactionType.php b/app/Models/TransactionType.php
index c6c39a1946..0ee5638c96 100644
--- a/app/Models/TransactionType.php
+++ b/app/Models/TransactionType.php
@@ -63,7 +63,6 @@ class TransactionType extends Model
}
/**
- * @codeCoverageIgnore
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php
index 6df4248721..929c1d5a3a 100644
--- a/app/Providers/EventServiceProvider.php
+++ b/app/Providers/EventServiceProvider.php
@@ -84,7 +84,7 @@ class EventServiceProvider extends ServiceProvider
try {
$repetition->save();
} catch (QueryException $e) {
- Log::error('Trying to save new LimitRepetition failed: ' . $e->getMessage()); // @codeCoverageIgnore
+ Log::error('Trying to save new LimitRepetition failed: ' . $e->getMessage());
}
} else {
if ($set->count() == 1) {
diff --git a/app/Providers/FireflyServiceProvider.php b/app/Providers/FireflyServiceProvider.php
index 40018fdb48..9994b5ba36 100644
--- a/app/Providers/FireflyServiceProvider.php
+++ b/app/Providers/FireflyServiceProvider.php
@@ -24,7 +24,6 @@ use Validator;
* Class FireflyServiceProvider
*
* @package FireflyIII\Providers
- * @codeCoverageIgnore
*/
class FireflyServiceProvider extends ServiceProvider
{
diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php
index 9e9a73a7c9..6d29a6119b 100644
--- a/app/Repositories/Account/AccountRepository.php
+++ b/app/Repositories/Account/AccountRepository.php
@@ -62,7 +62,7 @@ class AccountRepository implements AccountRepositoryInterface
* @param Account $account
* @param Account $moveTo
*
- * @return boolean
+ * @return bool
*/
public function destroy(Account $account, Account $moveTo = null): bool
{
@@ -542,9 +542,7 @@ class AccountRepository implements AccountRepositoryInterface
if (!$existingAccount) {
Log::error('Account create error: ' . $newAccount->getErrors()->toJson());
abort(500);
- // @codeCoverageIgnoreStart
}
- // @codeCoverageIgnoreEnd
$newAccount = $existingAccount;
}
diff --git a/app/Repositories/Account/AccountRepositoryInterface.php b/app/Repositories/Account/AccountRepositoryInterface.php
index 13cf3e3ace..4b32a75b48 100644
--- a/app/Repositories/Account/AccountRepositoryInterface.php
+++ b/app/Repositories/Account/AccountRepositoryInterface.php
@@ -31,7 +31,7 @@ interface AccountRepositoryInterface
* @param Account $account
* @param Account $moveTo
*
- * @return boolean
+ * @return bool
*/
public function destroy(Account $account, Account $moveTo): bool;
diff --git a/app/Repositories/Bill/BillRepository.php b/app/Repositories/Bill/BillRepository.php
index 59b35ea087..7420b1f902 100644
--- a/app/Repositories/Bill/BillRepository.php
+++ b/app/Repositories/Bill/BillRepository.php
@@ -40,7 +40,7 @@ class BillRepository implements BillRepositoryInterface
/**
* @param Bill $bill
*
- * @return boolean
+ * @return bool
*/
public function destroy(Bill $bill): bool
{
diff --git a/app/Repositories/Journal/JournalRepository.php b/app/Repositories/Journal/JournalRepository.php
index 956a4645f3..ef0b919a6f 100644
--- a/app/Repositories/Journal/JournalRepository.php
+++ b/app/Repositories/Journal/JournalRepository.php
@@ -44,7 +44,7 @@ class JournalRepository implements JournalRepositoryInterface
*
* @return bool
*/
- public function delete(TransactionJournal $journal)
+ public function delete(TransactionJournal $journal): bool
{
$journal->delete();
@@ -56,7 +56,7 @@ class JournalRepository implements JournalRepositoryInterface
*
* @return TransactionJournal
*/
- public function first()
+ public function first(): TransactionJournal
{
$entry = $this->user->transactionjournals()->orderBy('date', 'ASC')->first(['transaction_journals.*']);
@@ -67,9 +67,9 @@ class JournalRepository implements JournalRepositoryInterface
* @param TransactionJournal $journal
* @param Transaction $transaction
*
- * @return integer
+ * @return string
*/
- public function getAmountBefore(TransactionJournal $journal, Transaction $transaction)
+ public function getAmountBefore(TransactionJournal $journal, Transaction $transaction): string
{
$set = $transaction->account->transactions()->leftJoin(
'transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id'
@@ -94,7 +94,7 @@ class JournalRepository implements JournalRepositoryInterface
*
* @return Collection
*/
- public function getCollectionOfTypes(array $types, int $offset, int $count)
+ public function getCollectionOfTypes(array $types, int $offset, int $count): Collection
{
$set = $this->user->transactionJournals()
->expanded()
@@ -113,7 +113,7 @@ class JournalRepository implements JournalRepositoryInterface
*
* @return Collection
*/
- public function getJournalsOfType(TransactionType $dbType)
+ public function getJournalsOfType(TransactionType $dbType): Collection
{
return $this->user->transactionjournals()->where('transaction_type_id', $dbType->id)->orderBy('id', 'DESC')->take(50)->get();
}
@@ -127,7 +127,7 @@ class JournalRepository implements JournalRepositoryInterface
*
* @return LengthAwarePaginator
*/
- public function getJournalsOfTypes(array $types, int $offset, int $page, int $pagesize = 50)
+ public function getJournalsOfTypes(array $types, int $offset, int $page, int $pagesize = 50): LengthAwarePaginator
{
$set = $this->user
->transactionJournals()
@@ -151,7 +151,7 @@ class JournalRepository implements JournalRepositoryInterface
*
* @return TransactionType
*/
- public function getTransactionType(string $type)
+ public function getTransactionType(string $type): TransactionType
{
return TransactionType::whereType($type)->first();
}
@@ -162,7 +162,7 @@ class JournalRepository implements JournalRepositoryInterface
*
* @return TransactionJournal
*/
- public function getWithDate(int $journalId, Carbon $date)
+ public function getWithDate(int $journalId, Carbon $date): TransactionJournal
{
return $this->user->transactionjournals()->where('id', $journalId)->where('date', $date->format('Y-m-d 00:00:00'))->first();
}
@@ -175,9 +175,9 @@ class JournalRepository implements JournalRepositoryInterface
* @param TransactionJournal $journal
* @param array $array
*
- * @return void
+ * @return bool
*/
- public function saveTags(TransactionJournal $journal, array $array)
+ public function saveTags(TransactionJournal $journal, array $array): bool
{
/** @var \FireflyIII\Repositories\Tag\TagRepositoryInterface $tagRepository */
$tagRepository = app('FireflyIII\Repositories\Tag\TagRepositoryInterface');
@@ -190,6 +190,8 @@ class JournalRepository implements JournalRepositoryInterface
}
}
}
+
+ return true;
}
/**
@@ -197,7 +199,7 @@ class JournalRepository implements JournalRepositoryInterface
*
* @return TransactionJournal
*/
- public function store(array $data)
+ public function store(array $data): TransactionJournal
{
// find transaction type.
$transactionType = TransactionType::where('type', ucfirst($data['what']))->first();
@@ -269,7 +271,7 @@ class JournalRepository implements JournalRepositoryInterface
*
* @return TransactionJournal
*/
- public function update(TransactionJournal $journal, array $data)
+ public function update(TransactionJournal $journal, array $data): TransactionJournal
{
// update actual journal.
$journal->transaction_currency_id = $data['amount_currency_id_amount'];
@@ -329,9 +331,9 @@ class JournalRepository implements JournalRepositoryInterface
* @param TransactionJournal $journal
* @param array $array
*
- * @return void
+ * @return bool
*/
- public function updateTags(TransactionJournal $journal, array $array)
+ public function updateTags(TransactionJournal $journal, array $array): bool
{
// create tag repository
/** @var \FireflyIII\Repositories\Tag\TagRepositoryInterface $tagRepository */
@@ -363,6 +365,8 @@ class JournalRepository implements JournalRepositoryInterface
foreach ($tags as $tag) {
$tagRepository->connect($journal, $tag);
}
+
+ return true;
}
/**
@@ -373,7 +377,7 @@ class JournalRepository implements JournalRepositoryInterface
* @throws FireflyException
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
- protected function storeAccounts(TransactionType $type, array $data)
+ protected function storeAccounts(TransactionType $type, array $data): array
{
$fromAccount = null;
$toAccount = null;
@@ -395,18 +399,14 @@ class JournalRepository implements JournalRepositoryInterface
if (is_null($toAccount)) {
Log::error('"to"-account is null, so we cannot continue!');
throw new FireflyException('"to"-account is null, so we cannot continue!');
- // @codeCoverageIgnoreStart
}
- // @codeCoverageIgnoreEnd
if (is_null($fromAccount)) {
Log::error('"from"-account is null, so we cannot continue!');
throw new FireflyException('"from"-account is null, so we cannot continue!');
- // @codeCoverageIgnoreStart
}
- // @codeCoverageIgnoreEnd
return [$fromAccount, $toAccount];
}
@@ -416,7 +416,7 @@ class JournalRepository implements JournalRepositoryInterface
*
* @return array
*/
- protected function storeDepositAccounts(array $data)
+ protected function storeDepositAccounts(array $data): array
{
$toAccount = Account::find($data['account_id']);
@@ -440,7 +440,7 @@ class JournalRepository implements JournalRepositoryInterface
*
* @return array
*/
- protected function storeWithdrawalAccounts(array $data)
+ protected function storeWithdrawalAccounts(array $data): array
{
$fromAccount = Account::find($data['account_id']);
diff --git a/app/Repositories/Journal/JournalRepositoryInterface.php b/app/Repositories/Journal/JournalRepositoryInterface.php
index d917190cbc..e7bfa81bce 100644
--- a/app/Repositories/Journal/JournalRepositoryInterface.php
+++ b/app/Repositories/Journal/JournalRepositoryInterface.php
@@ -22,54 +22,54 @@ interface JournalRepositoryInterface
*
* @return bool
*/
- public function delete(TransactionJournal $journal);
+ public function delete(TransactionJournal $journal): bool;
/**
* Get users first transaction journal
*
* @return TransactionJournal
*/
- public function first();
+ public function first(): TransactionJournal;
/**
* @param TransactionJournal $journal
* @param Transaction $transaction
*
- * @return float
+ * @return string
*/
- public function getAmountBefore(TransactionJournal $journal, Transaction $transaction);
+ public function getAmountBefore(TransactionJournal $journal, Transaction $transaction): string;
/**
- * @param TransactionType $dbType
+ * @param array $types
+ * @param int $offset
+ * @param int $count
*
* @return Collection
*/
- public function getJournalsOfType(TransactionType $dbType);
+ public function getCollectionOfTypes(array $types, int $offset, int $count):Collection;
/**
- * @param array $types
- * @param int $offset
- * @param int $page
+ * @param TransactionType $dbType
*
- * @return LengthAwarePaginator
+ * @return Collection
*/
- public function getJournalsOfTypes(array $types, int $offset, int $page);
+ public function getJournalsOfType(TransactionType $dbType): Collection;
/**
* @param array $types
* @param int $offset
- * @param int $count
+ * @param int $page
*
- * @return Collection
+ * @return LengthAwarePaginator
*/
- public function getCollectionOfTypes(array $types, int $offset, int $count);
+ public function getJournalsOfTypes(array $types, int $offset, int $page): LengthAwarePaginator;
/**
* @param string $type
*
* @return TransactionType
*/
- public function getTransactionType(string $type);
+ public function getTransactionType(string $type): TransactionType;
/**
* @param int $journalId
@@ -77,7 +77,7 @@ interface JournalRepositoryInterface
*
* @return TransactionJournal
*/
- public function getWithDate(int $journalId, Carbon $date);
+ public function getWithDate(int $journalId, Carbon $date): TransactionJournal;
/**
* @param TransactionJournal $journal
@@ -90,30 +90,30 @@ interface JournalRepositoryInterface
* @param TransactionJournal $journal
* @param array $array
*
- * @return void
+ * @return bool
*/
- public function saveTags(TransactionJournal $journal, array $array);
+ public function saveTags(TransactionJournal $journal, array $array): bool;
/**
* @param array $data
*
* @return TransactionJournal
*/
- public function store(array $data);
+ public function store(array $data): TransactionJournal;
/**
* @param TransactionJournal $journal
* @param array $data
*
- * @return mixed
+ * @return TransactionJournal
*/
- public function update(TransactionJournal $journal, array $data);
+ public function update(TransactionJournal $journal, array $data): TransactionJournal;
/**
* @param TransactionJournal $journal
* @param array $array
*
- * @return mixed
+ * @return bool
*/
- public function updateTags(TransactionJournal $journal, array $array);
+ public function updateTags(TransactionJournal $journal, array $array): bool;
}
diff --git a/app/Repositories/PiggyBank/PiggyBankRepository.php b/app/Repositories/PiggyBank/PiggyBankRepository.php
index 48b285486a..7aa5d6d6e9 100644
--- a/app/Repositories/PiggyBank/PiggyBankRepository.php
+++ b/app/Repositories/PiggyBank/PiggyBankRepository.php
@@ -35,23 +35,24 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
* @param PiggyBank $piggyBank
* @param string $amount
*
- * @return bool
+ * @return PiggyBankEvent
*/
- public function createEvent(PiggyBank $piggyBank, string $amount)
+ public function createEvent(PiggyBank $piggyBank, string $amount): PiggyBankEvent
{
- PiggyBankEvent::create(['date' => Carbon::now(), 'amount' => $amount, 'piggy_bank_id' => $piggyBank->id]);
+ $event = PiggyBankEvent::create(['date' => Carbon::now(), 'amount' => $amount, 'piggy_bank_id' => $piggyBank->id]);
- return true;
+ return $event;
}
/**
* @param PiggyBank $piggyBank
*
- * @return boolean|null
+ * @return bool
*/
- public function destroy(PiggyBank $piggyBank)
+ public function destroy(PiggyBank $piggyBank): bool
{
- return $piggyBank->delete();
+ $piggyBank->delete();
+ return true;
}
/**
@@ -59,7 +60,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
*
* @return Collection
*/
- public function getEventSummarySet(PiggyBank $piggyBank)
+ public function getEventSummarySet(PiggyBank $piggyBank): Collection
{
return DB::table('piggy_bank_events')->where('piggy_bank_id', $piggyBank->id)->groupBy('date')->get(['date', DB::raw('SUM(`amount`) AS `sum`')]);
}
@@ -69,7 +70,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
*
* @return Collection
*/
- public function getEvents(PiggyBank $piggyBank)
+ public function getEvents(PiggyBank $piggyBank): Collection
{
return $piggyBank->piggyBankEvents()->orderBy('date', 'DESC')->orderBy('id', 'DESC')->get();
}
@@ -77,7 +78,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
/**
* @return int
*/
- public function getMaxOrder()
+ public function getMaxOrder(): int
{
return intval($this->user->piggyBanks()->max('order'));
}
@@ -85,7 +86,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
/**
* @return Collection
*/
- public function getPiggyBanks()
+ public function getPiggyBanks(): Collection
{
/** @var Collection $set */
$set = $this->user->piggyBanks()->orderBy('order', 'ASC')->get();
@@ -96,9 +97,9 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
/**
* Set all piggy banks to order 0.
*
- * @return boolean
+ * @return bool
*/
- public function reset()
+ public function reset(): bool
{
// split query to make it work in sqlite:
$set = PiggyBank::
@@ -119,9 +120,9 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
* @param int $piggyBankId
* @param int $order
*
- * @return void
+ * @return bool
*/
- public function setOrder(int $piggyBankId, int $order)
+ public function setOrder(int $piggyBankId, int $order): bool
{
$piggyBank = PiggyBank::leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id')->where('accounts.user_id', $this->user->id)
->where('piggy_banks.id', $piggyBankId)->first(['piggy_banks.*']);
@@ -129,6 +130,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
$piggyBank->order = $order;
$piggyBank->save();
}
+ return true;
}
/**
@@ -136,7 +138,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
*
* @return PiggyBank
*/
- public function store(array $data)
+ public function store(array $data): PiggyBank
{
$data['remind_me'] = false;
$data['reminder_skip'] = 0;
@@ -152,7 +154,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
*
* @return PiggyBank
*/
- public function update(PiggyBank $piggyBank, array $data)
+ public function update(PiggyBank $piggyBank, array $data): PiggyBank
{
$piggyBank->name = $data['name'];
diff --git a/app/Repositories/PiggyBank/PiggyBankRepositoryInterface.php b/app/Repositories/PiggyBank/PiggyBankRepositoryInterface.php
index d57f6300c0..206e4704b8 100644
--- a/app/Repositories/PiggyBank/PiggyBankRepositoryInterface.php
+++ b/app/Repositories/PiggyBank/PiggyBankRepositoryInterface.php
@@ -4,6 +4,7 @@ declare(strict_types = 1);
namespace FireflyIII\Repositories\PiggyBank;
use FireflyIII\Models\PiggyBank;
+use FireflyIII\Models\PiggyBankEvent;
use Illuminate\Support\Collection;
/**
@@ -18,47 +19,47 @@ interface PiggyBankRepositoryInterface
* @param PiggyBank $piggyBank
* @param string $amount
*
- * @return bool
+ * @return PiggyBankEvent
*/
- public function createEvent(PiggyBank $piggyBank, string $amount);
+ public function createEvent(PiggyBank $piggyBank, string $amount): PiggyBankEvent;
/**
* @param PiggyBank $piggyBank
*
* @return bool
*/
- public function destroy(PiggyBank $piggyBank);
+ public function destroy(PiggyBank $piggyBank): bool;
/**
* @param PiggyBank $piggyBank
*
* @return Collection
*/
- public function getEventSummarySet(PiggyBank $piggyBank);
+ public function getEventSummarySet(PiggyBank $piggyBank) : Collection;
/**
* @param PiggyBank $piggyBank
*
* @return Collection
*/
- public function getEvents(PiggyBank $piggyBank);
+ public function getEvents(PiggyBank $piggyBank) : Collection;
/**
* @return int
*/
- public function getMaxOrder();
+ public function getMaxOrder(): int;
/**
* @return Collection
*/
- public function getPiggyBanks();
+ public function getPiggyBanks() : Collection;
/**
* Set all piggy banks to order 0.
*
- * @return void
+ * @return bool
*/
- public function reset();
+ public function reset(): bool;
/**
*
@@ -67,9 +68,9 @@ interface PiggyBankRepositoryInterface
* @param int $piggyBankId
* @param int $order
*
- * @return void
+ * @return bool
*/
- public function setOrder(int $piggyBankId, int $order);
+ public function setOrder(int $piggyBankId, int $order): bool;
/**
@@ -77,7 +78,7 @@ interface PiggyBankRepositoryInterface
*
* @return PiggyBank
*/
- public function store(array $data);
+ public function store(array $data): PiggyBank;
/**
* @param PiggyBank $piggyBank
@@ -85,5 +86,5 @@ interface PiggyBankRepositoryInterface
*
* @return PiggyBank
*/
- public function update(PiggyBank $piggyBank, array $data);
+ public function update(PiggyBank $piggyBank, array $data): PiggyBank;
}
diff --git a/app/Repositories/Rule/RuleRepository.php b/app/Repositories/Rule/RuleRepository.php
index f5351ab955..e2d83e1790 100644
--- a/app/Repositories/Rule/RuleRepository.php
+++ b/app/Repositories/Rule/RuleRepository.php
@@ -40,7 +40,7 @@ class RuleRepository implements RuleRepositoryInterface
/**
* @return int
*/
- public function count()
+ public function count(): int
{
return $this->user->rules()->count();
}
@@ -50,7 +50,7 @@ class RuleRepository implements RuleRepositoryInterface
*
* @return bool
*/
- public function destroy(Rule $rule)
+ public function destroy(Rule $rule): bool
{
foreach ($rule->ruleTriggers as $trigger) {
$trigger->delete();
@@ -64,9 +64,11 @@ class RuleRepository implements RuleRepositoryInterface
}
/**
+ * FIXME can return null
+ *
* @return RuleGroup
*/
- public function getFirstRuleGroup()
+ public function getFirstRuleGroup(): RuleGroup
{
return $this->user->ruleGroups()->first();
}
@@ -76,7 +78,7 @@ class RuleRepository implements RuleRepositoryInterface
*
* @return int
*/
- public function getHighestOrderInRuleGroup(RuleGroup $ruleGroup)
+ public function getHighestOrderInRuleGroup(RuleGroup $ruleGroup): int
{
return intval($ruleGroup->rules()->max('order'));
}
@@ -102,7 +104,7 @@ class RuleRepository implements RuleRepositoryInterface
*
* @return bool
*/
- public function moveDown(Rule $rule)
+ public function moveDown(Rule $rule): bool
{
$order = $rule->order;
@@ -117,6 +119,7 @@ class RuleRepository implements RuleRepositoryInterface
$rule->order = ($rule->order + 1);
$rule->save();
$this->resetRulesInGroupOrder($rule->ruleGroup);
+ return true;
}
/**
@@ -124,7 +127,7 @@ class RuleRepository implements RuleRepositoryInterface
*
* @return bool
*/
- public function moveUp(Rule $rule)
+ public function moveUp(Rule $rule): bool
{
$order = $rule->order;
@@ -138,6 +141,7 @@ class RuleRepository implements RuleRepositoryInterface
$rule->order = ($rule->order - 1);
$rule->save();
$this->resetRulesInGroupOrder($rule->ruleGroup);
+ return true;
}
/**
@@ -146,7 +150,7 @@ class RuleRepository implements RuleRepositoryInterface
*
* @return bool
*/
- public function reorderRuleActions(Rule $rule, array $ids)
+ public function reorderRuleActions(Rule $rule, array $ids): bool
{
$order = 1;
foreach ($ids as $actionId) {
@@ -168,7 +172,7 @@ class RuleRepository implements RuleRepositoryInterface
*
* @return bool
*/
- public function reorderRuleTriggers(Rule $rule, array $ids)
+ public function reorderRuleTriggers(Rule $rule, array $ids): bool
{
$order = 1;
foreach ($ids as $triggerId) {
@@ -189,7 +193,7 @@ class RuleRepository implements RuleRepositoryInterface
*
* @return bool
*/
- public function resetRulesInGroupOrder(RuleGroup $ruleGroup)
+ public function resetRulesInGroupOrder(RuleGroup $ruleGroup): bool
{
$ruleGroup->rules()->whereNotNull('deleted_at')->update(['order' => 0]);
@@ -214,7 +218,7 @@ class RuleRepository implements RuleRepositoryInterface
*
* @return Rule
*/
- public function store(array $data)
+ public function store(array $data): Rule
{
/** @var RuleGroup $ruleGroup */
$ruleGroup = $this->user->ruleGroups()->find($data['rule_group_id']);
@@ -250,7 +254,7 @@ class RuleRepository implements RuleRepositoryInterface
*
* @return RuleAction
*/
- public function storeAction(Rule $rule, array $values)
+ public function storeAction(Rule $rule, array $values): RuleAction
{
$ruleAction = new RuleAction;
$ruleAction->rule()->associate($rule);
@@ -271,7 +275,7 @@ class RuleRepository implements RuleRepositoryInterface
*
* @return RuleTrigger
*/
- public function storeTrigger(Rule $rule, array $values)
+ public function storeTrigger(Rule $rule, array $values): RuleTrigger
{
$ruleTrigger = new RuleTrigger;
$ruleTrigger->rule()->associate($rule);
@@ -291,7 +295,7 @@ class RuleRepository implements RuleRepositoryInterface
*
* @return Rule
*/
- public function update(Rule $rule, array $data)
+ public function update(Rule $rule, array $data): Rule
{
// update rule:
$rule->active = $data['active'];
@@ -319,8 +323,10 @@ class RuleRepository implements RuleRepositoryInterface
/**
* @param Rule $rule
* @param array $data
+ *
+ * @return bool
*/
- private function storeActions(Rule $rule, array $data)
+ private function storeActions(Rule $rule, array $data): bool
{
$order = 1;
foreach ($data['rule-actions'] as $index => $action) {
@@ -336,14 +342,16 @@ class RuleRepository implements RuleRepositoryInterface
$this->storeAction($rule, $actionValues);
}
+ return true;
}
/**
* @param Rule $rule
* @param array $data
+ * @return bool
*/
- private function storeTriggers(Rule $rule, array $data)
+ private function storeTriggers(Rule $rule, array $data): bool
{
$order = 1;
$stopProcessing = false;
@@ -370,5 +378,6 @@ class RuleRepository implements RuleRepositoryInterface
$this->storeTrigger($rule, $triggerValues);
$order++;
}
+ return true;
}
}
diff --git a/app/Repositories/Rule/RuleRepositoryInterface.php b/app/Repositories/Rule/RuleRepositoryInterface.php
index c3556c7bbb..4c98093d20 100644
--- a/app/Repositories/Rule/RuleRepositoryInterface.php
+++ b/app/Repositories/Rule/RuleRepositoryInterface.php
@@ -26,26 +26,26 @@ interface RuleRepositoryInterface
/**
* @return int
*/
- public function count();
+ public function count(): int;
/**
* @param Rule $rule
*
* @return bool
*/
- public function destroy(Rule $rule);
+ public function destroy(Rule $rule): bool;
/**
* @return RuleGroup
*/
- public function getFirstRuleGroup();
+ public function getFirstRuleGroup(): RuleGroup;
/**
* @param RuleGroup $ruleGroup
*
* @return int
*/
- public function getHighestOrderInRuleGroup(RuleGroup $ruleGroup);
+ public function getHighestOrderInRuleGroup(RuleGroup $ruleGroup): int;
/**
* @param Rule $rule
@@ -59,14 +59,14 @@ interface RuleRepositoryInterface
*
* @return bool
*/
- public function moveDown(Rule $rule);
+ public function moveDown(Rule $rule): bool;
/**
* @param Rule $rule
*
* @return bool
*/
- public function moveUp(Rule $rule);
+ public function moveUp(Rule $rule): bool;
/**
* @param Rule $rule
@@ -74,7 +74,7 @@ interface RuleRepositoryInterface
*
* @return bool
*/
- public function reorderRuleActions(Rule $rule, array $ids);
+ public function reorderRuleActions(Rule $rule, array $ids): bool;
/**
* @param Rule $rule
@@ -82,21 +82,21 @@ interface RuleRepositoryInterface
*
* @return bool
*/
- public function reorderRuleTriggers(Rule $rule, array $ids);
+ public function reorderRuleTriggers(Rule $rule, array $ids): bool;
/**
* @param RuleGroup $ruleGroup
*
* @return bool
*/
- public function resetRulesInGroupOrder(RuleGroup $ruleGroup);
+ public function resetRulesInGroupOrder(RuleGroup $ruleGroup): bool;
/**
* @param array $data
*
* @return Rule
*/
- public function store(array $data);
+ public function store(array $data): Rule;
/**
* @param Rule $rule
@@ -104,7 +104,7 @@ interface RuleRepositoryInterface
*
* @return RuleAction
*/
- public function storeAction(Rule $rule, array $values);
+ public function storeAction(Rule $rule, array $values): RuleAction;
/**
* @param Rule $rule
@@ -112,7 +112,7 @@ interface RuleRepositoryInterface
*
* @return RuleTrigger
*/
- public function storeTrigger(Rule $rule, array $values);
+ public function storeTrigger(Rule $rule, array $values): RuleTrigger;
/**
* @param Rule $rule
@@ -120,6 +120,6 @@ interface RuleRepositoryInterface
*
* @return Rule
*/
- public function update(Rule $rule, array $data);
+ public function update(Rule $rule, array $data): Rule;
}
diff --git a/app/Repositories/RuleGroup/RuleGroupRepository.php b/app/Repositories/RuleGroup/RuleGroupRepository.php
index 8cacdc0fa8..cec33c66c3 100644
--- a/app/Repositories/RuleGroup/RuleGroupRepository.php
+++ b/app/Repositories/RuleGroup/RuleGroupRepository.php
@@ -33,7 +33,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
/**
* @return int
*/
- public function count()
+ public function count(): int
{
return $this->user->ruleGroups()->count();
}
@@ -42,9 +42,9 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
* @param RuleGroup $ruleGroup
* @param RuleGroup $moveTo
*
- * @return boolean
+ * @return bool
*/
- public function destroy(RuleGroup $ruleGroup, RuleGroup $moveTo = null)
+ public function destroy(RuleGroup $ruleGroup, RuleGroup $moveTo = null): bool
{
/** @var Rule $rule */
foreach ($ruleGroup->rules as $rule) {
@@ -72,7 +72,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
/**
* @return Collection
*/
- public function get()
+ public function get(): Collection
{
return $this->user->ruleGroups()->orderBy('order', 'ASC')->get();
}
@@ -80,7 +80,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
/**
* @return int
*/
- public function getHighestOrderRuleGroup()
+ public function getHighestOrderRuleGroup(): int
{
$entry = $this->user->ruleGroups()->max('order');
@@ -119,7 +119,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
*
* @return bool
*/
- public function moveDown(RuleGroup $ruleGroup)
+ public function moveDown(RuleGroup $ruleGroup): bool
{
$order = $ruleGroup->order;
@@ -133,6 +133,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
$ruleGroup->order = ($ruleGroup->order + 1);
$ruleGroup->save();
$this->resetRuleGroupOrder();
+ return true;
}
/**
@@ -140,7 +141,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
*
* @return bool
*/
- public function moveUp(RuleGroup $ruleGroup)
+ public function moveUp(RuleGroup $ruleGroup): bool
{
$order = $ruleGroup->order;
@@ -159,7 +160,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
/**
* @return bool
*/
- public function resetRuleGroupOrder()
+ public function resetRuleGroupOrder(): bool
{
$this->user->ruleGroups()->whereNotNull('deleted_at')->update(['order' => 0]);
@@ -181,7 +182,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
*
* @return bool
*/
- public function resetRulesInGroupOrder(RuleGroup $ruleGroup)
+ public function resetRulesInGroupOrder(RuleGroup $ruleGroup): bool
{
$ruleGroup->rules()->whereNotNull('deleted_at')->update(['order' => 0]);
@@ -206,7 +207,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
*
* @return RuleGroup
*/
- public function store(array $data)
+ public function store(array $data): RuleGroup
{
$order = $this->getHighestOrderRuleGroup();
@@ -233,7 +234,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
*
* @return RuleGroup
*/
- public function update(RuleGroup $ruleGroup, array $data)
+ public function update(RuleGroup $ruleGroup, array $data): RuleGroup
{
// update the account:
$ruleGroup->title = $data['title'];
diff --git a/app/Repositories/RuleGroup/RuleGroupRepositoryInterface.php b/app/Repositories/RuleGroup/RuleGroupRepositoryInterface.php
index 332a481354..8e91189457 100644
--- a/app/Repositories/RuleGroup/RuleGroupRepositoryInterface.php
+++ b/app/Repositories/RuleGroup/RuleGroupRepositoryInterface.php
@@ -20,7 +20,7 @@ interface RuleGroupRepositoryInterface
/**
* @return int
*/
- public function count();
+ public function count(): int;
/**
* @param RuleGroup $ruleGroup
@@ -28,17 +28,17 @@ interface RuleGroupRepositoryInterface
*
* @return bool
*/
- public function destroy(RuleGroup $ruleGroup, RuleGroup $moveTo = null);
+ public function destroy(RuleGroup $ruleGroup, RuleGroup $moveTo = null): bool;
/**
* @return Collection
*/
- public function get();
+ public function get(): Collection;
/**
* @return int
*/
- public function getHighestOrderRuleGroup();
+ public function getHighestOrderRuleGroup(): int;
/**
* @param User $user
@@ -52,33 +52,33 @@ interface RuleGroupRepositoryInterface
*
* @return bool
*/
- public function moveDown(RuleGroup $ruleGroup);
+ public function moveDown(RuleGroup $ruleGroup): bool;
/**
* @param RuleGroup $ruleGroup
*
* @return bool
*/
- public function moveUp(RuleGroup $ruleGroup);
+ public function moveUp(RuleGroup $ruleGroup): bool;
/**
* @return bool
*/
- public function resetRuleGroupOrder();
+ public function resetRuleGroupOrder(): bool;
/**
* @param RuleGroup $ruleGroup
*
* @return bool
*/
- public function resetRulesInGroupOrder(RuleGroup $ruleGroup);
+ public function resetRulesInGroupOrder(RuleGroup $ruleGroup): bool;
/**
* @param array $data
*
* @return RuleGroup
*/
- public function store(array $data);
+ public function store(array $data): RuleGroup;
/**
* @param RuleGroup $ruleGroup
@@ -86,7 +86,7 @@ interface RuleGroupRepositoryInterface
*
* @return RuleGroup
*/
- public function update(RuleGroup $ruleGroup, array $data);
+ public function update(RuleGroup $ruleGroup, array $data): RuleGroup;
}
diff --git a/app/Repositories/Tag/TagRepository.php b/app/Repositories/Tag/TagRepository.php
index 7ec2bcd6c8..32c3ddcfc1 100644
--- a/app/Repositories/Tag/TagRepository.php
+++ b/app/Repositories/Tag/TagRepository.php
@@ -42,7 +42,7 @@ class TagRepository implements TagRepositoryInterface
*
* @return Collection
*/
- public function allCoveredByBalancingActs(Collection $accounts, Carbon $start, Carbon $end)
+ public function allCoveredByBalancingActs(Collection $accounts, Carbon $start, Carbon $end): Collection
{
$ids = $accounts->pluck('id')->toArray();
$set = $this->user->tags()
@@ -84,9 +84,9 @@ class TagRepository implements TagRepositoryInterface
*
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's exactly 5.
*
- * @return boolean
+ * @return bool
*/
- public function connect(TransactionJournal $journal, Tag $tag)
+ public function connect(TransactionJournal $journal, Tag $tag): Collection
{
/*
* Already connected:
@@ -125,7 +125,7 @@ class TagRepository implements TagRepositoryInterface
*
* @return string
*/
- public function coveredByBalancingActs(Account $account, Carbon $start, Carbon $end)
+ public function coveredByBalancingActs(Account $account, Carbon $start, Carbon $end): string
{
// the quickest way to do this is by scanning all balancingAct tags
// because there will be less of them any way.
@@ -152,20 +152,19 @@ class TagRepository implements TagRepositoryInterface
/**
* @param Tag $tag
*
- * @return boolean
+ * @return bool
*/
- public function destroy(Tag $tag)
+ public function destroy(Tag $tag): bool
{
$tag->delete();
return true;
}
- // @codeCoverageIgnoreEnd
/**
* @return Collection
*/
- public function get()
+ public function get(): Collection
{
/** @var Collection $tags */
$tags = $this->user->tags()->get();
@@ -183,7 +182,7 @@ class TagRepository implements TagRepositoryInterface
*
* @return Tag
*/
- public function store(array $data)
+ public function store(array $data): Tag
{
$tag = new Tag;
$tag->tag = $data['tag'];
@@ -208,7 +207,7 @@ class TagRepository implements TagRepositoryInterface
*
* @return bool
*/
- public function tagAllowAdvance(Tag $tag)
+ public function tagAllowAdvance(Tag $tag): bool
{
/*
* If this tag is a balancing act, and it contains transfers, it cannot be
@@ -247,7 +246,7 @@ class TagRepository implements TagRepositoryInterface
*
* @return bool
*/
- public function tagAllowBalancing(Tag $tag)
+ public function tagAllowBalancing(Tag $tag): bool
{
/*
* If has more than two transactions already, cannot become a balancing act:
@@ -275,7 +274,7 @@ class TagRepository implements TagRepositoryInterface
*
* @return Tag
*/
- public function update(Tag $tag, array $data)
+ public function update(Tag $tag, array $data): Tag
{
$tag->tag = $data['tag'];
$tag->date = $data['date'];
@@ -295,9 +294,9 @@ class TagRepository implements TagRepositoryInterface
*
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
- * @return boolean
+ * @return bool
*/
- protected function connectAdvancePayment(TransactionJournal $journal, Tag $tag)
+ protected function connectAdvancePayment(TransactionJournal $journal, Tag $tag): bool
{
/** @var TransactionType $transfer */
$transfer = TransactionType::whereType(TransactionType::TRANSFER)->first();
@@ -332,7 +331,7 @@ class TagRepository implements TagRepositoryInterface
}
// this statement is unreachable.
- return false; // @codeCoverageIgnore
+ return false;
}
@@ -340,9 +339,9 @@ class TagRepository implements TagRepositoryInterface
* @param TransactionJournal $journal
* @param Tag $tag
*
- * @return boolean
+ * @return bool
*/
- protected function connectBalancingAct(TransactionJournal $journal, Tag $tag)
+ protected function connectBalancingAct(TransactionJournal $journal, Tag $tag): bool
{
/** @var TransactionType $withdrawal */
$withdrawal = TransactionType::whereType(TransactionType::WITHDRAWAL)->first();
@@ -380,7 +379,7 @@ class TagRepository implements TagRepositoryInterface
*
* @return bool
*/
- protected function matchAll(TransactionJournal $journal, Tag $tag)
+ protected function matchAll(TransactionJournal $journal, Tag $tag): bool
{
$match = true;
/** @var TransactionJournal $check */
diff --git a/app/Repositories/Tag/TagRepositoryInterface.php b/app/Repositories/Tag/TagRepositoryInterface.php
index 77c2d73c8b..0520c1caaf 100644
--- a/app/Repositories/Tag/TagRepositoryInterface.php
+++ b/app/Repositories/Tag/TagRepositoryInterface.php
@@ -24,15 +24,15 @@ interface TagRepositoryInterface
*
* @return Collection
*/
- public function allCoveredByBalancingActs(Collection $accounts, Carbon $start, Carbon $end);
+ public function allCoveredByBalancingActs(Collection $accounts, Carbon $start, Carbon $end): Collection;
/**
* @param TransactionJournal $journal
* @param Tag $tag
*
- * @return boolean
+ * @return bool
*/
- public function connect(TransactionJournal $journal, Tag $tag);
+ public function connect(TransactionJournal $journal, Tag $tag): bool;
/**
* @deprecated
@@ -49,26 +49,26 @@ interface TagRepositoryInterface
*
* @return string
*/
- public function coveredByBalancingActs(Account $account, Carbon $start, Carbon $end);
+ public function coveredByBalancingActs(Account $account, Carbon $start, Carbon $end): string;
/**
* @param Tag $tag
*
- * @return boolean
+ * @return bool
*/
- public function destroy(Tag $tag);
+ public function destroy(Tag $tag): bool;
/**
* @return Collection
*/
- public function get();
+ public function get(): Collection;
/**
* @param array $data
*
* @return Tag
*/
- public function store(array $data);
+ public function store(array $data): Tag;
/**
* Can a tag become an advance payment?
@@ -77,7 +77,7 @@ interface TagRepositoryInterface
*
* @return bool
*/
- public function tagAllowAdvance(Tag $tag);
+ public function tagAllowAdvance(Tag $tag): bool;
/**
* Can a tag become a balancing act?
@@ -86,7 +86,7 @@ interface TagRepositoryInterface
*
* @return bool
*/
- public function tagAllowBalancing(Tag $tag);
+ public function tagAllowBalancing(Tag $tag): bool;
/**
* @param Tag $tag
@@ -94,5 +94,5 @@ interface TagRepositoryInterface
*
* @return Tag
*/
- public function update(Tag $tag, array $data);
+ public function update(Tag $tag, array $data): Tag;
}
diff --git a/app/Support/Amount.php b/app/Support/Amount.php
index 810b85e818..7eaccfd620 100644
--- a/app/Support/Amount.php
+++ b/app/Support/Amount.php
@@ -139,7 +139,7 @@ class Amount
}
$cache->store(env('DEFAULT_CURRENCY', 'EUR'));
- return env('DEFAULT_CURRENCY', 'EUR'); // @codeCoverageIgnore
+ return env('DEFAULT_CURRENCY', 'EUR');
}
}
diff --git a/app/Support/CacheProperties.php b/app/Support/CacheProperties.php
index 710b971eab..19f6c0f6cc 100644
--- a/app/Support/CacheProperties.php
+++ b/app/Support/CacheProperties.php
@@ -14,7 +14,6 @@ use Preferences as Prefs;
/**
* Class CacheProperties
*
- * @codeCoverageIgnore
* @package FireflyIII\Support
*/
class CacheProperties
diff --git a/app/Support/ExpandedForm.php b/app/Support/ExpandedForm.php
index 64668d5c03..c92580de77 100644
--- a/app/Support/ExpandedForm.php
+++ b/app/Support/ExpandedForm.php
@@ -250,13 +250,11 @@ class ExpandedForm
{
$previousValue = null;
- // @codeCoverageIgnoreStart
try {
$previousValue = Input::old('post_submit_action');
} catch (RuntimeException $e) {
// don't care
}
- // @codeCoverageIgnoreEnd
$previousValue = is_null($previousValue) ? 'store' : $previousValue;
$html = view('form.options', compact('type', 'name', 'previousValue'))->render();
@@ -391,7 +389,6 @@ class ExpandedForm
$preFilled = session('preFilled');
$value = isset($preFilled[$name]) && is_null($value) ? $preFilled[$name] : $value;
}
- // @codeCoverageIgnoreStart
try {
if (!is_null(Input::old($name))) {
$value = Input::old($name);
@@ -400,7 +397,6 @@ class ExpandedForm
// don't care about session errors.
}
- // @codeCoverageIgnoreEnd
return $value;
}
diff --git a/app/Support/Facades/Amount.php b/app/Support/Facades/Amount.php
index c6d2b43250..ea067dcb32 100644
--- a/app/Support/Facades/Amount.php
+++ b/app/Support/Facades/Amount.php
@@ -8,7 +8,6 @@ use Illuminate\Support\Facades\Facade;
/**
* Class Amount
*
- * @codeCoverageIgnore
* @package FireflyIII\Support\Facades
*/
class Amount extends Facade
diff --git a/app/Support/Facades/ExpandedForm.php b/app/Support/Facades/ExpandedForm.php
index 006a88f2c3..50ad979629 100644
--- a/app/Support/Facades/ExpandedForm.php
+++ b/app/Support/Facades/ExpandedForm.php
@@ -8,7 +8,6 @@ use Illuminate\Support\Facades\Facade;
/**
* Class Amount
*
- * @codeCoverageIgnore
* @package FireflyIII\Support\Facades
*/
class ExpandedForm extends Facade
diff --git a/app/Support/Facades/Navigation.php b/app/Support/Facades/Navigation.php
index dba4ed838b..b00578a601 100644
--- a/app/Support/Facades/Navigation.php
+++ b/app/Support/Facades/Navigation.php
@@ -8,7 +8,6 @@ use Illuminate\Support\Facades\Facade;
/**
* Class Navigation
*
- * @codeCoverageIgnore
* @package FireflyIII\Support\Facades
*/
class Navigation extends Facade
diff --git a/app/Support/Facades/Preferences.php b/app/Support/Facades/Preferences.php
index 06b7033813..f51347a6e0 100644
--- a/app/Support/Facades/Preferences.php
+++ b/app/Support/Facades/Preferences.php
@@ -8,7 +8,6 @@ use Illuminate\Support\Facades\Facade;
/**
* Class Preferences
*
- * @codeCoverageIgnore
* @package FireflyIII\Support\Facades
*/
class Preferences extends Facade
diff --git a/app/Support/Facades/Steam.php b/app/Support/Facades/Steam.php
index 5c93adcd8b..9fa7b179b1 100644
--- a/app/Support/Facades/Steam.php
+++ b/app/Support/Facades/Steam.php
@@ -8,7 +8,6 @@ use Illuminate\Support\Facades\Facade;
/**
* Class Steam
*
- * @codeCoverageIgnore
* @package FireflyIII\Support\Facades
*/
class Steam extends Facade
diff --git a/app/Support/Models/TransactionJournalSupport.php b/app/Support/Models/TransactionJournalSupport.php
index 2a2a5faf1a..253361547a 100644
--- a/app/Support/Models/TransactionJournalSupport.php
+++ b/app/Support/Models/TransactionJournalSupport.php
@@ -39,7 +39,7 @@ class TransactionJournalSupport extends Model
$cache->addProperty('transaction-journal');
$cache->addProperty('amount');
if ($cache->has()) {
- return $cache->get(); // @codeCoverageIgnore
+ return $cache->get();
}
$transaction = $journal->transactions->sortByDesc('amount')->first();
@@ -66,7 +66,7 @@ class TransactionJournalSupport extends Model
$cache->addProperty('transaction-journal');
$cache->addProperty('amount-positive');
if ($cache->has()) {
- return $cache->get(); // @codeCoverageIgnore
+ return $cache->get();
}
$amount = '0';
@@ -143,7 +143,7 @@ class TransactionJournalSupport extends Model
$cache->addProperty('transaction-journal');
$cache->addProperty('destination-account');
if ($cache->has()) {
- return $cache->get(); // @codeCoverageIgnore
+ return $cache->get();
}
$transaction = $journal->transactions()->where('amount', '>', 0)->first();
if (!is_null($transaction)) {
@@ -168,7 +168,7 @@ class TransactionJournalSupport extends Model
$cache->addProperty('transaction-journal');
$cache->addProperty('destination-account-type-str');
if ($cache->has()) {
- return $cache->get(); // @codeCoverageIgnore
+ return $cache->get();
}
$account = self::destinationAccount($journal);
@@ -225,7 +225,7 @@ class TransactionJournalSupport extends Model
$cache->addProperty('transaction-journal');
$cache->addProperty('source-account');
if ($cache->has()) {
- return $cache->get(); // @codeCoverageIgnore
+ return $cache->get();
}
$transaction = $journal->transactions()->where('amount', '<', 0)->first();
if (!is_null($transaction)) {
@@ -250,7 +250,7 @@ class TransactionJournalSupport extends Model
$cache->addProperty('transaction-journal');
$cache->addProperty('source-account-type-str');
if ($cache->has()) {
- return $cache->get(); // @codeCoverageIgnore
+ return $cache->get();
}
$account = self::sourceAccount($journal);
@@ -272,7 +272,7 @@ class TransactionJournalSupport extends Model
$cache->addProperty('transaction-journal');
$cache->addProperty('type-string');
if ($cache->has()) {
- return $cache->get(); // @codeCoverageIgnore
+ return $cache->get();
}
$typeStr = $journal->transaction_type_type ?? $journal->transactionType->type;
diff --git a/app/Support/Preferences.php b/app/Support/Preferences.php
index 8b900f6fb9..52b958816b 100644
--- a/app/Support/Preferences.php
+++ b/app/Support/Preferences.php
@@ -110,7 +110,11 @@ class Preferences
{
$user = Auth::user();
if (is_null($user)) {
- return $value;
+ // make new preference, return it:
+ $pref = new Preference;
+ $pref->name = $name;
+ $pref->data = $value;
+ return $pref;
}
return $this->setForUser(Auth::user(), $name, $value);
diff --git a/app/Support/Steam.php b/app/Support/Steam.php
index ed5cff9d7b..3e73432113 100644
--- a/app/Support/Steam.php
+++ b/app/Support/Steam.php
@@ -35,7 +35,7 @@ class Steam
$cache->addProperty($date);
$cache->addProperty($ignoreVirtualBalance);
if ($cache->has()) {
- return $cache->get(); // @codeCoverageIgnore
+ return $cache->get();
}
$balance = strval(
@@ -72,7 +72,7 @@ class Steam
$cache->addProperty($start);
$cache->addProperty($end);
if ($cache->has()) {
- return $cache->get(); // @codeCoverageIgnore
+ return $cache->get();
}
$balances = [];
@@ -119,7 +119,7 @@ class Steam
$cache->addProperty('balances');
$cache->addProperty($date);
if ($cache->has()) {
- return $cache->get(); // @codeCoverageIgnore
+ return $cache->get();
}
$balances = Transaction::
diff --git a/app/Support/Twig/Budget.php b/app/Support/Twig/Budget.php
index d3a1d0cd89..3363f356ac 100644
--- a/app/Support/Twig/Budget.php
+++ b/app/Support/Twig/Budget.php
@@ -10,7 +10,6 @@ use Twig_Extension;
use Twig_SimpleFunction;
/**
- * @codeCoverageIgnore
* Class Budget
*
* @package FireflyIII\Support\Twig
@@ -29,7 +28,7 @@ class Budget extends Twig_Extension
$cache->addProperty($repetition->id);
$cache->addProperty('spentInRepetition');
if ($cache->has()) {
- return $cache->get(); // @codeCoverageIgnore
+ return $cache->get();
}
$sum
= Auth::user()->transactionjournals()
diff --git a/app/Support/Twig/General.php b/app/Support/Twig/General.php
index 2a4b16e1d3..5373708ef6 100644
--- a/app/Support/Twig/General.php
+++ b/app/Support/Twig/General.php
@@ -14,7 +14,6 @@ use Twig_SimpleFilter;
use Twig_SimpleFunction;
/**
- * @codeCoverageIgnore
*
* Class TwigSupport
*
diff --git a/app/Support/Twig/PiggyBank.php b/app/Support/Twig/PiggyBank.php
index 5df305d3f8..4c101e21fb 100644
--- a/app/Support/Twig/PiggyBank.php
+++ b/app/Support/Twig/PiggyBank.php
@@ -8,7 +8,6 @@ use Twig_Extension;
use Twig_SimpleFunction;
/**
- * @codeCoverageIgnore
*
* Class PiggyBank
*
diff --git a/app/Support/Twig/Translation.php b/app/Support/Twig/Translation.php
index a8ebe88da2..4af3055432 100644
--- a/app/Support/Twig/Translation.php
+++ b/app/Support/Twig/Translation.php
@@ -7,7 +7,6 @@ use Twig_Extension;
use Twig_SimpleFilter;
/**
- * @codeCoverageIgnore
*
* Class Budget
*