Code cleanup

This commit is contained in:
James Cole
2019-08-17 10:47:51 +02:00
parent c2296c3ad5
commit 342985d52a
22 changed files with 46 additions and 16 deletions

View File

@@ -23,7 +23,6 @@ declare(strict_types=1);
use Carbon\Carbon;
$factory->define(
FireflyIII\Models\Account::class,
function (Faker\Generator $faker) {

View File

@@ -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,

View File

@@ -21,6 +21,7 @@
*/
declare(strict_types=1);
/**
* UserFactory.php
* Copyright (c) 2018 thegrumpydictator@gmail.com

View File

@@ -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');
}
);

View File

@@ -41,6 +41,7 @@ class CreateOauthAuthCodesTable extends Migration
/**
* Run the migrations.
* @SuppressWarnings(PHPMD.ShortMethodName)
*/
public function up(): void
{

View File

@@ -41,6 +41,7 @@ class CreateOauthAccessTokensTable extends Migration
/**
* Run the migrations.
* @SuppressWarnings(PHPMD.ShortMethodName)
*/
public function up(): void
{

View File

@@ -41,6 +41,7 @@ class CreateOauthRefreshTokensTable extends Migration
/**
* Run the migrations.
* @SuppressWarnings(PHPMD.ShortMethodName)
*/
public function up(): void
{

View File

@@ -41,6 +41,7 @@ class CreateOauthClientsTable extends Migration
/**
* Run the migrations.
* @SuppressWarnings(PHPMD.ShortMethodName)
*/
public function up(): void
{

View File

@@ -42,6 +42,7 @@ class CreateOauthPersonalAccessClientsTable extends Migration
/**
* Run the migrations.
* @SuppressWarnings(PHPMD.ShortMethodName)
*/
public function up(): void
{

View File

@@ -53,6 +53,7 @@ class ChangesForV472 extends Migration
/**
* Run the migrations.
* @SuppressWarnings(PHPMD.ShortMethodName)
*
* @return void
*/

View File

@@ -61,6 +61,7 @@ class ChangesForV473 extends Migration
/**
* Run the migrations.
* @SuppressWarnings(PHPMD.ShortMethodName)
*
* @return void
*/

View File

@@ -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
*/

View File

@@ -47,6 +47,8 @@ class ChangesForV475 extends Migration
/**
* Run the migrations.
* @SuppressWarnings(PHPMD.ShortMethodName)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*
* @return void
*/

View File

@@ -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
*/

View File

@@ -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
*/

View File

@@ -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');
}
);
}

View File

@@ -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();
}
);

View File

@@ -42,6 +42,7 @@ class ChangesForV4712 extends Migration
/**
* Run the migrations.
* @SuppressWarnings(PHPMD.ShortMethodName)
*
* @return void
*/

View File

@@ -46,6 +46,7 @@ class FixLdapConfiguration extends Migration
/**
* Run the migrations.
* @SuppressWarnings(PHPMD.ShortMethodName)
*
* @return void
*/

View File

@@ -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();

View File

@@ -42,7 +42,7 @@ class AccountTypeSeeder extends Seeder
AccountType::LOAN,
AccountType::RECONCILIATION,
AccountType::DEBT,
AccountType::MORTGAGE
AccountType::MORTGAGE,
];
foreach ($types as $type) {
try {

View File

@@ -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];