Skip to content

Firefly III: a personal finances manager

Some cleaning up courtesy of PHPStorm.

James Colee834489206cb
diff --git a/app/Generator/Chart/Budget/ChartJsBudgetChartGenerator.php b/app/Generator/Chart/Budget/ChartJsBudgetChartGenerator.php
index 77678b93e9..fa25cd857b 100644
--- a/app/Generator/Chart/Budget/ChartJsBudgetChartGenerator.php
+++ b/app/Generator/Chart/Budget/ChartJsBudgetChartGenerator.php
@@ -156,7 +156,8 @@ class ChartJsBudgetChartGenerator implements BudgetChartGenerator
];
// get labels from one of the budgets (assuming there's at least one):
$first = $entries->first();
- foreach ($first['budgeted'] as $year => $noInterest) {
+ $keys = array_keys($first['budgeted']);
+ foreach ($keys as $year) {
$data['labels'][] = strval($year);
}
diff --git a/app/Generator/Chart/Category/ChartJsCategoryChartGenerator.php b/app/Generator/Chart/Category/ChartJsCategoryChartGenerator.php
index 07debb7581..3c744cb9de 100644
--- a/app/Generator/Chart/Category/ChartJsCategoryChartGenerator.php
+++ b/app/Generator/Chart/Category/ChartJsCategoryChartGenerator.php
@@ -124,7 +124,8 @@ class ChartJsCategoryChartGenerator implements CategoryChartGenerator
];
// get labels from one of the categories (assuming there's at least one):
$first = $entries->first();
- foreach ($first['spent'] as $year => $noInterest) {
+ $keys = array_keys($first['spent']);
+ foreach ($keys as $year) {
$data['labels'][] = strval($year);
}
diff --git a/app/Helpers/Report/ReportHelper.php b/app/Helpers/Report/ReportHelper.php
index 7daede4b45..2b13fbe9ae 100644
--- a/app/Helpers/Report/ReportHelper.php
+++ b/app/Helpers/Report/ReportHelper.php
@@ -342,12 +342,6 @@ class ReportHelper implements ReportHelperInterface
*/
public function getBalanceReport(Carbon $start, Carbon $end, Collection $accounts)
{
- // /** @var \FireflyIII\Repositories\Budget\BudgetRepositoryInterface $repository */
- // $repository = app('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
-
- // /** @var \FireflyIII\Repositories\Tag\TagRepositoryInterface $tagRepository */
- // $tagRepository = app('FireflyIII\Repositories\Tag\TagRepositoryInterface');
-
$balance = new Balance;
// build a balance header:
diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php
index da581288e5..f8253d7408 100644
--- a/app/Http/Controllers/ProfileController.php
+++ b/app/Http/Controllers/ProfileController.php
@@ -1,7 +1,6 @@
<?php namespace FireflyIII\Http\Controllers;
use Auth;
-use FireflyIII\Http\Requests;
use FireflyIII\Http\Requests\DeleteAccountFormRequest;
use FireflyIII\Http\Requests\ProfileFormRequest;
use FireflyIII\User;
diff --git a/app/Http/Controllers/RuleController.php b/app/Http/Controllers/RuleController.php
index 03dd0c17f3..e323aefdbb 100644
--- a/app/Http/Controllers/RuleController.php
+++ b/app/Http/Controllers/RuleController.php
@@ -10,7 +10,6 @@
namespace FireflyIII\Http\Controllers;
use Auth;
-use FireflyIII\Http\Requests;
use FireflyIII\Http\Requests\RuleFormRequest;
use FireflyIII\Models\Rule;
use FireflyIII\Models\RuleAction;
diff --git a/app/Http/Controllers/TransactionController.php b/app/Http/Controllers/TransactionController.php
index 156f8f9703..41b0a4975f 100644
--- a/app/Http/Controllers/TransactionController.php
+++ b/app/Http/Controllers/TransactionController.php
@@ -293,7 +293,6 @@ class TransactionController extends Controller
*/
public function store(JournalFormRequest $request, JournalRepositoryInterface $repository, AttachmentHelperInterface $att)
{
-
$journalData = $request->getJournalData();
// if not withdrawal, unset budgetid.
@@ -303,7 +302,6 @@ class TransactionController extends Controller
$journal = $repository->store($journalData);
- // save attachments:
$att->saveAttachmentsForModel($journal);
// flash errors
diff --git a/app/Repositories/Bill/BillRepository.php b/app/Repositories/Bill/BillRepository.php
index 29bd373877..daa5a2a698 100644
--- a/app/Repositories/Bill/BillRepository.php
+++ b/app/Repositories/Bill/BillRepository.php
@@ -540,8 +540,7 @@ class BillRepository implements BillRepositoryInterface
/** @var Account $creditCard */
foreach ($creditCards as $creditCard) {
if ($creditCard->balance == 0) {
- // find a transfer TO the credit card which should account for
- // anything paid. If not, the CC is not yet used.
+ // find a transfer TO the credit card which should account for anything paid. If not, the CC is not yet used.
$set = TransactionJournal::whereIn(
'transaction_journals.id', function (Builder $q) use ($creditCard, $start, $end) {
$q->select('transaction_journals.id')
diff --git a/database/migrations/2014_12_13_190730_changes_for_v321.php b/database/migrations/2014_12_13_190730_changes_for_v321.php
index a893f8c0a7..a10d7785ae 100644
--- a/database/migrations/2014_12_13_190730_changes_for_v321.php
+++ b/database/migrations/2014_12_13_190730_changes_for_v321.php
@@ -10,7 +10,8 @@ use Illuminate\Support\Facades\Schema;
/**
* @SuppressWarnings(PHPMD.ShortMethodName) // method names are mandated by laravel.
- * @SuppressWarnings("TooManyMethods") // I'm fine with this
+ * @SuppressWarnings(PHPMD.TooManyMethods)
+ *
*
* Down:
* 1. Create new Components based on Budgets.
diff --git a/database/migrations/2015_04_26_054507_changes_for_v3310.php b/database/migrations/2015_04_26_054507_changes_for_v3310.php
index 3598736a21..7073e1b6b1 100644
--- a/database/migrations/2015_04_26_054507_changes_for_v3310.php
+++ b/database/migrations/2015_04_26_054507_changes_for_v3310.php
@@ -5,7 +5,7 @@ use Illuminate\Database\Schema\Blueprint;
/**
* @SuppressWarnings(PHPMD.ShortMethodName)
- * @SuppressWarnings("PHPMD.ExcessiveMethodLength")
+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*
* Class ChangesForV3310
*/
diff --git a/database/migrations/2015_05_28_041652_entrust_setup_tables.php b/database/migrations/2015_05_28_041652_entrust_setup_tables.php
index 270f46a768..f18279e3a5 100644
--- a/database/migrations/2015_05_28_041652_entrust_setup_tables.php
+++ b/database/migrations/2015_05_28_041652_entrust_setup_tables.php
@@ -4,6 +4,9 @@ use Illuminate\Database\Schema\Blueprint;
/**
* Class EntrustSetupTables
+ *
+ * @SuppressWarnings(PHPMD.ShortMethodName)
+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
class EntrustSetupTables extends Migration
{
diff --git a/database/migrations/2015_06_14_093841_changes_for_v345.php b/database/migrations/2015_06_14_093841_changes_for_v345.php
index 43a1df7223..752a0a54f9 100644
--- a/database/migrations/2015_06_14_093841_changes_for_v345.php
+++ b/database/migrations/2015_06_14_093841_changes_for_v345.php
@@ -5,6 +5,9 @@ use Illuminate\Database\Schema\Blueprint;
/**
* Class ChangesForV345
+ *
+ * @SuppressWarnings(PHPMD.ShortMethodName)
+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
class ChangesForV345 extends Migration
{
diff --git a/database/migrations/2015_07_03_102450_changes_for_v3462.php b/database/migrations/2015_07_03_102450_changes_for_v3462.php
index 930c8b0bab..d18d7c232c 100644
--- a/database/migrations/2015_07_03_102450_changes_for_v3462.php
+++ b/database/migrations/2015_07_03_102450_changes_for_v3462.php
@@ -5,6 +5,8 @@ use Illuminate\Database\Schema\Blueprint;
/**
* Class ChangesForV3462
+ *
+ * @SuppressWarnings(PHPMD.ShortMethodName)
*/
class ChangesForV3462 extends Migration
{
diff --git a/database/migrations/2015_07_14_204645_changes_for_v349.php b/database/migrations/2015_07_14_204645_changes_for_v349.php
index 3f2538c339..48147e6448 100644
--- a/database/migrations/2015_07_14_204645_changes_for_v349.php
+++ b/database/migrations/2015_07_14_204645_changes_for_v349.php
@@ -5,6 +5,8 @@ use Illuminate\Database\Schema\Blueprint;
/**
* Class ChangesForV349
+ *
+ * @SuppressWarnings(PHPMD.ShortMethodName)
*/
class ChangesForV349 extends Migration
{
diff --git a/database/migrations/2015_07_17_190438_changes_for_v3410.php b/database/migrations/2015_07_17_190438_changes_for_v3410.php
index c8e64213d9..feebb8396b 100644
--- a/database/migrations/2015_07_17_190438_changes_for_v3410.php
+++ b/database/migrations/2015_07_17_190438_changes_for_v3410.php
@@ -5,6 +5,8 @@ use Illuminate\Database\Schema\Blueprint;
/**
* Class ChangesForV3410
+ *
+ * @SuppressWarnings(PHPMD.ShortMethodName)
*/
class ChangesForV3410 extends Migration
{
diff --git a/database/migrations/2016_01_11_193428_changes_for_v370.php b/database/migrations/2016_01_11_193428_changes_for_v370.php
index 6eed8b823b..87134f0581 100644
--- a/database/migrations/2016_01_11_193428_changes_for_v370.php
+++ b/database/migrations/2016_01_11_193428_changes_for_v370.php
@@ -12,6 +12,9 @@ use Illuminate\Database\Schema\Blueprint;
/**
* Class ChangesForV370
+ *
+ * @SuppressWarnings(PHPMD.ShortMethodName)
+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
class ChangesForV370 extends Migration
{
diff --git a/database/seeds/TestDataSeeder.php b/database/seeds/TestDataSeeder.php
index 49550f1b0a..8aec28e0b8 100644
--- a/database/seeds/TestDataSeeder.php
+++ b/database/seeds/TestDataSeeder.php
@@ -23,6 +23,8 @@ use Illuminate\Database\Seeder;
/**
*
* Class TestDataSeeder
+ * @SuppressWarnings(PHPMD.ExcessiveClassLength)
+ * @SuppressWarnings(PHPMD.TooManyMethods)
*/
class TestDataSeeder extends Seeder
{
@@ -39,6 +41,9 @@ class TestDataSeeder extends Seeder
}
+ /**
+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
+ */
public function createRules()
{
// three rule groups to get started.
@@ -433,26 +438,10 @@ class TestDataSeeder extends Seeder
$ruleAction->action_value = 'Bills';
$ruleAction->save();
unset($ruleAction);
-
-
- // a normal rule: saves transactions where description contains "groceries"
- // and from account is "MyBank Checking Account"
- // send it to Groceries/Groceries
-
-
- //$ruleAction
-
- // TODO a rule that triggers on something, just like the previous one, but it has "stop_processing" set to 1.
- // TODO a rule that triggers on that same thing, but it will not file, because the previous rule made FF skip it.
-
- // TODO rule with specific actions.
- // TODO rule with actions and one action has stop_processing and other actions are not processed. Somewhere in test?
-
-
}
/**
- *
+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function run()
{
@@ -545,6 +534,9 @@ class TestDataSeeder extends Seeder
}
+ /**
+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
+ */
protected function createAssetAccounts()
{
$assets = ['MyBank Checking Account', 'Savings', 'Shared', 'Creditcard', 'Emergencies', 'STE'];
@@ -663,6 +655,9 @@ class TestDataSeeder extends Seeder
);
}
+ /**
+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
+ */
protected function createPiggybanks()
{
$account = $this->findAccount('Savings');
@@ -820,6 +815,8 @@ class TestDataSeeder extends Seeder
* @param Carbon $date
* @param $amount
*
+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
+ *
* @return TransactionJournal
*/
protected function createIncome($description, Carbon $date, $amount)
@@ -1056,6 +1053,7 @@ class TestDataSeeder extends Seeder
/**
* @param Carbon $date
+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
protected function createGroceries(Carbon $date)
{
@@ -1113,6 +1111,7 @@ class TestDataSeeder extends Seeder
/**
* @param Carbon $date
+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
protected function createDrinksAndOthers(Carbon $date)
{
@@ -1331,6 +1330,12 @@ class TestDataSeeder extends Seeder
return null;
}
+ /**
+ * @param $date
+ *
+ * @return static
+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
+ */
protected function createCar($date)
{
// twice:
diff --git a/tests/BasicTest.php b/tests/BasicTest.php
index 0f1b9f46d4..079f2790df 100644
--- a/tests/BasicTest.php
+++ b/tests/BasicTest.php
@@ -1,9 +1,8 @@
<?php
-use Illuminate\Foundation\Testing\WithoutMiddleware;
-use Illuminate\Foundation\Testing\DatabaseMigrations;
-use Illuminate\Foundation\Testing\DatabaseTransactions;
-
+/**
+ * Class BasicTest
+ */
class BasicTest extends TestCase
{
/**
diff --git a/tests/TestCase.php b/tests/TestCase.php
index 8578b17e4a..6dce7adf21 100755
--- a/tests/TestCase.php
+++ b/tests/TestCase.php
@@ -1,5 +1,8 @@
<?php
+/**
+ * Class TestCase
+ */
class TestCase extends Illuminate\Foundation\Testing\TestCase
{
/**