Various code cleanup.

This commit is contained in:
James Cole
2021-09-18 10:20:19 +02:00
parent 481a6bdd5f
commit 3589c9f60f
137 changed files with 369 additions and 282 deletions

View File

@@ -57,6 +57,7 @@ class CorrectOpeningBalanceCurrencies extends Command
* Execute the console command.
*
* @return int
* @throws JsonException
*/
public function handle(): int
{
@@ -96,7 +97,6 @@ class CorrectOpeningBalanceCurrencies extends Command
* @param TransactionJournal $journal
*
* @return int
* @throws JsonException
*/
private function correctJournal(TransactionJournal $journal): int
{

View File

@@ -27,7 +27,6 @@ use Exception;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
use Illuminate\Console\Command;
use Illuminate\Support\Collection;
/**
* Class DeleteZeroAmount

View File

@@ -33,7 +33,6 @@ use FireflyIII\Models\AccountType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\Support\Export\ExportDataGenerator;
use FireflyIII\User;
use Illuminate\Console\Command;
use Illuminate\Support\Collection;
use InvalidArgumentException;
@@ -82,9 +81,7 @@ class ExportData extends Command
* Execute the console command.
*
* @return int
* @throws CannotInsertRecord
* @throws FireflyException
* @throws \League\Csv\Exception
*/
public function handle(): int
{

View File

@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands\Upgrade;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountMeta;
use FireflyIII\Models\AccountType;
@@ -63,6 +64,7 @@ class AccountCurrencies extends Command
* Each (asset) account must have a reference to a preferred currency. If the account does not have one, it's forced upon the account.
*
* @return int
* @throws FireflyException
*/
public function handle(): int
{
@@ -106,7 +108,7 @@ class AccountCurrencies extends Command
/**
* @return bool
* @throws \FireflyIII\Exceptions\FireflyException
* @throws FireflyException
*/
private function isExecuted(): bool
{
@@ -136,7 +138,7 @@ class AccountCurrencies extends Command
* @param User $user
* @param string $systemCurrencyCode
*
* @throws \FireflyIII\Exceptions\FireflyException
* @throws FireflyException
*/
private function updateCurrenciesForUser(User $user, string $systemCurrencyCode): void
{

View File

@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands\Upgrade;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\BudgetLimit;
use Illuminate\Console\Command;
use Log;
@@ -47,6 +48,7 @@ class AppendBudgetLimitPeriods extends Command
* Execute the console command.
*
* @return int
* @throws FireflyException
*/
public function handle(): int
{
@@ -69,7 +71,7 @@ class AppendBudgetLimitPeriods extends Command
/**
* @return bool
* @throws \FireflyIII\Exceptions\FireflyException
* @throws FireflyException
*/
private function isExecuted(): bool
{

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands\Upgrade;
use DB;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Budget;
use FireflyIII\Models\Category;
use FireflyIII\Models\Transaction;
@@ -55,6 +56,7 @@ class BackToJournals extends Command
* Execute the console command.
*
* @return int
* @throws FireflyException
*/
public function handle(): int
{
@@ -83,7 +85,7 @@ class BackToJournals extends Command
/**
* @return bool
* @throws \FireflyIII\Exceptions\FireflyException
* @throws FireflyException
*/
private function isMigrated(): bool
{
@@ -94,7 +96,7 @@ class BackToJournals extends Command
/**
* @return bool
* @throws \FireflyIII\Exceptions\FireflyException
* @throws FireflyException
*/
private function isExecuted(): bool
{

View File

@@ -23,7 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands\Upgrade;
use FireflyIII\Models\Budget;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\BudgetLimit;
use Illuminate\Console\Command;
@@ -50,6 +50,8 @@ class BudgetLimitCurrency extends Command
* Execute the console command.
*
* @return int
* @throws FireflyException
* @throws \JsonException
*/
public function handle(): int
{
@@ -95,7 +97,7 @@ class BudgetLimitCurrency extends Command
/**
* @return bool
* @throws \FireflyIII\Exceptions\FireflyException
* @throws FireflyException
*/
private function isExecuted(): bool
{

View File

@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands\Upgrade;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use Illuminate\Console\Command;
@@ -51,6 +52,7 @@ class CCLiabilities extends Command
* Execute the console command.
*
* @return int
* @throws FireflyException
*/
public function handle(): int
{
@@ -79,7 +81,7 @@ class CCLiabilities extends Command
$this->line(sprintf('Converted credit card liability account "%s" (#%d) to generic debt liability.', $account->name, $account->id));
}
if ($accounts->count() > 0) {
$this->info('Credit card liability types are no longer supported and have been converted to generic debts. See: http://bit.ly/FF3-credit-cards');
$this->info('Credit card liability types are no longer supported and have been converted to generic debts. See: https://bit.ly/FF3-credit-cards');
}
if (0 === $accounts->count()) {
$this->info('No incorrectly stored credit card liabilities.');
@@ -93,7 +95,7 @@ class CCLiabilities extends Command
/**
* @return bool
* @throws \FireflyIII\Exceptions\FireflyException
* @throws FireflyException
*/
private function isExecuted(): bool
{

View File

@@ -76,6 +76,7 @@ class CreateGroupMemberships extends Command
/**
* @return bool
* @throws FireflyException
*/
private function isExecuted(): bool
{

View File

@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands\Upgrade;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Attachment;
use FireflyIII\Models\Note;
use Illuminate\Console\Command;
@@ -51,6 +52,7 @@ class MigrateAttachments extends Command
* Execute the console command.
*
* @return int
* @throws FireflyException
*/
public function handle(): int
{
@@ -105,7 +107,7 @@ class MigrateAttachments extends Command
/**
* @return bool
* @throws \FireflyIII\Exceptions\FireflyException
* @throws FireflyException
*/
private function isExecuted(): bool
{

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands\Upgrade;
use Exception;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Note;
use FireflyIII\Models\TransactionJournalMeta;
use Illuminate\Console\Command;
@@ -52,6 +53,7 @@ class MigrateJournalNotes extends Command
* Execute the console command.
*
* @return int
* @throws FireflyException
*/
public function handle(): int
{
@@ -103,7 +105,7 @@ class MigrateJournalNotes extends Command
/**
* @return bool
* @throws \FireflyIII\Exceptions\FireflyException
* @throws FireflyException
*/
private function isExecuted(): bool
{

View File

@@ -24,9 +24,11 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands\Upgrade;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\RecurrenceMeta;
use FireflyIII\Models\RecurrenceTransactionMeta;
use Illuminate\Console\Command;
use JsonException;
/**
* Class MigrateRecurrenceMeta
@@ -51,6 +53,8 @@ class MigrateRecurrenceMeta extends Command
* Execute the console command.
*
* @return int
* @throws FireflyException
* @throws JsonException
*/
public function handle(): int
{
@@ -79,7 +83,7 @@ class MigrateRecurrenceMeta extends Command
/**
* @return bool
* @throws \FireflyIII\Exceptions\FireflyException
* @throws FireflyException
*/
private function isExecuted(): bool
{
@@ -93,7 +97,7 @@ class MigrateRecurrenceMeta extends Command
/**
* @return int
* @throws \JsonException
* @throws JsonException
*/
private function migrateMetaData(): int
{
@@ -112,7 +116,7 @@ class MigrateRecurrenceMeta extends Command
* @param RecurrenceMeta $meta
*
* @return int
* @throws \JsonException
* @throws JsonException
*/
private function migrateEntry(RecurrenceMeta $meta): int
{

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands\Upgrade;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Recurrence;
use FireflyIII\Models\RecurrenceTransaction;
use FireflyIII\Models\TransactionType;
@@ -52,6 +53,7 @@ class MigrateRecurrenceType extends Command
* Execute the console command.
*
* @return int
* @throws FireflyException
*/
public function handle(): int
{
@@ -74,7 +76,7 @@ class MigrateRecurrenceType extends Command
/**
* @return bool
* @throws \FireflyIII\Exceptions\FireflyException
* @throws FireflyException
*/
private function isExecuted(): bool
{

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands\Upgrade;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Location;
use FireflyIII\Models\Tag;
use Illuminate\Console\Command;
@@ -52,6 +53,7 @@ class MigrateTagLocations extends Command
* Execute the console command.
*
* @return int
* @throws FireflyException
*/
public function handle(): int
{
@@ -72,7 +74,7 @@ class MigrateTagLocations extends Command
/**
* @return bool
* @throws \FireflyIII\Exceptions\FireflyException
* @throws FireflyException
*/
private function isExecuted(): bool
{

View File

@@ -25,6 +25,7 @@ namespace FireflyIII\Console\Commands\Upgrade;
use DB;
use Exception;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Factory\TransactionGroupFactory;
use FireflyIII\Models\Budget;
use FireflyIII\Models\Category;
@@ -127,7 +128,7 @@ class MigrateToGroups extends Command
/**
* @return bool
* @throws \FireflyIII\Exceptions\FireflyException
* @throws FireflyException
*/
private function isMigrated(): bool
{

View File

@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands\Upgrade;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\Transaction;
@@ -70,6 +71,7 @@ class OtherCurrenciesCorrections extends Command
* Execute the console command.
*
* @return int
* @throws FireflyException
*/
public function handle(): int
{
@@ -112,7 +114,7 @@ class OtherCurrenciesCorrections extends Command
/**
* @return bool
* @throws \FireflyIII\Exceptions\FireflyException
* @throws FireflyException
*/
private function isExecuted(): bool
{

View File

@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands\Upgrade;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\AccountMeta;
use Illuminate\Console\Command;
@@ -49,6 +50,7 @@ class RenameAccountMeta extends Command
* Execute the console command.
*
* @return int
* @throws FireflyException
*/
public function handle(): int
{
@@ -96,7 +98,7 @@ class RenameAccountMeta extends Command
/**
* @return bool
* @throws \FireflyIII\Exceptions\FireflyException
* @throws FireflyException
*/
private function isExecuted(): bool
{

View File

@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands\Upgrade;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Journal\JournalCLIRepositoryInterface;
@@ -67,6 +68,7 @@ class TransactionIdentifier extends Command
* think. So each set gets a number (1,2,3) to keep them apart.
*
* @return int
* @throws FireflyException
*/
public function handle(): int
{
@@ -120,7 +122,7 @@ class TransactionIdentifier extends Command
/**
* @return bool
* @throws \FireflyIII\Exceptions\FireflyException
* @throws FireflyException
*/
private function isExecuted(): bool
{

View File

@@ -132,6 +132,7 @@ class TransferCurrenciesCorrections extends Command
/**
* @return bool
* @throws \FireflyIII\Exceptions\FireflyException
*/
private function isExecuted(): bool
{
@@ -169,7 +170,7 @@ class TransferCurrenciesCorrections extends Command
if ($this->isSplitJournal($transfer)) {
$this->line(sprintf(sprintf('Transaction journal #%d is a split journal. Cannot continue.', $transfer->id)));
$this->line(sprintf('Transaction journal #%d is a split journal. Cannot continue.', $transfer->id));
return;
}
@@ -246,7 +247,7 @@ class TransferCurrenciesCorrections extends Command
private function getSourceInformation(TransactionJournal $journal): void
{
$this->sourceTransaction = $this->getSourceTransaction($journal);
$this->sourceAccount = null === $this->sourceTransaction ? null : $this->sourceTransaction->account;
$this->sourceAccount = $this->sourceTransaction?->account;
$this->sourceCurrency = null === $this->sourceAccount ? null : $this->getCurrency($this->sourceAccount);
}
@@ -298,7 +299,7 @@ class TransferCurrenciesCorrections extends Command
private function getDestinationInformation(TransactionJournal $journal): void
{
$this->destinationTransaction = $this->getDestinationTransaction($journal);
$this->destinationAccount = null === $this->destinationTransaction ? null : $this->destinationTransaction->account;
$this->destinationAccount = $this->destinationTransaction?->account;
$this->destinationCurrency = null === $this->destinationAccount ? null : $this->getCurrency($this->destinationAccount);
}

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands\Upgrade;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Factory\AccountMetaFactory;
use FireflyIII\Models\Account;
use FireflyIII\Models\Transaction;
@@ -57,6 +58,7 @@ class UpgradeLiabilities extends Command
* Execute the console command.
*
* @return int
* @throws FireflyException
*/
public function handle(): int
{
@@ -78,7 +80,7 @@ class UpgradeLiabilities extends Command
/**
* @return bool
* @throws \FireflyIII\Exceptions\FireflyException
* @throws FireflyException
*/
private function isExecuted(): bool
{

View File

@@ -24,9 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands;
use FireflyIII\Support\System\GeneratesInstallationId;
use FireflyIII\User;
use Illuminate\Console\Command;
use Illuminate\Database\QueryException;
/**
* Class UpgradeFireflyInstructions.

View File

@@ -51,6 +51,7 @@ class VerifySecurityAlerts extends Command
* Execute the console command.
*
* @return int
* @throws \Illuminate\Contracts\Filesystem\FileNotFoundException
*/
public function handle(): int
{