From 342985d52ab1257008d09581b6036aaffe24267c Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 17 Aug 2019 10:47:51 +0200 Subject: [PATCH] Code cleanup --- database/factories/AccountFactory.php | 1 - database/factories/ModelFactory.php | 3 ++- database/factories/UserFactory.php | 1 + .../2016_12_28_203205_changes_for_v431.php | 11 ++++++----- ...8_01_01_000001_create_oauth_auth_codes_table.php | 1 + ...1_01_000002_create_oauth_access_tokens_table.php | 1 + ..._01_000003_create_oauth_refresh_tokens_table.php | 1 + ...2018_01_01_000004_create_oauth_clients_table.php | 1 + ...5_create_oauth_personal_access_clients_table.php | 1 + .../2018_03_19_141348_changes_for_v472.php | 1 + .../2018_04_07_210913_changes_for_v473.php | 1 + .../2018_04_29_174524_changes_for_v474.php | 2 ++ .../2018_06_08_200526_changes_for_v475.php | 2 ++ .../2018_09_05_195147_changes_for_v477.php | 3 ++- .../2018_11_06_172532_changes_for_v479.php | 2 ++ .../2019_01_28_193833_changes_for_v4710.php | 3 ++- .../2019_02_05_055516_changes_for_v4711.php | 4 +++- .../2019_02_11_170529_changes_for_v4712.php | 1 + .../2019_03_11_223700_fix_ldap_configuration.php | 1 + .../2019_03_22_183214_changes_for_v480.php | 13 +++++++++---- database/seeds/AccountTypeSeeder.php | 2 +- database/seeds/TransactionCurrencySeeder.php | 6 +++++- 22 files changed, 46 insertions(+), 16 deletions(-) diff --git a/database/factories/AccountFactory.php b/database/factories/AccountFactory.php index a48207abdf..1601c82d16 100644 --- a/database/factories/AccountFactory.php +++ b/database/factories/AccountFactory.php @@ -23,7 +23,6 @@ declare(strict_types=1); use Carbon\Carbon; - $factory->define( FireflyIII\Models\Account::class, function (Faker\Generator $faker) { diff --git a/database/factories/ModelFactory.php b/database/factories/ModelFactory.php index 936dc2d38e..97018e321b 100644 --- a/database/factories/ModelFactory.php +++ b/database/factories/ModelFactory.php @@ -21,6 +21,7 @@ declare(strict_types=1); use Carbon\Carbon; +use FireflyIII\Models\TransactionJournal; $factory->define( @@ -29,7 +30,7 @@ $factory->define( return [ 'user_id' => 1, 'attachable_id' => 1, - 'attachable_type' => \FireflyIII\Models\TransactionJournal::class, + 'attachable_type' => TransactionJournal::class, 'md5' => md5($faker->words(6, true)), 'mime' => 'text/plain', 'size' => 1, diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index ad3dc9dc58..6b0f9fcbe8 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -21,6 +21,7 @@ */ declare(strict_types=1); + /** * UserFactory.php * Copyright (c) 2018 thegrumpydictator@gmail.com diff --git a/database/migrations/2016_12_28_203205_changes_for_v431.php b/database/migrations/2016_12_28_203205_changes_for_v431.php index 1d276d6cee..c2e38429da 100644 --- a/database/migrations/2016_12_28_203205_changes_for_v431.php +++ b/database/migrations/2016_12_28_203205_changes_for_v431.php @@ -75,13 +75,14 @@ class ChangesForV431 extends Migration * Run the migrations. * * @SuppressWarnings(PHPMD.ShortMethodName) + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ public function up(): void { // add decimal places to "transaction currencies". Schema::table( 'transaction_currencies', - function (Blueprint $table) { + static function (Blueprint $table) { $table->smallInteger('decimal_places', false, true)->default(2); } ); @@ -89,7 +90,7 @@ class ChangesForV431 extends Migration // change field "startdate" to "start_date" Schema::table( 'budget_limits', - function (Blueprint $table) { + static function (Blueprint $table) { $table->renameColumn('startdate', 'start_date'); } ); @@ -97,7 +98,7 @@ class ChangesForV431 extends Migration // add date field "end_date" after "start_date" Schema::table( 'budget_limits', - function (Blueprint $table) { + static function (Blueprint $table) { $table->date('end_date')->nullable()->after('start_date'); } ); @@ -105,13 +106,13 @@ class ChangesForV431 extends Migration // drop "repeats" and "repeat_freq". Schema::table( 'budget_limits', - function (Blueprint $table) { + static function (Blueprint $table) { $table->dropColumn('repeats'); } ); Schema::table( 'budget_limits', - function (Blueprint $table) { + static function (Blueprint $table) { $table->dropColumn('repeat_freq'); } ); diff --git a/database/migrations/2018_01_01_000001_create_oauth_auth_codes_table.php b/database/migrations/2018_01_01_000001_create_oauth_auth_codes_table.php index 4d88023dc6..267a06ad60 100644 --- a/database/migrations/2018_01_01_000001_create_oauth_auth_codes_table.php +++ b/database/migrations/2018_01_01_000001_create_oauth_auth_codes_table.php @@ -41,6 +41,7 @@ class CreateOauthAuthCodesTable extends Migration /** * Run the migrations. + * @SuppressWarnings(PHPMD.ShortMethodName) */ public function up(): void { diff --git a/database/migrations/2018_01_01_000002_create_oauth_access_tokens_table.php b/database/migrations/2018_01_01_000002_create_oauth_access_tokens_table.php index 47101b5a2e..4053b05755 100644 --- a/database/migrations/2018_01_01_000002_create_oauth_access_tokens_table.php +++ b/database/migrations/2018_01_01_000002_create_oauth_access_tokens_table.php @@ -41,6 +41,7 @@ class CreateOauthAccessTokensTable extends Migration /** * Run the migrations. + * @SuppressWarnings(PHPMD.ShortMethodName) */ public function up(): void { diff --git a/database/migrations/2018_01_01_000003_create_oauth_refresh_tokens_table.php b/database/migrations/2018_01_01_000003_create_oauth_refresh_tokens_table.php index b154666881..3c4d530283 100644 --- a/database/migrations/2018_01_01_000003_create_oauth_refresh_tokens_table.php +++ b/database/migrations/2018_01_01_000003_create_oauth_refresh_tokens_table.php @@ -41,6 +41,7 @@ class CreateOauthRefreshTokensTable extends Migration /** * Run the migrations. + * @SuppressWarnings(PHPMD.ShortMethodName) */ public function up(): void { diff --git a/database/migrations/2018_01_01_000004_create_oauth_clients_table.php b/database/migrations/2018_01_01_000004_create_oauth_clients_table.php index 16c5bc6c87..1a6ceec6b8 100644 --- a/database/migrations/2018_01_01_000004_create_oauth_clients_table.php +++ b/database/migrations/2018_01_01_000004_create_oauth_clients_table.php @@ -41,6 +41,7 @@ class CreateOauthClientsTable extends Migration /** * Run the migrations. + * @SuppressWarnings(PHPMD.ShortMethodName) */ public function up(): void { diff --git a/database/migrations/2018_01_01_000005_create_oauth_personal_access_clients_table.php b/database/migrations/2018_01_01_000005_create_oauth_personal_access_clients_table.php index 73e26aff39..2e3db54ff2 100644 --- a/database/migrations/2018_01_01_000005_create_oauth_personal_access_clients_table.php +++ b/database/migrations/2018_01_01_000005_create_oauth_personal_access_clients_table.php @@ -42,6 +42,7 @@ class CreateOauthPersonalAccessClientsTable extends Migration /** * Run the migrations. + * @SuppressWarnings(PHPMD.ShortMethodName) */ public function up(): void { diff --git a/database/migrations/2018_03_19_141348_changes_for_v472.php b/database/migrations/2018_03_19_141348_changes_for_v472.php index abb3afe3ed..c116a65207 100644 --- a/database/migrations/2018_03_19_141348_changes_for_v472.php +++ b/database/migrations/2018_03_19_141348_changes_for_v472.php @@ -53,6 +53,7 @@ class ChangesForV472 extends Migration /** * Run the migrations. + * @SuppressWarnings(PHPMD.ShortMethodName) * * @return void */ diff --git a/database/migrations/2018_04_07_210913_changes_for_v473.php b/database/migrations/2018_04_07_210913_changes_for_v473.php index 3ebbb5fe6c..a9813b2da0 100644 --- a/database/migrations/2018_04_07_210913_changes_for_v473.php +++ b/database/migrations/2018_04_07_210913_changes_for_v473.php @@ -61,6 +61,7 @@ class ChangesForV473 extends Migration /** * Run the migrations. + * @SuppressWarnings(PHPMD.ShortMethodName) * * @return void */ diff --git a/database/migrations/2018_04_29_174524_changes_for_v474.php b/database/migrations/2018_04_29_174524_changes_for_v474.php index d9c2598cd7..d68542d6f8 100644 --- a/database/migrations/2018_04_29_174524_changes_for_v474.php +++ b/database/migrations/2018_04_29_174524_changes_for_v474.php @@ -32,6 +32,7 @@ class ChangesForV474 extends Migration { /** * Reverse the migrations. + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) * * @return void */ @@ -92,6 +93,7 @@ class ChangesForV474 extends Migration /** * Run the migrations. + * @SuppressWarnings(PHPMD.ShortMethodName) * * @return void */ diff --git a/database/migrations/2018_06_08_200526_changes_for_v475.php b/database/migrations/2018_06_08_200526_changes_for_v475.php index 003c556ea4..5a5e1a0acc 100644 --- a/database/migrations/2018_06_08_200526_changes_for_v475.php +++ b/database/migrations/2018_06_08_200526_changes_for_v475.php @@ -47,6 +47,8 @@ class ChangesForV475 extends Migration /** * Run the migrations. + * @SuppressWarnings(PHPMD.ShortMethodName) + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) * * @return void */ diff --git a/database/migrations/2018_09_05_195147_changes_for_v477.php b/database/migrations/2018_09_05_195147_changes_for_v477.php index 6aae743150..67777c6733 100644 --- a/database/migrations/2018_09_05_195147_changes_for_v477.php +++ b/database/migrations/2018_09_05_195147_changes_for_v477.php @@ -41,7 +41,7 @@ class ChangesForV477 extends Migration Schema::table( 'budget_limits', function (Blueprint $table) { - // cannot drop foreign keys in SQLite: + // cannot drop foreign keys in SQLite: if ('sqlite' !== config('database.default')) { $table->dropForeign('budget_limits_transaction_currency_id_foreign'); } @@ -53,6 +53,7 @@ class ChangesForV477 extends Migration /** * Run the migrations. + * @SuppressWarnings(PHPMD.ShortMethodName) * * @return void */ diff --git a/database/migrations/2018_11_06_172532_changes_for_v479.php b/database/migrations/2018_11_06_172532_changes_for_v479.php index 9846f38f0a..a0498d5b36 100644 --- a/database/migrations/2018_11_06_172532_changes_for_v479.php +++ b/database/migrations/2018_11_06_172532_changes_for_v479.php @@ -21,6 +21,7 @@ */ declare(strict_types=1); + use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; @@ -45,6 +46,7 @@ class ChangesForV479 extends Migration /** * Run the migrations. + * @SuppressWarnings(PHPMD.ShortMethodName) * * @return void */ diff --git a/database/migrations/2019_01_28_193833_changes_for_v4710.php b/database/migrations/2019_01_28_193833_changes_for_v4710.php index cce324b8c1..35326ec98d 100644 --- a/database/migrations/2019_01_28_193833_changes_for_v4710.php +++ b/database/migrations/2019_01_28_193833_changes_for_v4710.php @@ -41,6 +41,7 @@ class ChangesForV4710 extends Migration /** * Run the migrations. + * @SuppressWarnings(PHPMD.ShortMethodName) * * @return void */ @@ -73,7 +74,7 @@ class ChangesForV4710 extends Migration $table->foreign('transaction_journal_id')->references('id')->on('transaction_journals')->onDelete('cascade'); // unique combi: - $table->unique(['transaction_group_id', 'transaction_journal_id'],'unique_in_group'); + $table->unique(['transaction_group_id', 'transaction_journal_id'], 'unique_in_group'); } ); } diff --git a/database/migrations/2019_02_05_055516_changes_for_v4711.php b/database/migrations/2019_02_05_055516_changes_for_v4711.php index c05b293ac2..3a9f3a385a 100644 --- a/database/migrations/2019_02_05_055516_changes_for_v4711.php +++ b/database/migrations/2019_02_05_055516_changes_for_v4711.php @@ -40,6 +40,7 @@ class ChangesForV4711 extends Migration /** * Run the migrations. + * @SuppressWarnings(PHPMD.ShortMethodName) * * @return void */ @@ -59,7 +60,8 @@ class ChangesForV4711 extends Migration } ); - Schema::table('preferences', function (Blueprint $table) { + Schema::table( + 'preferences', function (Blueprint $table) { $table->text('data')->nullable()->change(); } ); diff --git a/database/migrations/2019_02_11_170529_changes_for_v4712.php b/database/migrations/2019_02_11_170529_changes_for_v4712.php index ad4371e711..2ae6b437ab 100644 --- a/database/migrations/2019_02_11_170529_changes_for_v4712.php +++ b/database/migrations/2019_02_11_170529_changes_for_v4712.php @@ -42,6 +42,7 @@ class ChangesForV4712 extends Migration /** * Run the migrations. + * @SuppressWarnings(PHPMD.ShortMethodName) * * @return void */ diff --git a/database/migrations/2019_03_11_223700_fix_ldap_configuration.php b/database/migrations/2019_03_11_223700_fix_ldap_configuration.php index 008a67de41..f1f5f04dd8 100644 --- a/database/migrations/2019_03_11_223700_fix_ldap_configuration.php +++ b/database/migrations/2019_03_11_223700_fix_ldap_configuration.php @@ -46,6 +46,7 @@ class FixLdapConfiguration extends Migration /** * Run the migrations. + * @SuppressWarnings(PHPMD.ShortMethodName) * * @return void */ diff --git a/database/migrations/2019_03_22_183214_changes_for_v480.php b/database/migrations/2019_03_22_183214_changes_for_v480.php index 21d19891c5..62f458f358 100644 --- a/database/migrations/2019_03_22_183214_changes_for_v480.php +++ b/database/migrations/2019_03_22_183214_changes_for_v480.php @@ -47,9 +47,11 @@ class ChangesForV480 extends Migration $table->dropColumn('transaction_group_id'); } ); - Schema::table('rule_groups', static function (Blueprint $table) { + Schema::table( + 'rule_groups', static function (Blueprint $table) { $table->dropColumn('stop_processing'); - }); + } + ); Schema::table( 'users', static function (Blueprint $table) { @@ -60,6 +62,7 @@ class ChangesForV480 extends Migration /** * Run the migrations. + * @SuppressWarnings(PHPMD.ShortMethodName) * * @return void */ @@ -80,9 +83,11 @@ class ChangesForV480 extends Migration $table->foreign('transaction_group_id')->references('id')->on('transaction_groups')->onDelete('cascade'); } ); - Schema::table('rule_groups', static function (Blueprint $table) { + Schema::table( + 'rule_groups', static function (Blueprint $table) { $table->boolean('stop_processing')->default(false); - }); + } + ); Schema::table( 'users', static function (Blueprint $table) { $table->string('mfa_secret', 50)->nullable(); diff --git a/database/seeds/AccountTypeSeeder.php b/database/seeds/AccountTypeSeeder.php index 2231fce92d..8755f50bd1 100644 --- a/database/seeds/AccountTypeSeeder.php +++ b/database/seeds/AccountTypeSeeder.php @@ -42,7 +42,7 @@ class AccountTypeSeeder extends Seeder AccountType::LOAN, AccountType::RECONCILIATION, AccountType::DEBT, - AccountType::MORTGAGE + AccountType::MORTGAGE, ]; foreach ($types as $type) { try { diff --git a/database/seeds/TransactionCurrencySeeder.php b/database/seeds/TransactionCurrencySeeder.php index 0a49b642ab..cd5a57ad3c 100644 --- a/database/seeds/TransactionCurrencySeeder.php +++ b/database/seeds/TransactionCurrencySeeder.php @@ -28,11 +28,15 @@ use Illuminate\Database\Seeder; */ class TransactionCurrencySeeder extends Seeder { + /** + * @SuppressWarnings(PHPMD.ShortMethodName) + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ public function run() { $currencies = []; // european currencies - $currencies[] = ['code' => 'EUR', 'name' => 'Euro', 'symbol' => '€', 'decimal_places' => 2,'enabled' => 1]; + $currencies[] = ['code' => 'EUR', 'name' => 'Euro', 'symbol' => '€', 'decimal_places' => 2, 'enabled' => 1]; $currencies[] = ['code' => 'HUF', 'name' => 'Hungarian forint', 'symbol' => 'Ft', 'decimal_places' => 2]; $currencies[] = ['code' => 'GBP', 'name' => 'British Pound', 'symbol' => '£', 'decimal_places' => 2]; $currencies[] = ['code' => 'UAH', 'name' => 'Ukrainian hryvnia', 'symbol' => '₴', 'decimal_places' => 2];