diff --git a/app/Http/Controllers/Account/ReconcileController.php b/app/Http/Controllers/Account/ReconcileController.php index 9e662ae441..a15b78de80 100644 --- a/app/Http/Controllers/Account/ReconcileController.php +++ b/app/Http/Controllers/Account/ReconcileController.php @@ -70,11 +70,12 @@ class ReconcileController extends Controller * @param Carbon $end * * @return \Illuminate\Http\JsonResponse + * * @throws FireflyException */ public function overview(Request $request, Account $account, Carbon $start, Carbon $end) { - if ($account->accountType->type !== AccountType::ASSET) { + if (AccountType::ASSET !== $account->accountType->type) { throw new FireflyException(sprintf('Account %s is not an asset account.', $account->name)); } $startBalance = $request->get('startBalance'); @@ -102,7 +103,7 @@ class ReconcileController extends Controller foreach ($cleared as $transaction) { if ($transaction->transactionJournal->date <= $end) { $clearedAmount = bcadd($clearedAmount, $transaction->amount); - $countCleared++; + ++$countCleared; } } @@ -120,7 +121,7 @@ class ReconcileController extends Controller 'accounts.reconcile.overview', compact( 'account', 'start', 'diffCompare', 'difference', 'end', 'clearedIds', 'transactionIds', 'clearedAmount', 'startBalance', 'endBalance', 'amount', - 'route','countCleared' + 'route', 'countCleared' ) )->render(); @@ -212,7 +213,7 @@ class ReconcileController extends Controller } // create reconciliation transaction (if necessary): - if ($request->get('reconcile') === 'create') { + if ('create' === $request->get('reconcile')) { /** @var AccountRepositoryInterface $accountRepos */ $accountRepos = app(AccountRepositoryInterface::class); $reconciliation = $accountRepos->getReconciliation($account); @@ -243,8 +244,6 @@ class ReconcileController extends Controller Session::flash('success', trans('firefly.reconciliation_stored')); return redirect(route('accounts.show', [$account->id])); - - } /** diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 94da2b319f..cd5f5aa58a 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -74,7 +74,7 @@ class LoginController extends Controller /** * Handle a login request to the application. * - * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Request $request * * @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\Response|\Illuminate\Http\JsonResponse */ @@ -92,7 +92,6 @@ class LoginController extends Controller } if ($this->attemptLogin($request)) { - // user is logged in. Save in session if the user requested session to be remembered: $request->session()->put('remember_login', $request->filled('remember')); @@ -110,7 +109,8 @@ class LoginController extends Controller /** * Log the user out of the application. * - * @param \Illuminate\Http\Request $request + * @param \Illuminate\Http\Request $request + * * @return \Illuminate\Http\Response */ public function logout(Request $request, CookieJar $cookieJar) @@ -166,7 +166,6 @@ class LoginController extends Controller $email = $request->old('email'); $remember = $request->old('remember'); - - return view('auth.login', compact('allowRegistration', 'email', 'remember'));//->withCookie($cookie); + return view('auth.login', compact('allowRegistration', 'email', 'remember')); //->withCookie($cookie); } } diff --git a/app/Http/Controllers/Auth/TwoFactorController.php b/app/Http/Controllers/Auth/TwoFactorController.php index de2da698d8..a4cd2711de 100644 --- a/app/Http/Controllers/Auth/TwoFactorController.php +++ b/app/Http/Controllers/Auth/TwoFactorController.php @@ -74,9 +74,9 @@ class TwoFactorController extends Controller */ public function lostTwoFactor() { - $user = auth()->user(); + $user = auth()->user(); $siteOwner = env('SITE_OWNER', ''); - $title = strval(trans('firefly.two_factor_forgot_title')); + $title = strval(trans('firefly.two_factor_forgot_title')); Log::info( 'To reset the two factor authentication for user #' . $user->id . @@ -99,10 +99,8 @@ class TwoFactorController extends Controller // wants to remember session? $remember = $request->session()->get('remember_login') ?? false; - - - $minutes = config('session.lifetime'); - if ($remember === true) { + $minutes = config('session.lifetime'); + if (true === $remember) { // set cookie with a long lifetime (30 days) $minutes = 43200; } diff --git a/app/Http/Middleware/AuthenticateTwoFactor.php b/app/Http/Middleware/AuthenticateTwoFactor.php index 648185d382..840ac16ab1 100644 --- a/app/Http/Middleware/AuthenticateTwoFactor.php +++ b/app/Http/Middleware/AuthenticateTwoFactor.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace FireflyIII\Http\Middleware; use Closure; -use Cookie; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Log; diff --git a/app/Http/Middleware/RedirectIfTwoFactorAuthenticated.php b/app/Http/Middleware/RedirectIfTwoFactorAuthenticated.php index 5e43aa7837..dce366ed4c 100644 --- a/app/Http/Middleware/RedirectIfTwoFactorAuthenticated.php +++ b/app/Http/Middleware/RedirectIfTwoFactorAuthenticated.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace FireflyIII\Http\Middleware; use Closure; -use Cookie; use Illuminate\Support\Facades\Auth; use Preferences; diff --git a/app/Import/Converter/Amount.php b/app/Import/Converter/Amount.php index f5e6420963..0977ccba88 100644 --- a/app/Import/Converter/Amount.php +++ b/app/Import/Converter/Amount.php @@ -88,7 +88,8 @@ class Amount implements ConverterInterface Log::debug(sprintf('No decimal character found. Converted amount from "%s" to "%s".', $oldValue, $value)); } - $number = strval(number_format(round(floatval($value), 12), 12,'.','')); + $number = strval(number_format(round(floatval($value), 12), 12, '.', '')); + return $number; } } diff --git a/app/Import/Object/ImportJournal.php b/app/Import/Object/ImportJournal.php index 3f27e1ab49..299315b47f 100644 --- a/app/Import/Object/ImportJournal.php +++ b/app/Import/Object/ImportJournal.php @@ -24,7 +24,6 @@ namespace FireflyIII\Import\Object; use Carbon\Carbon; use FireflyIII\Exceptions\FireflyException; -use FireflyIII\Import\Converter\Amount; use FireflyIII\Import\Converter\ConverterInterface; use FireflyIII\Import\MapperPreProcess\PreProcessorInterface; use FireflyIII\User; @@ -131,7 +130,7 @@ class ImportJournal $converterClass = sprintf('FireflyIII\Import\Converter\%s', config(sprintf('csv.import_roles.%s.converter', $this->amountCredit['role']))); $info = $this->amountCredit; } - if (count($info) === 0) { + if (0 === count($info)) { throw new FireflyException('No amount information for this row.'); } diff --git a/app/Repositories/Account/FindAccountsTrait.php b/app/Repositories/Account/FindAccountsTrait.php index b8609b7990..6910dad202 100644 --- a/app/Repositories/Account/FindAccountsTrait.php +++ b/app/Repositories/Account/FindAccountsTrait.php @@ -228,11 +228,12 @@ trait FindAccountsTrait * @param Account $account * * @return Account|null + * * @throws FireflyException */ public function getReconciliation(Account $account): ?Account { - if ($account->accountType->type !== AccountType::ASSET) { + if (AccountType::ASSET !== $account->accountType->type) { throw new FireflyException(sprintf('%s is not an asset account.', $account->name)); } $name = $account->name . ' reconciliation'; diff --git a/app/Repositories/Journal/JournalRepository.php b/app/Repositories/Journal/JournalRepository.php index 57700ad52d..3a87a8f602 100644 --- a/app/Repositories/Journal/JournalRepository.php +++ b/app/Repositories/Journal/JournalRepository.php @@ -189,7 +189,7 @@ class JournalRepository implements JournalRepositoryInterface ->where('transaction_journals.user_id', $this->user->id) ->whereNull('transaction_journals.deleted_at') ->whereNull('transactions.deleted_at') - ->get( ['transactions.*']); + ->get(['transactions.*']); return $set; } diff --git a/app/Repositories/Journal/JournalRepositoryInterface.php b/app/Repositories/Journal/JournalRepositoryInterface.php index 694683e2f0..2afb7a2785 100644 --- a/app/Repositories/Journal/JournalRepositoryInterface.php +++ b/app/Repositories/Journal/JournalRepositoryInterface.php @@ -35,15 +35,6 @@ use Illuminate\Support\MessageBag; */ interface JournalRepositoryInterface { - - /** - * @param array $transactionIds - * - * @return Collection - */ - public function getTransactionsById(array $transactionIds): Collection; - - /** * @param TransactionJournal $journal * @param TransactionType $type @@ -105,6 +96,13 @@ interface JournalRepositoryInterface */ public function getTransactionTypes(): Collection; + /** + * @param array $transactionIds + * + * @return Collection + */ + public function getTransactionsById(array $transactionIds): Collection; + /** * @param TransactionJournal $journal * diff --git a/app/Support/Import/Configuration/Csv/Roles.php b/app/Support/Import/Configuration/Csv/Roles.php index e15b2cf898..97160b430e 100644 --- a/app/Support/Import/Configuration/Csv/Roles.php +++ b/app/Support/Import/Configuration/Csv/Roles.php @@ -258,7 +258,7 @@ class Roles implements ConfigurationInterface if ('_ignore' !== $role) { ++$assigned; } - if (in_array($role, ['amount','amount_credit','amount_debet'])) { + if (in_array($role, ['amount', 'amount_credit', 'amount_debet'])) { $hasAmount = true; } } diff --git a/app/Support/Preferences.php b/app/Support/Preferences.php index 9acfcad9ce..d7aeec3970 100644 --- a/app/Support/Preferences.php +++ b/app/Support/Preferences.php @@ -127,7 +127,6 @@ class Preferences { $fullName = sprintf('preference%s%s', $user->id, $name); if (Cache::has($fullName)) { - return Cache::get($fullName); } diff --git a/app/Support/Twig/Extension/Transaction.php b/app/Support/Twig/Extension/Transaction.php index d93b22026d..ef8e443d78 100644 --- a/app/Support/Twig/Extension/Transaction.php +++ b/app/Support/Twig/Extension/Transaction.php @@ -58,7 +58,7 @@ class Transaction extends Twig_Extension $coloured = true; // at this point amount is always negative. - if ($transaction->transaction_type_type === TransactionType::RECONCILIATION && bccomp(strval($transaction->transaction_amount),'0') === 1) { + if (TransactionType::RECONCILIATION === $transaction->transaction_type_type && 1 === bccomp(strval($transaction->transaction_amount), '0')) { $amount = bcmul($amount, '-1'); } @@ -290,7 +290,7 @@ class Transaction extends Twig_Extension return $cache->get(); } - if($transaction->transaction_type_type === TransactionType::RECONCILIATION) { + if (TransactionType::RECONCILIATION === $transaction->transaction_type_type) { return '—'; } @@ -476,7 +476,7 @@ class Transaction extends Twig_Extension if ($cache->has()) { return $cache->get(); } - if($transaction->transaction_type_type === TransactionType::RECONCILIATION) { + if (TransactionType::RECONCILIATION === $transaction->transaction_type_type) { return '—'; } diff --git a/app/Support/Twig/General.php b/app/Support/Twig/General.php index 38da2546ed..754972cd4a 100644 --- a/app/Support/Twig/General.php +++ b/app/Support/Twig/General.php @@ -148,21 +148,6 @@ class General extends Twig_Extension ); } - /** - * @return Twig_SimpleFilter - */ - protected function markdown(): Twig_SimpleFilter - { - return new Twig_SimpleFilter( - 'markdown', - function (string $text): string { - $converter = new CommonMarkConverter; - - return $converter->convertToHtml($text); - },['is_safe' => ['html']] - ); - } - /** * @return Twig_SimpleFilter */ @@ -181,7 +166,6 @@ class General extends Twig_Extension ); } - /** * @return Twig_SimpleFunction */ @@ -244,6 +228,21 @@ class General extends Twig_Extension ); } + /** + * @return Twig_SimpleFilter + */ + protected function markdown(): Twig_SimpleFilter + { + return new Twig_SimpleFilter( + 'markdown', + function (string $text): string { + $converter = new CommonMarkConverter; + + return $converter->convertToHtml($text); + }, ['is_safe' => ['html']] + ); + } + /** * @return Twig_SimpleFilter */ diff --git a/config/csv.php b/config/csv.php index fa296fe055..a10ea901ba 100644 --- a/config/csv.php +++ b/config/csv.php @@ -280,13 +280,13 @@ return [ 'converter' => 'Amount', 'field' => 'amount', ], - 'amount_debet' => [ + 'amount_debet' => [ 'mappable' => false, 'pre-process-map' => false, 'converter' => 'AmountDebet', 'field' => 'amount_debet', ], - 'amount_credit' => [ + 'amount_credit' => [ 'mappable' => false, 'pre-process-map' => false, 'converter' => 'AmountCredit', diff --git a/database/factories/ModelFactory.php b/database/factories/ModelFactory.php index d42ab2c9b7..85bedc97cf 100644 --- a/database/factories/ModelFactory.php +++ b/database/factories/ModelFactory.php @@ -29,10 +29,10 @@ $factory->define( static $password; return [ - 'email' => $faker->safeEmail, - 'password' => $password ?: $password = bcrypt('secret'), - 'remember_token' => str_random(10), - ]; + 'email' => $faker->safeEmail, + 'password' => $password ?: $password = bcrypt('secret'), + 'remember_token' => str_random(10), + ]; } ); @@ -40,13 +40,13 @@ $factory->define( FireflyIII\Models\CurrencyExchangeRate::class, function (Faker\Generator $faker) { return [ - 'user_id' => 1, - 'from_currency_id' => 1, - 'to_currency_id' => 2, - 'date' => '2017-01-01', - 'rate' => '1.5', - 'user_rate' => null, - ]; + 'user_id' => 1, + 'from_currency_id' => 1, + 'to_currency_id' => 2, + 'date' => '2017-01-01', + 'rate' => '1.5', + 'user_rate' => null, + ]; } ); @@ -54,10 +54,10 @@ $factory->define( FireflyIII\Models\TransactionCurrency::class, function (Faker\Generator $faker) { return [ - 'name' => $faker->words(1, true), - 'code' => 'ABC', - 'symbol' => 'x', - ]; + 'name' => $faker->words(1, true), + 'code' => 'ABC', + 'symbol' => 'x', + ]; } ); @@ -65,44 +65,43 @@ $factory->define( FireflyIII\Models\ImportJob::class, function (Faker\Generator $faker) { return [ - 'id' => $faker->numberBetween(1, 100), - 'user_id' => 1, - 'key' => $faker->words(1, true), - 'file_type' => 'csv', - 'status' => 'import_status_never_started', - 'configuration' => null, - 'extended_status' => [ - 'total_steps' => 0, - 'steps_done' => 0, - 'import_count' => 0, - 'importTag' => 0, - 'errors' => [], - ], - ]; + 'id' => $faker->numberBetween(1, 100), + 'user_id' => 1, + 'key' => $faker->words(1, true), + 'file_type' => 'csv', + 'status' => 'import_status_never_started', + 'configuration' => null, + 'extended_status' => [ + 'total_steps' => 0, + 'steps_done' => 0, + 'import_count' => 0, + 'importTag' => 0, + 'errors' => [], + ], + ]; } ); - $factory->define( FireflyIII\Models\TransactionJournal::class, function (Faker\Generator $faker) { return [ - 'id' => $faker->unique()->numberBetween(1000, 10000), - 'user_id' => 1, - 'transaction_type_id' => 1, - 'bill_id' => null, - // TODO update this transaction currency reference. - 'transaction_currency_id' => 1, - 'description' => $faker->words(3, true), - 'date' => '2017-01-01', - 'interest_date' => null, - 'book_date' => null, - 'process_date' => null, - 'order' => 0, - 'tag_count' => 0, - 'encrypted' => 0, - 'completed' => 1, - ]; + 'id' => $faker->unique()->numberBetween(1000, 10000), + 'user_id' => 1, + 'transaction_type_id' => 1, + 'bill_id' => null, + // TODO update this transaction currency reference. + 'transaction_currency_id' => 1, + 'description' => $faker->words(3, true), + 'date' => '2017-01-01', + 'interest_date' => null, + 'book_date' => null, + 'process_date' => null, + 'order' => 0, + 'tag_count' => 0, + 'encrypted' => 0, + 'completed' => 1, + ]; } ); @@ -110,19 +109,19 @@ $factory->define( FireflyIII\Models\Bill::class, function (Faker\Generator $faker) { return [ - 'id' => $faker->numberBetween(1, 10), - 'user_id' => 1, - 'name' => $faker->words(3, true), - 'match' => $faker->words(3, true), - 'amount_min' => '100.00', - 'amount_max' => '100.00', - 'date' => '2017-01-01', - 'repeat_freq' => 'monthly', - 'skip' => 0, - 'automatch' => 1, - 'name_encrypted' => 0, - 'match_encrypted' => 0, - ]; + 'id' => $faker->numberBetween(1, 10), + 'user_id' => 1, + 'name' => $faker->words(3, true), + 'match' => $faker->words(3, true), + 'amount_min' => '100.00', + 'amount_max' => '100.00', + 'date' => '2017-01-01', + 'repeat_freq' => 'monthly', + 'skip' => 0, + 'automatch' => 1, + 'name_encrypted' => 0, + 'match_encrypted' => 0, + ]; } ); @@ -130,12 +129,12 @@ $factory->define( FireflyIII\Models\PiggyBankRepetition::class, function (Faker\Generator $faker) { return [ - 'id' => $faker->unique()->numberBetween(100, 10000), - 'piggy_bank_id' => $faker->numberBetween(1, 10), - 'startdate' => '2017-01-01', - 'targetdate' => '2020-01-01', - 'currentamount' => 10, - ]; + 'id' => $faker->unique()->numberBetween(100, 10000), + 'piggy_bank_id' => $faker->numberBetween(1, 10), + 'startdate' => '2017-01-01', + 'targetdate' => '2020-01-01', + 'currentamount' => 10, + ]; } ); @@ -143,15 +142,15 @@ $factory->define( FireflyIII\Models\PiggyBank::class, function (Faker\Generator $faker) { return [ - 'id' => $faker->unique()->numberBetween(100, 10000), - 'account_id' => $faker->numberBetween(1, 10), - 'name' => $faker->words(3, true), - 'target_amount' => '1000.00', - 'startdate' => '2017-01-01', - 'order' => 1, - 'active' => 1, - 'encrypted' => 0, - ]; + 'id' => $faker->unique()->numberBetween(100, 10000), + 'account_id' => $faker->numberBetween(1, 10), + 'name' => $faker->words(3, true), + 'target_amount' => '1000.00', + 'startdate' => '2017-01-01', + 'order' => 1, + 'active' => 1, + 'encrypted' => 0, + ]; } ); @@ -159,11 +158,11 @@ $factory->define( FireflyIII\Models\Tag::class, function (Faker\Generator $faker) { return [ - 'id' => $faker->unique()->numberBetween(200, 10000), - 'user_id' => 1, - 'tagMode' => 'nothing', - 'tag' => $faker->words(1, true), - ]; + 'id' => $faker->unique()->numberBetween(200, 10000), + 'user_id' => 1, + 'tagMode' => 'nothing', + 'tag' => $faker->words(1, true), + ]; } ); @@ -171,9 +170,9 @@ $factory->define( FireflyIII\Models\Category::class, function (Faker\Generator $faker) { return [ - 'id' => $faker->numberBetween(1, 10), - 'name' => $faker->words(3, true), - ]; + 'id' => $faker->numberBetween(1, 10), + 'name' => $faker->words(3, true), + ]; } ); @@ -181,9 +180,9 @@ $factory->define( FireflyIII\Models\Budget::class, function (Faker\Generator $faker) { return [ - 'id' => $faker->numberBetween(1, 10), - 'name' => $faker->words(3, true), - ]; + 'id' => $faker->numberBetween(1, 10), + 'name' => $faker->words(3, true), + ]; } ); @@ -191,12 +190,12 @@ $factory->define( FireflyIII\Models\PiggyBankEvent::class, function (Faker\Generator $faker) { return [ - 'id' => $faker->numberBetween(1, 10), - 'piggy_bank_id' => $faker->numberBetween(1, 10), - 'transaction_journal_id' => $faker->numberBetween(1, 10), - 'date' => $faker->date('Y-m-d'), - 'amount' => '100', - ]; + 'id' => $faker->numberBetween(1, 10), + 'piggy_bank_id' => $faker->numberBetween(1, 10), + 'transaction_journal_id' => $faker->numberBetween(1, 10), + 'date' => $faker->date('Y-m-d'), + 'amount' => '100', + ]; } ); @@ -204,13 +203,12 @@ $factory->define( FireflyIII\Models\BudgetLimit::class, function (Faker\Generator $faker) { return [ - 'id' => $faker->numberBetween(1, 10), - 'start_date' => '2017-01-01', - 'end_date' => '2017-01-31', - 'amount' => '300', - 'budget_id' => $faker->numberBetween(1, 6), - - ]; + 'id' => $faker->numberBetween(1, 10), + 'start_date' => '2017-01-01', + 'end_date' => '2017-01-31', + 'amount' => '300', + 'budget_id' => $faker->numberBetween(1, 6), + ]; } ); @@ -218,11 +216,11 @@ $factory->define( FireflyIII\Models\Account::class, function (Faker\Generator $faker) { return [ - 'id' => $faker->unique()->numberBetween(1000, 10000), - 'name' => $faker->words(3, true), - 'account_type_id' => 1, - 'active' => true, - ]; + 'id' => $faker->unique()->numberBetween(1000, 10000), + 'name' => $faker->words(3, true), + 'account_type_id' => 1, + 'active' => true, + ]; } ); @@ -230,31 +228,31 @@ $factory->define( FireflyIII\Models\Transaction::class, function (Faker\Generator $faker) { return [ - 'transaction_amount' => strval($faker->randomFloat(2, -100, 100)), - 'destination_amount' => strval($faker->randomFloat(2, -100, 100)), - 'opposing_account_id' => $faker->numberBetween(1, 10), - 'source_account_id' => $faker->numberBetween(1, 10), - 'opposing_account_name' => $faker->words(3, true), - 'description' => $faker->words(3, true), - 'source_account_name' => $faker->words(3, true), - 'destination_account_id' => $faker->numberBetween(1, 10), - 'date' => new Carbon, - 'destination_account_name' => $faker->words(3, true), - 'amount' => strval($faker->randomFloat(2, -100, 100)), - 'budget_id' => 0, - 'category' => $faker->words(3, true), - 'transaction_journal_id' => $faker->numberBetween(1, 10), - 'journal_id' => $faker->numberBetween(1, 10), - 'transaction_currency_code' => 'EUR', - 'transaction_type_type' => 'Withdrawal', - 'account_encrypted' => 0, - 'account_name' => 'Some name', - 'transaction_currency_id' => 1, - 'transaction_currency_symbol' => '€', - 'foreign_destination_amount' => null, - 'foreign_currency_id' => null, - 'foreign_currency_code' => null, - 'foreign_currency_symbol' => null, - ]; + 'transaction_amount' => strval($faker->randomFloat(2, -100, 100)), + 'destination_amount' => strval($faker->randomFloat(2, -100, 100)), + 'opposing_account_id' => $faker->numberBetween(1, 10), + 'source_account_id' => $faker->numberBetween(1, 10), + 'opposing_account_name' => $faker->words(3, true), + 'description' => $faker->words(3, true), + 'source_account_name' => $faker->words(3, true), + 'destination_account_id' => $faker->numberBetween(1, 10), + 'date' => new Carbon, + 'destination_account_name' => $faker->words(3, true), + 'amount' => strval($faker->randomFloat(2, -100, 100)), + 'budget_id' => 0, + 'category' => $faker->words(3, true), + 'transaction_journal_id' => $faker->numberBetween(1, 10), + 'journal_id' => $faker->numberBetween(1, 10), + 'transaction_currency_code' => 'EUR', + 'transaction_type_type' => 'Withdrawal', + 'account_encrypted' => 0, + 'account_name' => 'Some name', + 'transaction_currency_id' => 1, + 'transaction_currency_symbol' => '€', + 'foreign_destination_amount' => null, + 'foreign_currency_id' => null, + 'foreign_currency_code' => null, + 'foreign_currency_symbol' => null, + ]; } ); diff --git a/database/migrations/2016_06_16_000000_create_support_tables.php b/database/migrations/2016_06_16_000000_create_support_tables.php index b3f848bee0..b47de14d0b 100644 --- a/database/migrations/2016_06_16_000000_create_support_tables.php +++ b/database/migrations/2016_06_16_000000_create_support_tables.php @@ -20,7 +20,6 @@ class CreateSupportTables extends Migration { /** * Reverse the migrations. - * */ public function down() { @@ -124,8 +123,7 @@ class CreateSupportTables extends Migration Schema::create( 'jobs', function (Blueprint $table) { - - // straight from Laravel + // straight from Laravel $table->bigIncrements('id'); $table->string('queue'); $table->longText('payload'); diff --git a/database/migrations/2016_06_16_000002_create_main_tables.php b/database/migrations/2016_06_16_000002_create_main_tables.php index 4823ac9e39..edc7eb3b36 100644 --- a/database/migrations/2016_06_16_000002_create_main_tables.php +++ b/database/migrations/2016_06_16_000002_create_main_tables.php @@ -60,7 +60,6 @@ class CreateMainTables extends Migration */ public function up() { - // $this->createAccountTables(); $this->createPiggyBanksTable(); $this->createAttachmentsTable(); @@ -433,7 +432,6 @@ class CreateMainTables extends Migration $table->boolean('active')->default(1); $table->boolean('stop_processing')->default(0); - // link rule id to rules table $table->foreign('rule_id')->references('id')->on('rules')->onDelete('cascade'); } @@ -454,7 +452,6 @@ class CreateMainTables extends Migration $table->boolean('active')->default(1); $table->boolean('stop_processing')->default(0); - // link rule id to rules table $table->foreign('rule_id')->references('id')->on('rules')->onDelete('cascade'); } @@ -583,7 +580,6 @@ class CreateMainTables extends Migration ); } - if (!Schema::hasTable('piggy_bank_events')) { Schema::create( 'piggy_bank_events', diff --git a/database/migrations/2016_08_25_091522_changes_for_3101.php b/database/migrations/2016_08_25_091522_changes_for_3101.php index 06389fba1a..4a9c2a33ec 100644 --- a/database/migrations/2016_08_25_091522_changes_for_3101.php +++ b/database/migrations/2016_08_25_091522_changes_for_3101.php @@ -23,7 +23,6 @@ class ChangesFor3101 extends Migration */ public function down() { - // } /** diff --git a/database/migrations/2016_09_12_121359_fix_nullables.php b/database/migrations/2016_09_12_121359_fix_nullables.php index d448b84c77..164e3e5236 100644 --- a/database/migrations/2016_09_12_121359_fix_nullables.php +++ b/database/migrations/2016_09_12_121359_fix_nullables.php @@ -18,7 +18,6 @@ use Illuminate\Database\Schema\Blueprint; */ class FixNullables extends Migration { - /** * Reverse the migrations. */ diff --git a/database/migrations/2016_10_09_150037_expand_transactions_table.php b/database/migrations/2016_10_09_150037_expand_transactions_table.php index 4c2b750c4b..2e33905fd8 100644 --- a/database/migrations/2016_10_09_150037_expand_transactions_table.php +++ b/database/migrations/2016_10_09_150037_expand_transactions_table.php @@ -8,7 +8,6 @@ * * See the LICENSE file for details. */ - declare(strict_types=1); use Illuminate\Database\Migrations\Migration; @@ -24,7 +23,6 @@ class ExpandTransactionsTable extends Migration */ public function down() { - // } /** diff --git a/database/migrations/2016_10_22_075804_changes_for_v410.php b/database/migrations/2016_10_22_075804_changes_for_v410.php index 308d5e13ba..b3931aeb78 100644 --- a/database/migrations/2016_10_22_075804_changes_for_v410.php +++ b/database/migrations/2016_10_22_075804_changes_for_v410.php @@ -8,7 +8,6 @@ * * See the LICENSE file for details. */ - declare(strict_types=1); use Illuminate\Database\Migrations\Migration; diff --git a/database/migrations/2016_11_24_210552_changes_for_v420.php b/database/migrations/2016_11_24_210552_changes_for_v420.php index c118c12a47..1ca2c5b652 100644 --- a/database/migrations/2016_11_24_210552_changes_for_v420.php +++ b/database/migrations/2016_11_24_210552_changes_for_v420.php @@ -8,7 +8,6 @@ * * See the LICENSE file for details. */ - declare(strict_types=1); use Illuminate\Database\Migrations\Migration; @@ -24,7 +23,6 @@ class ChangesForV420 extends Migration */ public function down() { - // } /** diff --git a/database/migrations/2016_12_22_150431_changes_for_v430.php b/database/migrations/2016_12_22_150431_changes_for_v430.php index 69a32f727e..57be784576 100644 --- a/database/migrations/2016_12_22_150431_changes_for_v430.php +++ b/database/migrations/2016_12_22_150431_changes_for_v430.php @@ -8,10 +8,8 @@ * * See the LICENSE file for details. */ - declare(strict_types=1); - use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; @@ -47,7 +45,6 @@ class ChangesForV430 extends Migration $table->date('start_date'); $table->date('end_date'); - $table->foreign('transaction_currency_id')->references('id')->on('transaction_currencies')->onDelete('cascade'); $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); } 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 7e856c4987..9beb9fd9f6 100644 --- a/database/migrations/2016_12_28_203205_changes_for_v431.php +++ b/database/migrations/2016_12_28_203205_changes_for_v431.php @@ -8,7 +8,6 @@ * * See the LICENSE file for details. */ - declare(strict_types=1); use Illuminate\Database\Migrations\Migration; @@ -21,8 +20,6 @@ class ChangesForV431 extends Migration { /** * Reverse the migrations. - * - * @return void */ public function down() { @@ -40,7 +37,6 @@ class ChangesForV431 extends Migration } ); - // remove date field "end_date" Schema::table( 'budget_limits', diff --git a/database/migrations/2017_04_13_163623_changes_for_v440.php b/database/migrations/2017_04_13_163623_changes_for_v440.php index bc18523dfc..be6aa0e697 100644 --- a/database/migrations/2017_04_13_163623_changes_for_v440.php +++ b/database/migrations/2017_04_13_163623_changes_for_v440.php @@ -8,10 +8,8 @@ * * See the LICENSE file for details. */ - declare(strict_types=1); - use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; @@ -22,8 +20,6 @@ class ChangesForV440 extends Migration { /** * Reverse the migrations. - * - * @return void */ public function down() { @@ -36,7 +32,6 @@ class ChangesForV440 extends Migration * Run the migrations. * * @SuppressWarnings(PHPMD.ShortMethodName) - * @return void */ public function up() { @@ -60,7 +55,7 @@ class ChangesForV440 extends Migration } ); } - // + Schema::table( 'transactions', function (Blueprint $table) { diff --git a/database/migrations/2017_06_02_105232_changes_for_v450.php b/database/migrations/2017_06_02_105232_changes_for_v450.php index 430565399d..dbc92fe4da 100644 --- a/database/migrations/2017_06_02_105232_changes_for_v450.php +++ b/database/migrations/2017_06_02_105232_changes_for_v450.php @@ -8,10 +8,8 @@ * * See the LICENSE file for details. */ - declare(strict_types=1); - use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; @@ -22,8 +20,6 @@ class ChangesForV450 extends Migration { /** * Reverse the migrations. - * - * @return void */ public function down() { @@ -33,7 +29,6 @@ class ChangesForV450 extends Migration * Run the migrations. * * @SuppressWarnings(PHPMD.ShortMethodName) - * @return void */ public function up() { diff --git a/database/migrations/2017_08_20_062014_changes_for_v470.php b/database/migrations/2017_08_20_062014_changes_for_v470.php index 06743a5e3d..0f1173a17f 100644 --- a/database/migrations/2017_08_20_062014_changes_for_v470.php +++ b/database/migrations/2017_08_20_062014_changes_for_v470.php @@ -1,6 +1,6 @@ string('inward'); $table->boolean('editable'); - $table->unique(['name', 'outward','inward']); + $table->unique(['name', 'outward', 'inward']); } ); } @@ -62,7 +59,7 @@ class ChangesForV470 extends Migration $table->foreign('source_id')->references('id')->on('transaction_journals')->onDelete('cascade'); $table->foreign('destination_id')->references('id')->on('transaction_journals')->onDelete('cascade'); - $table->unique(['link_type_id','source_id','destination_id']); + $table->unique(['link_type_id', 'source_id', 'destination_id']); } ); } diff --git a/database/migrations/2017_11_04_170844_changes_for_v470a.php b/database/migrations/2017_11_04_170844_changes_for_v470a.php index 4b0e593ece..6ebbdb0a23 100644 --- a/database/migrations/2017_11_04_170844_changes_for_v470a.php +++ b/database/migrations/2017_11_04_170844_changes_for_v470a.php @@ -1,6 +1,6 @@ 'XBT', 'name' => 'Bitcoin', 'symbol' => '₿', 'decimal_places' => 8]); TransactionCurrency::create(['code' => 'BCH', 'name' => 'Bitcoin cash', 'symbol' => '₿C', 'decimal_places' => 8]); TransactionCurrency::create(['code' => 'ETH', 'name' => 'Ethereum', 'symbol' => 'Ξ', 'decimal_places' => 12]); - - - - - - } } diff --git a/database/seeds/TransactionTypeSeeder.php b/database/seeds/TransactionTypeSeeder.php index c9d9cc37df..f12c118758 100644 --- a/database/seeds/TransactionTypeSeeder.php +++ b/database/seeds/TransactionTypeSeeder.php @@ -8,7 +8,6 @@ * * See the LICENSE file for details. */ - declare(strict_types=1); use FireflyIII\Models\TransactionType; diff --git a/public/js/ff/charts.js b/public/js/ff/charts.js index 4595bb6a4a..c4d42ae173 100644 --- a/public/js/ff/charts.js +++ b/public/js/ff/charts.js @@ -21,8 +21,6 @@ var allCharts = {}; - - /* Make some colours: */ @@ -61,8 +59,6 @@ Chart.defaults.global.responsive = true; Chart.defaults.global.maintainAspectRatio = false; - - /** * Chart line thing */ @@ -92,12 +88,15 @@ const verticalLinePlugin = { afterDatasetsDraw: function (chart, easing) { if (chart.config.lineAtIndex) { - chart.config.lineAtIndex.forEach(pointIndex => this.renderVerticalLine(chart, pointIndex)); + chart.config.lineAtIndex.forEach(pointIndex = > this.renderVerticalLine(chart, pointIndex) + ) + ; } } }; Chart.plugins.register(verticalLinePlugin); + /** * * @param data @@ -343,8 +342,8 @@ function drawAChart(URI, container, chartType, options, colorData, today) { options: options, lineAtIndex: [] }; - if(today >= 0) { - chartOpts.lineAtIndex.push(today-1); + if (today >= 0) { + chartOpts.lineAtIndex.push(today - 1); console.log('push opt'); } allCharts[container] = new Chart(ctx, chartOpts); diff --git a/public/js/ff/index.js b/public/js/ff/index.js index 2dfb20fa92..114ce5315a 100644 --- a/public/js/ff/index.js +++ b/public/js/ff/index.js @@ -29,7 +29,7 @@ $(function () { function drawChart() { "use strict"; - if(today >= 0) { + if (today >= 0) { lineChartWithDay(accountFrontpageUri, 'accounts-chart', today); } else { lineChart(accountFrontpageUri, 'accounts-chart'); diff --git a/tests/CreatesApplication.php b/tests/CreatesApplication.php index f74c104bda..03b1443d26 100644 --- a/tests/CreatesApplication.php +++ b/tests/CreatesApplication.php @@ -18,10 +18,8 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); - namespace Tests; use Illuminate\Contracts\Console\Kernel; diff --git a/tests/Feature/Controllers/AccountControllerTest.php b/tests/Feature/Controllers/AccountControllerTest.php index e8bf5a1d40..c21501e367 100644 --- a/tests/Feature/Controllers/AccountControllerTest.php +++ b/tests/Feature/Controllers/AccountControllerTest.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace Tests\Feature\Controllers; @@ -42,7 +41,6 @@ use Tests\TestCase; /** * Class AccountControllerTest * - * @package Tests\Feature\Controllers * @SuppressWarnings(PHPMD.TooManyPublicMethods) * @SuppressWarnings(PHPMD.ExcessiveMethodLength) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -79,7 +77,6 @@ class AccountControllerTest extends TestCase $repository->shouldReceive('getAccountsByType')->withArgs([[AccountType::ASSET]])->andReturn(new Collection); $journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal); - $this->be($this->user()); $account = $this->user()->accounts()->where('account_type_id', 3)->whereNull('deleted_at')->first(); $response = $this->get(route('accounts.delete', [$account->id])); @@ -191,7 +188,6 @@ class AccountControllerTest extends TestCase $collector->shouldReceive('getJournals')->andReturn(new Collection([$transaction])); $collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([$transaction], 0, 10)); - $this->be($this->user()); $this->changeDateRange($this->user(), $range); $response = $this->get(route('accounts.show', [1])); @@ -222,7 +218,6 @@ class AccountControllerTest extends TestCase $collector->shouldReceive('getPaginatedJournals')->andReturn(new LengthAwarePaginator([$transaction], 0, 10)); - $tasker = $this->mock(AccountTaskerInterface::class); $tasker->shouldReceive('amountOutInPeriod')->withAnyArgs()->andReturn('-1'); $tasker->shouldReceive('amountInInPeriod')->withAnyArgs()->andReturn('1'); diff --git a/tests/Feature/Controllers/Admin/ConfigurationControllerTest.php b/tests/Feature/Controllers/Admin/ConfigurationControllerTest.php index 7181a3c956..5b2aeb57b8 100644 --- a/tests/Feature/Controllers/Admin/ConfigurationControllerTest.php +++ b/tests/Feature/Controllers/Admin/ConfigurationControllerTest.php @@ -18,12 +18,10 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace Tests\Feature\Controllers\Admin; - use FireflyConfig; use FireflyIII\Models\Configuration; use Tests\TestCase; @@ -31,14 +29,12 @@ use Tests\TestCase; /** * Class ConfigurationControllerTest * - * @package Tests\Feature\Controllers\Admin * @SuppressWarnings(PHPMD.TooManyPublicMethods) * @SuppressWarnings(PHPMD.ExcessiveMethodLength) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class ConfigurationControllerTest extends TestCase { - /** * @covers \FireflyIII\Http\Controllers\Admin\ConfigurationController::index * @covers \FireflyIII\Http\Controllers\Admin\ConfigurationController::__construct @@ -80,5 +76,4 @@ class ConfigurationControllerTest extends TestCase $response->assertSessionHas('success'); $response->assertStatus(302); } - } diff --git a/tests/Feature/Controllers/Admin/HomeControllerTest.php b/tests/Feature/Controllers/Admin/HomeControllerTest.php index e34ede9b46..3c87eb27af 100644 --- a/tests/Feature/Controllers/Admin/HomeControllerTest.php +++ b/tests/Feature/Controllers/Admin/HomeControllerTest.php @@ -18,7 +18,6 @@ * You should have received a copy of the GNU General Public License * along with Firefly III. If not, see . */ - declare(strict_types=1); namespace Tests\Feature\Controllers\Admin; @@ -28,14 +27,12 @@ use Tests\TestCase; /** * Class HomeControllerTest * - * @package Tests\Feature\Controllers\Admin * @SuppressWarnings(PHPMD.TooManyPublicMethods) * @SuppressWarnings(PHPMD.ExcessiveMethodLength) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class HomeControllerTest extends TestCase { - /** * @covers \FireflyIII\Http\Controllers\Admin\HomeController::index */ @@ -47,5 +44,4 @@ class HomeControllerTest extends TestCase // has bread crumb $response->assertSee('