Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Code clean up.
James Coleffca858b8d7c
diff --git a/app/Console/Commands/CreateExport.php b/app/Console/Commands/CreateExport.phpindex c991d086cd..0d55833af7 100644--- a/app/Console/Commands/CreateExport.php+++ b/app/Console/Commands/CreateExport.php@@ -18,10 +18,8 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);-namespace FireflyIII\Console\Commands;use Carbon\Carbon;@@ -35,11 +33,9 @@ use Illuminate\Console\Command;use Storage;/**- * Class CreateExport+ * Class CreateExport.** Generates export from the command line.- *- * @package FireflyIII\Console\Commands*/class CreateExport extends Command{@@ -65,7 +61,6 @@ class CreateExport extends Command/*** Create a new command instance.- **/public function __construct(){@@ -73,7 +68,6 @@ class CreateExport extends Command}/**- ** @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's five its fine.* @SuppressWarnings(PHPMD.ExcessiveMethodLength)*@@ -108,7 +102,7 @@ class CreateExport extends Command// first date$firstJournal = $journalRepository->first();$first = new Carbon;- if (!is_null($firstJournal->id)) {+ if (null !== $firstJournal->id) {$first = $firstJournal->date;}@@ -124,7 +118,6 @@ class CreateExport extends Command'job' => $job,];-/** @var ProcessorInterface $processor */$processor = app(ProcessorInterface::class);$processor->setSettings($settings);diff --git a/app/Console/Commands/CreateImport.php b/app/Console/Commands/CreateImport.phpindex d0cc7136dc..69b034ac7d 100644--- a/app/Console/Commands/CreateImport.php+++ b/app/Console/Commands/CreateImport.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Console\Commands;@@ -35,9 +34,7 @@ use Monolog\Formatter\LineFormatter;use Preferences;/**- * Class CreateImport- *- * @package FireflyIII\Console\Commands+ * Class CreateImport.*/class CreateImport extends Command{@@ -65,7 +62,6 @@ class CreateImport extends Command/*** Create a new command instance.- **/public function __construct(){@@ -98,7 +94,7 @@ class CreateImport extends Command}$configurationData = json_decode(file_get_contents($configuration));- if (is_null($configurationData)) {+ if (null === $configurationData) {$this->error(sprintf('Firefly III cannot read the contents of configuration file "%s" (working directory: "%s").', $configuration, $cwd));return;@@ -109,25 +105,21 @@ class CreateImport extends Command$this->line(sprintf('Import into user: #%d (%s)', $user->id, $user->email));$this->line(sprintf('Type of import: %s', $type));-/** @var ImportJobRepositoryInterface $jobRepository */$jobRepository = app(ImportJobRepositoryInterface::class);$jobRepository->setUser($user);$job = $jobRepository->create($type);$this->line(sprintf('Created job "%s"', $job->key));-Artisan::call('firefly:encrypt-file', ['file' => $file, 'key' => $job->key]);$this->line('Stored import data...');-$job->configuration = $configurationData;$job->status = 'configured';$job->save();$this->line('Stored configuration...');-- if ($this->option('start') === true) {+ if (true === $this->option('start')) {$this->line('The import will start in a moment. This process is not visible...');Log::debug('Go for import!');@@ -138,7 +130,6 @@ class CreateImport extends Command$handler->setFormatter($formatter);$monolog->pushHandler($handler);-// start the actual routine:/** @var ImportRoutine $routine */$routine = app(ImportRoutine::class);@@ -177,7 +168,7 @@ class CreateImport extends Command$cwd = getcwd();$validTypes = array_keys(config('firefly.import_formats'));$type = strtolower($this->option('type'));- if (is_null($user->id)) {+ if (null === $user->id) {$this->error(sprintf('There is no user with ID %d.', $this->option('user')));return false;diff --git a/app/Console/Commands/DecryptAttachment.php b/app/Console/Commands/DecryptAttachment.phpindex 226c66c9fd..e574a9cd00 100644--- a/app/Console/Commands/DecryptAttachment.php+++ b/app/Console/Commands/DecryptAttachment.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Console\Commands;@@ -28,9 +27,7 @@ use Illuminate\Console\Command;use Log;/**- * Class DecryptAttachment- *- * @package FireflyIII\Console\Commands+ * Class DecryptAttachment.*/class DecryptAttachment extends Command{@@ -50,10 +47,8 @@ class DecryptAttachment extends Command= 'firefly:decrypt-attachment {id:The ID of the attachment.} {name:The file name of the attachment.}{directory:Where the file must be stored.}';-/*** Create a new command instance.- **/public function __construct(){@@ -65,7 +60,6 @@ class DecryptAttachment extends Command** @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's five its fine.* @SuppressWarnings(PHPMD.ExcessiveMethodLength)- **/public function handle(){@@ -75,7 +69,7 @@ class DecryptAttachment extends Command$attachment = $repository->findWithoutUser($attachmentId);$attachmentName = trim($this->argument('name'));$storagePath = realpath(trim($this->argument('directory')));- if (is_null($attachment->id)) {+ if (null === $attachment->id) {$this->error(sprintf('No attachment with id #%d', $attachmentId));Log::error(sprintf('DecryptAttachment: No attachment with id #%d', $attachmentId));@@ -107,7 +101,7 @@ class DecryptAttachment extends Command$content = $repository->getContent($attachment);$this->line(sprintf('Going to write content for attachment #%d into file "%s"', $attachment->id, $fullPath));$result = file_put_contents($fullPath, $content);- if ($result === false) {+ if (false === $result) {$this->error('Could not write to file.');return;diff --git a/app/Console/Commands/EncryptFile.php b/app/Console/Commands/EncryptFile.phpindex acd355060c..a90d9e819b 100644--- a/app/Console/Commands/EncryptFile.php+++ b/app/Console/Commands/EncryptFile.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Console\Commands;@@ -27,9 +26,7 @@ use Crypt;use Illuminate\Console\Command;/**- * Class EncryptFile- *- * @package FireflyIII\Console\Commands+ * Class EncryptFile.*/class EncryptFile extends Command{@@ -49,7 +46,6 @@ class EncryptFile extends Command/*** Create a new command instance.- **/public function __construct(){diff --git a/app/Console/Commands/Import.php b/app/Console/Commands/Import.phpindex 0e1f861a55..d4208dea70 100644--- a/app/Console/Commands/Import.php+++ b/app/Console/Commands/Import.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Console\Commands;@@ -31,9 +30,7 @@ use Illuminate\Support\MessageBag;use Log;/**- * Class Import- *- * @package FireflyIII\Console\Commands+ * Class Import.*/class Import extends Command{@@ -53,7 +50,6 @@ class Import extends Command/*** Create a new command instance.- **/public function __construct(){@@ -68,7 +64,7 @@ class Import extends CommandLog::debug('Start start-import command');$jobKey = $this->argument('key');$job = ImportJob::where('key', $jobKey)->first();- if (is_null($job)) {+ if (null === $job) {$this->error(sprintf('No job found with key "%s"', $jobKey));return;@@ -109,14 +105,14 @@ class Import extends Command*/private function isValid(ImportJob $job): bool{- if (is_null($job)) {+ if (null === $job) {Log::error('This job does not seem to exist.');$this->error('This job does not seem to exist.');return false;}- if ($job->status !== 'configured') {+ if ('configured' !== $job->status) {Log::error(sprintf('This job is not ready to be imported (status is %s).', $job->status));$this->error('This job is not ready to be imported.');diff --git a/app/Console/Commands/ScanAttachments.php b/app/Console/Commands/ScanAttachments.phpindex e6dd31b0e0..53d84e9663 100644--- a/app/Console/Commands/ScanAttachments.php+++ b/app/Console/Commands/ScanAttachments.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Console\Commands;@@ -31,9 +30,7 @@ use Illuminate\Contracts\Filesystem\FileNotFoundException;use Storage;/**- * Class ScanAttachments- *- * @package FireflyIII\Console\Commands+ * Class ScanAttachments.*/class ScanAttachments extends Command{@@ -53,7 +50,6 @@ class ScanAttachments extends Command/*** Create a new command instance.- **/public function __construct(){diff --git a/app/Console/Commands/UpgradeDatabase.php b/app/Console/Commands/UpgradeDatabase.phpindex 5a97b618f6..c50664836d 100644--- a/app/Console/Commands/UpgradeDatabase.php+++ b/app/Console/Commands/UpgradeDatabase.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Console\Commands;@@ -44,17 +43,15 @@ use Preferences;use Schema;/**- * Class UpgradeDatabase+ * Class UpgradeDatabase.** Upgrade user database.*** @SuppressWarnings(PHPMD.CouplingBetweenObjects) // it just touches a lot of things.- * @package FireflyIII\Console\Commands*/class UpgradeDatabase extends Command{-/*** The console command description.*@@ -105,7 +102,7 @@ class UpgradeDatabase extends Commandforeach ($set as $budgetLimit) {/** @var LimitRepetition $repetition */$repetition = $budgetLimit->limitrepetitions()->first();- if (!is_null($repetition)) {+ if (null !== $repetition) {$budgetLimit->end_date = $repetition->enddate;$budgetLimit->save();$this->line(sprintf('Updated budget limit #%d', $budgetLimit->id));@@ -170,7 +167,7 @@ class UpgradeDatabase extends Command$obCurrency = intval($openingBalance->transaction_currency_id);// both 0? set to default currency:- if ($accountCurrency === 0 && $obCurrency === 0) {+ if (0 === $accountCurrency && 0 === $obCurrency) {AccountMeta::create(['account_id' => $account->id, 'name' => 'currency_id', 'data' => $defaultCurrency->id]);$this->line(sprintf('Account #%d ("%s") now has a currency setting (%s).', $account->id, $account->name, $defaultCurrencyCode));@@ -178,7 +175,7 @@ class UpgradeDatabase extends Command}// account is set to 0, opening balance is not?- if ($accountCurrency === 0 && $obCurrency > 0) {+ if (0 === $accountCurrency && $obCurrency > 0) {AccountMeta::create(['account_id' => $account->id, 'name' => 'currency_id', 'data' => $obCurrency]);$this->line(sprintf('Account #%d ("%s") now has a currency setting (%s).', $account->id, $account->name, $defaultCurrencyCode));@@ -228,7 +225,7 @@ class UpgradeDatabase extends Command->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')->whereIn('account_types.type', [AccountType::DEFAULT, AccountType::ASSET])->first(['transactions.*']);- if (is_null($transaction)) {+ if (null === $transaction) {return;}/** @var Account $account */@@ -237,7 +234,7 @@ class UpgradeDatabase extends Command$transactions = $journal->transactions()->get();$transactions->each(function (Transaction $transaction) use ($currency) {- if (is_null($transaction->transaction_currency_id)) {+ if (null === $transaction->transaction_currency_id) {$transaction->transaction_currency_id = $currency->id;$transaction->save();}@@ -302,7 +299,7 @@ class UpgradeDatabase extends Commandforeach ($set as $meta) {$journal = $meta->transactionJournal;$note = $journal->notes()->first();- if (is_null($note)) {+ if (null === $note) {$note = new Note;$note->noteable()->associate($journal);}@@ -314,7 +311,6 @@ class UpgradeDatabase extends Command}}-/*** This method makes sure that the transaction journal uses the currency given in the transaction.*@@ -375,7 +371,7 @@ class UpgradeDatabase extends Commandreturn;}- if (!is_null($opposing)) {+ if (null !== $opposing) {// give both a new identifier:$transaction->identifier = $identifier;$opposing->identifier = $identifier;@@ -384,7 +380,7 @@ class UpgradeDatabase extends Command$processed[] = $transaction->id;$processed[] = $opposing->id;}- $identifier++;+ ++$identifier;}return;@@ -411,7 +407,7 @@ class UpgradeDatabase extends Command$currency = $repository->find(intval($transaction->account->getMeta('currency_id')));// has no currency ID? Must have, so fill in using account preference:- if (is_null($transaction->transaction_currency_id)) {+ if (null === $transaction->transaction_currency_id) {$transaction->transaction_currency_id = $currency->id;Log::debug(sprintf('Transaction #%d has no currency setting, now set to %s', $transaction->id, $currency->code));$transaction->save();@@ -419,7 +415,7 @@ class UpgradeDatabase extends Command// does not match the source account (see above)? Can be fixed// when mismatch in transaction and NO foreign amount is set:- if ($transaction->transaction_currency_id !== $currency->id && is_null($transaction->foreign_amount)) {+ if ($transaction->transaction_currency_id !== $currency->id && null === $transaction->foreign_amount) {Log::debug(sprintf('Transaction #%d has a currency setting (#%d) that should be #%d. Amount remains %s, currency is changed.',@@ -440,7 +436,7 @@ class UpgradeDatabase extends Command$opposing = $journal->transactions()->where('amount', '>', 0)->where('identifier', $transaction->identifier)->first();$opposingCurrency = $repository->find(intval($opposing->account->getMeta('currency_id')));- if (is_null($opposingCurrency->id)) {+ if (null === $opposingCurrency->id) {Log::error(sprintf('Account #%d ("%s") must have currency preference but has none.', $opposing->account->id, $opposing->account->name));return;@@ -470,23 +466,23 @@ class UpgradeDatabase extends Command}// if foreign amount of one is null and the other is not, use this to restore:- if (is_null($transaction->foreign_amount) && !is_null($opposing->foreign_amount)) {+ if (null === $transaction->foreign_amount && null !== $opposing->foreign_amount) {$transaction->foreign_amount = bcmul(strval($opposing->foreign_amount), '-1');$transaction->save();Log::debug(sprintf('Restored foreign amount of transaction (1) #%d to %s', $transaction->id, $transaction->foreign_amount));}// if foreign amount of one is null and the other is not, use this to restore (other way around)- if (is_null($opposing->foreign_amount) && !is_null($transaction->foreign_amount)) {+ if (null === $opposing->foreign_amount && null !== $transaction->foreign_amount) {$opposing->foreign_amount = bcmul(strval($transaction->foreign_amount), '-1');$opposing->save();Log::debug(sprintf('Restored foreign amount of transaction (2) #%d to %s', $opposing->id, $opposing->foreign_amount));}// when both are zero, try to grab it from journal:- if (is_null($opposing->foreign_amount) && is_null($transaction->foreign_amount)) {+ if (null === $opposing->foreign_amount && null === $transaction->foreign_amount) {$foreignAmount = $journal->getMeta('foreign_amount');- if (is_null($foreignAmount)) {+ if (null === $foreignAmount) {Log::debug(sprintf('Journal #%d has missing foreign currency data, forced to do 1:1 conversion :(.', $transaction->transaction_journal_id));$transaction->foreign_amount = bcmul(strval($transaction->amount), '-1');$opposing->foreign_amount = bcmul(strval($opposing->amount), '-1');@@ -509,7 +505,6 @@ class UpgradeDatabase extends Command$opposing->save();}-return;}}diff --git a/app/Console/Commands/UpgradeFireflyInstructions.php b/app/Console/Commands/UpgradeFireflyInstructions.phpindex 18464559ef..1daafe93ec 100644--- a/app/Console/Commands/UpgradeFireflyInstructions.php+++ b/app/Console/Commands/UpgradeFireflyInstructions.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Console\Commands;@@ -26,9 +25,7 @@ namespace FireflyIII\Console\Commands;use Illuminate\Console\Command;/**- * Class UpgradeFireflyInstructions- *- * @package FireflyIII\Console\Commands+ * Class UpgradeFireflyInstructions.*/class UpgradeFireflyInstructions extends Command{@@ -47,7 +44,6 @@ class UpgradeFireflyInstructions extends Command/*** Create a new command instance.- **/public function __construct(){@@ -59,16 +55,16 @@ class UpgradeFireflyInstructions extends Command*/public function handle(){- if ($this->argument('task') === 'update') {+ if ('update' === $this->argument('task')) {$this->updateInstructions();}- if ($this->argument('task') === 'install') {+ if ('install' === $this->argument('task')) {$this->installInstructions();}}/**- * Show a nice box+ * Show a nice box.** @param string $text*/@@ -81,7 +77,7 @@ class UpgradeFireflyInstructions extends Command}/**- * Show a nice info box+ * Show a nice info box.** @param string $text*/@@ -111,7 +107,7 @@ class UpgradeFireflyInstructions extends Command}$this->showLine();$this->boxed('');- if (is_null($text)) {+ if (null === $text) {$this->boxed(sprintf('Thank you for installing Firefly III, v%s!', $version));$this->boxedInfo('There are no extra installation instructions.');$this->boxed('Firefly III should be ready for use.');@@ -128,12 +124,12 @@ class UpgradeFireflyInstructions extends Command}/**- * Show a line+ * Show a line.*/private function showLine(){$line = '+';- for ($i = 0; $i < 78; $i++) {+ for ($i = 0; $i < 78; ++$i) {$line .= '-';}$line .= '+';@@ -158,7 +154,7 @@ class UpgradeFireflyInstructions extends Command}$this->showLine();$this->boxed('');- if (is_null($text)) {+ if (null === $text) {$this->boxed(sprintf('Thank you for updating to Firefly III, v%s', $version));$this->boxedInfo('There are no extra upgrade instructions.');$this->boxed('Firefly III should be ready for use.');diff --git a/app/Console/Commands/UseEncryption.php b/app/Console/Commands/UseEncryption.phpindex 7a7b5b3eea..648533fa20 100644--- a/app/Console/Commands/UseEncryption.php+++ b/app/Console/Commands/UseEncryption.php@@ -19,7 +19,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);/**@@ -36,9 +35,7 @@ use Illuminate\Console\Command;use Illuminate\Support\Str;/**- * Class UseEncryption- *- * @package FireflyIII\Console\Commands+ * Class UseEncryption.*/class UseEncryption extends Command{@@ -57,7 +54,6 @@ class UseEncryption extends Command/*** Create a new command instance.- **/public function __construct(){diff --git a/app/Console/Commands/VerifiesAccessToken.php b/app/Console/Commands/VerifiesAccessToken.phpindex 9d1b13b863..15b2ae5658 100644--- a/app/Console/Commands/VerifiesAccessToken.php+++ b/app/Console/Commands/VerifiesAccessToken.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Console\Commands;@@ -28,11 +27,9 @@ use Log;use Preferences;/**- * Trait VerifiesAccessToken+ * Trait VerifiesAccessToken.** Verifies user access token for sensitive commands.- *- * @package FireflyIII\Console\Commands*/trait VerifiesAccessToken{@@ -58,13 +55,13 @@ trait VerifiesAccessToken$repository = app(UserRepositoryInterface::class);$user = $repository->find($userId);- if (is_null($user->id)) {+ if (null === $user->id) {Log::error(sprintf('verifyAccessToken(): no such user for input "%d"', $userId));return false;}$accessToken = Preferences::getForUser($user, 'access_token', null);- if (is_null($accessToken)) {+ if (null === $accessToken) {Log::error(sprintf('User #%d has no access token, so cannot access command line options.', $userId));return false;diff --git a/app/Console/Commands/VerifyDatabase.php b/app/Console/Commands/VerifyDatabase.phpindex 693f2f53cc..79e07b02ea 100644--- a/app/Console/Commands/VerifyDatabase.php+++ b/app/Console/Commands/VerifyDatabase.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Console\Commands;@@ -42,11 +41,9 @@ use Schema;use stdClass;/**- * Class VerifyDatabase+ * Class VerifyDatabase.** @SuppressWarnings(PHPMD.CouplingBetweenObjects)- *- * @package FireflyIII\Console\Commands*/class VerifyDatabase extends Command{@@ -107,7 +104,7 @@ class VerifyDatabase extends Command/** @var User $user */foreach ($users as $user) {$pref = Preferences::getForUser($user, 'access_token', null);- if (is_null($pref)) {+ if (null === $pref) {$token = $user->generateAccessToken();Preferences::setForUser($user, 'access_token', $token);$this->line(sprintf('Generated access token for user %s', $user->email));@@ -128,7 +125,7 @@ class VerifyDatabase extends Command];foreach ($set as $name => $values) {$link = LinkType::where('name', $name)->where('outward', $values[0])->where('inward', $values[1])->first();- if (is_null($link)) {+ if (null === $link) {$link = new LinkType;$link->name = $name;$link->outward = $values[0];@@ -147,17 +144,17 @@ class VerifyDatabase extends Command$set = PiggyBankEvent::with(['PiggyBank', 'TransactionJournal', 'TransactionJournal.TransactionType'])->get();$set->each(function (PiggyBankEvent $event) {- if (is_null($event->transaction_journal_id)) {+ if (null === $event->transaction_journal_id) {return true;}/** @var TransactionJournal $journal */$journal = $event->transactionJournal()->first();- if (is_null($journal)) {+ if (null === $journal) {return true;}$type = $journal->transactionType->type;- if ($type !== TransactionType::TRANSFER) {+ if (TransactionType::TRANSFER !== $type) {$event->transaction_journal_id = null;$event->save();$this->line(sprintf('Piggy bank #%d was referenced by an invalid event. This has been fixed.', $event->piggy_bank_id));@@ -234,11 +231,11 @@ class VerifyDatabase extends Command->get(['accounts.id as account_id', 'accounts.deleted_at as account_deleted_at', 'transactions.id as transaction_id','transactions.deleted_at as transaction_deleted_at', 'transaction_journals.id as journal_id',- 'transaction_journals.deleted_at as journal_deleted_at']+ 'transaction_journals.deleted_at as journal_deleted_at',]);/** @var stdClass $entry */foreach ($set as $entry) {- $date = is_null($entry->transaction_deleted_at) ? $entry->journal_deleted_at : $entry->transaction_deleted_at;+ $date = null === $entry->transaction_deleted_at ? $entry->journal_deleted_at : $entry->transaction_deleted_at;$this->error('Error: Account #' . $entry->account_id . ' should have been deleted, but has not.' .' Find it in the table called "accounts" and change the "deleted_at" field to: "' . $date . '"'@@ -270,7 +267,7 @@ class VerifyDatabase extends Command->whereNull('transaction_journals.deleted_at')->get(['transaction_journals.id', 'transaction_journals.user_id', 'users.email', 'account_types.type as a_type',- 'transaction_types.type']+ 'transaction_types.type',]);foreach ($set as $entry) {$this->error(@@ -289,7 +286,7 @@ class VerifyDatabase extends Command}/**- * Any deleted transaction journals that have transactions that are NOT deleted:+ * Any deleted transaction journals that have transactions that are NOT deleted:.*/private function reportJournals(){@@ -303,7 +300,7 @@ class VerifyDatabase extends Command'transaction_journals.description','transaction_journals.deleted_at as journal_deleted','transactions.id as transaction_id',- 'transactions.deleted_at as transaction_deleted_at']+ 'transactions.deleted_at as transaction_deleted_at',]);/** @var stdClass $entry */foreach ($set as $entry) {@@ -340,7 +337,7 @@ class VerifyDatabase extends Command{$plural = str_plural($name);$class = sprintf('FireflyIII\Models\%s', ucfirst($name));- $field = $name === 'tag' ? 'tag' : 'name';+ $field = 'tag' === $name ? 'tag' : 'name';$set = $class::leftJoin($name . '_transaction_journal', $plural . '.id', '=', $name . '_transaction_journal.' . $name . '_id')->leftJoin('users', $plural . '.user_id', '=', 'users.id')->distinct()@@ -380,7 +377,7 @@ class VerifyDatabase extends Command/** @var User $user */foreach ($userRepository->all() as $user) {$sum = strval($user->transactions()->sum('amount'));- if (bccomp($sum, '0') !== 0) {+ if (0 !== bccomp($sum, '0')) {$this->error('Error: Transactions for user #' . $user->id . ' (' . $user->email . ') are off by ' . $sum . '!');}}@@ -396,7 +393,7 @@ class VerifyDatabase extends Command->whereNull('transaction_journals.deleted_at')->get(['transactions.id as transaction_id', 'transactions.deleted_at as transaction_deleted', 'transaction_journals.id as journal_id',- 'transaction_journals.deleted_at']+ 'transaction_journals.deleted_at',]);/** @var stdClass $entry */foreach ($set as $entry) {diff --git a/app/Console/Kernel.php b/app/Console/Kernel.phpindex 4e6511ba43..b444bbef42 100644--- a/app/Console/Kernel.php+++ b/app/Console/Kernel.php@@ -18,10 +18,8 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);-/*** Kernel.php* Copyright (c) 2017 [email protected]@@ -48,13 +46,10 @@ class Kernel extends ConsoleKernel*/protected $commands= [- //];/*** Register the commands for the application.- *- * @return void*/protected function commands(){@@ -66,9 +61,8 @@ class Kernel extends ConsoleKernel/*** Define the application's command schedule.*- * @param \Illuminate\Console\Scheduling\Schedule $schedule+ * @param \Illuminate\Console\Scheduling\Schedule $schedule*- * @return void* @SuppressWarnings(PHPMD.UnusedFormalParameter)*/protected function schedule(Schedule $schedule)diff --git a/app/Events/AdminRequestedTestMessage.php b/app/Events/AdminRequestedTestMessage.phpindex 0a54637908..5406ca4bc9 100644--- a/app/Events/AdminRequestedTestMessage.php+++ b/app/Events/AdminRequestedTestMessage.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Events;@@ -28,9 +27,7 @@ use Illuminate\Queue\SerializesModels;use Log;/**- * Class AdminRequestedTestMessage- *- * @package FireflyIII\Events+ * Class AdminRequestedTestMessage.*/class AdminRequestedTestMessage extends Event{@@ -42,7 +39,7 @@ class AdminRequestedTestMessage extends Event/*** Create a new event instance.*- * @param User $user+ * @param User $user* @param string $ipAddress*/public function __construct(User $user, string $ipAddress)diff --git a/app/Events/Event.php b/app/Events/Event.phpindex cc0b01595d..4efa51dfce 100644--- a/app/Events/Event.php+++ b/app/Events/Event.php@@ -18,17 +18,13 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Events;/**- * Class Event- *- * @package FireflyIII\Events+ * Class Event.*/abstract class Event{- //}diff --git a/app/Events/RegisteredUser.php b/app/Events/RegisteredUser.phpindex 271ff0bfa5..3886edd432 100644--- a/app/Events/RegisteredUser.php+++ b/app/Events/RegisteredUser.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Events;@@ -27,9 +26,7 @@ use FireflyIII\User;use Illuminate\Queue\SerializesModels;/**- * Class RegisteredUser- *- * @package FireflyIII\Events+ * Class RegisteredUser.*/class RegisteredUser extends Event{@@ -41,7 +38,7 @@ class RegisteredUser extends Event/*** Create a new event instance. This event is triggered when a new user registers.*- * @param User $user+ * @param User $user* @param string $ipAddress*/public function __construct(User $user, string $ipAddress)diff --git a/app/Events/RequestedNewPassword.php b/app/Events/RequestedNewPassword.phpindex 154eb22647..e8031e316e 100644--- a/app/Events/RequestedNewPassword.php+++ b/app/Events/RequestedNewPassword.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Events;@@ -27,9 +26,7 @@ use FireflyIII\User;use Illuminate\Queue\SerializesModels;/**- * Class RequestedNewPassword- *- * @package FireflyIII\Events+ * Class RequestedNewPassword.*/class RequestedNewPassword extends Event{@@ -42,7 +39,7 @@ class RequestedNewPassword extends Event/*** Create a new event instance. This event is triggered when a users tries to reset his or her password.*- * @param User $user+ * @param User $user* @param string $token* @param string $ipAddress*/diff --git a/app/Events/StoredTransactionJournal.php b/app/Events/StoredTransactionJournal.phpindex 07a18f8cdf..deab148be0 100644--- a/app/Events/StoredTransactionJournal.php+++ b/app/Events/StoredTransactionJournal.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Events;@@ -27,9 +26,7 @@ use FireflyIII\Models\TransactionJournal;use Illuminate\Queue\SerializesModels;/**- * Class StoredTransactionJournal- *- * @package FireflyIII\Events+ * Class StoredTransactionJournal.*/class StoredTransactionJournal extends Event{@@ -48,7 +45,6 @@ class StoredTransactionJournal extends Event*/public function __construct(TransactionJournal $journal, int $piggyBankId){- //$this->journal = $journal;$this->piggyBankId = $piggyBankId;}diff --git a/app/Events/UpdatedTransactionJournal.php b/app/Events/UpdatedTransactionJournal.phpindex f83ca87595..9f365929e8 100644--- a/app/Events/UpdatedTransactionJournal.php+++ b/app/Events/UpdatedTransactionJournal.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Events;@@ -27,9 +26,7 @@ use FireflyIII\Models\TransactionJournal;use Illuminate\Queue\SerializesModels;/**- * Class UpdatedTransactionJournal- *- * @package FireflyIII\Events+ * Class UpdatedTransactionJournal.*/class UpdatedTransactionJournal extends Event{@@ -45,7 +42,6 @@ class UpdatedTransactionJournal extends Event*/public function __construct(TransactionJournal $journal){- //$this->journal = $journal;}}diff --git a/app/Events/UserChangedEmail.php b/app/Events/UserChangedEmail.phpindex d858c903b4..2c75145d34 100644--- a/app/Events/UserChangedEmail.php+++ b/app/Events/UserChangedEmail.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Events;@@ -27,19 +26,17 @@ use FireflyIII\User;use Illuminate\Queue\SerializesModels;/**- * Class UserChangedEmail- *- * @package FireflyIII\Events+ * Class UserChangedEmail.*/class UserChangedEmail extends Event{use SerializesModels;- /** @var string */+ /** @var string */public $ipAddress;- /** @var string */+ /** @var string */public $newEmail;- /** @var string */+ /** @var string */public $oldEmail;/** @var User */public $user;diff --git a/app/Exceptions/FireflyException.php b/app/Exceptions/FireflyException.phpindex 5bcde065a7..313ea77b7f 100644--- a/app/Exceptions/FireflyException.php+++ b/app/Exceptions/FireflyException.php@@ -18,15 +18,12 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Exceptions;/**- * Class FireflyException- *- * @package FireflyIII\Exceptions+ * Class FireflyException.*/class FireflyException extends \Exception{diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.phpindex 1dc47c3053..322ae31e26 100644--- a/app/Exceptions/Handler.php+++ b/app/Exceptions/Handler.php@@ -18,10 +18,8 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);-/*** Handler.php* Copyright (c) 2017 [email protected]@@ -58,14 +56,13 @@ class Handler extends ExceptionHandler*/protected $dontReport= [- //];/*** Render an exception into an HTTP response.*- * @param \Illuminate\Http\Request $request- * @param \Exception $exception+ * @param \Illuminate\Http\Request $request+ * @param \Exception $exception** @return \Illuminate\Http\Response*/@@ -86,9 +83,8 @@ class Handler extends ExceptionHandler* This is a great spot to send exceptions to Sentry, Bugsnag, etc.** @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's five its fine.- * @param \Exception $exception*- * @return void+ * @param \Exception $exception*/public function report(Exception $exception){@@ -119,7 +115,6 @@ class Handler extends ExceptionHandlerdispatch($job);}-parent::report($exception);}}diff --git a/app/Exceptions/NotImplementedException.php b/app/Exceptions/NotImplementedException.phpindex d6decc2bc7..f3fe68d8de 100644--- a/app/Exceptions/NotImplementedException.php+++ b/app/Exceptions/NotImplementedException.php@@ -18,15 +18,12 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Exceptions;/**- * Class NotImplementedException- *- * @package FireflyIII\Exceptions+ * Class NotImplementedException.*/class NotImplementedException extends \Exception{diff --git a/app/Exceptions/ValidationException.php b/app/Exceptions/ValidationException.phpindex f46b5b1588..dba608fa1a 100644--- a/app/Exceptions/ValidationException.php+++ b/app/Exceptions/ValidationException.php@@ -18,15 +18,12 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Exceptions;/**- * Class ValidationExceptions- *- * @package FireflyIII\Exception+ * Class ValidationExceptions.*/class ValidationException extends \Exception{diff --git a/app/Export/Collector/AttachmentCollector.php b/app/Export/Collector/AttachmentCollector.phpindex 0fe6ec7f9b..c3f76d2274 100644--- a/app/Export/Collector/AttachmentCollector.php+++ b/app/Export/Collector/AttachmentCollector.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Export\Collector;@@ -33,19 +32,17 @@ use Log;use Storage;/**- * Class AttachmentCollector- *- * @package FireflyIII\Export\Collector+ * Class AttachmentCollector.*/class AttachmentCollector extends BasicCollector implements CollectorInterface{- /** @var Carbon */+ /** @var Carbon */private $end;/** @var \Illuminate\Contracts\Filesystem\Filesystem */private $exportDisk;- /** @var AttachmentRepositoryInterface */+ /** @var AttachmentRepositoryInterface */private $repository;- /** @var Carbon */+ /** @var Carbon */private $start;/** @var \Illuminate\Contracts\Filesystem\Filesystem */private $uploadDisk;@@ -55,7 +52,7 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface*/public function __construct(){- /** @var AttachmentRepositoryInterface repository */+ // @var AttachmentRepositoryInterface repository$this->repository = app(AttachmentRepositoryInterface::class);// make storage:$this->uploadDisk = Storage::disk('upload');diff --git a/app/Export/Collector/BasicCollector.php b/app/Export/Collector/BasicCollector.phpindex 80bb64ba37..0aa688ae30 100644--- a/app/Export/Collector/BasicCollector.php+++ b/app/Export/Collector/BasicCollector.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Export\Collector;@@ -28,15 +27,13 @@ use FireflyIII\User;use Illuminate\Support\Collection;/**- * Class BasicCollector- *- * @package FireflyIII\Export\Collector+ * Class BasicCollector.*/class BasicCollector{/** @var ExportJob */protected $job;- /** @var User */+ /** @var User */protected $user;/** @var Collection */private $entries;diff --git a/app/Export/Collector/CollectorInterface.php b/app/Export/Collector/CollectorInterface.phpindex d36a76c202..362692f247 100644--- a/app/Export/Collector/CollectorInterface.php+++ b/app/Export/Collector/CollectorInterface.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Export\Collector;@@ -27,9 +26,7 @@ use FireflyIII\Models\ExportJob;use Illuminate\Support\Collection;/**- * Interface CollectorInterface- *- * @package FireflyIII\Export\Collector+ * Interface CollectorInterface.*/interface CollectorInterface{@@ -45,9 +42,6 @@ interface CollectorInterface/*** @param Collection $entries- *- * @return void- **/public function setEntries(Collection $entries);diff --git a/app/Export/Collector/UploadCollector.php b/app/Export/Collector/UploadCollector.phpindex 732b04e750..9bb5dd20fb 100644--- a/app/Export/Collector/UploadCollector.php+++ b/app/Export/Collector/UploadCollector.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Export\Collector;@@ -30,9 +29,7 @@ use Log;use Storage;/**- * Class UploadCollector- *- * @package FireflyIII\Export\Collector+ * Class UploadCollector.*/class UploadCollector extends BasicCollector implements CollectorInterface{@@ -94,7 +91,7 @@ class UploadCollector extends BasicCollector implements CollectorInterface{// find job associated with import file:$job = $this->job->user->importJobs()->where('key', $key)->first();- if (is_null($job)) {+ if (null === $job) {return false;}diff --git a/app/Export/Entry/Entry.php b/app/Export/Entry/Entry.phpindex 43246627f0..44271130f1 100644--- a/app/Export/Entry/Entry.php+++ b/app/Export/Entry/Entry.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Export\Entry;@@ -27,7 +26,7 @@ use FireflyIII\Models\Transaction;/*** To extend the exported object, in case of new features in Firefly III for example,- * do the following:+ * do the following:.** - Add the field(s) to this class. If you add more than one related field, add a new object.* - Make sure the "fromJournal"-routine fills these fields.@@ -39,52 +38,42 @@ use FireflyIII\Models\Transaction;*** Class Entry+ ** @SuppressWarnings(PHPMD.LongVariable)* @SuppressWarnings(PHPMD.TooManyFields)- *- * @package FireflyIII\Export\Entry*/final class Entry{// @formatter:off- public $journal_id;- public $transaction_id = 0;-- public $date;- public $description;-- public $currency_code;public $amount;- public $foreign_currency_code = '';- public $foreign_amount = '0';-- public $transaction_type;-+ public $asset_account_bic;+ public $asset_account_iban;public $asset_account_id;public $asset_account_name;- public $asset_account_iban;- public $asset_account_bic;public $asset_account_number;public $asset_currency_code;-- public $opposing_account_id;- public $opposing_account_name;- public $opposing_account_iban;- public $opposing_account_bic;- public $opposing_account_number;- public $opposing_currency_code;-+ public $bill_id;+ public $bill_name;public $budget_id;public $budget_name;-public $category_id;public $category_name;-- public $bill_id;- public $bill_name;-+ public $currency_code;+ public $date;+ public $description;+ public $foreign_amount = '0';+ public $foreign_currency_code = '';+ public $journal_id;public $notes;+ public $opposing_account_bic;+ public $opposing_account_iban;+ public $opposing_account_id;+ public $opposing_account_name;+ public $opposing_account_number;+ public $opposing_currency_code;public $tags;+ public $transaction_id = 0;+ public $transaction_type;// @formatter:on/**@@ -104,7 +93,7 @@ final class Entry** @return Entry*/- public static function fromTransaction(Transaction $transaction): Entry+ public static function fromTransaction(Transaction $transaction): self{$entry = new self;$entry->journal_id = $transaction->journal_id;@@ -117,8 +106,8 @@ final class Entry$entry->currency_code = $transaction->transactionCurrency->code;$entry->amount = round($transaction->transaction_amount, $transaction->transactionCurrency->decimal_places);- $entry->foreign_currency_code = is_null($transaction->foreign_currency_id) ? null : $transaction->foreignCurrency->code;- $entry->foreign_amount = is_null($transaction->foreign_currency_id)+ $entry->foreign_currency_code = null === $transaction->foreign_currency_id ? null : $transaction->foreignCurrency->code;+ $entry->foreign_amount = null === $transaction->foreign_currency_id? null: strval(round(@@ -142,23 +131,23 @@ final class Entry$entry->opposing_account_bic = $transaction->opposing_account_bic;$entry->opposing_currency_code = $transaction->opposing_currency_code;- /** budget */+ // budget$entry->budget_id = $transaction->transaction_budget_id;$entry->budget_name = app('steam')->tryDecrypt($transaction->transaction_budget_name);- if (is_null($transaction->transaction_budget_id)) {+ if (null === $transaction->transaction_budget_id) {$entry->budget_id = $transaction->transaction_journal_budget_id;$entry->budget_name = app('steam')->tryDecrypt($transaction->transaction_journal_budget_name);}- /** category */+ // category$entry->category_id = $transaction->transaction_category_id;$entry->category_name = app('steam')->tryDecrypt($transaction->transaction_category_name);- if (is_null($transaction->transaction_category_id)) {+ if (null === $transaction->transaction_category_id) {$entry->category_id = $transaction->transaction_journal_category_id;$entry->category_name = app('steam')->tryDecrypt($transaction->transaction_journal_category_name);}- /** budget */+ // budget$entry->bill_id = $transaction->bill_id;$entry->bill_name = app('steam')->tryDecrypt($transaction->bill_name);diff --git a/app/Export/ExpandedProcessor.php b/app/Export/ExpandedProcessor.phpindex bafd575006..11504e2267 100644--- a/app/Export/ExpandedProcessor.php+++ b/app/Export/ExpandedProcessor.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Export;@@ -42,32 +41,29 @@ use Storage;use ZipArchive;/**- * Class ExpandedProcessor+ * Class ExpandedProcessor.** @SuppressWarnings(PHPMD.CouplingBetweenObjects) // its doing a lot.- *- * @package FireflyIII\Export*/class ExpandedProcessor implements ProcessorInterface{-/** @var Collection */public $accounts;- /** @var string */+ /** @var string */public $exportFormat;- /** @var bool */+ /** @var bool */public $includeAttachments;- /** @var bool */+ /** @var bool */public $includeOldUploads;- /** @var ExportJob */+ /** @var ExportJob */public $job;/** @var array */public $settings;- /** @var Collection */+ /** @var Collection */private $exportEntries;- /** @var Collection */+ /** @var Collection */private $files;- /** @var Collection */+ /** @var Collection */private $journals;/**@@ -175,6 +171,7 @@ class ExpandedProcessor implements ProcessorInterface/*** @return bool+ ** @throws FireflyException*/public function createZipFile(): bool@@ -183,7 +180,7 @@ class ExpandedProcessor implements ProcessorInterface$file = $this->job->key . '.zip';$fullPath = storage_path('export') . '/' . $file;- if ($zip->open($fullPath, ZipArchive::CREATE) !== true) {+ if (true !== $zip->open($fullPath, ZipArchive::CREATE)) {throw new FireflyException('Cannot store zip file.');}// for each file in the collection, add it to the zip file.@@ -278,7 +275,7 @@ class ExpandedProcessor implements ProcessorInterface}/**- * Get all IBAN / SWIFT / account numbers+ * Get all IBAN / SWIFT / account numbers.** @param array $array*diff --git a/app/Export/Exporter/BasicExporter.php b/app/Export/Exporter/BasicExporter.phpindex c04869286c..ece94d3703 100644--- a/app/Export/Exporter/BasicExporter.php+++ b/app/Export/Exporter/BasicExporter.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Export\Exporter;@@ -27,13 +26,11 @@ use FireflyIII\Models\ExportJob;use Illuminate\Support\Collection;/**- * Class BasicExporter- *- * @package FireflyIII\Export\Exporter+ * Class BasicExporter.*/class BasicExporter{- /** @var ExportJob */+ /** @var ExportJob */protected $job;/** @var Collection */private $entries;diff --git a/app/Export/Exporter/CsvExporter.php b/app/Export/Exporter/CsvExporter.phpindex d9e337b0fc..2799f7902f 100644--- a/app/Export/Exporter/CsvExporter.php+++ b/app/Export/Exporter/CsvExporter.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Export\Exporter;@@ -28,13 +27,11 @@ use League\Csv\Writer;use SplFileObject;/**- * Class CsvExporter- *- * @package FireflyIII\Export\Exporter+ * Class CsvExporter.*/class CsvExporter extends BasicExporter implements ExporterInterface{- /** @var string */+ /** @var string */private $fileName;/**@@ -69,7 +66,7 @@ class CsvExporter extends BasicExporter implements ExporterInterface// get field names for header row:$first = $this->getEntries()->first();$headers = [];- if (!is_null($first)) {+ if (null !== $first) {$headers = array_keys(get_object_vars($first));}@@ -88,7 +85,6 @@ class CsvExporter extends BasicExporter implements ExporterInterfacereturn true;}-private function tempFile(){$this->fileName = $this->job->key . '-records.csv';diff --git a/app/Export/Exporter/ExporterInterface.php b/app/Export/Exporter/ExporterInterface.phpindex 0ef9fb12c6..50790b3c92 100644--- a/app/Export/Exporter/ExporterInterface.php+++ b/app/Export/Exporter/ExporterInterface.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Export\Exporter;@@ -27,9 +26,7 @@ use FireflyIII\Models\ExportJob;use Illuminate\Support\Collection;/**- * Interface ExporterInterface- *- * @package FireflyIII\Export\Exporter+ * Interface ExporterInterface.*/interface ExporterInterface{@@ -50,9 +47,6 @@ interface ExporterInterface/*** @param Collection $entries- *- * @return void- **/public function setEntries(Collection $entries);diff --git a/app/Export/ProcessorInterface.php b/app/Export/ProcessorInterface.phpindex 90dd471efa..3d24a91f1f 100644--- a/app/Export/ProcessorInterface.php+++ b/app/Export/ProcessorInterface.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Export;@@ -26,13 +25,10 @@ namespace FireflyIII\Export;use Illuminate\Support\Collection;/**- * Interface ProcessorInterface- *- * @package FireflyIII\Export+ * Interface ProcessorInterface.*/interface ProcessorInterface{-/*** Processor constructor.*/diff --git a/app/Generator/Chart/Basic/ChartJsGenerator.php b/app/Generator/Chart/Basic/ChartJsGenerator.phpindex 75b1b4bd38..e366db9587 100644--- a/app/Generator/Chart/Basic/ChartJsGenerator.php+++ b/app/Generator/Chart/Basic/ChartJsGenerator.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Generator\Chart\Basic;@@ -27,15 +26,12 @@ use FireflyIII\Support\ChartColour;use Steam;/**- * Class ChartJsGenerator- *- * @package FireflyIII\Generator\Chart\Basic+ * Class ChartJsGenerator.*/class ChartJsGenerator implements GeneratorInterface{-/**- * Will generate a Chart JS compatible array from the given input. Expects this format+ * Will generate a Chart JS compatible array from the given input. Expects this format.** Will take labels for all from first set.*@@ -102,7 +98,7 @@ class ChartJsGenerator implements GeneratorInterface}/**- * Expects data as:+ * Expects data as:.** key => value*@@ -123,7 +119,7 @@ class ChartJsGenerator implements GeneratorInterface// different sort when values are positive and when they're negative.asort($data);$next = next($data);- if (!is_bool($next) && bccomp($next, '0') === 1) {+ if (!is_bool($next) && 1 === bccomp($next, '0')) {// next is positive, sort other way around.arsort($data);}@@ -131,19 +127,18 @@ class ChartJsGenerator implements GeneratorInterface$index = 0;foreach ($data as $key => $value) {-// make larger than 0$chartData['datasets'][0]['data'][] = floatval(Steam::positive($value));$chartData['datasets'][0]['backgroundColor'][] = ChartColour::getColour($index);$chartData['labels'][] = $key;- $index++;+ ++$index;}return $chartData;}/**- * Will generate a (ChartJS) compatible array from the given input. Expects this format:+ * Will generate a (ChartJS) compatible array from the given input. Expects this format:.** 'label-of-entry' => value* 'label-of-entry' => valuediff --git a/app/Generator/Chart/Basic/GeneratorInterface.php b/app/Generator/Chart/Basic/GeneratorInterface.phpindex 37b089d903..68753e1276 100644--- a/app/Generator/Chart/Basic/GeneratorInterface.php+++ b/app/Generator/Chart/Basic/GeneratorInterface.php@@ -18,21 +18,17 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Generator\Chart\Basic;/**- * Interface GeneratorInterface- *- * @package FireflyIII\Generator\Chart\Basic+ * Interface GeneratorInterface.*/interface GeneratorInterface{-/**- * Will generate a Chart JS compatible array from the given input. Expects this format+ * Will generate a Chart JS compatible array from the given input. Expects this format.** Will take labels for all from first set.*@@ -66,7 +62,7 @@ interface GeneratorInterfacepublic function multiSet(array $data): array;/**- * Expects data as:+ * Expects data as:.** key => value*@@ -77,7 +73,7 @@ interface GeneratorInterfacepublic function pieChart(array $data): array;/**- * Will generate a (ChartJS) compatible array from the given input. Expects this format:+ * Will generate a (ChartJS) compatible array from the given input. Expects this format:.** 'label-of-entry' => value* 'label-of-entry' => valuediff --git a/app/Generator/Report/Audit/MonthReportGenerator.php b/app/Generator/Report/Audit/MonthReportGenerator.phpindex 809e047b6f..f944874ea4 100644--- a/app/Generator/Report/Audit/MonthReportGenerator.php+++ b/app/Generator/Report/Audit/MonthReportGenerator.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Generator\Report\Audit;@@ -27,23 +26,20 @@ use Carbon\Carbon;use FireflyIII\Generator\Report\ReportGeneratorInterface;use FireflyIII\Helpers\Collector\JournalCollectorInterface;use FireflyIII\Models\Account;-use FireflyIII\Models\Transaction;use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;use Illuminate\Support\Collection;use Steam;/**- * Class MonthReportGenerator- *- * @package FireflyIII\Generator\Report\Audit+ * Class MonthReportGenerator.*/class MonthReportGenerator implements ReportGeneratorInterface{- /** @var Collection */+ /** @var Collection */private $accounts;- /** @var Carbon */+ /** @var Carbon */private $end;- /** @var Carbon */+ /** @var Carbon */private $start;/**@@ -74,7 +70,6 @@ class MonthReportGenerator implements ReportGeneratorInterface'create_date', 'update_date',];-return view('reports.audit.report', compact('reportType', 'accountIds', 'auditData', 'hideable', 'defaultShow'))->with('start', $this->start)->with('end', $this->end)->with('accounts', $this->accounts)->render();@@ -153,7 +148,6 @@ class MonthReportGenerator implements ReportGeneratorInterface* @return array** @SuppressWarnings(PHPMD.ExcessiveMethodLength) // not that long- **/private function getAuditReport(Account $account, Carbon $date): array{@@ -169,7 +163,7 @@ class MonthReportGenerator implements ReportGeneratorInterface$startBalance = $dayBeforeBalance;$currency = $currencyRepos->find(intval($account->getMeta('currency_id')));- /** @var Transaction $journal */+ // @var Transaction $journalforeach ($journals as $transaction) {$transaction->before = $startBalance;$transactionAmount = $transaction->transaction_amount;diff --git a/app/Generator/Report/Audit/MultiYearReportGenerator.php b/app/Generator/Report/Audit/MultiYearReportGenerator.phpindex 42e06b1349..93629d0c55 100644--- a/app/Generator/Report/Audit/MultiYearReportGenerator.php+++ b/app/Generator/Report/Audit/MultiYearReportGenerator.php@@ -18,19 +18,14 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Generator\Report\Audit;/**- * Class MultiYearReportGenerator- *- * @package FireflyIII\Generator\Report\Audit+ * Class MultiYearReportGenerator.*/class MultiYearReportGenerator extends MonthReportGenerator{- /**- * Doesn't do anything different.- */+ // Doesn't do anything different.}diff --git a/app/Generator/Report/Audit/YearReportGenerator.php b/app/Generator/Report/Audit/YearReportGenerator.phpindex d5a7d8eb82..2cd93c9b01 100644--- a/app/Generator/Report/Audit/YearReportGenerator.php+++ b/app/Generator/Report/Audit/YearReportGenerator.php@@ -18,20 +18,14 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Generator\Report\Audit;/**- * Class YearReportGenerator- *- * @package FireflyIII\Generator\Report\Audit+ * Class YearReportGenerator.*/class YearReportGenerator extends MonthReportGenerator{-- /**- * Doesn't do anything different.- */+ // Doesn't do anything different.}diff --git a/app/Generator/Report/Budget/MonthReportGenerator.php b/app/Generator/Report/Budget/MonthReportGenerator.phpindex 59edfe32ab..1295061e6b 100644--- a/app/Generator/Report/Budget/MonthReportGenerator.php+++ b/app/Generator/Report/Budget/MonthReportGenerator.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Generator\Report\Budget;@@ -36,23 +35,21 @@ use Illuminate\Support\Collection;use Log;/**- * Class MonthReportGenerator- *- * @package FireflyIII\Generator\Report\Budget+ * Class MonthReportGenerator.*/class MonthReportGenerator extends Support implements ReportGeneratorInterface{- /** @var Collection */+ /** @var Collection */private $accounts;- /** @var Collection */+ /** @var Collection */private $budgets;- /** @var Carbon */+ /** @var Carbon */private $end;/** @var Collection */private $expenses;/** @var Collection */private $income;- /** @var Carbon */+ /** @var Carbon */private $start;/**diff --git a/app/Generator/Report/Budget/MultiYearReportGenerator.php b/app/Generator/Report/Budget/MultiYearReportGenerator.phpindex 2f49d7bd7f..956968075f 100644--- a/app/Generator/Report/Budget/MultiYearReportGenerator.php+++ b/app/Generator/Report/Budget/MultiYearReportGenerator.php@@ -18,19 +18,14 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Generator\Report\Budget;/**- * Class MultiYearReportGenerator- *- * @package FireflyIII\Generator\Report\Budget+ * Class MultiYearReportGenerator.*/class MultiYearReportGenerator extends MonthReportGenerator{- /**- * Doesn't do anything different.- */+ // Doesn't do anything different.}diff --git a/app/Generator/Report/Budget/YearReportGenerator.php b/app/Generator/Report/Budget/YearReportGenerator.phpindex 3ac751cbc6..649636f91b 100644--- a/app/Generator/Report/Budget/YearReportGenerator.php+++ b/app/Generator/Report/Budget/YearReportGenerator.php@@ -18,20 +18,14 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Generator\Report\Budget;/**- * Class YearReportGenerator- *- * @package FireflyIII\Generator\Report\Budget+ * Class YearReportGenerator.*/class YearReportGenerator extends MonthReportGenerator{-- /**- * Doesn't do anything different.- */+ // Doesn't do anything different.}diff --git a/app/Generator/Report/Category/MonthReportGenerator.php b/app/Generator/Report/Category/MonthReportGenerator.phpindex 58f110627c..24370c6be0 100644--- a/app/Generator/Report/Category/MonthReportGenerator.php+++ b/app/Generator/Report/Category/MonthReportGenerator.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Generator\Report\Category;@@ -37,23 +36,21 @@ use Illuminate\Support\Collection;use Log;/**- * Class MonthReportGenerator- *- * @package FireflyIII\Generator\Report\Category+ * Class MonthReportGenerator.*/class MonthReportGenerator extends Support implements ReportGeneratorInterface{- /** @var Collection */+ /** @var Collection */private $accounts;- /** @var Collection */+ /** @var Collection */private $categories;- /** @var Carbon */+ /** @var Carbon */private $end;/** @var Collection */private $expenses;/** @var Collection */private $income;- /** @var Carbon */+ /** @var Carbon */private $start;/**@@ -82,7 +79,6 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface$topExpenses = $this->getTopExpenses();$topIncome = $this->getTopIncome();-// render!return view('reports.category.month',diff --git a/app/Generator/Report/Category/MultiYearReportGenerator.php b/app/Generator/Report/Category/MultiYearReportGenerator.phpindex c3112ce681..d18dc47c0d 100644--- a/app/Generator/Report/Category/MultiYearReportGenerator.php+++ b/app/Generator/Report/Category/MultiYearReportGenerator.php@@ -18,19 +18,14 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Generator\Report\Category;/**- * Class MultiYearReportGenerator- *- * @package FireflyIII\Generator\Report\Category+ * Class MultiYearReportGenerator.*/class MultiYearReportGenerator extends MonthReportGenerator{- /**- * Doesn't do anything different.- */+ // Doesn't do anything different.}diff --git a/app/Generator/Report/Category/YearReportGenerator.php b/app/Generator/Report/Category/YearReportGenerator.phpindex 5186ec9f50..7a3f15a484 100644--- a/app/Generator/Report/Category/YearReportGenerator.php+++ b/app/Generator/Report/Category/YearReportGenerator.php@@ -18,20 +18,14 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Generator\Report\Category;/**- * Class YearReportGenerator- *- * @package FireflyIII\Generator\Report\Category+ * Class YearReportGenerator.*/class YearReportGenerator extends MonthReportGenerator{-- /**- * Doesn't do anything different.- */+ // Doesn't do anything different.}diff --git a/app/Generator/Report/ReportGeneratorFactory.php b/app/Generator/Report/ReportGeneratorFactory.phpindex 0b96aee968..f6d7956a60 100644--- a/app/Generator/Report/ReportGeneratorFactory.php+++ b/app/Generator/Report/ReportGeneratorFactory.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Generator\Report;@@ -27,19 +26,17 @@ use Carbon\Carbon;use FireflyIII\Exceptions\FireflyException;/**- * Class ReportGeneratorFactory- *- * @package FireflyIII\Generator\Report+ * Class ReportGeneratorFactory.*/class ReportGeneratorFactory{-/*** @param string $type* @param Carbon $start* @param Carbon $end** @return ReportGeneratorInterface+ ** @throws FireflyException*/public static function reportGenerator(string $type, Carbon $start, Carbon $end): ReportGeneratorInterface@@ -55,7 +52,6 @@ class ReportGeneratorFactory$period = 'MultiYear';}-$class = sprintf('FireflyIII\Generator\Report\%s\%sReportGenerator', $type, $period);if (class_exists($class)) {/** @var ReportGeneratorInterface $obj */diff --git a/app/Generator/Report/ReportGeneratorInterface.php b/app/Generator/Report/ReportGeneratorInterface.phpindex 5fecbf0e91..f4ff815cc1 100644--- a/app/Generator/Report/ReportGeneratorInterface.php+++ b/app/Generator/Report/ReportGeneratorInterface.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Generator\Report;@@ -27,9 +26,7 @@ use Carbon\Carbon;use Illuminate\Support\Collection;/**- * Interface ReportGeneratorInterface- *- * @package FireflyIII\Generator\Report+ * Interface ReportGeneratorInterface.*/interface ReportGeneratorInterface{@@ -43,40 +40,40 @@ interface ReportGeneratorInterface** @return ReportGeneratorInterface*/- public function setAccounts(Collection $accounts): ReportGeneratorInterface;+ public function setAccounts(Collection $accounts): self;/*** @param Collection $budgets** @return ReportGeneratorInterface*/- public function setBudgets(Collection $budgets): ReportGeneratorInterface;+ public function setBudgets(Collection $budgets): self;/*** @param Collection $categories** @return ReportGeneratorInterface*/- public function setCategories(Collection $categories): ReportGeneratorInterface;+ public function setCategories(Collection $categories): self;/*** @param Carbon $date** @return ReportGeneratorInterface*/- public function setEndDate(Carbon $date): ReportGeneratorInterface;+ public function setEndDate(Carbon $date): self;/*** @param Carbon $date** @return ReportGeneratorInterface*/- public function setStartDate(Carbon $date): ReportGeneratorInterface;+ public function setStartDate(Carbon $date): self;/*** @param Collection $tags** @return ReportGeneratorInterface*/- public function setTags(Collection $tags): ReportGeneratorInterface;+ public function setTags(Collection $tags): self;}diff --git a/app/Generator/Report/Standard/MonthReportGenerator.php b/app/Generator/Report/Standard/MonthReportGenerator.phpindex c042e3ac13..74c005b0ab 100644--- a/app/Generator/Report/Standard/MonthReportGenerator.php+++ b/app/Generator/Report/Standard/MonthReportGenerator.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Generator\Report\Standard;@@ -29,17 +28,15 @@ use FireflyIII\Helpers\Report\ReportHelperInterface;use Illuminate\Support\Collection;/**- * Class MonthReportGenerator- *- * @package FireflyIII\Generator\Report\Standard+ * Class MonthReportGenerator.*/class MonthReportGenerator implements ReportGeneratorInterface{- /** @var Collection */+ /** @var Collection */private $accounts;- /** @var Carbon */+ /** @var Carbon */private $end;- /** @var Carbon */+ /** @var Carbon */private $start;/**diff --git a/app/Generator/Report/Standard/MultiYearReportGenerator.php b/app/Generator/Report/Standard/MultiYearReportGenerator.phpindex d625767dfd..7bc83c6dc7 100644--- a/app/Generator/Report/Standard/MultiYearReportGenerator.php+++ b/app/Generator/Report/Standard/MultiYearReportGenerator.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Generator\Report\Standard;@@ -28,17 +27,15 @@ use FireflyIII\Generator\Report\ReportGeneratorInterface;use Illuminate\Support\Collection;/**- * Class MonthReportGenerator- *- * @package FireflyIII\Generator\Report\Standard+ * Class MonthReportGenerator.*/class MultiYearReportGenerator implements ReportGeneratorInterface{- /** @var Collection */+ /** @var Collection */private $accounts;- /** @var Carbon */+ /** @var Carbon */private $end;- /** @var Carbon */+ /** @var Carbon */private $start;/**diff --git a/app/Generator/Report/Standard/YearReportGenerator.php b/app/Generator/Report/Standard/YearReportGenerator.phpindex 8209e6bfc8..fc591c0e97 100644--- a/app/Generator/Report/Standard/YearReportGenerator.php+++ b/app/Generator/Report/Standard/YearReportGenerator.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Generator\Report\Standard;@@ -28,17 +27,15 @@ use FireflyIII\Generator\Report\ReportGeneratorInterface;use Illuminate\Support\Collection;/**- * Class MonthReportGenerator- *- * @package FireflyIII\Generator\Report\Standard+ * Class MonthReportGenerator.*/class YearReportGenerator implements ReportGeneratorInterface{- /** @var Collection */+ /** @var Collection */private $accounts;- /** @var Carbon */+ /** @var Carbon */private $end;- /** @var Carbon */+ /** @var Carbon */private $start;/**diff --git a/app/Generator/Report/Support.php b/app/Generator/Report/Support.phpindex c4749d1cc6..71cc298307 100644--- a/app/Generator/Report/Support.php+++ b/app/Generator/Report/Support.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Generator\Report;@@ -27,9 +26,7 @@ use FireflyIII\Models\Transaction;use Illuminate\Support\Collection;/**- * Class Support- *- * @package FireflyIII\Generator\Report\Category+ * Class Support.*/class Support{@@ -79,7 +76,7 @@ class Support];continue;}- $result[$opposingId]['count']++;+ ++$result[$opposingId]['count'];$result[$opposingId]['sum'] = bcadd($result[$opposingId]['sum'], $transaction->transaction_amount);$result[$opposingId]['average'] = bcdiv($result[$opposingId]['sum'], strval($result[$opposingId]['count']));}@@ -97,6 +94,7 @@ class Support/*** @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's exactly five.+ ** @param array $spent* @param array $earned*@@ -107,7 +105,7 @@ class Support$return = [];/**- * @var int $accountId+ * @var int* @var string $entry*/foreach ($spent as $objectId => $entry) {@@ -120,7 +118,7 @@ class Supportunset($entry);/**- * @var int $accountId+ * @var int* @var string $entry*/foreach ($earned as $objectId => $entry) {@@ -131,7 +129,6 @@ class Support$return[$objectId]['earned'] = $entry;}-return $return;}diff --git a/app/Generator/Report/Tag/MonthReportGenerator.php b/app/Generator/Report/Tag/MonthReportGenerator.phpindex cffaf129a6..418b05dd16 100644--- a/app/Generator/Report/Tag/MonthReportGenerator.php+++ b/app/Generator/Report/Tag/MonthReportGenerator.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Generator\Report\Tag;@@ -38,22 +37,19 @@ use Illuminate\Support\Collection;use Log;/**- * Class MonthReportGenerator- *- * @package FireflyIII\Generator\Report\Tag+ * Class MonthReportGenerator.*/class MonthReportGenerator extends Support implements ReportGeneratorInterface{-/** @var Collection */private $accounts;- /** @var Carbon */+ /** @var Carbon */private $end;/** @var Collection */private $expenses;/** @var Collection */private $income;- /** @var Carbon */+ /** @var Carbon */private $start;/** @var Collection */private $tags;@@ -84,7 +80,6 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface$topExpenses = $this->getTopExpenses();$topIncome = $this->getTopIncome();-// render!return view('reports.tag.month',diff --git a/app/Generator/Report/Tag/MultiYearReportGenerator.php b/app/Generator/Report/Tag/MultiYearReportGenerator.phpindex 4be4f8a7dc..7687cf9d0e 100644--- a/app/Generator/Report/Tag/MultiYearReportGenerator.php+++ b/app/Generator/Report/Tag/MultiYearReportGenerator.php@@ -18,19 +18,14 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Generator\Report\Tag;/**- * Class MultiYearReportGenerator- *- * @package FireflyIII\Generator\Report\Tag+ * Class MultiYearReportGenerator.*/class MultiYearReportGenerator extends MonthReportGenerator{- /**- * Doesn't do anything different.- */+ // Doesn't do anything different.}diff --git a/app/Generator/Report/Tag/YearReportGenerator.php b/app/Generator/Report/Tag/YearReportGenerator.phpindex 5e362745dc..2e72c8d252 100644--- a/app/Generator/Report/Tag/YearReportGenerator.php+++ b/app/Generator/Report/Tag/YearReportGenerator.php@@ -18,20 +18,14 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Generator\Report\Tag;/**- * Class YearReportGenerator- *- * @package FireflyIII\Generator\Report\Tag+ * Class YearReportGenerator.*/class YearReportGenerator extends MonthReportGenerator{-- /**- * Doesn't do anything different.- */+ // Doesn't do anything different.}diff --git a/app/Handlers/Events/AdminEventHandler.php b/app/Handlers/Events/AdminEventHandler.phpindex c08a81b9ed..b7f999fe19 100644--- a/app/Handlers/Events/AdminEventHandler.php+++ b/app/Handlers/Events/AdminEventHandler.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Handlers\Events;@@ -31,9 +30,7 @@ use Session;use Swift_TransportException;/**- * Class AdminEventHandler- *- * @package FireflyIII\Handlers\Events+ * Class AdminEventHandler.*/class AdminEventHandler{diff --git a/app/Handlers/Events/StoredJournalEventHandler.php b/app/Handlers/Events/StoredJournalEventHandler.phpindex 51cb16b375..e02146f253 100644--- a/app/Handlers/Events/StoredJournalEventHandler.php+++ b/app/Handlers/Events/StoredJournalEventHandler.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Handlers\Events;@@ -37,17 +36,15 @@ use Log;* @codeCoverageIgnore** Class StoredJournalEventHandler- *- * @package FireflyIII\Handlers\Events*/class StoredJournalEventHandler{- /** @var JRI */+ /** @var JRI */public $journalRepository;- /** @var PRI */+ /** @var PRI */public $repository;- /** @var RGRI */+ /** @var RGRI */public $ruleGroupRepository;/**@@ -88,7 +85,7 @@ class StoredJournalEventHandler}// piggy exists?- if (is_null($piggyBank->id)) {+ if (null === $piggyBank->id) {Log::error(sprintf('There is no piggy bank with ID #%d', $piggyBankId));return true;@@ -96,7 +93,7 @@ class StoredJournalEventHandler// repetition exists?$repetition = $this->repository->getRepetition($piggyBank, $journal->date);- if (is_null($repetition->id)) {+ if (null === $repetition->id) {Log::error(sprintf('No piggy bank repetition on %s!', $journal->date->format('Y-m-d')));return true;@@ -104,7 +101,7 @@ class StoredJournalEventHandler// get the amount$amount = $this->repository->getExactAmount($piggyBank, $repetition, $journal);- if (bccomp($amount, '0') === 0) {+ if (0 === bccomp($amount, '0')) {Log::debug('Amount is zero, will not create event.');return true;diff --git a/app/Handlers/Events/UpdatedJournalEventHandler.php b/app/Handlers/Events/UpdatedJournalEventHandler.phpindex beca510fd2..13f2af4b01 100644--- a/app/Handlers/Events/UpdatedJournalEventHandler.php+++ b/app/Handlers/Events/UpdatedJournalEventHandler.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Handlers\Events;@@ -34,12 +33,10 @@ use FireflyIII\TransactionRules\Processor;* @codeCoverageIgnore** Class UpdatedJournalEventHandler- *- * @package FireflyIII\Handlers\Events*/class UpdatedJournalEventHandler{- /** @var RuleGroupRepositoryInterface */+ /** @var RuleGroupRepositoryInterface */public $repository;/**diff --git a/app/Handlers/Events/UserEventHandler.php b/app/Handlers/Events/UserEventHandler.phpindex 8f3379f2c5..d1c2186811 100644--- a/app/Handlers/Events/UserEventHandler.php+++ b/app/Handlers/Events/UserEventHandler.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Handlers\Events;@@ -37,17 +36,14 @@ use Preferences;use Swift_TransportException;/**- * Class UserEventHandler+ * Class UserEventHandler.** This class responds to any events that have anything to do with the User object.** The method name reflects what is being done. This is in the present tense.- *- * @package FireflyIII\Handlers\Events*/class UserEventHandler{-/*** This method will bestow upon a user the "owner" role if he is the first user in the system.*@@ -61,7 +57,7 @@ class UserEventHandler$repository = app(UserRepositoryInterface::class);// first user ever?- if ($repository->count() === 1) {+ if (1 === $repository->count()) {$repository->attachRole($event->user, 'owner');}diff --git a/app/Helpers/Attachments/AttachmentHelper.php b/app/Helpers/Attachments/AttachmentHelper.phpindex aab22e613f..d36a840063 100644--- a/app/Helpers/Attachments/AttachmentHelper.php+++ b/app/Helpers/Attachments/AttachmentHelper.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Helpers\Attachments;@@ -33,14 +32,11 @@ use Storage;use Symfony\Component\HttpFoundation\File\UploadedFile;/**- * Class AttachmentHelper- *- * @package FireflyIII\Helpers\Attachments+ * Class AttachmentHelper.*/class AttachmentHelper implements AttachmentHelperInterface{-- /** @var Collection */+ /** @var Collection */public $attachments;/** @var MessageBag */public $errors;@@ -114,7 +110,7 @@ class AttachmentHelper implements AttachmentHelperInterfaceif (is_array($files)) {/** @var UploadedFile $entry */foreach ($files as $entry) {- if (!is_null($entry)) {+ if (null !== $entry) {$this->processFile($entry, $model);}}@@ -152,7 +148,6 @@ class AttachmentHelper implements AttachmentHelperInterface}/**- ** @param UploadedFile $file* @param Model $model*@@ -161,7 +156,7 @@ class AttachmentHelper implements AttachmentHelperInterfaceprotected function processFile(UploadedFile $file, Model $model): Attachment{$validation = $this->validateUpload($file, $model);- if ($validation === false) {+ if (false === $validation) {return new Attachment;}diff --git a/app/Helpers/Attachments/AttachmentHelperInterface.php b/app/Helpers/Attachments/AttachmentHelperInterface.phpindex 4d398739dd..e292b29539 100644--- a/app/Helpers/Attachments/AttachmentHelperInterface.php+++ b/app/Helpers/Attachments/AttachmentHelperInterface.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Helpers\Attachments;@@ -29,13 +28,10 @@ use Illuminate\Support\Collection;use Illuminate\Support\MessageBag;/**- * Interface AttachmentHelperInterface- *- * @package FireflyIII\Helpers\Attachments+ * Interface AttachmentHelperInterface.*/interface AttachmentHelperInterface{-/*** @param Attachment $attachment*@@ -60,7 +56,6 @@ interface AttachmentHelperInterface/*** @param Model $model- ** @param null|array $files** @return booldiff --git a/app/Helpers/Chart/MetaPieChart.php b/app/Helpers/Chart/MetaPieChart.phpindex 4950e9f855..65d11c52d4 100644--- a/app/Helpers/Chart/MetaPieChart.php+++ b/app/Helpers/Chart/MetaPieChart.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Helpers\Chart;@@ -41,23 +40,19 @@ use Illuminate\Support\Collection;use Steam;/**- * Class MetaPieChart- *- * @package FireflyIII\Helpers\Chart- *- *+ * Class MetaPieChart.*/class MetaPieChart implements MetaPieChartInterface{- /** @var Collection */+ /** @var Collection */protected $accounts;- /** @var Collection */+ /** @var Collection */protected $budgets;- /** @var Collection */+ /** @var Collection */protected $categories;/** @var bool */protected $collectOtherObjects = false;- /** @var Carbon */+ /** @var Carbon */protected $end;/** @var array */protected $grouping@@ -75,13 +70,13 @@ class MetaPieChart implements MetaPieChartInterface'category' => CategoryRepositoryInterface::class,'tag' => TagRepositoryInterface::class,];- /** @var Carbon */+ /** @var Carbon */protected $start;- /** @var Collection */+ /** @var Collection */protected $tags;- /** @var string */+ /** @var string */protected $total = '0';- /** @var User */+ /** @var User */protected $user;public function __construct()@@ -108,7 +103,7 @@ class MetaPieChart implements MetaPieChartInterface$key = strval(trans('firefly.everything_else'));// also collect all other transactions- if ($this->collectOtherObjects && $direction === 'expense') {+ if ($this->collectOtherObjects && 'expense' === $direction) {/** @var JournalCollectorInterface $collector */$collector = app(JournalCollectorInterface::class);$collector->setUser($this->user);@@ -121,7 +116,7 @@ class MetaPieChart implements MetaPieChartInterface$chartData[$key] = $sum;}- if ($this->collectOtherObjects && $direction === 'income') {+ if ($this->collectOtherObjects && 'income' === $direction) {/** @var JournalCollectorInterface $collector */$collector = app(JournalCollectorInterface::class);$collector->setUser($this->user);@@ -258,7 +253,7 @@ class MetaPieChart implements MetaPieChartInterface$collector = app(JournalCollectorInterface::class);$types = [TransactionType::DEPOSIT, TransactionType::TRANSFER];$collector->addFilter(NegativeAmountFilter::class);- if ($direction === 'expense') {+ if ('expense' === $direction) {$types = [TransactionType::WITHDRAWAL, TransactionType::TRANSFER];$collector->addFilter(PositiveAmountFilter::class);$collector->removeFilter(NegativeAmountFilter::class);@@ -271,7 +266,7 @@ class MetaPieChart implements MetaPieChartInterface$collector->withOpposingAccount();$collector->addFilter(OpposingAccountFilter::class);- if ($direction === 'income') {+ if ('income' === $direction) {$collector->removeFilter(TransferFilter::class);}@@ -294,11 +289,10 @@ class MetaPieChart implements MetaPieChartInterface* @return array** @SuppressWarnings(PHPMD.CyclomaticComplexity)- **/protected function groupByFields(Collection $set, array $fields): array{- if (count($fields) === 0 && $this->tags->count() > 0) {+ if (0 === count($fields) && $this->tags->count() > 0) {// do a special group on tags:return $this->groupByTag($set);}diff --git a/app/Helpers/Chart/MetaPieChartInterface.php b/app/Helpers/Chart/MetaPieChartInterface.phpindex cc15e17308..250b13c7bc 100644--- a/app/Helpers/Chart/MetaPieChartInterface.php+++ b/app/Helpers/Chart/MetaPieChartInterface.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Helpers\Chart;@@ -28,9 +27,7 @@ use FireflyIII\User;use Illuminate\Support\Collection;/**- * Interface MetaPieChartInterface- *- * @package FireflyIII\Helpers\Chart+ * Interface MetaPieChartInterface.*/interface MetaPieChartInterface{@@ -47,54 +44,54 @@ interface MetaPieChartInterface** @return MetaPieChartInterface*/- public function setAccounts(Collection $accounts): MetaPieChartInterface;+ public function setAccounts(Collection $accounts): self;/*** @param Collection $budgets** @return MetaPieChartInterface*/- public function setBudgets(Collection $budgets): MetaPieChartInterface;+ public function setBudgets(Collection $budgets): self;/*** @param Collection $categories** @return MetaPieChartInterface*/- public function setCategories(Collection $categories): MetaPieChartInterface;+ public function setCategories(Collection $categories): self;/*** @param bool $collectOtherObjects** @return MetaPieChartInterface*/- public function setCollectOtherObjects(bool $collectOtherObjects): MetaPieChartInterface;+ public function setCollectOtherObjects(bool $collectOtherObjects): self;/*** @param Carbon $end** @return MetaPieChartInterface*/- public function setEnd(Carbon $end): MetaPieChartInterface;+ public function setEnd(Carbon $end): self;/*** @param Carbon $start** @return MetaPieChartInterface*/- public function setStart(Carbon $start): MetaPieChartInterface;+ public function setStart(Carbon $start): self;/*** @param Collection $tags** @return MetaPieChartInterface*/- public function setTags(Collection $tags): MetaPieChartInterface;+ public function setTags(Collection $tags): self;/*** @param User $user** @return MetaPieChartInterface*/- public function setUser(User $user): MetaPieChartInterface;+ public function setUser(User $user): self;}diff --git a/app/Helpers/Collection/Balance.php b/app/Helpers/Collection/Balance.phpindex aef2709026..b1ecf5c206 100644--- a/app/Helpers/Collection/Balance.php+++ b/app/Helpers/Collection/Balance.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Helpers\Collection;@@ -26,18 +25,14 @@ namespace FireflyIII\Helpers\Collection;use Illuminate\Support\Collection;/**- *- * Class Balance- *- * @package FireflyIII\Helpers\Collection+ * Class Balance.*/class Balance{-- /** @var BalanceHeader */+ /** @var BalanceHeader */protected $balanceHeader;- /** @var Collection */+ /** @var Collection */protected $balanceLines;/**diff --git a/app/Helpers/Collection/BalanceEntry.php b/app/Helpers/Collection/BalanceEntry.phpindex e67a11e7de..5037b3d421 100644--- a/app/Helpers/Collection/BalanceEntry.php+++ b/app/Helpers/Collection/BalanceEntry.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Helpers\Collection;@@ -26,16 +25,11 @@ namespace FireflyIII\Helpers\Collection;use FireflyIII\Models\Account as AccountModel;/**- *- * Class BalanceEntry- *- * @package FireflyIII\Helpers\Collection+ * Class BalanceEntry.*/class BalanceEntry{--- /** @var AccountModel */+ /** @var AccountModel */protected $account;/** @var string */protected $left = '0';diff --git a/app/Helpers/Collection/BalanceHeader.php b/app/Helpers/Collection/BalanceHeader.phpindex 7a6746997c..84d9844b89 100644--- a/app/Helpers/Collection/BalanceHeader.php+++ b/app/Helpers/Collection/BalanceHeader.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Helpers\Collection;@@ -27,15 +26,11 @@ use FireflyIII\Models\Account as AccountModel;use Illuminate\Support\Collection;/**- *- * Class BalanceHeader- *- * @package FireflyIII\Helpers\Collection+ * Class BalanceHeader.*/class BalanceHeader{-- /** @var Collection */+ /** @var Collection */protected $accounts;/**diff --git a/app/Helpers/Collection/BalanceLine.php b/app/Helpers/Collection/BalanceLine.phpindex e9673eb680..2f8f8f729f 100644--- a/app/Helpers/Collection/BalanceLine.php+++ b/app/Helpers/Collection/BalanceLine.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Helpers\Collection;@@ -29,10 +28,7 @@ use FireflyIII\Models\BudgetLimit;use Illuminate\Support\Collection;/**- *- * Class BalanceLine- *- * @package FireflyIII\Helpers\Collection+ * Class BalanceLine.*/class BalanceLine{@@ -40,12 +36,12 @@ class BalanceLineconst ROLE_TAGROLE = 2;const ROLE_DIFFROLE = 3;- /** @var Collection */+ /** @var Collection */protected $balanceEntries;/** @var BudgetModel */protected $budget;- /** @var BudgetLimit */+ /** @var BudgetLimit */protected $budgetLimit;/** @var int */protected $role = self::ROLE_DEFAULTROLE;@@ -148,20 +144,21 @@ class BalanceLine/*** @SuppressWarnings(PHPMD.CyclomaticComplexity)+ ** @return string*/public function getTitle(): string{- if ($this->getBudget() instanceof BudgetModel && !is_null($this->getBudget()->id)) {+ if ($this->getBudget() instanceof BudgetModel && null !== $this->getBudget()->id) {return $this->getBudget()->name;}- if ($this->getRole() === self::ROLE_DEFAULTROLE) {+ if (self::ROLE_DEFAULTROLE === $this->getRole()) {return strval(trans('firefly.no_budget'));}- if ($this->getRole() === self::ROLE_TAGROLE) {+ if (self::ROLE_TAGROLE === $this->getRole()) {return strval(trans('firefly.coveredWithTags'));}- if ($this->getRole() === self::ROLE_DIFFROLE) {+ if (self::ROLE_DIFFROLE === $this->getRole()) {return strval(trans('firefly.leftUnbalanced'));}@@ -172,7 +169,7 @@ class BalanceLine* If a BalanceLine has a budget/repetition, each BalanceEntry in this BalanceLine* should have a "spent" value, which is the amount of money that has been spent* on the given budget/repetition. If you subtract all those amounts from the budget/repetition's- * total amount, this is returned:+ * total amount, this is returned:.** @return string*/diff --git a/app/Helpers/Collection/Bill.php b/app/Helpers/Collection/Bill.phpindex e79ce41076..16a4730863 100644--- a/app/Helpers/Collection/Bill.php+++ b/app/Helpers/Collection/Bill.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Helpers\Collection;@@ -29,20 +28,17 @@ use Illuminate\Support\Collection;use Log;/**- * Class Bill- *- * @package FireflyIII\Helpers\Collection+ * Class Bill.*/class Bill{-/*** @var Collection*/private $bills;- /** @var Carbon */+ /** @var Carbon */private $endDate;- /** @var Carbon */+ /** @var Carbon */private $startDate;/**@@ -105,14 +101,13 @@ class Bill{$set = $this->bills->sortBy(function (BillLine $bill) {- $active = intval($bill->getBill()->active) === 0 ? 1 : 0;+ $active = 0 === intval($bill->getBill()->active) ? 1 : 0;$name = $bill->getBill()->name;return $active . $name;});-return $set;}diff --git a/app/Helpers/Collection/BillLine.php b/app/Helpers/Collection/BillLine.phpindex a82f8fb289..ed5dde7fe7 100644--- a/app/Helpers/Collection/BillLine.php+++ b/app/Helpers/Collection/BillLine.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Helpers\Collection;@@ -27,27 +26,23 @@ use Carbon\Carbon;use FireflyIII\Models\Bill as BillModel;/**- *- * Class BillLine- *- * @package FireflyIII\Helpers\Collection+ * Class BillLine.*/class BillLine{-- /** @var string */+ /** @var string */protected $amount;- /** @var BillModel */+ /** @var BillModel */protected $bill;- /** @var bool */+ /** @var bool */protected $hit;- /** @var string */+ /** @var string */protected $max;- /** @var string */+ /** @var string */protected $min;- /** @var Carbon */+ /** @var Carbon */private $lastHitDate;- /** @var int */+ /** @var int */private $transactionJournalId;/**@@ -159,7 +154,7 @@ class BillLine*/public function isActive(): bool{- return intval($this->bill->active) === 1;+ return 1 === intval($this->bill->active);}/**diff --git a/app/Helpers/Collection/Category.php b/app/Helpers/Collection/Category.phpindex 9bb918cb5e..60bd436add 100644--- a/app/Helpers/Collection/Category.php+++ b/app/Helpers/Collection/Category.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Helpers\Collection;@@ -27,15 +26,11 @@ use FireflyIII\Models\Category as CategoryModel;use Illuminate\Support\Collection;/**- *- * Class Category- *- * @package FireflyIII\Helpers\Collection+ * Class Category.*/class Category{-- /** @var Collection */+ /** @var Collection */protected $categories;/** @var string */protected $total = '0';@@ -79,7 +74,6 @@ class Category});-return $set;}diff --git a/app/Helpers/Collector/JournalCollector.php b/app/Helpers/Collector/JournalCollector.phpindex 39e31ba888..4219a13068 100644--- a/app/Helpers/Collector/JournalCollector.php+++ b/app/Helpers/Collector/JournalCollector.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Helpers\Collector;@@ -51,7 +50,6 @@ use Steam;** Class JournalCollector*- * @package FireflyIII\Helpers\Collector** @SuppressWarnings(PHPMD.ExcessiveClassComplexity)* @SuppressWarnings(PHPMD.CouplingBetweenObjects)@@ -59,10 +57,9 @@ use Steam;*/class JournalCollector implements JournalCollectorInterface{-/** @var array */private $accountIds = [];- /** @var int */+ /** @var int */private $count = 0;/** @var array */private $fields@@ -101,22 +98,21 @@ class JournalCollector implements JournalCollectorInterface'accounts.encrypted as account_encrypted','accounts.iban as account_iban','account_types.type as account_type',-];/** @var array */private $filters = [InternalTransferFilter::class];- /** @var bool */+ /** @var bool */private $joinedBudget = false;- /** @var bool */+ /** @var bool */private $joinedCategory = false;/** @var bool */private $joinedOpposing = false;/** @var bool */private $joinedTag = false;- /** @var int */+ /** @var int */private $limit;- /** @var int */+ /** @var int */private $offset;/** @var int */private $page = 1;@@ -218,11 +214,12 @@ class JournalCollector implements JournalCollectorInterface/*** @return int+ ** @throws FireflyException*/public function count(): int{- if ($this->run === true) {+ if (true === $this->run) {throw new FireflyException('Cannot count after run in JournalCollector.');}@@ -258,7 +255,7 @@ class JournalCollector implements JournalCollectorInterface$transaction->date = new Carbon($transaction->date);$transaction->description = Steam::decrypt(intval($transaction->encrypted), $transaction->description);- if (!is_null($transaction->bill_name)) {+ if (null !== $transaction->bill_name) {$transaction->bill_name = Steam::decrypt(intval($transaction->bill_name_encrypted), $transaction->bill_name);}$transaction->opposing_account_name = app('steam')->tryDecrypt($transaction->opposing_account_name);@@ -272,11 +269,12 @@ class JournalCollector implements JournalCollectorInterface/*** @return LengthAwarePaginator+ ** @throws FireflyException*/public function getPaginatedJournals(): LengthAwarePaginator{- if ($this->run === true) {+ if (true === $this->run) {throw new FireflyException('Cannot getPaginatedJournals after run in JournalCollector.');}$this->count();@@ -294,7 +292,7 @@ class JournalCollector implements JournalCollectorInterfacepublic function removeFilter(string $filter): JournalCollectorInterface{$key = array_search($filter, $this->filters, true);- if (!($key === false)) {+ if (!(false === $key)) {Log::debug(sprintf('Removed filter %s', $filter));unset($this->filters[$key]);}@@ -320,7 +318,6 @@ class JournalCollector implements JournalCollectorInterface$this->addFilter(TransferFilter::class);}-return $this;}@@ -416,7 +413,7 @@ class JournalCollector implements JournalCollectorInterfacepublic function setBudgets(Collection $budgets): JournalCollectorInterface{$budgetIds = $budgets->pluck('id')->toArray();- if (count($budgetIds) === 0) {+ if (0 === count($budgetIds)) {return $this;}$this->joinBudgetTables();@@ -440,7 +437,7 @@ class JournalCollector implements JournalCollectorInterfacepublic function setCategories(Collection $categories): JournalCollectorInterface{$categoryIds = $categories->pluck('id')->toArray();- if (count($categoryIds) === 0) {+ if (0 === count($categoryIds)) {return $this;}$this->joinCategoryTables();@@ -514,11 +511,11 @@ class JournalCollector implements JournalCollectorInterface$this->page = $page;if ($page > 0) {- $page--;+ --$page;}Log::debug(sprintf('Page is %d', $page));- if (!is_null($this->limit)) {+ if (null !== $this->limit) {$offset = ($this->limit * $page);$this->offset = $offset;$this->query->skip($offset);diff --git a/app/Helpers/Collector/JournalCollectorInterface.php b/app/Helpers/Collector/JournalCollectorInterface.phpindex cb9dbe444f..d6a7793572 100644--- a/app/Helpers/Collector/JournalCollectorInterface.php+++ b/app/Helpers/Collector/JournalCollectorInterface.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Helpers\Collector;@@ -32,9 +31,7 @@ use Illuminate\Pagination\LengthAwarePaginator;use Illuminate\Support\Collection;/**- * Interface JournalCollectorInterface- *- * @package FireflyIII\Helpers\Collector+ * Interface JournalCollectorInterface.*/interface JournalCollectorInterface{@@ -43,28 +40,28 @@ interface JournalCollectorInterface** @return JournalCollectorInterface*/- public function addFilter(string $filter): JournalCollectorInterface;+ public function addFilter(string $filter): self;/*** @param string $amount** @return JournalCollectorInterface*/- public function amountIs(string $amount): JournalCollectorInterface;+ public function amountIs(string $amount): self;/*** @param string $amount** @return JournalCollectorInterface*/- public function amountLess(string $amount): JournalCollectorInterface;+ public function amountLess(string $amount): self;/*** @param string $amount** @return JournalCollectorInterface*/- public function amountMore(string $amount): JournalCollectorInterface;+ public function amountMore(string $amount): self;/*** @return int@@ -86,89 +83,89 @@ interface JournalCollectorInterface** @return JournalCollectorInterface*/- public function removeFilter(string $filter): JournalCollectorInterface;+ public function removeFilter(string $filter): self;/*** @param Collection $accounts** @return JournalCollectorInterface*/- public function setAccounts(Collection $accounts): JournalCollectorInterface;+ public function setAccounts(Collection $accounts): self;/*** @param Carbon $after** @return JournalCollectorInterface*/- public function setAfter(Carbon $after): JournalCollectorInterface;+ public function setAfter(Carbon $after): self;/*** @return JournalCollectorInterface*/- public function setAllAssetAccounts(): JournalCollectorInterface;+ public function setAllAssetAccounts(): self;/*** @param Carbon $before** @return JournalCollectorInterface*/- public function setBefore(Carbon $before): JournalCollectorInterface;+ public function setBefore(Carbon $before): self;/*** @param Collection $bills** @return JournalCollectorInterface*/- public function setBills(Collection $bills): JournalCollectorInterface;+ public function setBills(Collection $bills): self;/*** @param Budget $budget** @return JournalCollectorInterface*/- public function setBudget(Budget $budget): JournalCollectorInterface;+ public function setBudget(Budget $budget): self;/*** @param Collection $budgets** @return JournalCollectorInterface*/- public function setBudgets(Collection $budgets): JournalCollectorInterface;+ public function setBudgets(Collection $budgets): self;/*** @param Collection $categories** @return JournalCollectorInterface*/- public function setCategories(Collection $categories): JournalCollectorInterface;+ public function setCategories(Collection $categories): self;/*** @param Category $category** @return JournalCollectorInterface*/- public function setCategory(Category $category): JournalCollectorInterface;+ public function setCategory(Category $category): self;/*** @param int $limit** @return JournalCollectorInterface*/- public function setLimit(int $limit): JournalCollectorInterface;+ public function setLimit(int $limit): self;/*** @param int $offset** @return JournalCollectorInterface*/- public function setOffset(int $offset): JournalCollectorInterface;+ public function setOffset(int $offset): self;/*** @param int $page** @return JournalCollectorInterface*/- public function setPage(int $page): JournalCollectorInterface;+ public function setPage(int $page): self;/*** @param Carbon $start@@ -176,28 +173,28 @@ interface JournalCollectorInterface** @return JournalCollectorInterface*/- public function setRange(Carbon $start, Carbon $end): JournalCollectorInterface;+ public function setRange(Carbon $start, Carbon $end): self;/*** @param Tag $tag** @return JournalCollectorInterface*/- public function setTag(Tag $tag): JournalCollectorInterface;+ public function setTag(Tag $tag): self;/*** @param Collection $tags** @return JournalCollectorInterface*/- public function setTags(Collection $tags): JournalCollectorInterface;+ public function setTags(Collection $tags): self;/*** @param array $types** @return JournalCollectorInterface*/- public function setTypes(array $types): JournalCollectorInterface;+ public function setTypes(array $types): self;public function setUser(User $user);@@ -209,25 +206,25 @@ interface JournalCollectorInterface/*** @return JournalCollectorInterface*/- public function withBudgetInformation(): JournalCollectorInterface;+ public function withBudgetInformation(): self;/*** @return JournalCollectorInterface*/- public function withCategoryInformation(): JournalCollectorInterface;+ public function withCategoryInformation(): self;/*** @return JournalCollectorInterface*/- public function withOpposingAccount(): JournalCollectorInterface;+ public function withOpposingAccount(): self;/*** @return JournalCollectorInterface*/- public function withoutBudget(): JournalCollectorInterface;+ public function withoutBudget(): self;/*** @return JournalCollectorInterface*/- public function withoutCategory(): JournalCollectorInterface;+ public function withoutCategory(): self;}diff --git a/app/Helpers/Filter/AmountFilter.php b/app/Helpers/Filter/AmountFilter.phpindex 2c5439928c..970bbefa49 100644--- a/app/Helpers/Filter/AmountFilter.php+++ b/app/Helpers/Filter/AmountFilter.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Helpers\Filter;@@ -28,12 +27,10 @@ use Illuminate\Support\Collection;use Log;/**- * Class AmountFilter+ * Class AmountFilter.** This filter removes transactions with either a positive amount ($parameters = 1) or a negative amount* ($parameter = -1). This is helpful when a Collection has you with both transactions in a journal.- *- * @package FireflyIII\Helpers\Filter*/class AmountFilter implements FilterInterface{diff --git a/app/Helpers/Filter/EmptyFilter.php b/app/Helpers/Filter/EmptyFilter.phpindex a9a0aaa5f6..7c8c16313c 100644--- a/app/Helpers/Filter/EmptyFilter.php+++ b/app/Helpers/Filter/EmptyFilter.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Helpers\Filter;@@ -26,14 +25,10 @@ namespace FireflyIII\Helpers\Filter;use Illuminate\Support\Collection;/**- * Class EmptyFilter- *- * @package FireflyIII\Helpers\Filter+ * Class EmptyFilter.*/class EmptyFilter implements FilterInterface{--/*** @param Collection $set*diff --git a/app/Helpers/Filter/FilterInterface.php b/app/Helpers/Filter/FilterInterface.phpindex 24e3362a32..229864ad8f 100644--- a/app/Helpers/Filter/FilterInterface.php+++ b/app/Helpers/Filter/FilterInterface.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Helpers\Filter;diff --git a/app/Helpers/Filter/InternalTransferFilter.php b/app/Helpers/Filter/InternalTransferFilter.phpindex 2f72d22f30..1113977ceb 100644--- a/app/Helpers/Filter/InternalTransferFilter.php+++ b/app/Helpers/Filter/InternalTransferFilter.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Helpers\Filter;@@ -28,13 +27,11 @@ use Illuminate\Support\Collection;use Log;/**- * Class InternalTransferFilter+ * Class InternalTransferFilter.** This filter removes any filters that are from A to B or from B to A given a set of* account id's (in $parameters) where A and B are mentioned. So transfers between the mentioned* accounts will be removed.- *- * @package FireflyIII\Helpers\Filter*/class InternalTransferFilter implements FilterInterface{@@ -60,7 +57,7 @@ class InternalTransferFilter implements FilterInterface{return $set->filter(function (Transaction $transaction) {- if (is_null($transaction->opposing_account_id)) {+ if (null === $transaction->opposing_account_id) {return $transaction;}// both id's in $parameters?diff --git a/app/Helpers/Filter/NegativeAmountFilter.php b/app/Helpers/Filter/NegativeAmountFilter.phpindex 730f9717b1..65e95f9fe5 100644--- a/app/Helpers/Filter/NegativeAmountFilter.php+++ b/app/Helpers/Filter/NegativeAmountFilter.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Helpers\Filter;@@ -28,11 +27,9 @@ use Illuminate\Support\Collection;use Log;/**- * Class NegativeAmountFilter+ * Class NegativeAmountFilter.** This filter removes entries with a negative amount (the original modifier is -1).- *- * @package FireflyIII\Helpers\Filter*/class NegativeAmountFilter implements FilterInterface{diff --git a/app/Helpers/Filter/OpposingAccountFilter.php b/app/Helpers/Filter/OpposingAccountFilter.phpindex df02f9405a..1539b86bde 100644--- a/app/Helpers/Filter/OpposingAccountFilter.php+++ b/app/Helpers/Filter/OpposingAccountFilter.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Helpers\Filter;@@ -28,12 +27,10 @@ use Illuminate\Support\Collection;use Log;/**- * Class OpposingAccountFilter+ * Class OpposingAccountFilter.** This filter is similar to the internal transfer filter but only removes transactions when the opposing account is* amongst $parameters (list of account ID's).- *- * @package FireflyIII\Helpers\Filter*/class OpposingAccountFilter implements FilterInterface{diff --git a/app/Helpers/Filter/PositiveAmountFilter.php b/app/Helpers/Filter/PositiveAmountFilter.phpindex e5464d9253..1a6b5383d3 100644--- a/app/Helpers/Filter/PositiveAmountFilter.php+++ b/app/Helpers/Filter/PositiveAmountFilter.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Helpers\Filter;@@ -28,14 +27,12 @@ use Illuminate\Support\Collection;use Log;/**- * Class PositiveAmountFilter+ * Class PositiveAmountFilter.** This filter removes entries with a negative amount (the original modifier is -1).** This filter removes transactions with either a positive amount ($parameters = 1) or a negative amount* ($parameter = -1). This is helpful when a Collection has you with both transactions in a journal.- *- * @package FireflyIII\Helpers\Filter*/class PositiveAmountFilter implements FilterInterface{@@ -49,7 +46,7 @@ class PositiveAmountFilter implements FilterInterfacereturn $set->filter(function (Transaction $transaction) {// remove by amount- if (bccomp($transaction->transaction_amount, '0') === 1) {+ if (1 === bccomp($transaction->transaction_amount, '0')) {Log::debug(sprintf('Filtered #%d because amount is %f.', $transaction->id, $transaction->transaction_amount));return null;diff --git a/app/Helpers/Filter/TransferFilter.php b/app/Helpers/Filter/TransferFilter.phpindex 732e9dee6b..4d3e6877ef 100644--- a/app/Helpers/Filter/TransferFilter.php+++ b/app/Helpers/Filter/TransferFilter.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Helpers\Filter;@@ -29,11 +28,9 @@ use Illuminate\Support\Collection;use Steam;/**- * Class TransferFilter+ * Class TransferFilter.** This filter removes any transfers that are in the collection twice (from A to B and from B to A).- *- * @package FireflyIII\Helpers\Filter*/class TransferFilter implements FilterInterface{@@ -48,7 +45,7 @@ class TransferFilter implements FilterInterface$new = new Collection;/** @var Transaction $transaction */foreach ($set as $transaction) {- if ($transaction->transaction_type_type !== TransactionType::TRANSFER) {+ if (TransactionType::TRANSFER !== $transaction->transaction_type_type) {$new->push($transaction);continue;}diff --git a/app/Helpers/FiscalHelper.php b/app/Helpers/FiscalHelper.phpindex 45b2280ca6..4624f5aac2 100644--- a/app/Helpers/FiscalHelper.php+++ b/app/Helpers/FiscalHelper.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Helpers;@@ -27,20 +26,15 @@ use Carbon\Carbon;use Preferences;/**- * Class FiscalHelper- *- * @package FireflyIII\Helpers+ * Class FiscalHelper.*/class FiscalHelper implements FiscalHelperInterface{-/** @var bool */protected $useCustomFiscalYear;/*** FiscalHelper constructor.- *- **/public function __construct(){@@ -56,7 +50,7 @@ class FiscalHelper implements FiscalHelperInterface{// get start of fiscal year for passed date$endDate = $this->startOfFiscalYear($date);- if ($this->useCustomFiscalYear === true) {+ if (true === $this->useCustomFiscalYear) {// add 1 year and sub 1 day$endDate->addYear();$endDate->subDay();@@ -65,7 +59,6 @@ class FiscalHelper implements FiscalHelperInterface}$endDate->endOfYear();-return $endDate;}@@ -78,7 +71,7 @@ class FiscalHelper implements FiscalHelperInterface{// get start mm-dd. Then create a start date in the year passed.$startDate = clone $date;- if ($this->useCustomFiscalYear === true) {+ if (true === $this->useCustomFiscalYear) {$prefStartStr = Preferences::get('fiscalYearStart', '01-01')->data;list($mth, $day) = explode('-', $prefStartStr);$startDate->month(intval($mth))->day(intval($day));diff --git a/app/Helpers/FiscalHelperInterface.php b/app/Helpers/FiscalHelperInterface.phpindex 152ba48262..c6a4764da0 100644--- a/app/Helpers/FiscalHelperInterface.php+++ b/app/Helpers/FiscalHelperInterface.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Helpers;@@ -26,13 +25,10 @@ namespace FireflyIII\Helpers;use Carbon\Carbon;/**- * Interface FiscalHelperInterface- *- * @package FireflyIII\Helpers+ * Interface FiscalHelperInterface.*/interface FiscalHelperInterface{-/*** This method produces a clone of the Carbon date object passed, checks preferences* and calculates the last day of the fiscal year.diff --git a/app/Helpers/Help/Help.php b/app/Helpers/Help/Help.phpindex 9a27a368c4..265a642d5e 100644--- a/app/Helpers/Help/Help.php+++ b/app/Helpers/Help/Help.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Helpers\Help;@@ -31,9 +30,7 @@ use Requests_Exception;use Route;/**- * Class Help- *- * @package FireflyIII\Helpers\Help+ * Class Help.*/class Help implements HelpInterface{@@ -76,7 +73,7 @@ class Help implements HelpInterfaceLog::debug(sprintf('Status code is %d', $result->status_code));- if ($result->status_code === 200) {+ if (200 === $result->status_code) {$content = trim($result->body);}@@ -90,7 +87,6 @@ class Help implements HelpInterface}/**- ** @param string $route** @return bool@@ -121,11 +117,9 @@ class Help implements HelpInterface}/**- ** @param string $route* @param string $language* @param string $content- **/public function putInCache(string $route, string $language, string $content){diff --git a/app/Helpers/Help/HelpInterface.php b/app/Helpers/Help/HelpInterface.phpindex 5b97799697..4768e3fd40 100644--- a/app/Helpers/Help/HelpInterface.php+++ b/app/Helpers/Help/HelpInterface.php@@ -18,19 +18,15 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Helpers\Help;/**- * Interface HelpInterface- *- * @package FireflyIII\Helpers\Help+ * Interface HelpInterface.*/interface HelpInterface{-/*** @param string $route* @param string $languagediff --git a/app/Helpers/Report/BalanceReportHelper.php b/app/Helpers/Report/BalanceReportHelper.phpindex 244ab9be70..3222c1f1f5 100644--- a/app/Helpers/Report/BalanceReportHelper.php+++ b/app/Helpers/Report/BalanceReportHelper.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Helpers\Report;@@ -34,15 +33,13 @@ use Illuminate\Support\Collection;use Log;/**- * Class BalanceReportHelper+ * Class BalanceReportHelper.** @SuppressWarnings(PHPMD.CouplingBetweenObjects) // I can't really help it.- * @package FireflyIII\Helpers\Report*/class BalanceReportHelper implements BalanceReportHelperInterface{-- /** @var BudgetRepositoryInterface */+ /** @var BudgetRepositoryInterface */protected $budgetRepository;/**@@ -56,7 +53,6 @@ class BalanceReportHelper implements BalanceReportHelperInterface$this->budgetRepository = $budgetRepository;}-/*** @param Collection $accounts* @param Carbon $start@@ -77,7 +73,7 @@ class BalanceReportHelper implements BalanceReportHelperInterface/** @var BudgetLimit $budgetLimit */foreach ($budgetLimits as $budgetLimit) {- if (!is_null($budgetLimit->budget)) {+ if (null !== $budgetLimit->budget) {$line = $this->createBalanceLine($budgetLimit, $accounts);$balance->addBalanceLine($line);}@@ -96,7 +92,6 @@ class BalanceReportHelper implements BalanceReportHelperInterfacereturn $balance;}-/*** @param BudgetLimit $budgetLimit* @param Collection $accounts@@ -126,7 +121,6 @@ class BalanceReportHelper implements BalanceReportHelperInterfacereturn $line;}-/*** @param Collection $accounts* @param Carbon $start@@ -150,7 +144,6 @@ class BalanceReportHelper implements BalanceReportHelperInterfacereturn $empty;}-/*** @param Balance $balance* @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's exactly 5.@@ -162,7 +155,7 @@ class BalanceReportHelper implements BalanceReportHelperInterface$set = $balance->getBalanceLines();$newSet = new Collection;foreach ($set as $entry) {- if (!is_null($entry->getBudget()->id)) {+ if (null !== $entry->getBudget()->id) {$sum = '0';foreach ($entry->getBalanceEntries() as $balanceEntry) {$sum = bcadd($sum, $balanceEntry->getSpent());diff --git a/app/Helpers/Report/BalanceReportHelperInterface.php b/app/Helpers/Report/BalanceReportHelperInterface.phpindex 9aa17f589f..66e7b23e89 100644--- a/app/Helpers/Report/BalanceReportHelperInterface.php+++ b/app/Helpers/Report/BalanceReportHelperInterface.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Helpers\Report;@@ -28,9 +27,7 @@ use FireflyIII\Helpers\Collection\Balance;use Illuminate\Support\Collection;/**- * Interface BalanceReportHelperInterface- *- * @package FireflyIII\Helpers\Report+ * Interface BalanceReportHelperInterface.*/interface BalanceReportHelperInterface{diff --git a/app/Helpers/Report/BudgetReportHelper.php b/app/Helpers/Report/BudgetReportHelper.phpindex 07d4cda721..995932ce73 100644--- a/app/Helpers/Report/BudgetReportHelper.php+++ b/app/Helpers/Report/BudgetReportHelper.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Helpers\Report;@@ -30,9 +29,7 @@ use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;use Illuminate\Support\Collection;/**- * Class BudgetReportHelper- *- * @package FireflyIII\Helpers\Report+ * Class BudgetReportHelper.*/class BudgetReportHelper implements BudgetReportHelperInterface{@@ -52,6 +49,7 @@ class BudgetReportHelper implements BudgetReportHelperInterface/*** @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's exactly 5.* @SuppressWarnings(PHPMD.ExcessiveMethodLength) // all the arrays make it long.+ ** @param Carbon $start* @param Carbon $end* @param Collection $accounts@@ -66,9 +64,8 @@ class BudgetReportHelper implements BudgetReportHelperInterface/** @var Budget $budget */foreach ($set as $budget) {$budgetLimits = $this->repository->getBudgetLimits($budget, $start, $end);- if ($budgetLimits->count() === 0) { // no budget limit(s) for this budget-- $spent = $this->repository->spentInPeriod(new Collection([$budget]), $accounts, $start, $end);// spent for budget in time range+ if (0 === $budgetLimits->count()) { // no budget limit(s) for this budget+ $spent = $this->repository->spentInPeriod(new Collection([$budget]), $accounts, $start, $end); // spent for budget in time rangeif (bccomp($spent, '0') === -1) {$line = ['type' => 'budget',@@ -156,9 +153,9 @@ class BudgetReportHelper implements BudgetReportHelperInterface{$array = [];$expenses = $this->repository->spentInPeriod(new Collection([$budget]), $accounts, $budgetLimit->start_date, $budgetLimit->end_date);- $array['left'] = bccomp(bcadd($budgetLimit->amount, $expenses), '0') === 1 ? bcadd($budgetLimit->amount, $expenses) : '0';- $array['spent'] = bccomp(bcadd($budgetLimit->amount, $expenses), '0') === 1 ? $expenses : '0';- $array['overspent'] = bccomp(bcadd($budgetLimit->amount, $expenses), '0') === 1 ? '0' : bcadd($expenses, $budgetLimit->amount);+ $array['left'] = 1 === bccomp(bcadd($budgetLimit->amount, $expenses), '0') ? bcadd($budgetLimit->amount, $expenses) : '0';+ $array['spent'] = 1 === bccomp(bcadd($budgetLimit->amount, $expenses), '0') ? $expenses : '0';+ $array['overspent'] = 1 === bccomp(bcadd($budgetLimit->amount, $expenses), '0') ? '0' : bcadd($expenses, $budgetLimit->amount);$array['expenses'] = $expenses;return $array;diff --git a/app/Helpers/Report/BudgetReportHelperInterface.php b/app/Helpers/Report/BudgetReportHelperInterface.phpindex 3c86a0fd12..7c4a7ccf2f 100644--- a/app/Helpers/Report/BudgetReportHelperInterface.php+++ b/app/Helpers/Report/BudgetReportHelperInterface.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Helpers\Report;@@ -27,13 +26,10 @@ use Carbon\Carbon;use Illuminate\Support\Collection;/**- * Interface BudgetReportHelperInterface- *- * @package FireflyIII\Helpers\Report+ * Interface BudgetReportHelperInterface.*/interface BudgetReportHelperInterface{-/*** @param Carbon $start* @param Carbon $enddiff --git a/app/Helpers/Report/PopupReport.php b/app/Helpers/Report/PopupReport.phpindex 49b4014354..65c9164d0c 100644--- a/app/Helpers/Report/PopupReport.php+++ b/app/Helpers/Report/PopupReport.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Helpers\Report;@@ -32,14 +31,10 @@ use FireflyIII\Models\TransactionType;use Illuminate\Support\Collection;/**- * Class PopupReport- *- * @package FireflyIII\Helpers\Report+ * Class PopupReport.*/class PopupReport implements PopupReportInterface{--/*** @param $account* @param $attributes@@ -58,11 +53,10 @@ class PopupReport implements PopupReportInterface->withoutBudget();$journals = $collector->getJournals();-return $journals->filter(function (Transaction $transaction) {$tags = $transaction->transactionJournal->tags()->where('tagMode', 'balancingAct')->count();- if ($tags === 0) {+ if (0 === $tags) {return true;}@@ -120,10 +114,10 @@ class PopupReport implements PopupReportInterface$collector->setAccounts($attributes['accounts'])->setRange($attributes['startDate'], $attributes['endDate']);- if (is_null($budget->id)) {+ if (null === $budget->id) {$collector->setTypes([TransactionType::WITHDRAWAL])->withoutBudget();}- if (!is_null($budget->id)) {+ if (null !== $budget->id) {$collector->setBudget($budget);}$journals = $collector->getJournals();diff --git a/app/Helpers/Report/PopupReportInterface.php b/app/Helpers/Report/PopupReportInterface.phpindex 288c53a72e..4b19f54661 100644--- a/app/Helpers/Report/PopupReportInterface.php+++ b/app/Helpers/Report/PopupReportInterface.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Helpers\Report;@@ -29,13 +28,10 @@ use FireflyIII\Models\Category;use Illuminate\Support\Collection;/**- * Interface PopupReportInterface- *- * @package FireflyIII\Helpers\Report+ * Interface PopupReportInterface.*/interface PopupReportInterface{-/*** @param $account* @param $attributesdiff --git a/app/Helpers/Report/ReportHelper.php b/app/Helpers/Report/ReportHelper.phpindex c355f65821..3b812533da 100644--- a/app/Helpers/Report/ReportHelper.php+++ b/app/Helpers/Report/ReportHelper.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Helpers\Report;@@ -35,14 +34,11 @@ use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;use Illuminate\Support\Collection;/**- * Class ReportHelper- *- * @package FireflyIII\Helpers\Report+ * Class ReportHelper.*/class ReportHelper implements ReportHelperInterface{-- /** @var BudgetRepositoryInterface */+ /** @var BudgetRepositoryInterface */protected $budgetRepository;/**@@ -95,7 +91,7 @@ class ReportHelper implements ReportHelperInterface});$first = $entry->first();- if (!is_null($first)) {+ if (null !== $first) {$billLine->setTransactionJournalId($first->id);$billLine->setAmount($first->transaction_amount);$billLine->setLastHitDate($first->date);diff --git a/app/Helpers/Report/ReportHelperInterface.php b/app/Helpers/Report/ReportHelperInterface.phpindex 98e26667ad..dafd0105ae 100644--- a/app/Helpers/Report/ReportHelperInterface.php+++ b/app/Helpers/Report/ReportHelperInterface.php@@ -18,25 +18,19 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Helpers\Report;use Carbon\Carbon;use FireflyIII\Helpers\Collection\Bill as BillCollection;-use FireflyIII\Helpers\Collection\Expense;-use FireflyIII\Helpers\Collection\Income;use Illuminate\Support\Collection;/**- * Interface ReportHelperInterface- *- * @package FireflyIII\Helpers\Report+ * Interface ReportHelperInterface.*/interface ReportHelperInterface{-/*** This method generates a full report for the given period on all* the users bills and their payments.diff --git a/app/Http/Controllers/Account/ReconcileController.php b/app/Http/Controllers/Account/ReconcileController.phpindex d0c1d1234c..37746ccdde 100644--- a/app/Http/Controllers/Account/ReconcileController.php+++ b/app/Http/Controllers/Account/ReconcileController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers\Account;@@ -37,9 +36,7 @@ use Response;use View;/**- * Class ReconcileController- *- * @package FireflyIII\Http\Controllers\Account+ * Class ReconcileController.*/class ReconcileController extends Controller{@@ -94,14 +91,14 @@ class ReconcileController extends Controller*/public function reconcile(Account $account, Carbon $start = null, Carbon $end = null){- if ($account->accountType->type === AccountType::INITIAL_BALANCE) {+ if (AccountType::INITIAL_BALANCE === $account->accountType->type) {return $this->redirectToOriginalAccount($account);}/** @var CurrencyRepositoryInterface $currencyRepos */$currencyRepos = app(CurrencyRepositoryInterface::class);$currencyId = intval($account->getMeta('currency_id'));$currency = $currencyRepos->find($currencyId);- if ($currencyId === 0) {+ if (0 === $currencyId) {$currency = app('amount')->getDefaultCurrency();}@@ -109,11 +106,11 @@ class ReconcileController extends Controller$range = Preferences::get('viewRange', '1M')->data;// get start and end- if (is_null($start) && is_null($end)) {+ if (null === $start && null === $end) {$start = clone session('start', Navigation::startOfPeriod(new Carbon, $range));$end = clone session('end', Navigation::endOfPeriod(new Carbon, $range));}- if (is_null($end)) {+ if (null === $end) {$end = Navigation::endOfPeriod($start, $range);}@@ -158,7 +155,7 @@ class ReconcileController extends Controller*/public function transactions(Account $account, Carbon $start, Carbon $end){- if ($account->accountType->type === AccountType::INITIAL_BALANCE) {+ if (AccountType::INITIAL_BALANCE === $account->accountType->type) {return $this->redirectToOriginalAccount($account);}@@ -168,7 +165,6 @@ class ReconcileController extends Controller$selectionEnd = clone $end;$selectionEnd->addDays(3);-// grab transactions:/** @var JournalCollectorInterface $collector */$collector = app(JournalCollectorInterface::class);diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.phpindex 1880401794..ebbd721bbe 100644--- a/app/Http/Controllers/AccountController.php+++ b/app/Http/Controllers/AccountController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers;@@ -45,9 +44,8 @@ use Steam;use View;/**- * Class AccountController+ * Class AccountController.*- * @package FireflyIII\Http\Controllers* @SuppressWarnings(PHPMD.CouplingBetweenObjects)*/class AccountController extends Controller@@ -90,12 +88,11 @@ class AccountController extends Controller$roles[$role] = strval(trans('firefly.account_role_' . $role));}-// pre fill some data- $request->session()->flash('preFilled', ['currency_id' => $defaultCurrency->id,]);+ $request->session()->flash('preFilled', ['currency_id' => $defaultCurrency->id]);// put previous url in session if not redirect from store (not "create another").- if (session('accounts.create.fromStore') !== true) {+ if (true !== session('accounts.create.fromStore')) {$this->rememberPreviousUri('accounts.create.uri');}$request->session()->forget('accounts.create.fromStore');@@ -174,9 +171,8 @@ class AccountController extends Controller$roles[$role] = strval(trans('firefly.account_role_' . $role));}-// put previous url in session if not redirect from store (not "return_to_edit").- if (session('accounts.edit.fromUpdate') !== true) {+ if (true !== session('accounts.edit.fromUpdate')) {$this->rememberPreviousUri('accounts.edit.uri');}$request->session()->forget('accounts.edit.fromUpdate');@@ -185,9 +181,9 @@ class AccountController extends Controller// the opening balance is tricky:$openingBalanceAmount = $account->getOpeningBalanceAmount();- $openingBalanceAmount = $account->getOpeningBalanceAmount() === '0' ? '' : $openingBalanceAmount;+ $openingBalanceAmount = '0' === $account->getOpeningBalanceAmount() ? '' : $openingBalanceAmount;$openingBalanceDate = $account->getOpeningBalanceDate();- $openingBalanceDate = $openingBalanceDate->year === 1900 ? null : $openingBalanceDate->format('Y-m-d');+ $openingBalanceDate = 1900 === $openingBalanceDate->year ? null : $openingBalanceDate->format('Y-m-d');$currency = $repository->find(intval($account->getMeta('currency_id')));$preFilled = [@@ -200,7 +196,6 @@ class AccountController extends Controller'openingBalance' => $openingBalanceAmount,'virtualBalance' => $account->virtual_balance,'currency_id' => $currency->id,-];$request->session()->flash('preFilled', $preFilled);$request->session()->flash('gaEventCategory', 'accounts');@@ -273,7 +268,7 @@ class AccountController extends Controller*/public function show(Request $request, JournalRepositoryInterface $repository, Account $account, string $moment = ''){- if ($account->accountType->type === AccountType::INITIAL_BALANCE) {+ if (AccountType::INITIAL_BALANCE === $account->accountType->type) {return $this->redirectToOriginalAccount($account);}/** @var CurrencyRepositoryInterface $currencyRepos */@@ -288,13 +283,12 @@ class AccountController extends Controller$periods = new Collection;$currencyId = intval($account->getMeta('currency_id'));$currency = $currencyRepos->find($currencyId);- if ($currencyId === 0) {+ if (0 === $currencyId) {$currency = app('amount')->getDefaultCurrency();}-// prep for "all" view.- if ($moment === 'all') {+ if ('all' === $moment) {$subTitle = trans('firefly.all_journals_for_account', ['name' => $account->name]);$chartUri = route('chart.account.all', [$account->id]);$first = $repository->first();@@ -303,7 +297,7 @@ class AccountController extends Controller}// prep for "specific date" view.- if (strlen($moment) > 0 && $moment !== 'all') {+ if (strlen($moment) > 0 && 'all' !== $moment) {$start = new Carbon($moment);$end = Navigation::endOfPeriod($start, $range);$fStart = $start->formatLocalized($this->monthAndDayFormat);@@ -314,7 +308,7 @@ class AccountController extends Controller}// prep for current period view- if (strlen($moment) === 0) {+ if (0 === strlen($moment)) {$start = clone session('start', Navigation::startOfPeriod(new Carbon, $range));$end = clone session('end', Navigation::endOfPeriod(new Carbon, $range));$fStart = $start->formatLocalized($this->monthAndDayFormat);@@ -326,7 +320,7 @@ class AccountController extends Controller// grab journals:$collector = app(JournalCollectorInterface::class);$collector->setAccounts(new Collection([$account]))->setLimit($pageSize)->setPage($page);- if (!is_null($start)) {+ if (null !== $start) {$collector->setRange($start, $end);}$transactions = $collector->getPaginatedJournals();@@ -343,7 +337,6 @@ class AccountController extends Controller* @param AccountRepositoryInterface $repository** @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector- **/public function store(AccountFormRequest $request, AccountRepositoryInterface $repository){@@ -354,12 +347,12 @@ class AccountController extends Controller// update preferences if necessary:$frontPage = Preferences::get('frontPageAccounts', [])->data;- if (count($frontPage) > 0 && $account->accountType->type === AccountType::ASSET) {+ if (count($frontPage) > 0 && AccountType::ASSET === $account->accountType->type) {$frontPage[] = $account->id;Preferences::set('frontPageAccounts', $frontPage);}- if (intval($request->get('create_another')) === 1) {+ if (1 === intval($request->get('create_another'))) {// set value so create routine will not overwrite URL:$request->session()->put('accounts.create.fromStore', true);@@ -385,7 +378,7 @@ class AccountController extends Controller$request->session()->flash('success', strval(trans('firefly.updated_account', ['name' => $account->name])));Preferences::mark();- if (intval($request->get('return_to_edit')) === 1) {+ if (1 === intval($request->get('return_to_edit'))) {// set value so edit routine will not overwrite URL:$request->session()->put('accounts.edit.fromUpdate', true);@@ -396,7 +389,6 @@ class AccountController extends Controllerreturn redirect($this->getPreviousUri('accounts.edit.uri'));}-/*** @param array $array* @param int $entryId@@ -468,10 +460,10 @@ class AccountController extends Controller'name' => $dateName,'spent' => $spent,'earned' => $earned,- 'date' => clone $end]+ 'date' => clone $end,]);$end = Navigation::subtractPeriod($end, $range, 1);- $count++;+ ++$count;}$cache->store($entries);@@ -482,13 +474,14 @@ class AccountController extends Controller* @param Account $account** @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector+ ** @throws FireflyException*/private function redirectToOriginalAccount(Account $account){/** @var Transaction $transaction */$transaction = $account->transactions()->first();- if (is_null($transaction)) {+ if (null === $transaction) {throw new FireflyException('Expected a transaction. This account has none. BEEP, error.');}@@ -496,7 +489,7 @@ class AccountController extends Controller/** @var Transaction $opposingTransaction */$opposingTransaction = $journal->transactions()->where('transactions.id', '!=', $transaction->id)->first();- if (is_null($opposingTransaction)) {+ if (null === $opposingTransaction) {throw new FireflyException('Expected an opposing transaction. This account has none. BEEP, error.'); // @codeCoverageIgnore}diff --git a/app/Http/Controllers/Admin/ConfigurationController.php b/app/Http/Controllers/Admin/ConfigurationController.phpindex 1be473766c..fa4b3ab1d5 100644--- a/app/Http/Controllers/Admin/ConfigurationController.php+++ b/app/Http/Controllers/Admin/ConfigurationController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers\Admin;@@ -32,9 +31,7 @@ use Session;use View;/**- * Class ConfigurationController- *- * @package FireflyIII\Http\Controllers\Admin+ * Class ConfigurationController.*/class ConfigurationController extends Controller{@@ -45,7 +42,6 @@ class ConfigurationController extends Controller{parent::__construct();-$this->middleware(function ($request, $next) {View::share('title', strval(trans('firefly.administration')));diff --git a/app/Http/Controllers/Admin/HomeController.php b/app/Http/Controllers/Admin/HomeController.phpindex 1c25ae67d1..4fa7948909 100644--- a/app/Http/Controllers/Admin/HomeController.php+++ b/app/Http/Controllers/Admin/HomeController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers\Admin;@@ -30,9 +29,7 @@ use Log;use Session;/**- * Class HomeController- *- * @package FireflyIII\Http\Controllers\Admin+ * Class HomeController.*/class HomeController extends Controller{diff --git a/app/Http/Controllers/Admin/LinkController.php b/app/Http/Controllers/Admin/LinkController.phpindex ee25cab6a7..06c8146e37 100644--- a/app/Http/Controllers/Admin/LinkController.php+++ b/app/Http/Controllers/Admin/LinkController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers\Admin;@@ -32,9 +31,7 @@ use Preferences;use View;/**- * Class LinkController- *- * @package FireflyIII\Http\Controllers\Admin+ * Class LinkController.*/class LinkController extends Controller{@@ -64,7 +61,7 @@ class LinkController extends Controller$subTitleIcon = 'fa-link';// put previous url in session if not redirect from store (not "create another").- if (session('link_types.create.fromStore') !== true) {+ if (true !== session('link_types.create.fromStore')) {$this->rememberPreviousUri('link_types.create.uri');}@@ -139,7 +136,7 @@ class LinkController extends Controller$subTitleIcon = 'fa-link';// put previous url in session if not redirect from store (not "return_to_edit").- if (session('link_types.edit.fromUpdate') !== true) {+ if (true !== session('link_types.edit.fromUpdate')) {$this->rememberPreviousUri('link_types.edit.uri');}$request->session()->forget('link_types.edit.fromUpdate');@@ -196,7 +193,7 @@ class LinkController extends Controller$linkType = $repository->store($data);$request->session()->flash('success', strval(trans('firefly.stored_new_link_type', ['name' => $linkType->name])));- if (intval($request->get('create_another')) === 1) {+ if (1 === intval($request->get('create_another'))) {// set value so create routine will not overwrite URL:$request->session()->put('link_types.create.fromStore', true);@@ -225,7 +222,7 @@ class LinkController extends Controller$request->session()->flash('success', strval(trans('firefly.updated_link_type', ['name' => $linkType->name])));Preferences::mark();- if (intval($request->get('return_to_edit')) === 1) {+ if (1 === intval($request->get('return_to_edit'))) {// set value so edit routine will not overwrite URL:$request->session()->put('link_types.edit.fromUpdate', true);diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.phpindex e8cf8288cf..8670e95e90 100644--- a/app/Http/Controllers/Admin/UserController.php+++ b/app/Http/Controllers/Admin/UserController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers\Admin;@@ -33,9 +32,7 @@ use Session;use View;/**- * Class UserController- *- * @package FireflyIII\Http\Controllers\Admin+ * Class UserController.*/class UserController extends Controller{@@ -46,7 +43,6 @@ class UserController extends Controller{parent::__construct();-$this->middleware(function ($request, $next) {View::share('title', strval(trans('firefly.administration')));@@ -91,7 +87,7 @@ class UserController extends Controllerpublic function edit(User $user){// put previous url in session if not redirect from store (not "return_to_edit").- if (session('users.edit.fromUpdate') !== true) {+ if (true !== session('users.edit.fromUpdate')) {$this->rememberPreviousUri('users.edit.uri');}Session::forget('users.edit.fromUpdate');@@ -125,14 +121,13 @@ class UserController extends Controller$list = ['twoFactorAuthEnabled', 'twoFactorAuthSecret'];$preferences = Preferences::getArrayForUser($user, $list);$user->isAdmin = $user->hasRole('owner');- $is2faEnabled = $preferences['twoFactorAuthEnabled'] === true;- $has2faSecret = !is_null($preferences['twoFactorAuthSecret']);+ $is2faEnabled = true === $preferences['twoFactorAuthEnabled'];+ $has2faSecret = null !== $preferences['twoFactorAuthSecret'];$user->has2FA = ($is2faEnabled && $has2faSecret) ? true : false;$user->prefs = $preferences;});-return view('admin.users.index', compact('subTitle', 'subTitleIcon', 'users'));}@@ -166,7 +161,6 @@ class UserController extends Controller/*** @param UserFormRequest $request* @param User $user- ** @param UserRepositoryInterface $repository** @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector@@ -187,7 +181,7 @@ class UserController extends ControllerSession::flash('success', strval(trans('firefly.updated_user', ['email' => $user->email])));Preferences::mark();- if (intval($request->get('return_to_edit')) === 1) {+ if (1 === intval($request->get('return_to_edit'))) {// @codeCoverageIgnoreStartSession::put('users.edit.fromUpdate', true);diff --git a/app/Http/Controllers/AttachmentController.php b/app/Http/Controllers/AttachmentController.phpindex e09f8cb8d5..b2ef0b7875 100644--- a/app/Http/Controllers/AttachmentController.php+++ b/app/Http/Controllers/AttachmentController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers;@@ -35,15 +34,12 @@ use Response;use View;/**- * Class AttachmentController+ * Class AttachmentController.** @SuppressWarnings(PHPMD.CouplingBetweenObjects) // it's 13.- *- * @package FireflyIII\Http\Controllers*/class AttachmentController extends Controller{-/****/@@ -104,6 +100,7 @@ class AttachmentController extends Controller* @param Attachment $attachment** @return mixed+ ** @throws FireflyException*/public function download(AttachmentRepositoryInterface $repository, Attachment $attachment)@@ -112,7 +109,6 @@ class AttachmentController extends Controller$content = $repository->getContent($attachment);$quoted = sprintf('"%s"', addcslashes(basename($attachment->filename), '"\\'));-/** @var LaravelResponse $response */$response = response($content, 200);$response@@ -143,7 +139,7 @@ class AttachmentController extends Controller$subTitle = trans('firefly.edit_attachment', ['name' => $attachment->filename]);// put previous url in session if not redirect from store (not "return_to_edit").- if (session('attachments.edit.fromUpdate') !== true) {+ if (true !== session('attachments.edit.fromUpdate')) {$this->rememberPreviousUri('attachments.edit.uri');}$request->session()->forget('attachments.edit.fromUpdate');@@ -160,8 +156,7 @@ class AttachmentController extends Controller{$image = 'images/page_green.png';-- if ($attachment->mime === 'application/pdf') {+ if ('application/pdf' === $attachment->mime) {$image = 'images/page_white_acrobat.png';}$file = public_path($image);@@ -171,7 +166,6 @@ class AttachmentController extends Controllerreturn $response;}-/*** @param AttachmentFormRequest $request* @param AttachmentRepositoryInterface $repository@@ -187,7 +181,7 @@ class AttachmentController extends Controller$request->session()->flash('success', strval(trans('firefly.attachment_updated', ['name' => $attachment->filename])));Preferences::mark();- if (intval($request->get('return_to_edit')) === 1) {+ if (1 === intval($request->get('return_to_edit'))) {// @codeCoverageIgnoreStart$request->session()->put('attachments.edit.fromUpdate', true);diff --git a/app/Http/Controllers/Auth/ForgotPasswordController.php b/app/Http/Controllers/Auth/ForgotPasswordController.phpindex 82f1f40c44..e969737770 100644--- a/app/Http/Controllers/Auth/ForgotPasswordController.php+++ b/app/Http/Controllers/Auth/ForgotPasswordController.php@@ -18,10 +18,8 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);-/*** ForgotPasswordController.php* Copyright (c) 2017 [email protected]@@ -53,7 +51,6 @@ class ForgotPasswordController extends Controller/*** Create a new controller instance.- **/public function __construct(){diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.phpindex 2d958b0d94..1a4aa09918 100644--- a/app/Http/Controllers/Auth/LoginController.php+++ b/app/Http/Controllers/Auth/LoginController.php@@ -18,10 +18,8 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);-/*** LoginController.php* Copyright (c) 2017 [email protected]@@ -66,7 +64,6 @@ class LoginController extends Controller/*** Create a new controller instance.- **/public function __construct(){@@ -93,7 +90,7 @@ class LoginController extends Controller// check for presence of currency:$currency = TransactionCurrency::where('code', 'EUR')->first();- if (is_null($currency)) {+ if (null === $currency) {$message= 'Firefly III could not find the EURO currency. This is a strong indication the database has not been initialized correctly. Did you follow the installation instructions?';@@ -107,7 +104,7 @@ class LoginController extends Controller$singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;$userCount = User::count();$allowRegistration = true;- if ($singleUserMode === true && $userCount > 0) {+ if (true === $singleUserMode && $userCount > 0) {$allowRegistration = false;}diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.phpindex b539028c8d..7125a0de68 100644--- a/app/Http/Controllers/Auth/RegisterController.php+++ b/app/Http/Controllers/Auth/RegisterController.php@@ -18,10 +18,8 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);-/*** RegisterController.php* Copyright (c) 2017 [email protected]@@ -66,7 +64,6 @@ class RegisterController extends Controller/*** Create a new controller instance.- **/public function __construct(){@@ -77,7 +74,7 @@ class RegisterController extends Controller/*** Handle a registration request for the application.*- * @param \Illuminate\Http\Request $request+ * @param \Illuminate\Http\Request $request** @return \Illuminate\Http\Response*/@@ -86,7 +83,7 @@ class RegisterController extends Controller// is allowed to?$singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;$userCount = User::count();- if ($singleUserMode === true && $userCount > 0) {+ if (true === $singleUserMode && $userCount > 0) {$message = 'Registration is currently not available.';return view('error', compact('message'));@@ -119,7 +116,7 @@ class RegisterController extends Controller// is allowed to?$singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;$userCount = User::count();- if ($singleUserMode === true && $userCount > 0) {+ if (true === $singleUserMode && $userCount > 0) {$message = 'Registration is currently not available.';return view('error', compact('message'));@@ -127,14 +124,13 @@ class RegisterController extends Controller$email = $request->old('email');-return view('auth.register', compact('isDemoSite', 'email'));}/*** Create a new user instance after a valid registration.*- * @param array $data+ * @param array $data** @return \FireflyIII\User*/@@ -151,7 +147,7 @@ class RegisterController extends Controller/*** Get a validator for an incoming registration request.*- * @param array $data+ * @param array $data** @return \Illuminate\Contracts\Validation\Validator*/diff --git a/app/Http/Controllers/Auth/ResetPasswordController.php b/app/Http/Controllers/Auth/ResetPasswordController.phpindex 60913a0822..9009af2485 100644--- a/app/Http/Controllers/Auth/ResetPasswordController.php+++ b/app/Http/Controllers/Auth/ResetPasswordController.php@@ -18,10 +18,8 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);-/*** ResetPasswordController.php* Copyright (c) 2017 [email protected]@@ -60,7 +58,6 @@ class ResetPasswordController extends Controller/*** Create a new controller instance.- **/public function __construct(){diff --git a/app/Http/Controllers/Auth/TwoFactorController.php b/app/Http/Controllers/Auth/TwoFactorController.phpindex 2a9fd275c3..79bc49041e 100644--- a/app/Http/Controllers/Auth/TwoFactorController.php+++ b/app/Http/Controllers/Auth/TwoFactorController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers\Auth;@@ -32,17 +31,15 @@ use Log;use Preferences;/**- * Class TwoFactorController- *- * @package FireflyIII\Http\Controllers\Auth+ * Class TwoFactorController.*/class TwoFactorController extends Controller{-/*** @param Request $request** @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View+ ** @throws FireflyException** @SuppressWarnings(PHPMD.CyclomaticComplexity)@@ -53,16 +50,16 @@ class TwoFactorController extends Controller// to make sure the validator in the next step gets the secret, we push it in session$secretPreference = Preferences::get('twoFactorAuthSecret', null);- $secret = is_null($secretPreference) ? null : $secretPreference->data;+ $secret = null === $secretPreference ? null : $secretPreference->data;$title = strval(trans('firefly.two_factor_title'));// make sure the user has two factor configured:$has2FA = Preferences::get('twoFactorAuthEnabled', false)->data;- if (is_null($has2FA) || $has2FA === false) {+ if (null === $has2FA || false === $has2FA) {return redirect(route('index'));}- if (strlen(strval($secret)) === 0) {+ if (0 === strlen(strval($secret))) {throw new FireflyException('Your two factor authentication secret is empty, which it cannot be at this point. Please check the log files.');}$request->session()->flash('two-factor-secret', $secret);@@ -72,6 +69,7 @@ class TwoFactorController extends Controller/*** @return mixed+ ** @throws FireflyException*/public function lostTwoFactor()@@ -95,7 +93,6 @@ class TwoFactorController extends Controller** @return mixed* @SuppressWarnings(PHPMD.UnusedFormalParameter) // it's unused but the class does some validation.- **/public function postIndex(TokenFormRequest $request, CookieJar $cookieJar){diff --git a/app/Http/Controllers/BillController.php b/app/Http/Controllers/BillController.phpindex 55bbbaba06..548f127766 100644--- a/app/Http/Controllers/BillController.php+++ b/app/Http/Controllers/BillController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers;@@ -36,13 +35,10 @@ use URL;use View;/**- * Class BillController- *- * @package FireflyIII\Http\Controllers+ * Class BillController.*/class BillController extends Controller{-/****/@@ -50,7 +46,6 @@ class BillController extends Controller{parent::__construct();-$this->middleware(function ($request, $next) {View::share('title', trans('firefly.bills'));@@ -74,9 +69,8 @@ class BillController extends Controller}$subTitle = trans('firefly.create_new_bill');-// put previous url in session if not redirect from store (not "create another").- if (session('bills.create.fromStore') !== true) {+ if (true !== session('bills.create.fromStore')) {$this->rememberPreviousUri('bills.create.uri');}$request->session()->forget('bills.create.fromStore');@@ -136,7 +130,7 @@ class BillController extends Controller$subTitle = trans('firefly.edit_bill', ['name' => $bill->name]);// put previous url in session if not redirect from store (not "return_to_edit").- if (session('bills.edit.fromUpdate') !== true) {+ if (true !== session('bills.edit.fromUpdate')) {$this->rememberPreviousUri('bills.edit.uri');}@@ -166,7 +160,6 @@ class BillController extends Controller$bills = $repository->getBills();$bills->each(function (Bill $bill) use ($repository, $start, $end) {-// paid in this period?$bill->paidDates = $repository->getPaidDatesInRange($bill, $start, $end);$bill->payDates = $repository->getPayDatesInRange($bill, $start, $end);@@ -190,7 +183,7 @@ class BillController extends Controller*/public function rescan(Request $request, BillRepositoryInterface $repository, Bill $bill){- if (intval($bill->active) === 0) {+ if (0 === intval($bill->active)) {$request->session()->flash('warning', strval(trans('firefly.cannot_scan_inactive_bill')));return redirect(URL::previous());@@ -202,7 +195,6 @@ class BillController extends Controller$repository->scan($bill, $journal);}-$request->session()->flash('success', strval(trans('firefly.rescanned_bill')));Preferences::mark();@@ -254,7 +246,7 @@ class BillController extends Controller$request->session()->flash('success', strval(trans('firefly.stored_new_bill', ['name' => $bill->name])));Preferences::mark();- if (intval($request->get('create_another')) === 1) {+ if (1 === intval($request->get('create_another'))) {// @codeCoverageIgnoreStart$request->session()->put('bills.create.fromStore', true);@@ -281,7 +273,7 @@ class BillController extends Controller$request->session()->flash('success', strval(trans('firefly.updated_bill', ['name' => $bill->name])));Preferences::mark();- if (intval($request->get('return_to_edit')) === 1) {+ if (1 === intval($request->get('return_to_edit'))) {// @codeCoverageIgnoreStart$request->session()->put('bills.edit.fromUpdate', true);diff --git a/app/Http/Controllers/BudgetController.php b/app/Http/Controllers/BudgetController.phpindex 9f0d5a0519..63b12faeaa 100644--- a/app/Http/Controllers/BudgetController.php+++ b/app/Http/Controllers/BudgetController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers;@@ -44,16 +43,14 @@ use Response;use View;/**- * Class BudgetController+ * Class BudgetController.*- * @package FireflyIII\Http\Controllers* @SuppressWarnings(PHPMD.CouplingBetweenObjects)* @SuppressWarnings(PHPMD.TooManyPublicMethods)*/class BudgetController extends Controller{-- /** @var BudgetRepositoryInterface */+ /** @var BudgetRepositoryInterface */private $repository;/**@@ -88,7 +85,7 @@ class BudgetController extends Controller$start = Carbon::createFromFormat('Y-m-d', $request->get('start'));$end = Carbon::createFromFormat('Y-m-d', $request->get('end'));$budgetLimit = $this->repository->updateLimitAmount($budget, $start, $end, $amount);- if ($amount === 0) {+ if (0 === $amount) {$budgetLimit = null;}Preferences::mark();@@ -104,7 +101,7 @@ class BudgetController extends Controllerpublic function create(Request $request){// put previous url in session if not redirect from store (not "create another").- if (session('budgets.create.fromStore') !== true) {+ if (true !== session('budgets.create.fromStore')) {$this->rememberPreviousUri('budgets.create.uri');}$request->session()->forget('budgets.create.fromStore');@@ -160,7 +157,7 @@ class BudgetController extends Controller$subTitle = trans('firefly.edit_budget', ['name' => $budget->name]);// put previous url in session if not redirect from store (not "return_to_edit").- if (session('budgets.edit.fromUpdate') !== true) {+ if (true !== session('budgets.edit.fromUpdate')) {$this->rememberPreviousUri('budgets.edit.uri');}$request->session()->forget('budgets.edit.fromUpdate');@@ -185,7 +182,7 @@ class BudgetController extends Controller$end = session('end', new Carbon);// make date if present:- if (!is_null($moment) || strlen(strval($moment)) !== 0) {+ if (null !== $moment || 0 !== strlen(strval($moment))) {try {$start = new Carbon($moment);$end = Navigation::endOfPeriod($start, $range);@@ -218,7 +215,7 @@ class BudgetController extends Controller$previousDate = Navigation::startOfPeriod($previousDate, $range);$format = $previousDate->format('Y-m-d');$previousLoop[$format] = Navigation::periodShow($previousDate, $range);- $count++;+ ++$count;}// select thing for next 12 periods:@@ -231,7 +228,7 @@ class BudgetController extends Controller$format = $nextDate->format('Y-m-d');$nextLoop[$format] = Navigation::periodShow($nextDate, $range);$nextDate = Navigation::endOfPeriod($nextDate, $range);- $count++;+ ++$count;$nextDate->addDay();}@@ -301,7 +298,7 @@ class BudgetController extends Controller$currentEnd = Navigation::endOfPeriod($currentStart, $range);$total = bcadd($total, $this->repository->getAvailableBudget($currency, $currentStart, $currentEnd));$currentStart = Navigation::addPeriod($currentStart, $range, 0);- $count++;+ ++$count;}$result['available'] = bcdiv($total, strval($count));@@ -320,12 +317,11 @@ class BudgetController extends Controller$result['spent'] = bcdiv(strval($collector->getJournals()->sum('transaction_amount')), strval($count));// suggestion starts with the amount spent$result['suggested'] = bcmul($result['spent'], '-1');- $result['suggested'] = bccomp($result['suggested'], $result['earned']) === 1 ? $result['earned'] : $result['suggested'];+ $result['suggested'] = 1 === bccomp($result['suggested'], $result['earned']) ? $result['earned'] : $result['suggested'];// unless it's more than you earned. So min() of suggested/earned$cache->store($result);-return view('budgets.info', compact('result', 'begin', 'currentEnd'));}@@ -348,7 +344,7 @@ class BudgetController extends Controller$periods = new Collection;// prep for "all" view.- if ($moment === 'all') {+ if ('all' === $moment) {$subTitle = trans('firefly.all_journals_without_budget');$first = $repository->first();$start = $first->date ?? new Carbon;@@ -356,7 +352,7 @@ class BudgetController extends Controller}// prep for "specific date" view.- if (strlen($moment) > 0 && $moment !== 'all') {+ if (strlen($moment) > 0 && 'all' !== $moment) {$start = new Carbon($moment);$end = Navigation::endOfPeriod($start, $range);$subTitle = trans(@@ -367,7 +363,7 @@ class BudgetController extends Controller}// prep for current period- if (strlen($moment) === 0) {+ if (0 === strlen($moment)) {$start = clone session('start', Navigation::startOfPeriod(new Carbon, $range));$end = clone session('end', Navigation::endOfPeriod(new Carbon, $range));$periods = $this->getPeriodOverview();@@ -430,7 +426,6 @@ class BudgetController extends Controller$transactions = $collector->getPaginatedJournals();$transactions->setPath(route('budgets.show', [$budget->id]));-$subTitle = trans('firefly.all_journals_for_budget', ['name' => $budget->name]);return view('budgets.show', compact('limits', 'budget', 'repetition', 'transactions', 'subTitle'));@@ -442,6 +437,7 @@ class BudgetController extends Controller* @param BudgetLimit $budgetLimit** @return View+ ** @throws FireflyException*/public function showByBudgetLimit(Request $request, Budget $budget, BudgetLimit $budgetLimit)@@ -488,7 +484,7 @@ class BudgetController extends Controller$request->session()->flash('success', strval(trans('firefly.stored_new_budget', ['name' => $budget->name])));Preferences::mark();- if (intval($request->get('create_another')) === 1) {+ if (1 === intval($request->get('create_another'))) {// @codeCoverageIgnoreStart$request->session()->put('budgets.create.fromStore', true);@@ -513,7 +509,7 @@ class BudgetController extends Controller$request->session()->flash('success', strval(trans('firefly.updated_budget', ['name' => $budget->name])));Preferences::mark();- if (intval($request->get('return_to_edit')) === 1) {+ if (1 === intval($request->get('return_to_edit'))) {// @codeCoverageIgnoreStart$request->session()->put('budgets.edit.fromUpdate', true);@@ -605,7 +601,7 @@ class BudgetController extends Controller$journals = $set->count();$dateStr = $end->format('Y-m-d');$dateName = Navigation::periodShow($end, $range);- $entries->push(['string' => $dateStr, 'name' => $dateName, 'count' => $journals, 'sum' => $sum, 'date' => clone $end,]);+ $entries->push(['string' => $dateStr, 'name' => $dateName, 'count' => $journals, 'sum' => $sum, 'date' => clone $end]);$end = Navigation::subtractPeriod($end, $range, 1);}$cache->store($entries);diff --git a/app/Http/Controllers/CategoryController.php b/app/Http/Controllers/CategoryController.phpindex 2ebd43efa6..1ea9509027 100644--- a/app/Http/Controllers/CategoryController.php+++ b/app/Http/Controllers/CategoryController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers;@@ -43,13 +42,10 @@ use Steam;use View;/**- * Class CategoryController- *- * @package FireflyIII\Http\Controllers+ * Class CategoryController.*/class CategoryController extends Controller{-/****/@@ -57,7 +53,6 @@ class CategoryController extends Controller{parent::__construct();-$this->middleware(function ($request, $next) {View::share('title', trans('firefly.categories'));@@ -75,7 +70,7 @@ class CategoryController extends Controller*/public function create(Request $request){- if (session('categories.create.fromStore') !== true) {+ if (true !== session('categories.create.fromStore')) {$this->rememberPreviousUri('categories.create.uri');}$request->session()->forget('categories.create.fromStore');@@ -104,7 +99,6 @@ class CategoryController extends Controllerreturn view('categories.delete', compact('category', 'subTitle'));}-/*** @param Request $request* @param CategoryRepositoryInterface $repository@@ -134,7 +128,7 @@ class CategoryController extends Controller$subTitle = trans('firefly.edit_category', ['name' => $category->name]);// put previous url in session if not redirect from store (not "return_to_edit").- if (session('categories.edit.fromUpdate') !== true) {+ if (true !== session('categories.edit.fromUpdate')) {$this->rememberPreviousUri('categories.edit.uri');}$request->session()->forget('categories.edit.fromUpdate');@@ -180,7 +174,7 @@ class CategoryController extends Controller$pageSize = intval(Preferences::get('transactionPageSize', 50)->data);// prep for "all" view.- if ($moment === 'all') {+ if ('all' === $moment) {$subTitle = trans('firefly.all_journals_without_category');$first = $repository->first();$start = $first->date ?? new Carbon;@@ -188,7 +182,7 @@ class CategoryController extends Controller}// prep for "specific date" view.- if (strlen($moment) > 0 && $moment !== 'all') {+ if (strlen($moment) > 0 && 'all' !== $moment) {$start = new Carbon($moment);$end = Navigation::endOfPeriod($start, $range);$subTitle = trans(@@ -199,7 +193,7 @@ class CategoryController extends Controller}// prep for current period- if (strlen($moment) === 0) {+ if (0 === strlen($moment)) {$start = clone session('start', Navigation::startOfPeriod(new Carbon, $range));$end = clone session('end', Navigation::endOfPeriod(new Carbon, $range));$periods = $this->getNoCategoryPeriodOverview();@@ -209,7 +203,6 @@ class CategoryController extends Controller);}-/** @var JournalCollectorInterface $collector */$collector = app(JournalCollectorInterface::class);$collector->setAllAssetAccounts()->setRange($start, $end)->setLimit($pageSize)->setPage($page)->withoutCategory()->withOpposingAccount()@@ -242,28 +235,28 @@ class CategoryController extends Controller$periods = new Collection;// prep for "all" view.- if ($moment === 'all') {+ if ('all' === $moment) {$subTitle = trans('firefly.all_journals_for_category', ['name' => $category->name]);$first = $repository->firstUseDate($category);/** @var Carbon $start */- $start = is_null($first) ? new Carbon : $first;+ $start = null === $first ? new Carbon : $first;$end = new Carbon;}// prep for "specific date" view.- if (strlen($moment) > 0 && $moment !== 'all') {+ if (strlen($moment) > 0 && 'all' !== $moment) {$start = new Carbon($moment);$end = Navigation::endOfPeriod($start, $range);$subTitle = trans('firefly.journals_in_period_for_category',['name' => $category->name,- 'start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]+ 'start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat),]);$periods = $this->getPeriodOverview($category);}// prep for current period- if (strlen($moment) === 0) {+ if (0 === strlen($moment)) {/** @var Carbon $start */$start = clone session('start', Navigation::startOfPeriod(new Carbon, $range));/** @var Carbon $end */@@ -272,7 +265,7 @@ class CategoryController extends Controller$subTitle = trans('firefly.journals_in_period_for_category',['name' => $category->name, 'start' => $start->formatLocalized($this->monthAndDayFormat),- 'end' => $end->formatLocalized($this->monthAndDayFormat)]+ 'end' => $end->formatLocalized($this->monthAndDayFormat),]);}@@ -284,11 +277,9 @@ class CategoryController extends Controller$transactions = $collector->getPaginatedJournals();$transactions->setPath(route('categories.show', [$category->id]));-return view('categories.show', compact('category', 'moment', 'transactions', 'periods', 'subTitle', 'subTitleIcon', 'start', 'end'));}-/*** @param CategoryFormRequest $request* @param CategoryRepositoryInterface $repository@@ -303,7 +294,7 @@ class CategoryController extends Controller$request->session()->flash('success', strval(trans('firefly.stored_category', ['name' => $category->name])));Preferences::mark();- if (intval($request->get('create_another')) === 1) {+ if (1 === intval($request->get('create_another'))) {// @codeCoverageIgnoreStart$request->session()->put('categories.create.fromStore', true);@@ -314,7 +305,6 @@ class CategoryController extends Controllerreturn redirect(route('categories.index'));}-/*** @param CategoryFormRequest $request* @param CategoryRepositoryInterface $repository@@ -330,7 +320,7 @@ class CategoryController extends Controller$request->session()->flash('success', strval(trans('firefly.updated_category', ['name' => $category->name])));Preferences::mark();- if (intval($request->get('return_to_edit')) === 1) {+ if (1 === intval($request->get('return_to_edit'))) {// @codeCoverageIgnoreStart$request->session()->put('categories.edit.fromUpdate', true);@@ -432,7 +422,7 @@ class CategoryController extends Controller$accountRepository = app(AccountRepositoryInterface::class);$accounts = $accountRepository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);$first = $repository->firstUseDate($category);- if (is_null($first)) {+ if (null === $first) {$first = new Carbon;}$range = Preferences::get('viewRange', '1M')->data;@@ -479,7 +469,7 @@ class CategoryController extends Controller]);$end = Navigation::subtractPeriod($end, $range, 1);- $count++;+ ++$count;}$cache->store($entries);diff --git a/app/Http/Controllers/Chart/AccountController.php b/app/Http/Controllers/Chart/AccountController.phpindex 04981b69cb..a814be6e1b 100644--- a/app/Http/Controllers/Chart/AccountController.php+++ b/app/Http/Controllers/Chart/AccountController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers\Chart;@@ -45,14 +44,11 @@ use Response;use Steam;/** checked- * Class AccountController- *- * @package FireflyIII\Http\Controllers\Chart+ * Class AccountController.*/class AccountController extends Controller{-- /** @var GeneratorInterface */+ /** @var GeneratorInterface */protected $generator;/**@@ -133,7 +129,7 @@ class AccountController extends Controller$startBalance = $startBalances[$id] ?? '0';$endBalance = $endBalances[$id] ?? '0';$diff = bcsub($endBalance, $startBalance);- if (bccomp($diff, '0') !== 0) {+ if (0 !== bccomp($diff, '0')) {$chartData[$account->name] = $diff;}}@@ -274,7 +270,7 @@ class AccountController extends ControllerLog::debug('Default set is ', $defaultSet);$frontPage = Preferences::get('frontPageAccounts', $defaultSet);Log::debug('Frontpage preference set is ', $frontPage->data);- if (count($frontPage->data) === 0) {+ if (0 === count($frontPage->data)) {$frontPage->data = $defaultSet;Log::debug('frontpage set is empty!');$frontPage->save();@@ -346,6 +342,7 @@ class AccountController extends Controller* @param Carbon $start** @return \Illuminate\Http\JsonResponse+ ** @throws FireflyException*/public function period(Account $account, Carbon $start)@@ -427,7 +424,7 @@ class AccountController extends Controller$endBalance = $endBalances[$id] ?? '0';$diff = bcsub($endBalance, $startBalance);$diff = bcmul($diff, '-1');- if (bccomp($diff, '0') !== 0) {+ if (0 !== bccomp($diff, '0')) {$chartData[$account->name] = $diff;}}@@ -539,7 +536,6 @@ class AccountController extends Controller*/private function getBudgetNames(array $budgetIds): array{-/** @var BudgetRepositoryInterface $repository */$repository = app(BudgetRepositoryInterface::class);$budgets = $repository->getBudgets();diff --git a/app/Http/Controllers/Chart/BillController.php b/app/Http/Controllers/Chart/BillController.phpindex f81f761686..34e0ca9641 100644--- a/app/Http/Controllers/Chart/BillController.php+++ b/app/Http/Controllers/Chart/BillController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers\Chart;@@ -35,18 +34,15 @@ use Illuminate\Support\Collection;use Response;/**- * Class BillController- *- * @package FireflyIII\Http\Controllers\Chart+ * Class BillController.*/class BillController extends Controller{-/** @var GeneratorInterface */protected $generator;/**- * checked+ * checked.*/public function __construct(){@@ -108,9 +104,9 @@ class BillController extends Controller});$chartData = [- ['type' => 'bar', 'label' => trans('firefly.min-amount'), 'entries' => [],],- ['type' => 'bar', 'label' => trans('firefly.max-amount'), 'entries' => [],],- ['type' => 'line', 'label' => trans('firefly.journal-amount'), 'entries' => [],],+ ['type' => 'bar', 'label' => trans('firefly.min-amount'), 'entries' => []],+ ['type' => 'bar', 'label' => trans('firefly.max-amount'), 'entries' => []],+ ['type' => 'line', 'label' => trans('firefly.journal-amount'), 'entries' => []],];/** @var Transaction $entry */diff --git a/app/Http/Controllers/Chart/BudgetController.php b/app/Http/Controllers/Chart/BudgetController.phpindex 6ebb6222bb..0fbc20571a 100644--- a/app/Http/Controllers/Chart/BudgetController.php+++ b/app/Http/Controllers/Chart/BudgetController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers\Chart;@@ -44,19 +43,16 @@ use Response;use Steam;/**- * Class BudgetController+ * Class BudgetController.** @SuppressWarnings(PHPMD.CouplingBetweenObjects) // can't realy be helped.- *- * @package FireflyIII\Http\Controllers\Chart*/class BudgetController extends Controller{-/** @var GeneratorInterface */protected $generator;- /** @var BudgetRepositoryInterface */+ /** @var BudgetRepositoryInterface */protected $repository;/**@@ -77,7 +73,6 @@ class BudgetController extends Controller}/**- ** @param Budget $budget** @return \Symfony\Component\HttpFoundation\Response@@ -125,10 +120,12 @@ class BudgetController extends Controller* Shows the amount left in a specific budget limit.** @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's exactly five.+ ** @param Budget $budget* @param BudgetLimit $budgetLimit** @return \Symfony\Component\HttpFoundation\Response+ ** @throws FireflyException*/public function budgetLimit(Budget $budget, BudgetLimit $budgetLimit)@@ -185,7 +182,7 @@ class BudgetController extends Controller/** @var JournalCollectorInterface $collector */$collector = app(JournalCollectorInterface::class);$collector->setAllAssetAccounts()->setBudget($budget);- if (!is_null($budgetLimit->id)) {+ if (null !== $budgetLimit->id) {$collector->setRange($budgetLimit->start_date, $budgetLimit->end_date);}@@ -229,7 +226,7 @@ class BudgetController extends Controller/** @var JournalCollectorInterface $collector */$collector = app(JournalCollectorInterface::class);$collector->setAllAssetAccounts()->setBudget($budget)->withCategoryInformation();- if (!is_null($budgetLimit->id)) {+ if (null !== $budgetLimit->id) {$collector->setRange($budgetLimit->start_date, $budgetLimit->end_date);}@@ -275,7 +272,7 @@ class BudgetController extends Controller/** @var JournalCollectorInterface $collector */$collector = app(JournalCollectorInterface::class);$collector->setAllAssetAccounts()->setTypes([TransactionType::WITHDRAWAL])->setBudget($budget)->withOpposingAccount();- if (!is_null($budgetLimit->id)) {+ if (null !== $budgetLimit->id) {$collector->setRange($budgetLimit->start_date, $budgetLimit->end_date);}@@ -303,6 +300,7 @@ class BudgetController extends Controller/*** Shows a budget list with spent/left/overspent.+ ** @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's exactly five.* @SuppressWarnings(PHPMD.ExcessiveMethodLength) // 46 lines, I'm fine with this.*@@ -322,9 +320,9 @@ class BudgetController extends Controller}$budgets = $this->repository->getActiveBudgets();$chartData = [- ['label' => strval(trans('firefly.spent_in_budget')), 'entries' => [], 'type' => 'bar',],- ['label' => strval(trans('firefly.left_to_spend')), 'entries' => [], 'type' => 'bar',],- ['label' => strval(trans('firefly.overspent')), 'entries' => [], 'type' => 'bar',],+ ['label' => strval(trans('firefly.spent_in_budget')), 'entries' => [], 'type' => 'bar'],+ ['label' => strval(trans('firefly.left_to_spend')), 'entries' => [], 'type' => 'bar'],+ ['label' => strval(trans('firefly.overspent')), 'entries' => [], 'type' => 'bar'],];/** @var Budget $budget */@@ -342,7 +340,7 @@ class BudgetController extends Controller// for no budget:$spent = $this->spentInPeriodWithout($start, $end);$name = strval(trans('firefly.no_budget'));- if (bccomp($spent, '0') !== 0) {+ if (0 !== bccomp($spent, '0')) {$chartData[0]['entries'][$name] = bcmul($spent, '-1');$chartData[1]['entries'][$name] = '0';$chartData[2]['entries'][$name] = '0';@@ -354,7 +352,6 @@ class BudgetController extends Controllerreturn Response::json($data);}-/*** @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's exactly five.*@@ -383,8 +380,8 @@ class BudgetController extends Controller// join them into one set of data:$chartData = [- ['label' => strval(trans('firefly.spent')), 'type' => 'bar', 'entries' => [],],- ['label' => strval(trans('firefly.budgeted')), 'type' => 'bar', 'entries' => [],],+ ['label' => strval(trans('firefly.spent')), 'type' => 'bar', 'entries' => []],+ ['label' => strval(trans('firefly.budgeted')), 'type' => 'bar', 'entries' => []],];foreach (array_keys($periods) as $period) {@@ -509,7 +506,6 @@ class BudgetController extends Controller}/**- ** @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's 6 but ok.** @param Collection $limits@@ -522,9 +518,9 @@ class BudgetController extends Controllerprivate function getExpensesForBudget(Collection $limits, Budget $budget, Carbon $start, Carbon $end): array{$return = [];- if ($limits->count() === 0) {+ if (0 === $limits->count()) {$spent = $this->repository->spentInPeriod(new Collection([$budget]), new Collection, $start, $end);- if (bccomp($spent, '0') !== 0) {+ if (0 !== bccomp($spent, '0')) {$return[$budget->name]['spent'] = bcmul($spent, '-1');$return[$budget->name]['left'] = 0;$return[$budget->name]['overspent'] = 0;@@ -535,7 +531,7 @@ class BudgetController extends Controller$rows = $this->spentInPeriodMulti($budget, $limits);foreach ($rows as $name => $row) {- if (bccomp($row['spent'], '0') !== 0 || bccomp($row['left'], '0') !== 0) {+ if (0 !== bccomp($row['spent'], '0') || 0 !== bccomp($row['left'], '0')) {$return[$name] = $row;}}@@ -607,7 +603,7 @@ class BudgetController extends Controller* 'name' => "no budget" in local language* 'repetition_left' => left in budget repetition (always zero)* 'repetition_overspent' => spent more than budget repetition? (always zero)- * 'spent' => actually spent in period for budget+ * 'spent' => actually spent in period for budget.** @param Carbon $start* @param Carbon $enddiff --git a/app/Http/Controllers/Chart/BudgetReportController.php b/app/Http/Controllers/Chart/BudgetReportController.phpindex 62b3b07f3a..60ee052df1 100644--- a/app/Http/Controllers/Chart/BudgetReportController.php+++ b/app/Http/Controllers/Chart/BudgetReportController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers\Chart;@@ -45,15 +44,12 @@ use Response;* Separate controller because many helper functions are shared.** Class BudgetReportController- *- * @package FireflyIII\Http\Controllers\Chart*/class BudgetReportController extends Controller{-/** @var BudgetRepositoryInterface */private $budgetRepository;- /** @var GeneratorInterface */+ /** @var GeneratorInterface */private $generator;/**@@ -89,7 +85,7 @@ class BudgetReportController extends Controller$helper->setBudgets($budgets);$helper->setStart($start);$helper->setEnd($end);- $helper->setCollectOtherObjects(intval($others) === 1);+ $helper->setCollectOtherObjects(1 === intval($others));$chartData = $helper->generate('expense', 'account');$data = $this->generator->pieChart($chartData);@@ -113,7 +109,7 @@ class BudgetReportController extends Controller$helper->setBudgets($budgets);$helper->setStart($start);$helper->setEnd($end);- $helper->setCollectOtherObjects(intval($others) === 1);+ $helper->setCollectOtherObjects(1 === intval($others));$chartData = $helper->generate('expense', 'budget');$data = $this->generator->pieChart($chartData);diff --git a/app/Http/Controllers/Chart/CategoryController.php b/app/Http/Controllers/Chart/CategoryController.phpindex 83b5cbd656..f354244d2d 100644--- a/app/Http/Controllers/Chart/CategoryController.php+++ b/app/Http/Controllers/Chart/CategoryController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers\Chart;@@ -37,13 +36,11 @@ use Preferences;use Response;/**- * Class CategoryController- *- * @package FireflyIII\Http\Controllers\Chart+ * Class CategoryController.*/class CategoryController extends Controller{- /** @var GeneratorInterface */+ /** @var GeneratorInterface */protected $generator;/**@@ -76,7 +73,7 @@ class CategoryController extends Controller$start = $repository->firstUseDate($category);- if (is_null($start)) {+ if (null === $start) {$start = new Carbon;}@@ -277,7 +274,6 @@ class CategoryController extends Controller/*** @param CategoryRepositoryInterface $repository* @param Category $category- ** @param $date** @return \Symfony\Component\HttpFoundation\Response@@ -292,7 +288,6 @@ class CategoryController extends Controllerreturn Response::json($data);}-/*** @param CategoryRepositoryInterface $repository* @param Category $category@@ -347,7 +342,6 @@ class CategoryController extends Controller$chartData[1]['entries'][$label] = round($earned, 12);$chartData[2]['entries'][$label] = round($sum, 12);-$start->addDay();}diff --git a/app/Http/Controllers/Chart/CategoryReportController.php b/app/Http/Controllers/Chart/CategoryReportController.phpindex 1fea301d5a..5c59817706 100644--- a/app/Http/Controllers/Chart/CategoryReportController.php+++ b/app/Http/Controllers/Chart/CategoryReportController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers\Chart;@@ -44,13 +43,10 @@ use Response;* Separate controller because many helper functions are shared.** Class CategoryReportController- *- * @package FireflyIII\Http\Controllers\Chart*/class CategoryReportController extends Controller{-- /** @var GeneratorInterface */+ /** @var GeneratorInterface */private $generator;/**@@ -81,7 +77,7 @@ class CategoryReportController extends Controller{/** @var MetaPieChartInterface $helper */$helper = app(MetaPieChartInterface::class);- $helper->setAccounts($accounts)->setCategories($categories)->setStart($start)->setEnd($end)->setCollectOtherObjects(intval($others) === 1);+ $helper->setAccounts($accounts)->setCategories($categories)->setStart($start)->setEnd($end)->setCollectOtherObjects(1 === intval($others));$chartData = $helper->generate('expense', 'account');$data = $this->generator->pieChart($chartData);@@ -106,7 +102,7 @@ class CategoryReportController extends Controller$helper->setCategories($categories);$helper->setStart($start);$helper->setEnd($end);- $helper->setCollectOtherObjects(intval($others) === 1);+ $helper->setCollectOtherObjects(1 === intval($others));$chartData = $helper->generate('income', 'account');$data = $this->generator->pieChart($chartData);@@ -130,7 +126,7 @@ class CategoryReportController extends Controller$helper->setCategories($categories);$helper->setStart($start);$helper->setEnd($end);- $helper->setCollectOtherObjects(intval($others) === 1);+ $helper->setCollectOtherObjects(1 === intval($others));$chartData = $helper->generate('expense', 'category');$data = $this->generator->pieChart($chartData);@@ -148,14 +144,13 @@ class CategoryReportController extends Controller*/public function categoryIncome(Collection $accounts, Collection $categories, Carbon $start, Carbon $end, string $others){-/** @var MetaPieChartInterface $helper */$helper = app(MetaPieChartInterface::class);$helper->setAccounts($accounts);$helper->setCategories($categories);$helper->setStart($start);$helper->setEnd($end);- $helper->setCollectOtherObjects(intval($others) === 1);+ $helper->setCollectOtherObjects(1 === intval($others));$chartData = $helper->generate('income', 'category');$data = $this->generator->pieChart($chartData);@@ -236,7 +231,6 @@ class CategoryReportController extends Controller$currentIncome = $income[$category->id] ?? '0';$currentExpense = $expenses[$category->id] ?? '0';-// add to sum:$sumOfIncome[$category->id] = $sumOfIncome[$category->id] ?? '0';$sumOfExpense[$category->id] = $sumOfExpense[$category->id] ?? '0';@@ -255,11 +249,11 @@ class CategoryReportController extends Controller// remove all empty entries to prevent cluttering:$newSet = [];foreach ($chartData as $key => $entry) {- if (!array_sum($entry['entries']) === 0) {+ if (0 === !array_sum($entry['entries'])) {$newSet[$key] = $chartData[$key];}}- if (count($newSet) === 0) {+ if (0 === count($newSet)) {$newSet = $chartData;}$data = $this->generator->multiSet($newSet);@@ -268,7 +262,6 @@ class CategoryReportController extends Controllerreturn Response::json($data);}-/*** @param Collection $accounts* @param Collection $categoriesdiff --git a/app/Http/Controllers/Chart/PiggyBankController.php b/app/Http/Controllers/Chart/PiggyBankController.phpindex 275fab7f68..303f239008 100644--- a/app/Http/Controllers/Chart/PiggyBankController.php+++ b/app/Http/Controllers/Chart/PiggyBankController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers\Chart;@@ -32,13 +31,10 @@ use FireflyIII\Support\CacheProperties;use Response;/**- * Class PiggyBankController- *- * @package FireflyIII\Http\Controllers\Chart+ * Class PiggyBankController.*/class PiggyBankController extends Controller{-/** @var GeneratorInterface */protected $generator;diff --git a/app/Http/Controllers/Chart/ReportController.php b/app/Http/Controllers/Chart/ReportController.phpindex 5ffe130df5..d54697bfa5 100644--- a/app/Http/Controllers/Chart/ReportController.php+++ b/app/Http/Controllers/Chart/ReportController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers\Chart;@@ -35,13 +34,10 @@ use Response;use Steam;/**- * Class ReportController- *- * @package FireflyIII\Http\Controllers\Chart+ * Class ReportController.*/class ReportController extends Controller{-/** @var GeneratorInterface */protected $generator;@@ -92,15 +88,13 @@ class ReportController extends Controllerreturn Response::json($data);}-/**- * Shows income and expense, debet/credit: operations+ * Shows income and expense, debet/credit: operations.** @param Collection $accounts* @param Carbon $start* @param Carbon $end*- ** @return \Illuminate\Http\JsonResponse*/public function operations(Collection $accounts, Carbon $start, Carbon $end)@@ -143,7 +137,6 @@ class ReportController extends Controller$chartData[1]['entries'][$label] = bcadd($spent, $amount);}-$data = $this->generator->multiSet($chartData);$cache->store($data);@@ -151,7 +144,7 @@ class ReportController extends Controller}/**- * Shows sum income and expense, debet/credit: operations+ * Shows sum income and expense, debet/credit: operations.** @param Carbon $start* @param Carbon $end@@ -161,8 +154,6 @@ class ReportController extends Controller*/public function sum(Collection $accounts, Carbon $start, Carbon $end){--// chart properties for cache:$cache = new CacheProperties;$cache->addProperty('chart.report.sum');@@ -173,7 +164,6 @@ class ReportController extends Controllerreturn Response::json($cache->get()); // @codeCoverageIgnore}-$source = $this->getChartData($accounts, $start, $end);$numbers = ['sum_earned' => '0',@@ -185,14 +175,14 @@ class ReportController extends Controller];foreach ($source['earned'] as $amount) {$numbers['sum_earned'] = bcadd($amount, $numbers['sum_earned']);- $numbers['count_earned']++;+ ++$numbers['count_earned'];}if ($numbers['count_earned'] > 0) {$numbers['avg_earned'] = $numbers['sum_earned'] / $numbers['count_earned'];}foreach ($source['spent'] as $amount) {$numbers['sum_spent'] = bcadd($amount, $numbers['sum_spent']);- $numbers['count_spent']++;+ ++$numbers['count_spent'];}if ($numbers['count_spent'] > 0) {$numbers['avg_spent'] = $numbers['sum_spent'] / $numbers['count_spent'];@@ -217,7 +207,6 @@ class ReportController extends Controller],];-$data = $this->generator->multiSet($chartData);$cache->store($data);@@ -240,7 +229,7 @@ class ReportController extends Controller}/**- * Collects the incomes and expenses for the given periods, grouped per month. Will cache its results+ * Collects the incomes and expenses for the given periods, grouped per month. Will cache its results.** @param Collection $accounts* @param Carbon $start@@ -290,7 +279,6 @@ class ReportController extends Controller));-$label = $currentStart->format('Y-m') . '-01';$spentArray[$label] = bcmul($spent, '-1');$earnedArray[$label] = $earned;diff --git a/app/Http/Controllers/Chart/TagReportController.php b/app/Http/Controllers/Chart/TagReportController.phpindex 6aead89388..de4daf03dc 100644--- a/app/Http/Controllers/Chart/TagReportController.php+++ b/app/Http/Controllers/Chart/TagReportController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers\Chart;@@ -72,7 +71,7 @@ class TagReportController extends Controller$helper->setTags($tags);$helper->setStart($start);$helper->setEnd($end);- $helper->setCollectOtherObjects(intval($others) === 1);+ $helper->setCollectOtherObjects(1 === intval($others));$chartData = $helper->generate('expense', 'account');$data = $this->generator->pieChart($chartData);@@ -96,7 +95,7 @@ class TagReportController extends Controller$helper->setTags($tags);$helper->setStart($start);$helper->setEnd($end);- $helper->setCollectOtherObjects(intval($others) === 1);+ $helper->setCollectOtherObjects(1 === intval($others));$chartData = $helper->generate('income', 'account');$data = $this->generator->pieChart($chartData);@@ -223,7 +222,6 @@ class TagReportController extends Controller$currentIncome = $income[$tag->id] ?? '0';$currentExpense = $expenses[$tag->id] ?? '0';-// add to sum:$sumOfIncome[$tag->id] = $sumOfIncome[$tag->id] ?? '0';$sumOfExpense[$tag->id] = $sumOfExpense[$tag->id] ?? '0';@@ -242,11 +240,11 @@ class TagReportController extends Controller// remove all empty entries to prevent cluttering:$newSet = [];foreach ($chartData as $key => $entry) {- if (!array_sum($entry['entries']) === 0) {+ if (0 === !array_sum($entry['entries'])) {$newSet[$key] = $chartData[$key];}}- if (count($newSet) === 0) {+ if (0 === count($newSet)) {$newSet = $chartData; // @codeCoverageIgnore}$data = $this->generator->multiSet($newSet);@@ -272,7 +270,7 @@ class TagReportController extends Controller$helper->setTags($tags);$helper->setStart($start);$helper->setEnd($end);- $helper->setCollectOtherObjects(intval($others) === 1);+ $helper->setCollectOtherObjects(1 === intval($others));$chartData = $helper->generate('expense', 'tag');$data = $this->generator->pieChart($chartData);@@ -290,14 +288,13 @@ class TagReportController extends Controller*/public function tagIncome(Collection $accounts, Collection $tags, Carbon $start, Carbon $end, string $others){-/** @var MetaPieChartInterface $helper */$helper = app(MetaPieChartInterface::class);$helper->setAccounts($accounts);$helper->setTags($tags);$helper->setStart($start);$helper->setEnd($end);- $helper->setCollectOtherObjects(intval($others) === 1);+ $helper->setCollectOtherObjects(1 === intval($others));$chartData = $helper->generate('income', 'tag');$data = $this->generator->pieChart($chartData);diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.phpindex 3d7e3e0999..3d08e5d0b0 100644--- a/app/Http/Controllers/Controller.php+++ b/app/Http/Controllers/Controller.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers;@@ -40,15 +39,13 @@ use URL;use View;/**- * Class Controller- *- * @package FireflyIII\Http\Controllers+ * Class Controller.*/class Controller extends BaseController{use AuthorizesRequests, DispatchesJobs, ValidatesRequests;- /** @var string */+ /** @var string */protected $dateTimeFormat;/** @var string */protected $monthAndDayFormat;@@ -75,7 +72,6 @@ class Controller extends BaseControllerView::share('DEMO_PASSWORD', env('DEMO_PASSWORD', ''));View::share('FF_VERSION', config('firefly.version'));-$this->middleware(function ($request, $next) {// translations for specific strings:@@ -86,7 +82,7 @@ class Controller extends BaseController// get shown-intro-preference:if (auth()->check()) {// some routes have a "what" parameter, which indicates a special page:- $specificPage = is_null(Route::current()->parameter('what')) ? '' : '_' . Route::current()->parameter('what');+ $specificPage = null === Route::current()->parameter('what') ? '' : '_' . Route::current()->parameter('what');$page = str_replace('.', '_', Route::currentRouteName());// indicator if user has seen the help for this page ( + special page):@@ -113,7 +109,7 @@ class Controller extends BaseController}/**- * Functionality:+ * Functionality:.** - If the $identifier contains the word "delete" then a remembered uri with the text "/show/" in it will not be returned but instead the index (/)* will be returned.@@ -126,10 +122,10 @@ class Controller extends BaseControllerprotected function getPreviousUri(string $identifier): string{$uri = strval(session($identifier));- if (!(strpos($identifier, 'delete') === false) && !(strpos($uri, '/show/') === false)) {+ if (!(false === strpos($identifier, 'delete')) && !(false === strpos($uri, '/show/'))) {$uri = $this->redirectUri;}- if (!(strpos($uri, 'jscript') === false)) {+ if (!(false === strpos($uri, 'jscript'))) {$uri = $this->redirectUri;}@@ -143,7 +139,7 @@ class Controller extends BaseController*/protected function isOpeningBalance(TransactionJournal $journal): bool{- return $journal->transactionTypeStr() === TransactionType::OPENING_BALANCE;+ return TransactionType::OPENING_BALANCE === $journal->transactionTypeStr();}/**diff --git a/app/Http/Controllers/CurrencyController.php b/app/Http/Controllers/CurrencyController.phpindex 62c8e519f9..40026c295a 100644--- a/app/Http/Controllers/CurrencyController.php+++ b/app/Http/Controllers/CurrencyController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers;@@ -34,17 +33,14 @@ use Preferences;use View;/**- * Class CurrencyController- *- * @package FireflyIII\Http\Controllers+ * Class CurrencyController.*/class CurrencyController extends Controller{-/** @var CurrencyRepositoryInterface */protected $repository;- /** @var UserRepositoryInterface */+ /** @var UserRepositoryInterface */protected $userRepository;/**@@ -54,7 +50,6 @@ class CurrencyController extends Controller{parent::__construct();-$this->middleware(function ($request, $next) {View::share('title', trans('firefly.currencies'));@@ -84,7 +79,7 @@ class CurrencyController extends Controller$subTitle = trans('firefly.create_currency');// put previous url in session if not redirect from store (not "create another").- if (session('currencies.create.fromStore') !== true) {+ if (true !== session('currencies.create.fromStore')) {$this->rememberPreviousUri('currencies.create.uri');}$request->session()->forget('currencies.create.fromStore');@@ -112,7 +107,6 @@ class CurrencyController extends Controllerreturn redirect(route('currencies.index'));}-/*** @param Request $request* @param TransactionCurrency $currency@@ -135,14 +129,12 @@ class CurrencyController extends Controllerreturn redirect(route('currencies.index'));}-// put previous url in session$this->rememberPreviousUri('currencies.delete.uri');$request->session()->flash('gaEventCategory', 'currency');$request->session()->flash('gaEventAction', 'delete');$subTitle = trans('form.delete_currency', ['name' => $currency->name]);-return view('currencies.delete', compact('currency', 'subTitle'));}@@ -195,7 +187,7 @@ class CurrencyController extends Controller$currency->symbol = htmlentities($currency->symbol);// put previous url in session if not redirect from store (not "return_to_edit").- if (session('currencies.edit.fromUpdate') !== true) {+ if (true !== session('currencies.edit.fromUpdate')) {$this->rememberPreviousUri('currencies.edit.uri');}$request->session()->forget('currencies.edit.fromUpdate');@@ -242,7 +234,7 @@ class CurrencyController extends Controller$currency = $this->repository->store($data);$request->session()->flash('success', trans('firefly.created_currency', ['name' => $currency->name]));- if (intval($request->get('create_another')) === 1) {+ if (1 === intval($request->get('create_another'))) {// @codeCoverageIgnoreStart$request->session()->put('currencies.create.fromStore', true);@@ -274,8 +266,7 @@ class CurrencyController extends Controller$request->session()->flash('success', trans('firefly.updated_currency', ['name' => $currency->name]));Preferences::mark();-- if (intval($request->get('return_to_edit')) === 1) {+ if (1 === intval($request->get('return_to_edit'))) {// @codeCoverageIgnoreStart$request->session()->put('currencies.edit.fromUpdate', true);diff --git a/app/Http/Controllers/ExportController.php b/app/Http/Controllers/ExportController.phpindex 025de96265..fa746b8145 100644--- a/app/Http/Controllers/ExportController.php+++ b/app/Http/Controllers/ExportController.php@@ -18,10 +18,8 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);-namespace FireflyIII\Http\Controllers;use Carbon\Carbon;@@ -39,9 +37,7 @@ use Response;use View;/**- * Class ExportController- *- * @package FireflyIII\Http\Controllers+ * Class ExportController.*/class ExportController extends Controller{@@ -52,7 +48,6 @@ class ExportController extends Controller{parent::__construct();-$this->middleware(function ($request, $next) {View::share('mainTitleIcon', 'fa-file-archive-o');@@ -68,6 +63,7 @@ class ExportController extends Controller* @param ExportJob $job** @return \Illuminate\Contracts\Routing\ResponseFactory|\Symfony\Component\HttpFoundation\Response+ ** @throws FireflyException*/public function download(ExportJobRepositoryInterface $repository, ExportJob $job)@@ -82,7 +78,6 @@ class ExportController extends Controller}$content = $repository->getContent($job);-$job->change('export_downloaded');/** @var LaravelResponse $response */$response = response($content, 200);@@ -162,48 +157,35 @@ class ExportController extends Controller$processor = app(ProcessorInterface::class);$processor->setSettings($settings);- /*- * Collect journals:- */+ // Collect journals:$jobs->changeStatus($job, 'export_status_collecting_journals');$processor->collectJournals();$jobs->changeStatus($job, 'export_status_collected_journals');- /*- * Transform to exportable entries:- */+ // Transform to exportable entries:$jobs->changeStatus($job, 'export_status_converting_to_export_format');$processor->convertJournals();$jobs->changeStatus($job, 'export_status_converted_to_export_format');- /*- * Transform to (temporary) file:- */+ // Transform to (temporary) file:$jobs->changeStatus($job, 'export_status_creating_journal_file');$processor->exportJournals();$jobs->changeStatus($job, 'export_status_created_journal_file');- /*- * Collect attachments, if applicable.- */+ // Collect attachments, if applicable.if ($settings['includeAttachments']) {$jobs->changeStatus($job, 'export_status_collecting_attachments');$processor->collectAttachments();$jobs->changeStatus($job, 'export_status_collected_attachments');}-- /*- * Collect old uploads- */+ // Collect old uploadsif ($settings['includeOldUploads']) {$jobs->changeStatus($job, 'export_status_collecting_old_uploads');$processor->collectOldUploads();$jobs->changeStatus($job, 'export_status_collected_old_uploads');}- /*- * Create ZIP file:- */+ // Create ZIP file:$jobs->changeStatus($job, 'export_status_creating_zip_file');$processor->createZipFile();$jobs->changeStatus($job, 'export_status_created_zip_file');diff --git a/app/Http/Controllers/HelpController.php b/app/Http/Controllers/HelpController.phpindex 05d3d256f1..9dbc65a8e8 100644--- a/app/Http/Controllers/HelpController.php+++ b/app/Http/Controllers/HelpController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers;@@ -29,13 +28,10 @@ use Preferences;use Response;/**- * Class HelpController- *- * @package FireflyIII\Http\Controllers+ * Class HelpController.*/class HelpController extends Controller{-/** @var HelpInterface */private $help;@@ -56,7 +52,7 @@ class HelpController extends Controller}/**- * @param $route+ * @param $route** @return \Illuminate\Http\JsonResponse*/@@ -99,7 +95,7 @@ class HelpController extends Controller$content = $this->help->getFromGithub($route, $language);// content will have 0 length when Github failed. Try en_US when it does:- if (strlen($content) === 0) {+ if (0 === strlen($content)) {$language = 'en_US';// also check cache first:@@ -114,7 +110,7 @@ class HelpController extends Controller}// help still empty?- if (strlen($content) !== 0) {+ if (0 !== strlen($content)) {$this->help->putInCache($route, $language, $content);return $content;diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.phpindex 8f8c8f6be5..d24313062a 100644--- a/app/Http/Controllers/HomeController.php+++ b/app/Http/Controllers/HomeController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers;@@ -42,9 +41,7 @@ use Session;use View;/**- * Class HomeController- *- * @package FireflyIII\Http\Controllers+ * Class HomeController.*/class HomeController extends Controller{@@ -112,7 +109,7 @@ class HomeController extends Controllerforeach ($handlers as $handler) {if ($handler instanceof RotatingFileHandler) {$logFile = $handler->getUrl();- if (!is_null($logFile)) {+ if (null !== $logFile) {$logContent = file_get_contents($logFile);}}@@ -180,7 +177,7 @@ class HomeController extends Controller$types = config('firefly.accountTypesByIdentifier.asset');$count = $repository->count($types);- if ($count === 0) {+ if (0 === $count) {return redirect(route('new-user.index'));}@@ -202,7 +199,6 @@ class HomeController extends Controller$billRepository = app(BillRepositoryInterface::class);$billCount = $billRepository->getBills()->count();-foreach ($accounts as $account) {$collector = app(JournalCollectorInterface::class);$collector->setAccounts(new Collection([$account]))->setRange($start, $end)->setLimit(10)->setPage(1);@@ -225,16 +221,15 @@ class HomeController extends Controller'register', 'report.options', 'routes', 'rule-groups.down', 'rule-groups.up', 'rules.up', 'rules.down','rules.select', 'search.search', 'test-flash', 'transactions.link.delete', 'transactions.link.switch','two-factor.lost', 'report.options',-];/** @var Route $route */foreach ($set as $route) {$name = $route->getName();- if (!is_null($name) && in_array('GET', $route->methods()) && strlen($name) > 0) {+ if (null !== $name && in_array('GET', $route->methods()) && strlen($name) > 0) {$found = false;foreach ($ignore as $string) {- if (strpos($name, $string) !== false) {+ if (false !== strpos($name, $string)) {$found = true;}}diff --git a/app/Http/Controllers/Import/BankController.php b/app/Http/Controllers/Import/BankController.phpindex 0018673cac..2fbefc0d7b 100644--- a/app/Http/Controllers/Import/BankController.php+++ b/app/Http/Controllers/Import/BankController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers\Import;@@ -32,7 +31,6 @@ use Session;class BankController extends Controller{-/*** This method must ask the user all parameters necessary to start importing data. This may not be enough* to finish the import itself (ie. mapping) but it should be enough to begin: accounts to import from,@@ -82,7 +80,7 @@ class BankController extends Controllerreturn redirect(route('import.bank.prerequisites', [$bank]));}$remoteAccounts = $request->get('do_import');- if (!is_array($remoteAccounts) || count($remoteAccounts) === 0) {+ if (!is_array($remoteAccounts) || 0 === count($remoteAccounts)) {Session::flash('error', 'Must select accounts');return redirect(route('import.bank.form', [$bank]));diff --git a/app/Http/Controllers/Import/FileController.php b/app/Http/Controllers/Import/FileController.phpindex 93950180d3..ff6c86b48c 100644--- a/app/Http/Controllers/Import/FileController.php+++ b/app/Http/Controllers/Import/FileController.php@@ -18,10 +18,8 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);-namespace FireflyIII\Http\Controllers\Import;use FireflyIII\Exceptions\FireflyException;@@ -41,12 +39,10 @@ use View;/*** Class FileController.- *- * @package FireflyIII\Http\Controllers\Import*/class FileController extends Controller{- /** @var ImportJobRepositoryInterface */+ /** @var ImportJobRepositoryInterface */public $repository;/**@@ -73,6 +69,7 @@ class FileController extends Controller* @param ImportJob $job** @return View+ ** @throws FireflyException*/public function configure(ImportJob $job)@@ -110,7 +107,7 @@ class FileController extends Controller$config['column-roles-complete'] = false;$config['column-mapping-complete'] = false;$config['initial-config-complete'] = false;- $config['delimiter'] = $config['delimiter'] === "\t" ? 'tab' : $config['delimiter'];+ $config['delimiter'] = "\t" === $config['delimiter'] ? 'tab' : $config['delimiter'];$result = json_encode($config, JSON_PRETTY_PRINT);$name = sprintf('"%s"', addcslashes('import-configuration-' . date('Y-m-d') . '.json', '"\\'));@@ -177,9 +174,7 @@ class FileController extends Controllerreturn redirect(route('import.file.configure', [$job->key]));}-/**- ** Show status of import job in JSON.** @param ImportJob $job@@ -202,12 +197,12 @@ class FileController extends Controller'finishedText' => '',];- if ($job->extended_status['steps'] !== 0) {+ if (0 !== $job->extended_status['steps']) {$result['percentage'] = round(($job->extended_status['done'] / $job->extended_status['steps']) * 100, 0);$result['show_percentage'] = true;}- if ($job->status === 'finished') {+ if ('finished' === $job->status) {$tagId = $job->extended_status['tag'];/** @var TagRepositoryInterface $repository */$repository = app(TagRepositoryInterface::class);@@ -216,7 +211,7 @@ class FileController extends Controller$result['finishedText'] = trans('firefly.import_status_finished_job', ['link' => route('tags.show', [$tag->id, 'all']), 'tag' => $tag->tag]);}- if ($job->status === 'running') {+ if ('running' === $job->status) {$result['started'] = true;$result['running'] = true;}@@ -259,6 +254,7 @@ class FileController extends Controller* @param ImportJob $job** @return \Illuminate\Http\JsonResponse+ ** @throws FireflyException*/public function start(ImportJob $job)@@ -295,6 +291,7 @@ class FileController extends Controller* @param ImportJob $job** @return ConfiguratorInterface+ ** @throws FireflyException*/private function makeConfigurator(ImportJob $job): ConfiguratorInterface@@ -302,14 +299,13 @@ class FileController extends Controller$type = $job->file_type;$key = sprintf('firefly.import_configurators.%s', $type);$className = config($key);- if (is_null($className)) {+ if (null === $className) {throw new FireflyException('Cannot find configurator class for this job.'); // @codeCoverageIgnore}/** @var ConfiguratorInterface $configurator */$configurator = app($className);$configurator->setJob($job);-return $configurator;}}diff --git a/app/Http/Controllers/ImportController.php b/app/Http/Controllers/ImportController.phpindex aa1720146a..8d513b1e91 100644--- a/app/Http/Controllers/ImportController.php+++ b/app/Http/Controllers/ImportController.php@@ -27,12 +27,10 @@ use View;/*** Class ImportController.- *- * @package FireflyIII\Http\Controllers*/class ImportController extends Controller{- /** @var ImportJobRepositoryInterface */+ /** @var ImportJobRepositoryInterface */public $repository;/**@@ -53,9 +51,8 @@ class ImportController extends Controller);}-/**- * General import index+ * General import index.** @return View*/diff --git a/app/Http/Controllers/JavascriptController.php b/app/Http/Controllers/JavascriptController.phpindex 5cff2e72f3..2e4ea3b92b 100644--- a/app/Http/Controllers/JavascriptController.php+++ b/app/Http/Controllers/JavascriptController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers;@@ -35,9 +34,7 @@ use Navigation;use Preferences;/**- * Class JavascriptController- *- * @package FireflyIII\Http\Controllers+ * Class JavascriptController.*/class JavascriptController extends Controller{@@ -53,19 +50,17 @@ class JavascriptController extends Controller$preference = Preferences::get('currencyPreference', config('firefly.default_currency', 'EUR'));$default = $currencyRepository->findByCode($preference->data);- $data = ['accounts' => [],];-+ $data = ['accounts' => []];/** @var Account $account */foreach ($accounts as $account) {$accountId = $account->id;$currency = intval($account->getMeta('currency_id'));- $currency = $currency === 0 ? $default->id : $currency;+ $currency = 0 === $currency ? $default->id : $currency;$entry = ['preferredCurrency' => $currency, 'name' => $account->name];$data['accounts'][$accountId] = $entry;}-return response()->view('javascript.accounts', $data, 200)->header('Content-Type', 'text/javascript');@@ -79,7 +74,7 @@ class JavascriptController extends Controllerpublic function currencies(CurrencyRepositoryInterface $repository){$currencies = $repository->get();- $data = ['currencies' => [],];+ $data = ['currencies' => []];/** @var TransactionCurrency $currency */foreach ($currencies as $currency) {$currencyId = $currency->id;@@ -180,7 +175,6 @@ class JavascriptController extends Controller],];-return $return;}}diff --git a/app/Http/Controllers/Json/AutoCompleteController.php b/app/Http/Controllers/Json/AutoCompleteController.phpindex bdb54ce2b0..1cbd9c26e2 100644--- a/app/Http/Controllers/Json/AutoCompleteController.php+++ b/app/Http/Controllers/Json/AutoCompleteController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers\Json;@@ -33,20 +32,16 @@ use FireflyIII\Support\CacheProperties;use Response;/**- * Class AutoCompleteController- *- * @package FireflyIII\Http\Controllers\Json+ * Class AutoCompleteController.*/class AutoCompleteController extends Controller{-/*** Returns a JSON list of all accounts.** @param AccountRepositoryInterface $repository** @return \Illuminate\Http\JsonResponse- **/public function allAccounts(AccountRepositoryInterface $repository){@@ -80,7 +75,6 @@ class AutoCompleteController extends Controller* @param AccountRepositoryInterface $repository** @return \Illuminate\Http\JsonResponse- **/public function expenseAccounts(AccountRepositoryInterface $repository){@@ -103,7 +97,6 @@ class AutoCompleteController extends Controller/*** @param JournalCollectorInterface $collector- ** @param TransactionJournal $except** @return \Illuminate\Http\JsonResponse|mixed@@ -139,7 +132,6 @@ class AutoCompleteController extends Controller* @param AccountRepositoryInterface $repository** @return \Illuminate\Http\JsonResponse- **/public function revenueAccounts(AccountRepositoryInterface $repository){diff --git a/app/Http/Controllers/Json/BoxController.php b/app/Http/Controllers/Json/BoxController.phpindex c971426085..29ecc6bdf7 100644--- a/app/Http/Controllers/Json/BoxController.php+++ b/app/Http/Controllers/Json/BoxController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers\Json;@@ -35,9 +34,7 @@ use FireflyIII\Support\CacheProperties;use Response;/**- * Class BoxController- *- * @package FireflyIII\Http\Controllers\Json+ * Class BoxController.*/class BoxController extends Controller{@@ -63,7 +60,6 @@ class BoxController extends Controller$currency = app('amount')->getDefaultCurrency();$available = $repository->getAvailableBudget($currency, $start, $end);-// get spent amount:$budgets = $repository->getActiveBudgets();$budgetInformation = $repository->collectBudgetInformation($budgets, $start, $end);@@ -75,7 +71,7 @@ class BoxController extends Controller}$days = $today->diffInDays($end) + 1;$perDay = '0';- if ($days !== 0) {+ if (0 !== $days) {$perDay = bcdiv($left, strval($days));}diff --git a/app/Http/Controllers/Json/ExchangeController.php b/app/Http/Controllers/Json/ExchangeController.phpindex 38c8a696dd..096398caa8 100644--- a/app/Http/Controllers/Json/ExchangeController.php+++ b/app/Http/Controllers/Json/ExchangeController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers\Json;@@ -33,9 +32,7 @@ use Log;use Response;/**- * Class ExchangeController- *- * @package FireflyIII\Http\Controllers\Json+ * Class ExchangeController.*/class ExchangeController extends Controller{@@ -52,7 +49,7 @@ class ExchangeController extends Controller/** @var CurrencyRepositoryInterface $repository */$repository = app(CurrencyRepositoryInterface::class);$rate = $repository->getExchangeRate($fromCurrency, $toCurrency, $date);- if (is_null($rate->id)) {+ if (null === $rate->id) {Log::debug(sprintf('No cached exchange rate in database for %s to %s on %s', $fromCurrency->code, $toCurrency->code, $date->format('Y-m-d')));$preferred = env('EXCHANGE_RATE_SERVICE', config('firefly.preferred_exchange_service'));$class = config('firefly.currency_exchange_services.' . $preferred);@@ -63,7 +60,7 @@ class ExchangeController extends Controller}$return = $rate->toArray();$return['amount'] = null;- if (!is_null($request->get('amount'))) {+ if (null !== $request->get('amount')) {// assume amount is in "from" currency:$return['amount'] = bcmul($request->get('amount'), strval($rate->rate), 12);// round to toCurrency decimal places:diff --git a/app/Http/Controllers/Json/FrontpageController.php b/app/Http/Controllers/Json/FrontpageController.phpindex 00af0970ea..4f187f4eab 100644--- a/app/Http/Controllers/Json/FrontpageController.php+++ b/app/Http/Controllers/Json/FrontpageController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers\Json;@@ -29,9 +28,7 @@ use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;use Response;/**- * Class FrontpageController- *- * @package FireflyIII\Http\Controllers\Json+ * Class FrontpageController.*/class FrontpageController extends Controller{@@ -46,8 +43,7 @@ class FrontpageController extends Controllerforeach ($set as $piggyBank) {$rep = $piggyBank->currentRelevantRep();$amount = strval($rep->currentamount);- if (!is_null($rep->id) && bccomp($amount, '0') === 1) {-+ if (null !== $rep->id && 1 === bccomp($amount, '0')) {// percentage!$pct = round(($amount / $piggyBank->targetamount) * 100);diff --git a/app/Http/Controllers/Json/IntroController.php b/app/Http/Controllers/Json/IntroController.phpindex df89f71a19..78f10480a0 100644--- a/app/Http/Controllers/Json/IntroController.php+++ b/app/Http/Controllers/Json/IntroController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers\Json;@@ -28,13 +27,10 @@ use Log;use Response;/**- * Class IntroController- *- * @package FireflyIII\Http\Controllers\Json+ * Class IntroController.*/class IntroController{-/*** @param string $route* @param string $specificPage@@ -45,7 +41,7 @@ class IntroController{$steps = $this->getBasicSteps($route);$specificSteps = $this->getSpecificSteps($route, $specificPage);- if (count($specificSteps) === 0) {+ if (0 === count($specificSteps)) {return Response::json($steps);}if ($this->hasOutroStep($route)) {@@ -91,7 +87,7 @@ class IntroController{$route = str_replace('.', '_', $route);$key = 'shown_demo_' . $route;- if ($specialPage !== '') {+ if ('' !== $specialPage) {$key .= '_' . $specialPage;}Log::debug(sprintf('Going to mark the following route as NOT done: %s with special "%s" (%s)', $route, $specialPage, $key));@@ -109,7 +105,7 @@ class IntroControllerpublic function postFinished(string $route, string $specialPage = ''){$key = 'shown_demo_' . $route;- if ($specialPage !== '') {+ if ('' !== $specialPage) {$key .= '_' . $specialPage;}Log::debug(sprintf('Going to mark the following route as done: %s with special "%s" (%s)', $route, $specialPage, $key));@@ -135,7 +131,6 @@ class IntroController// get the text:$currentStep['intro'] = trans('intro.' . $route . '_' . $key);-// save in array:$steps[] = $currentStep;}diff --git a/app/Http/Controllers/Json/TransactionController.php b/app/Http/Controllers/Json/TransactionController.phpindex 5de85266ab..f9292661cc 100644--- a/app/Http/Controllers/Json/TransactionController.php+++ b/app/Http/Controllers/Json/TransactionController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers\Json;@@ -62,7 +61,7 @@ class TransactionController extends Controller$totals[$currencyId]['amount'] = bcadd($totals[$currencyId]['amount'], app('steam')->positive($transaction->amount));// foreign amount:- if (!is_null($transaction->foreign_amount)) {+ if (null !== $transaction->foreign_amount) {$currencyId = $transaction->foreign_currency_id;if (!isset($totals[$currencyId])) {$totals[$currencyId] = [@@ -78,7 +77,7 @@ class TransactionController extends Controller$entries = [];foreach ($totals as $entry) {$amount = $entry['amount'];- if ($entry['type'] === TransactionType::WITHDRAWAL) {+ if (TransactionType::WITHDRAWAL === $entry['type']) {$amount = bcmul($entry['amount'], '-1');}$entries[] = app('amount')->formatAnything($entry['currency'], $amount, false);diff --git a/app/Http/Controllers/JsonController.php b/app/Http/Controllers/JsonController.phpindex 1194d4d599..a9239d71c1 100644--- a/app/Http/Controllers/JsonController.php+++ b/app/Http/Controllers/JsonController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers;@@ -31,9 +30,7 @@ use Illuminate\Http\Request;use Response;/**- * Class JsonController- *- * @package FireflyIII\Http\Controllers+ * Class JsonController.*/class JsonController extends Controller{@@ -60,7 +57,6 @@ class JsonController extends Controller}$view = view('rules.partials.action', compact('actions', 'count'))->render();-return Response::json(['html' => $view]);}@@ -131,7 +127,7 @@ class JsonController extends Controller$keys = array_keys(config('firefly.rule-triggers'));$triggers = [];foreach ($keys as $key) {- if ($key !== 'user_action') {+ if ('user_action' !== $key) {$triggers[$key] = trans('firefly.rule_trigger_' . $key . '_choice');}}@@ -139,7 +135,6 @@ class JsonController extends Controller$view = view('rules.partials.trigger', compact('triggers', 'count'))->render();-return Response::json(['html' => $view]);}}diff --git a/app/Http/Controllers/NewUserController.php b/app/Http/Controllers/NewUserController.phpindex cc7a1f8838..6589f22769 100644--- a/app/Http/Controllers/NewUserController.php+++ b/app/Http/Controllers/NewUserController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers;@@ -32,9 +31,7 @@ use Session;use View;/**- * Class NewUserController- *- * @package FireflyIII\Http\Controllers+ * Class NewUserController.*/class NewUserController extends Controller{@@ -52,7 +49,6 @@ class NewUserController extends Controller);}-/*** @param AccountRepositoryInterface $repository*@@ -90,13 +86,12 @@ class NewUserController extends Controller// also store currency preference from input:$currency = $currencyRepository->find(intval($request->input('amount_currency_id_bank_balance')));- if (!is_null($currency->id)) {+ if (null !== $currency->id) {// store currency preference:Preferences::set('currencyPreference', $currency->code);Preferences::mark();}-Session::flash('success', strval(trans('firefly.stored_new_accounts_new_user')));Preferences::mark();diff --git a/app/Http/Controllers/PiggyBankController.php b/app/Http/Controllers/PiggyBankController.phpindex 35fe50d4ae..1f419a9e97 100644--- a/app/Http/Controllers/PiggyBankController.php+++ b/app/Http/Controllers/PiggyBankController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers;@@ -40,15 +39,10 @@ use Steam;use View;/**- *- *- * Class PiggyBankController- *- * @package FireflyIII\Http\Controllers+ * Class PiggyBankController.*/class PiggyBankController extends Controller{-/****/@@ -56,7 +50,6 @@ class PiggyBankController extends Controller{parent::__construct();-$this->middleware(function ($request, $next) {View::share('title', trans('firefly.piggyBanks'));@@ -68,7 +61,7 @@ class PiggyBankController extends Controller}/**- * Add money to piggy bank+ * Add money to piggy bank.** @param PiggyBank $piggyBank*@@ -87,7 +80,7 @@ class PiggyBankController extends Controller}/**- * Add money to piggy bank (for mobile devices)+ * Add money to piggy bank (for mobile devices).** @param PiggyBank $piggyBank*@@ -109,7 +102,6 @@ class PiggyBankController extends Controller* @param AccountRepositoryInterface $repository** @return View- **/public function create(AccountRepositoryInterface $repository){@@ -117,14 +109,14 @@ class PiggyBankController extends Controller$subTitle = trans('firefly.new_piggy_bank');$subTitleIcon = 'fa-plus';- if (count($accounts) === 0) {+ if (0 === count($accounts)) {Session::flash('error', strval(trans('firefly.need_at_least_one_account')));return redirect(route('new-user.index'));}// put previous url in session if not redirect from store (not "create another").- if (session('piggy-banks.create.fromStore') !== true) {+ if (true !== session('piggy-banks.create.fromStore')) {$this->rememberPreviousUri('piggy-banks.create.uri');}Session::forget('piggy-banks.create.fromStore');@@ -179,10 +171,8 @@ class PiggyBankController extends Controller$subTitleIcon = 'fa-pencil';$targetDate = null;$note = $piggyBank->notes()->first();- /*- * Flash some data to fill the form.- */- if (!is_null($piggyBank->targetdate)) {+ // Flash some data to fill the form.+ if (null !== $piggyBank->targetdate) {$targetDate = $piggyBank->targetdate->format('Y-m-d');}@@ -190,14 +180,14 @@ class PiggyBankController extends Controller'account_id' => $piggyBank->account_id,'targetamount' => $piggyBank->targetamount,'targetdate' => $targetDate,- 'note' => is_null($note) ? '' : $note->text,+ 'note' => null === $note ? '' : $note->text,];Session::flash('preFilled', $preFilled);Session::flash('gaEventCategory', 'piggy-banks');Session::flash('gaEventAction', 'edit');// put previous url in session if not redirect from store (not "return_to_edit").- if (session('piggy-banks.edit.fromUpdate') !== true) {+ if (true !== session('piggy-banks.edit.fromUpdate')) {$this->rememberPreviousUri('piggy-banks.edit.uri');}Session::forget('piggy-banks.edit.fromUpdate');@@ -222,13 +212,11 @@ class PiggyBankController extends Controller/** @var PiggyBank $piggyBank */foreach ($piggyBanks as $piggyBank) {$piggyBank->savedSoFar = $piggyBank->currentRelevantRep()->currentamount ?? '0';- $piggyBank->percentage = bccomp('0', $piggyBank->savedSoFar) !== 0 ? intval($piggyBank->savedSoFar / $piggyBank->targetamount * 100) : 0;+ $piggyBank->percentage = 0 !== bccomp('0', $piggyBank->savedSoFar) ? intval($piggyBank->savedSoFar / $piggyBank->targetamount * 100) : 0;$piggyBank->leftToSave = bcsub($piggyBank->targetamount, strval($piggyBank->savedSoFar));$piggyBank->percentage = $piggyBank->percentage > 100 ? 100 : $piggyBank->percentage;- /*- * Fill account information:- */+ // Fill account information:$account = $piggyBank->account;$new = false;if (!isset($accounts[$account->id])) {@@ -242,7 +230,7 @@ class PiggyBankController extends Controller'leftToSave' => $piggyBank->leftToSave,];}- if (isset($accounts[$account->id]) && $new === false) {+ if (isset($accounts[$account->id]) && false === $new) {$accounts[$account->id]['sumOfSaved'] = bcadd($accounts[$account->id]['sumOfSaved'], strval($piggyBank->savedSoFar));$accounts[$account->id]['sumOfTargets'] = bcadd($accounts[$account->id]['sumOfTargets'], $piggyBank->targetamount);$accounts[$account->id]['leftToSave'] = bcadd($accounts[$account->id]['leftToSave'], $piggyBank->leftToSave);@@ -265,7 +253,6 @@ class PiggyBankController extends Controller// set all users piggy banks to zero:$repository->reset();-if (is_array($data)) {foreach ($data as $order => $id) {$repository->setOrder(intval($id), ($order + 1));@@ -361,7 +348,6 @@ class PiggyBankController extends Controller/*** @param PiggyBank $piggyBank*- ** @return View*/public function remove(PiggyBank $piggyBank)@@ -370,7 +356,7 @@ class PiggyBankController extends Controller}/**- * Remove money from piggy bank (for mobile devices)+ * Remove money from piggy bank (for mobile devices).** @param PiggyBank $piggyBank*@@ -410,7 +396,7 @@ class PiggyBankController extends ControllerSession::flash('success', strval(trans('firefly.stored_piggy_bank', ['name' => $piggyBank->name])));Preferences::mark();- if (intval($request->get('create_another')) === 1) {+ if (1 === intval($request->get('create_another'))) {// @codeCoverageIgnoreStartSession::put('piggy-banks.create.fromStore', true);@@ -436,7 +422,7 @@ class PiggyBankController extends ControllerSession::flash('success', strval(trans('firefly.updated_piggy_bank', ['name' => $piggyBank->name])));Preferences::mark();- if (intval($request->get('return_to_edit')) === 1) {+ if (1 === intval($request->get('return_to_edit'))) {// @codeCoverageIgnoreStartSession::put('piggy-banks.edit.fromUpdate', true);diff --git a/app/Http/Controllers/Popup/ReportController.php b/app/Http/Controllers/Popup/ReportController.phpindex 4eeafb197a..1b08f49932 100644--- a/app/Http/Controllers/Popup/ReportController.php+++ b/app/Http/Controllers/Popup/ReportController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers\Popup;@@ -38,13 +37,10 @@ use Response;use View;/**- * Class ReportController- *- * @package FireflyIII\Http\Controllers\Popup+ * Class ReportController.*/class ReportController extends Controller{-/** @var AccountRepositoryInterface */private $accountRepository;/** @var BudgetRepositoryInterface */@@ -54,7 +50,6 @@ class ReportController extends Controller/** @var PopupReportInterface */private $popupHelper;-/****/@@ -63,17 +58,16 @@ class ReportController extends Controllerparent::__construct();$this->middleware(function ($request, $next) {-- /** @var AccountRepositoryInterface $repository */+ // @var AccountRepositoryInterface $repository$this->accountRepository = app(AccountRepositoryInterface::class);- /** @var BudgetRepositoryInterface $repository */+ // @var BudgetRepositoryInterface $repository$this->budgetRepository = app(BudgetRepositoryInterface::class);- /** @var CategoryRepositoryInterface categoryRepository */+ // @var CategoryRepositoryInterface categoryRepository$this->categoryRepository = app(CategoryRepositoryInterface::class);- /** @var PopupReportInterface popupHelper */+ // @var PopupReportInterface popupHelper$this->popupHelper = app(PopupReportInterface::class);return $next($request);@@ -81,11 +75,11 @@ class ReportController extends Controller);}-/*** @param Request $request** @return \Illuminate\Http\JsonResponse+ ** @throws FireflyException*/public function general(Request $request)@@ -123,6 +117,7 @@ class ReportController extends Controller* @param $attributes** @return string+ ** @throws FireflyException*/private function balanceAmount(array $attributes): string@@ -132,20 +127,20 @@ class ReportController extends Controller$account = $this->accountRepository->find(intval($attributes['accountId']));switch (true) {- case ($role === BalanceLine::ROLE_DEFAULTROLE && !is_null($budget->id)):+ case BalanceLine::ROLE_DEFAULTROLE === $role && null !== $budget->id:// normal row with a budget:$journals = $this->popupHelper->balanceForBudget($budget, $account, $attributes);break;- case ($role === BalanceLine::ROLE_DEFAULTROLE && is_null($budget->id)):+ case BalanceLine::ROLE_DEFAULTROLE === $role && null === $budget->id:// normal row without a budget:$journals = $this->popupHelper->balanceForNoBudget($account, $attributes);$budget->name = strval(trans('firefly.no_budget'));break;- case ($role === BalanceLine::ROLE_DIFFROLE):+ case BalanceLine::ROLE_DIFFROLE === $role:$journals = $this->popupHelper->balanceDifference($account, $attributes);$budget->name = strval(trans('firefly.leftUnbalanced'));break;- case ($role === BalanceLine::ROLE_TAGROLE):+ case BalanceLine::ROLE_TAGROLE === $role:// row with tag info.throw new FireflyException('Firefly cannot handle this type of info-button (BalanceLine::TagRole)');}@@ -160,6 +155,7 @@ class ReportController extends Controller* @param array $attributes** @return string+ ** @throws FireflyException*/private function budgetSpentAmount(array $attributes): string@@ -177,6 +173,7 @@ class ReportController extends Controller* @param $attributes** @return string+ ** @throws FireflyException*/private function categoryEntry(array $attributes): string@@ -194,6 +191,7 @@ class ReportController extends Controller* @param $attributes** @return string+ ** @throws FireflyException*/private function expenseEntry(array $attributes): string@@ -211,6 +209,7 @@ class ReportController extends Controller* @param $attributes** @return string+ ** @throws FireflyException*/private function incomeEntry(array $attributes): string@@ -226,6 +225,7 @@ class ReportController extends Controller* @param array $attributes** @return array+ ** @throws FireflyException*/private function parseAttributes(array $attributes): array@@ -244,7 +244,6 @@ class ReportController extends Controllerthrow new FireflyException('Could not parse start date "' . e($attributes['endDate']) . '".');}-return $attributes;}}diff --git a/app/Http/Controllers/PreferencesController.php b/app/Http/Controllers/PreferencesController.phpindex 30b0a6135a..4dfa42d049 100644--- a/app/Http/Controllers/PreferencesController.php+++ b/app/Http/Controllers/PreferencesController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers;@@ -34,13 +33,10 @@ use Session;use View;/**- * Class PreferencesController- *- * @package FireflyIII\Http\Controllers+ * Class PreferencesController.*/class PreferencesController extends Controller{-/****/@@ -48,7 +44,6 @@ class PreferencesController extends Controller{parent::__construct();-$this->middleware(function ($request, $next) {View::share('title', trans('firefly.preferences'));@@ -71,7 +66,6 @@ class PreferencesController extends ControllerSession::flash('two-factor-secret', $secret);$image = $google2fa->getQRCodeInline($domain, auth()->user()->email, $secret, 200);-return view('preferences.code', compact('image'));}@@ -107,8 +101,8 @@ class PreferencesController extends Controller$fiscalYearStart = date('Y') . '-' . $fiscalYearStartStr;$tjOptionalFields = Preferences::get('transaction_journal_optional_fields', [])->data;$is2faEnabled = Preferences::get('twoFactorAuthEnabled', 0)->data; // twoFactorAuthEnabled- $has2faSecret = !is_null(Preferences::get('twoFactorAuthSecret')); // hasTwoFactorAuthSecret- $showIncomplete = env('SHOW_INCOMPLETE_TRANSLATIONS', false) === true;+ $has2faSecret = null !== Preferences::get('twoFactorAuthSecret'); // hasTwoFactorAuthSecret+ $showIncomplete = true === env('SHOW_INCOMPLETE_TRANSLATIONS', false);return view('preferences.index',@@ -148,7 +142,6 @@ class PreferencesController extends Controller/*** @param Request $request- ** @param UserRepositoryInterface $repository** @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector@@ -172,13 +165,13 @@ class PreferencesController extends ControllerSession::forget('range');// custom fiscal year- $customFiscalYear = intval($request->get('customFiscalYear')) === 1;+ $customFiscalYear = 1 === intval($request->get('customFiscalYear'));$fiscalYearStart = date('m-d', strtotime(strval($request->get('fiscalYearStart'))));Preferences::set('customFiscalYear', $customFiscalYear);Preferences::set('fiscalYearStart', $fiscalYearStart);// show deposits frontpage:- $showDepositsFrontpage = intval($request->get('showDepositsFrontpage')) === 1;+ $showDepositsFrontpage = 1 === intval($request->get('showDepositsFrontpage'));Preferences::set('showDepositsFrontpage', $showDepositsFrontpage);// save page size:@@ -193,7 +186,7 @@ class PreferencesController extends Controllerif (!$repository->hasRole(auth()->user(), 'demo')) {// two factor auth$twoFactorAuthEnabled = intval($request->get('twoFactorAuthEnabled'));- $hasTwoFactorAuthSecret = !is_null(Preferences::get('twoFactorAuthSecret'));+ $hasTwoFactorAuthSecret = null !== Preferences::get('twoFactorAuthSecret');// If we already have a secret, just set the two factor auth enabled to 1, and let the user continue with the existing secret.if ($hasTwoFactorAuthSecret) {@@ -222,13 +215,12 @@ class PreferencesController extends Controller];Preferences::set('transaction_journal_optional_fields', $optionalTj);-Session::flash('success', strval(trans('firefly.saved_preferences')));Preferences::mark();// if we don't have a valid secret yet, redirect to the code page.// AND USER HAS ACTUALLY ENABLED 2FA- if (!$hasTwoFactorAuthSecret && $twoFactorAuthEnabled === 1) {+ if (!$hasTwoFactorAuthSecret && 1 === $twoFactorAuthEnabled) {return redirect(route('preferences.code'));}diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.phpindex 9c4a398968..c8fe9ed92e 100644--- a/app/Http/Controllers/ProfileController.php+++ b/app/Http/Controllers/ProfileController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers;@@ -41,9 +40,7 @@ use Session;use View;/**- * Class ProfileController- *- * @package FireflyIII\Http\Controllers+ * Class ProfileController.*/class ProfileController extends Controller{@@ -54,7 +51,6 @@ class ProfileController extends Controller{parent::__construct();-$this->middleware(function ($request, $next) {View::share('title', trans('firefly.profile'));@@ -95,6 +91,7 @@ class ProfileController extends Controller* @param string $token** @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector+ ** @throws FireflyException*/public function confirmEmailChange(string $token)@@ -109,7 +106,7 @@ class ProfileController extends Controller}}// update user to clear blocked and blocked_code.- if (is_null($user)) {+ if (null === $user) {throw new FireflyException('Invalid token.');}$user->blocked = 0;@@ -136,7 +133,6 @@ class ProfileController extends Controller/*** @return View- **/public function index(){@@ -145,7 +141,7 @@ class ProfileController extends Controller// get access token or create one.$accessToken = Preferences::get('access_token', null);- if (is_null($accessToken)) {+ if (null === $accessToken) {$token = auth()->user()->generateAccessToken();$accessToken = Preferences::set('access_token', $token);}@@ -171,7 +167,7 @@ class ProfileController extends Controllerreturn redirect(route('profile.change-email'))->withInput();}$existing = $repository->findByEmail($newEmail);- if (!is_null($existing)) {+ if (null !== $existing) {// force user logout.$this->guard()->logout();$request->session()->invalidate();@@ -245,7 +241,6 @@ class ProfileController extends ControllerSession::flash('gaEventCategory', 'user');Session::flash('gaEventAction', 'delete-account');-return redirect(route('index'));}@@ -278,7 +273,7 @@ class ProfileController extends Controller$user = $preference->user;}}- if (is_null($user)) {+ if (null === $user) {throw new FireflyException('Invalid token.');}@@ -293,7 +288,7 @@ class ProfileController extends Controllerbreak;}}- if (is_null($match)) {+ if (null === $match) {throw new FireflyException('Invalid token.');}// change user back@@ -314,6 +309,7 @@ class ProfileController extends Controller* @param string $new** @return bool+ ** @throws ValidationException*/protected function validatePassword(User $user, string $current, string $new): booldiff --git a/app/Http/Controllers/Report/AccountController.php b/app/Http/Controllers/Report/AccountController.phpindex 1ab913d8df..56215699f4 100644--- a/app/Http/Controllers/Report/AccountController.php+++ b/app/Http/Controllers/Report/AccountController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers\Report;@@ -30,13 +29,10 @@ use FireflyIII\Support\CacheProperties;use Illuminate\Support\Collection;/**- * Class AccountController- *- * @package FireflyIII\Http\Controllers\Report+ * Class AccountController.*/class AccountController extends Controller{-/*** @param Collection $accounts* @param Carbon $startdiff --git a/app/Http/Controllers/Report/BalanceController.php b/app/Http/Controllers/Report/BalanceController.phpindex 7cb28859fa..af4a0a629d 100644--- a/app/Http/Controllers/Report/BalanceController.php+++ b/app/Http/Controllers/Report/BalanceController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers\Report;@@ -30,13 +29,10 @@ use FireflyIII\Support\CacheProperties;use Illuminate\Support\Collection;/**- * Class BalanceController- *- * @package FireflyIII\Http\Controllers\Report+ * Class BalanceController.*/class BalanceController extends Controller{-/*** @param BalanceReportHelperInterface $helper* @param Collection $accounts@@ -47,8 +43,6 @@ class BalanceController extends Controller*/public function general(BalanceReportHelperInterface $helper, Collection $accounts, Carbon $start, Carbon $end){--// chart properties for cache:$cache = new CacheProperties;$cache->addProperty($start);diff --git a/app/Http/Controllers/Report/BudgetController.php b/app/Http/Controllers/Report/BudgetController.phpindex 0f82aa54f0..60532b58fc 100644--- a/app/Http/Controllers/Report/BudgetController.php+++ b/app/Http/Controllers/Report/BudgetController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers\Report;@@ -32,14 +31,10 @@ use Illuminate\Support\Collection;use Navigation;/**- * Class BudgetController- *- * @package FireflyIII\Http\Controllers\Report+ * Class BudgetController.*/class BudgetController extends Controller{--/*** @param BudgetReportHelperInterface $helper* @param Collection $accounts@@ -50,7 +45,6 @@ class BudgetController extends Controller*/public function general(BudgetReportHelperInterface $helper, Collection $accounts, Carbon $start, Carbon $end){-// chart properties for cache:$cache = new CacheProperties;$cache->addProperty($start);@@ -103,7 +97,7 @@ class BudgetController extends Controller}/**- * Filters empty results from getBudgetPeriodReport+ * Filters empty results from getBudgetPeriodReport.** @param array $data*@@ -112,7 +106,7 @@ class BudgetController extends Controllerprivate function filterBudgetPeriodReport(array $data): array{/**- * @var int $budgetId+ * @var int* @var array $set*/foreach ($data as $budgetId => $set) {@@ -121,7 +115,7 @@ class BudgetController extends Controller$sum = bcadd($amount, $sum);}$data[$budgetId]['sum'] = $sum;- if (bccomp('0', $sum) === 0) {+ if (0 === bccomp('0', $sum)) {unset($data[$budgetId]);}}diff --git a/app/Http/Controllers/Report/CategoryController.php b/app/Http/Controllers/Report/CategoryController.phpindex 9f681fc7c9..929b9eb0eb 100644--- a/app/Http/Controllers/Report/CategoryController.php+++ b/app/Http/Controllers/Report/CategoryController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers\Report;@@ -32,9 +31,7 @@ use Illuminate\Support\Collection;use Navigation;/**- * Class CategoryController- *- * @package FireflyIII\Http\Controllers\Report+ * Class CategoryController.*/class CategoryController extends Controller{@@ -70,7 +67,6 @@ class CategoryController extends Controller}/**- ** @param Carbon $start* @param Carbon $end* @param Collection $accounts@@ -107,6 +103,7 @@ class CategoryController extends Controller* @param Carbon $end** @return mixed|string+ ** @internal param ReportHelperInterface $helper*/public function operations(Collection $accounts, Carbon $start, Carbon $end)@@ -128,7 +125,7 @@ class CategoryController extends Controller/** @var Category $category */foreach ($categories as $category) {$spent = $repository->spentInPeriod(new Collection([$category]), $accounts, $start, $end);- if (bccomp($spent, '0') !== 0) {+ if (0 !== bccomp($spent, '0')) {$report[$category->id] = ['name' => $category->name, 'spent' => $spent, 'id' => $category->id];}}@@ -149,7 +146,7 @@ class CategoryController extends Controller}/**- * Filters empty results from category period report+ * Filters empty results from category period report.** @param array $data*@@ -163,12 +160,11 @@ class CategoryController extends Controller$sum = bcadd($amount, $sum);}$data[$categoryId]['sum'] = $sum;- if (bccomp('0', $sum) === 0) {+ if (0 === bccomp('0', $sum)) {unset($data[$categoryId]);}}-return $data;}}diff --git a/app/Http/Controllers/Report/OperationsController.php b/app/Http/Controllers/Report/OperationsController.phpindex 3e33e3c28b..860734891a 100644--- a/app/Http/Controllers/Report/OperationsController.php+++ b/app/Http/Controllers/Report/OperationsController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers\Report;@@ -30,13 +29,10 @@ use FireflyIII\Support\CacheProperties;use Illuminate\Support\Collection;/**- * Class OperationsController- *- * @package FireflyIII\Http\Controllers\Report+ * Class OperationsController.*/class OperationsController extends Controller{-/*** @param AccountTaskerInterface $tasker* @param Collection $accountsdiff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.phpindex 3193cad81e..9a6d131f8b 100644--- a/app/Http/Controllers/ReportController.php+++ b/app/Http/Controllers/ReportController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers;@@ -42,9 +41,7 @@ use Session;use View;/**- * Class ReportController- *- * @package FireflyIII\Http\Controllers+ * Class ReportController.*/class ReportController extends Controller{@@ -98,7 +95,6 @@ class ReportController extends Controller));-$generator = ReportGeneratorFactory::reportGenerator('Audit', $start, $end);$generator->setAccounts($accounts);$result = $generator->generate();@@ -227,7 +223,6 @@ class ReportController extends Controller$accounts = $repository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);$accountList = join(',', $accounts->pluck('id')->toArray());-return view('reports.index', compact('months', 'accounts', 'start', 'accountList', 'customFiscalYear'));}@@ -274,26 +269,26 @@ class ReportController extends Controller$tags = join(',', $request->getTagList()->pluck('tag')->toArray());$uri = route('reports.index');- if ($request->getAccountList()->count() === 0) {+ if (0 === $request->getAccountList()->count()) {Log::debug('Account count is zero');Session::flash('error', trans('firefly.select_more_than_one_account'));return redirect(route('reports.index'));}- if ($request->getCategoryList()->count() === 0 && $reportType === 'category') {+ if (0 === $request->getCategoryList()->count() && 'category' === $reportType) {Session::flash('error', trans('firefly.select_more_than_one_category'));return redirect(route('reports.index'));}- if ($request->getBudgetList()->count() === 0 && $reportType === 'budget') {+ if (0 === $request->getBudgetList()->count() && 'budget' === $reportType) {Session::flash('error', trans('firefly.select_more_than_one_budget'));return redirect(route('reports.index'));}- if ($request->getTagList()->count() === 0 && $reportType === 'tag') {+ if (0 === $request->getTagList()->count() && 'tag' === $reportType) {Session::flash('error', trans('firefly.select_more_than_one_tag'));return redirect(route('reports.index'));diff --git a/app/Http/Controllers/RuleController.php b/app/Http/Controllers/RuleController.phpindex 5335f1a70e..aeec282409 100644--- a/app/Http/Controllers/RuleController.php+++ b/app/Http/Controllers/RuleController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers;@@ -45,9 +44,7 @@ use Session;use View;/**- * Class RuleController- *- * @package FireflyIII\Http\Controllers+ * Class RuleController.*/class RuleController extends Controller{@@ -58,7 +55,6 @@ class RuleController extends Controller{parent::__construct();-$this->middleware(function ($request, $next) {View::share('title', trans('firefly.rules'));@@ -102,7 +98,7 @@ class RuleController extends Controller$subTitle = trans('firefly.make_new_rule', ['title' => $ruleGroup->title]);// put previous url in session if not redirect from store (not "create another").- if (session('rules.create.fromStore') !== true) {+ if (true !== session('rules.create.fromStore')) {$this->rememberPreviousUri('rules.create.uri');}Session::forget('rules.create.fromStore');@@ -191,7 +187,7 @@ class RuleController extends Controller}// overrule old input when it as no rule data:- if ($triggerCount === 0 && $actionCount === 0) {+ if (0 === $triggerCount && 0 === $actionCount) {$oldTriggers = $this->getCurrentTriggers($rule);$triggerCount = count($oldTriggers);$oldActions = $this->getCurrentActions($rule);@@ -203,7 +199,7 @@ class RuleController extends Controller$subTitle = trans('firefly.edit_rule', ['title' => $rule->title]);// put previous url in session if not redirect from store (not "return_to_edit").- if (session('rules.edit.fromUpdate') !== true) {+ if (true !== session('rules.edit.fromUpdate')) {$this->rememberPreviousUri('rules.edit.uri');}Session::forget('rules.edit.fromUpdate');@@ -226,13 +222,14 @@ class RuleController extends Controller}/**- * Execute the given rule on a set of existing transactions+ * Execute the given rule on a set of existing transactions.** @param SelectTransactionsRequest $request* @param AccountRepositoryInterface $repository* @param Rule $rule** @return \Illuminate\Http\RedirectResponse+ ** @internal param RuleGroup $ruleGroup*/public function execute(SelectTransactionsRequest $request, AccountRepositoryInterface $repository, Rule $rule)@@ -343,7 +340,7 @@ class RuleController extends ControllerSession::flash('success', trans('firefly.stored_new_rule', ['title' => $rule->title]));Preferences::mark();- if (intval($request->get('create_another')) === 1) {+ if (1 === intval($request->get('create_another'))) {// @codeCoverageIgnoreStartSession::put('rules.create.fromStore', true);@@ -371,7 +368,7 @@ class RuleController extends Controller// build trigger array from response$triggers = $this->getValidTriggerList($request);- if (count($triggers) === 0) {+ if (0 === count($triggers)) {return Response::json(['html' => '', 'warning' => trans('firefly.warning_no_valid_triggers')]);}@@ -390,7 +387,7 @@ class RuleController extends Controllerif (count($matchingTransactions) === $limit) {$warning = trans('firefly.warning_transaction_subset', ['max_num_transactions' => $limit]);}- if (count($matchingTransactions) === 0) {+ if (0 === count($matchingTransactions)) {$warning = trans('firefly.warning_no_matching_transactions', ['num_transactions' => $range]);}@@ -417,7 +414,7 @@ class RuleController extends Controller{$triggers = $rule->ruleTriggers;- if (count($triggers) === 0) {+ if (0 === count($triggers)) {return Response::json(['html' => '', 'warning' => trans('firefly.warning_no_valid_triggers')]);}@@ -436,7 +433,7 @@ class RuleController extends Controllerif (count($matchingTransactions) === $limit) {$warning = trans('firefly.warning_transaction_subset', ['max_num_transactions' => $limit]);}- if (count($matchingTransactions) === 0) {+ if (0 === count($matchingTransactions)) {$warning = trans('firefly.warning_no_matching_transactions', ['num_transactions' => $range]);}@@ -474,7 +471,7 @@ class RuleController extends ControllerSession::flash('success', trans('firefly.updated_rule', ['title' => $rule->title]));Preferences::mark();- if (intval($request->get('return_to_edit')) === 1) {+ if (1 === intval($request->get('return_to_edit'))) {// @codeCoverageIgnoreStartSession::put('rules.edit.fromUpdate', true);@@ -490,7 +487,7 @@ class RuleController extends Controller/** @var RuleRepositoryInterface $repository */$repository = app(RuleRepositoryInterface::class);- if ($repository->count() === 0) {+ if (0 === $repository->count()) {$data = ['rule_group_id' => $repository->getFirstRuleGroup()->id,'stop_processing' => 0,@@ -519,11 +516,10 @@ class RuleController extends Controller*/private function createDefaultRuleGroup(){-/** @var RuleGroupRepositoryInterface $repository */$repository = app(RuleGroupRepositoryInterface::class);- if ($repository->count() === 0) {+ if (0 === $repository->count()) {$data = ['title' => trans('firefly.default_rule_group_name'),'description' => trans('firefly.default_rule_group_description'),@@ -555,7 +551,7 @@ class RuleController extends Controller'count' => $count,])->render();- $index++;+ ++$index;}return $actions;@@ -573,7 +569,7 @@ class RuleController extends Controller/** @var RuleTrigger $entry */foreach ($rule->ruleTriggers as $entry) {- if ($entry->trigger_type !== 'user_action') {+ if ('user_action' !== $entry->trigger_type) {$count = ($index + 1);$triggers[] = view('rules.partials.trigger',@@ -584,7 +580,7 @@ class RuleController extends Controller'count' => $count,])->render();- $index++;+ ++$index;}}@@ -614,7 +610,7 @@ class RuleController extends Controller'count' => $count,])->render();- $newIndex++;+ ++$newIndex;}return $actions;@@ -643,7 +639,7 @@ class RuleController extends Controller'count' => $count,])->render();- $newIndex++;+ ++$newIndex;}return $triggers;@@ -668,7 +664,7 @@ class RuleController extends Controller$triggers[] = ['type' => $triggerType,'value' => $data['rule-trigger-values'][$index],- 'stopProcessing' => intval($data['rule-trigger-stop'][$index]) === 1 ? true : false,+ 'stopProcessing' => 1 === intval($data['rule-trigger-stop'][$index]) ? true : false,];}}diff --git a/app/Http/Controllers/RuleGroupController.php b/app/Http/Controllers/RuleGroupController.phpindex ff7859cbdb..0ba9141041 100644--- a/app/Http/Controllers/RuleGroupController.php+++ b/app/Http/Controllers/RuleGroupController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers;@@ -38,9 +37,7 @@ use Session;use View;/**- * Class RuleGroupController- *- * @package FireflyIII\Http\Controllers+ * Class RuleGroupController.*/class RuleGroupController extends Controller{@@ -51,7 +48,6 @@ class RuleGroupController extends Controller{parent::__construct();-$this->middleware(function ($request, $next) {View::share('title', trans('firefly.rules'));@@ -71,7 +67,7 @@ class RuleGroupController extends Controller$subTitle = trans('firefly.make_new_rule_group');// put previous url in session if not redirect from store (not "create another").- if (session('rule-groups.create.fromStore') !== true) {+ if (true !== session('rule-groups.create.fromStore')) {$this->rememberPreviousUri('rule-groups.create.uri');}Session::forget('rule-groups.create.fromStore');@@ -116,7 +112,6 @@ class RuleGroupController extends Controller$repository->destroy($ruleGroup, $moveTo);-Session::flash('success', strval(trans('firefly.deleted_rule_group', ['title' => $title])));Preferences::mark();@@ -146,7 +141,7 @@ class RuleGroupController extends Controller$subTitle = trans('firefly.edit_rule_group', ['title' => $ruleGroup->title]);// put previous url in session if not redirect from store (not "return_to_edit").- if (session('rule-groups.edit.fromUpdate') !== true) {+ if (true !== session('rule-groups.edit.fromUpdate')) {$this->rememberPreviousUri('rule-groups.edit.uri');}Session::forget('rule-groups.edit.fromUpdate');@@ -157,7 +152,7 @@ class RuleGroupController extends Controller}/**- * Execute the given rulegroup on a set of existing transactions+ * Execute the given rulegroup on a set of existing transactions.** @param SelectTransactionsRequest $request* @param AccountRepositoryInterface $repository@@ -223,7 +218,7 @@ class RuleGroupController extends ControllerSession::flash('success', strval(trans('firefly.created_new_rule_group', ['title' => $ruleGroup->title])));Preferences::mark();- if (intval($request->get('create_another')) === 1) {+ if (1 === intval($request->get('create_another'))) {// @codeCoverageIgnoreStartSession::put('rule-groups.create.fromStore', true);@@ -259,7 +254,7 @@ class RuleGroupController extends Controller$data = ['title' => $request->input('title'),'description' => $request->input('description'),- 'active' => intval($request->input('active')) === 1,+ 'active' => 1 === intval($request->input('active')),];$repository->update($ruleGroup, $data);@@ -267,7 +262,7 @@ class RuleGroupController extends ControllerSession::flash('success', strval(trans('firefly.updated_rule_group', ['title' => $ruleGroup->title])));Preferences::mark();- if (intval($request->get('return_to_edit')) === 1) {+ if (1 === intval($request->get('return_to_edit'))) {// @codeCoverageIgnoreStartSession::put('rule-groups.edit.fromUpdate', true);diff --git a/app/Http/Controllers/SearchController.php b/app/Http/Controllers/SearchController.phpindex f6c1d62ba6..48cf6e9159 100644--- a/app/Http/Controllers/SearchController.php+++ b/app/Http/Controllers/SearchController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers;@@ -30,9 +29,7 @@ use Response;use View;/**- * Class SearchController- *- * @package FireflyIII\Http\Controllers+ * Class SearchController.*/class SearchController extends Controller{diff --git a/app/Http/Controllers/TagController.php b/app/Http/Controllers/TagController.phpindex c3f7a310cb..550b67574d 100644--- a/app/Http/Controllers/TagController.php+++ b/app/Http/Controllers/TagController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers;@@ -38,7 +37,7 @@ use Session;use View;/**- * Class TagController+ * Class TagController.** Remember: a balancingAct takes at most one expense and one transfer.* an advancePayment takes at most one expense, infinite deposits and NO transfers.@@ -47,13 +46,10 @@ use View;* Other attempts to put in such a tag are blocked.* also show an error when editing a tag and it becomes either* of these two types. Or rather, block editing of the tag.- *- * @package FireflyIII\Http\Controllers*/class TagController extends Controller{-- /** @var TagRepositoryInterface */+ /** @var TagRepositoryInterface */protected $repository;/**@@ -88,7 +84,7 @@ class TagController extends Controller$apiKey = env('GOOGLE_MAPS_API_KEY', '');// put previous url in session if not redirect from store (not "create another").- if (session('tags.create.fromStore') !== true) {+ if (true !== session('tags.create.fromStore')) {$this->rememberPreviousUri('tags.create.uri');}Session::forget('tags.create.fromStore');@@ -99,7 +95,7 @@ class TagController extends Controller}/**- * Delete a tag+ * Delete a tag.** @param Tag $tag*@@ -134,7 +130,7 @@ class TagController extends Controller}/**- * Edit a tag+ * Edit a tag.** @param Tag $tag*@@ -147,7 +143,7 @@ class TagController extends Controller$apiKey = env('GOOGLE_MAPS_API_KEY', '');// put previous url in session if not redirect from store (not "return_to_edit").- if (session('tags.edit.fromUpdate') !== true) {+ if (true !== session('tags.edit.fromUpdate')) {$this->rememberPreviousUri('tags.edit.uri');}Session::forget('tags.edit.fromUpdate');@@ -158,7 +154,7 @@ class TagController extends Controller}/**- * View all tags+ * View all tags.** @param TagRepositoryInterface $repository*@@ -170,13 +166,13 @@ class TagController extends Controller$oldestTag = $repository->oldestTag();/** @var Carbon $start */$start = new Carbon;- if (!is_null($oldestTag)) {+ if (null !== $oldestTag) {/** @var Carbon $start */$start = $oldestTag->date;}- if (is_null($oldestTag)) {+ if (null === $oldestTag) {/** @var Carbon $start */- $start = clone(session('first'));+ $start = clone session('first');}$now = new Carbon;@@ -216,7 +212,7 @@ class TagController extends Controller$path = route('tags.show', [$tag->id]);// prep for "all" view.- if ($moment === 'all') {+ if ('all' === $moment) {$subTitle = trans('firefly.all_journals_for_tag', ['tag' => $tag->tag]);$start = $repository->firstUseDate($tag);$end = new Carbon;@@ -224,20 +220,20 @@ class TagController extends Controller}// prep for "specific date" view.- if (strlen($moment) > 0 && $moment !== 'all') {+ if (strlen($moment) > 0 && 'all' !== $moment) {$start = new Carbon($moment);$end = Navigation::endOfPeriod($start, $range);$subTitle = trans('firefly.journals_in_period_for_tag',['tag' => $tag->tag,- 'start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]+ 'start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat),]);$periods = $this->getPeriodOverview($tag);$path = route('tags.show', [$tag->id, $moment]);}// prep for current period- if (strlen($moment) === 0) {+ if (0 === strlen($moment)) {/** @var Carbon $start */$start = clone session('start', Navigation::startOfPeriod(new Carbon, $range));/** @var Carbon $end */@@ -274,7 +270,7 @@ class TagController extends ControllerSession::flash('success', strval(trans('firefly.created_tag', ['tag' => $data['tag']])));Preferences::mark();- if (intval($request->get('create_another')) === 1) {+ if (1 === intval($request->get('create_another'))) {// @codeCoverageIgnoreStartSession::put('tags.create.fromStore', true);@@ -299,7 +295,7 @@ class TagController extends ControllerSession::flash('success', strval(trans('firefly.updated_tag', ['tag' => $data['tag']])));Preferences::mark();- if (intval($request->get('return_to_edit')) === 1) {+ if (1 === intval($request->get('return_to_edit'))) {// @codeCoverageIgnoreStartSession::put('tags.edit.fromUpdate', true);diff --git a/app/Http/Controllers/Transaction/ConvertController.php b/app/Http/Controllers/Transaction/ConvertController.phpindex aea7f98d97..c6c2b62b1f 100644--- a/app/Http/Controllers/Transaction/ConvertController.php+++ b/app/Http/Controllers/Transaction/ConvertController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers\Transaction;@@ -37,13 +36,11 @@ use Session;use View;/**- * Class ConvertController- *- * @package FireflyIII\Http\Controllers\Transaction+ * Class ConvertController.*/class ConvertController extends Controller{- /** @var AccountRepositoryInterface */+ /** @var AccountRepositoryInterface */private $accounts;/**@@ -117,11 +114,9 @@ class ConvertController extends Controller'sourceType','subTitle','subTitleIcon'-));-// convert withdrawal to deposit requires a new source account ()// or to transfer requires}@@ -178,6 +173,7 @@ class ConvertController extends Controller* @param array $data** @return Account+ ** @throws FireflyException*/private function getDestinationAccount(TransactionJournal $journal, TransactionType $destinationType, array $data): Account@@ -202,7 +198,7 @@ class ConvertController extends Controllercase TransactionType::DEPOSIT . '-' . TransactionType::WITHDRAWAL:case TransactionType::TRANSFER . '-' . TransactionType::WITHDRAWAL:// three and five- if ($data['destination_account_expense'] === '' || is_null($data['destination_account_expense'])) {+ if ('' === $data['destination_account_expense'] || null === $data['destination_account_expense']) {// destination is a cash account.$destination = $accountRepository->getCashAccount();@@ -233,6 +229,7 @@ class ConvertController extends Controller* @param array $data** @return Account+ ** @throws FireflyException*/private function getSourceAccount(TransactionJournal $journal, TransactionType $destinationType, array $data): Account@@ -249,7 +246,7 @@ class ConvertController extends Controllercase TransactionType::WITHDRAWAL . '-' . TransactionType::DEPOSIT:case TransactionType::TRANSFER . '-' . TransactionType::DEPOSIT:- if ($data['source_account_revenue'] === '' || is_null($data['source_account_revenue'])) {+ if ('' === $data['source_account_revenue'] || null === $data['source_account_revenue']) {// destination is a cash account.$destination = $accountRepository->getCashAccount();diff --git a/app/Http/Controllers/Transaction/LinkController.php b/app/Http/Controllers/Transaction/LinkController.phpindex 42cc68786b..ca4f85e350 100644--- a/app/Http/Controllers/Transaction/LinkController.php+++ b/app/Http/Controllers/Transaction/LinkController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers\Transaction;@@ -36,14 +35,10 @@ use URL;use View;/**- * Class LinkController- *- * @package FireflyIII\Http\Controllers\Transaction+ * Class LinkController.*/class LinkController extends Controller{--/****/@@ -61,7 +56,6 @@ class LinkController extends Controller);}-/*** @param TransactionJournalLink $link*@@ -107,7 +101,7 @@ class LinkController extends ControllerTransactionJournal $journal) {$linkInfo = $request->getLinkInfo();- if ($linkInfo['transaction_journal_id'] === 0) {+ if (0 === $linkInfo['transaction_journal_id']) {Session::flash('error', trans('firefly.invalid_link_selection'));return redirect(route('transactions.show', [$journal->id]));@@ -124,13 +118,13 @@ class LinkController extends Controller$journalLink = new TransactionJournalLink;$journalLink->linkType()->associate($linkType);- if ($linkInfo['direction'] === 'inward') {+ if ('inward' === $linkInfo['direction']) {Log::debug(sprintf('Link type is inwards ("%s"), so %d is source and %d is destination.', $linkType->inward, $other->id, $journal->id));$journalLink->source()->associate($other);$journalLink->destination()->associate($journal);}- if ($linkInfo['direction'] === 'outward') {+ if ('outward' === $linkInfo['direction']) {Log::debug(sprintf('Link type is inwards ("%s"), so %d is source and %d is destination.', $linkType->outward, $journal->id, $other->id));$journalLink->source()->associate($journal);$journalLink->destination()->associate($other);diff --git a/app/Http/Controllers/Transaction/MassController.php b/app/Http/Controllers/Transaction/MassController.phpindex 1add0b245e..d7dc44935b 100644--- a/app/Http/Controllers/Transaction/MassController.php+++ b/app/Http/Controllers/Transaction/MassController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers\Transaction;@@ -39,9 +38,7 @@ use Session;use View;/**- * Class MassController- *- * @package FireflyIII\Http\Controllers\Transaction+ * Class MassController.*/class MassController extends Controller{@@ -52,7 +49,6 @@ class MassController extends Controller{parent::__construct();-$this->middleware(function ($request, $next) {View::share('title', trans('firefly.transactions'));@@ -95,7 +91,7 @@ class MassController extends Controllerforeach ($ids as $journalId) {/** @var TransactionJournal $journal */$journal = $repository->find(intval($journalId));- if (!is_null($journal->id) && intval($journalId) === $journal->id) {+ if (null !== $journal->id && intval($journalId) === $journal->id) {$set->push($journal);}}@@ -106,7 +102,7 @@ class MassController extends Controller/** @var TransactionJournal $journal */foreach ($set as $journal) {$repository->delete($journal);- $count++;+ ++$count;}Preferences::mark();@@ -116,7 +112,6 @@ class MassController extends Controllerreturn redirect($this->getPreviousUri('transactions.mass-delete.uri'));}-/*** @param Collection $journals*@@ -139,7 +134,7 @@ class MassController extends Controller$filtered = new Collection;$messages = [];/**- * @var TransactionJournal $journal+ * @var TransactionJournal*/foreach ($journals as $journal) {$sources = $journal->sourceAccountList();@@ -153,7 +148,7 @@ class MassController extends Controller$messages[] = trans('firefly.cannot_edit_multiple_dest', ['description' => $journal->description, 'id' => $journal->id]);continue;}- if ($journal->transactionType->type === TransactionType::OPENING_BALANCE) {+ if (TransactionType::OPENING_BALANCE === $journal->transactionType->type) {$messages[] = trans('firefly.cannot_edit_opening_balance');continue;}@@ -191,18 +186,18 @@ class MassController extends Controller$journal->foreign_amount = floatval($transaction->foreign_amount);$journal->foreign_currency = $transaction->foreignCurrency;- if (!is_null($sources->first())) {+ if (null !== $sources->first()) {$journal->source_account_id = $sources->first()->id;$journal->source_account_name = $sources->first()->editname;}- if (!is_null($destinations->first())) {+ if (null !== $destinations->first()) {$journal->destination_account_id = $destinations->first()->id;$journal->destination_account_name = $destinations->first()->editname;}});- if ($filtered->count() === 0) {+ if (0 === $filtered->count()) {Session::flash('error', trans('firefly.no_edit_multiple_left'));}@@ -265,7 +260,7 @@ class MassController extends Controller// call repository update function.$repository->update($journal, $data);- $count++;+ ++$count;}}}diff --git a/app/Http/Controllers/Transaction/SingleController.php b/app/Http/Controllers/Transaction/SingleController.phpindex ba260c7e1c..7d6f23f26c 100644--- a/app/Http/Controllers/Transaction/SingleController.php+++ b/app/Http/Controllers/Transaction/SingleController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers\Transaction;@@ -48,26 +47,24 @@ use Steam;use View;/**- * Class SingleController- *- * @package FireflyIII\Http\Controllers\Transaction+ * Class SingleController.*/class SingleController extends Controller{- /** @var AccountRepositoryInterface */+ /** @var AccountRepositoryInterface */private $accounts;/** @var AttachmentHelperInterface */private $attachments;- /** @var BudgetRepositoryInterface */+ /** @var BudgetRepositoryInterface */private $budgets;- /** @var CurrencyRepositoryInterface */+ /** @var CurrencyRepositoryInterface */private $currency;- /** @var PiggyBankRepositoryInterface */+ /** @var PiggyBankRepositoryInterface */private $piggyBanks;- /** @var JournalRepositoryInterface */+ /** @var JournalRepositoryInterface */private $repository;/**@@ -105,14 +102,14 @@ class SingleController extends Controller$source = $journal->sourceAccountList()->first();$destination = $journal->destinationAccountList()->first();$budget = $journal->budgets()->first();- $budgetId = is_null($budget) ? 0 : $budget->id;+ $budgetId = null === $budget ? 0 : $budget->id;$category = $journal->categories()->first();- $categoryName = is_null($category) ? '' : $category->name;+ $categoryName = null === $category ? '' : $category->name;$tags = join(',', $journal->tags()->get()->pluck('tag')->toArray());/** @var Transaction $transaction */$transaction = $journal->transactions()->first();$amount = Steam::positive($transaction->amount);- $foreignAmount = is_null($transaction->foreign_amount) ? null : Steam::positive($transaction->foreign_amount);+ $foreignAmount = null === $transaction->foreign_amount ? null : Steam::positive($transaction->foreign_amount);$preFilled = ['description' => $journal->description,@@ -142,7 +139,7 @@ class SingleController extends Controller/** @var Note $note */$note = $journal->notes()->first();- if (!is_null($note)) {+ if (null !== $note) {$preFilled['notes'] = $note->text;}@@ -172,7 +169,7 @@ class SingleController extends ControllerSession::put('preFilled', $preFilled);// put previous url in session if not redirect from store (not "create another").- if (session('transactions.create.fromStore') !== true) {+ if (true !== session('transactions.create.fromStore')) {$this->rememberPreviousUri('transactions.create.uri');}Session::forget('transactions.create.fromStore');@@ -218,6 +215,7 @@ class SingleController extends Controller* @param TransactionJournal $transactionJournal** @return \Illuminate\Http\RedirectResponse+ ** @internal param JournalRepositoryInterface $repository*/public function destroy(TransactionJournal $transactionJournal)@@ -265,7 +263,7 @@ class SingleController extends Controller$destinationAccounts = $journal->destinationAccountList();$optionalFields = Preferences::get('transaction_journal_optional_fields', [])->data;$pTransaction = $journal->positiveTransaction();- $foreignCurrency = !is_null($pTransaction->foreignCurrency) ? $pTransaction->foreignCurrency : $pTransaction->transactionCurrency;+ $foreignCurrency = null !== $pTransaction->foreignCurrency ? $pTransaction->foreignCurrency : $pTransaction->transactionCurrency;$preFilled = ['date' => $journal->dateAsString(),'interest_date' => $journal->dateAsString('interest_date'),@@ -299,13 +297,13 @@ class SingleController extends Controller];/** @var Note $note */$note = $journal->notes()->first();- if (!is_null($note)) {+ if (null !== $note) {$preFilled['notes'] = $note->text;}// amounts for withdrawals and deposits:// amount, native_amount, source_amount, destination_amount- if (($journal->isWithdrawal() || $journal->isDeposit()) && !is_null($pTransaction->foreign_amount)) {+ if (($journal->isWithdrawal() || $journal->isDeposit()) && null !== $pTransaction->foreign_amount) {$preFilled['amount'] = $pTransaction->foreign_amount;$preFilled['currency'] = $pTransaction->foreignCurrency;}@@ -315,7 +313,7 @@ class SingleController extends ControllerSession::flash('gaEventAction', 'edit-' . $what);// put previous url in session if not redirect from store (not "return_to_edit").- if (session('transactions.edit.fromUpdate') !== true) {+ if (true !== session('transactions.edit.fromUpdate')) {$this->rememberPreviousUri('transactions.edit.uri');}Session::forget('transactions.edit.fromUpdate');@@ -334,11 +332,11 @@ class SingleController extends Controller*/public function store(JournalFormRequest $request, JournalRepositoryInterface $repository){- $doSplit = intval($request->get('split_journal')) === 1;- $createAnother = intval($request->get('create_another')) === 1;+ $doSplit = 1 === intval($request->get('split_journal'));+ $createAnother = 1 === intval($request->get('create_another'));$data = $request->getJournalData();$journal = $repository->store($data);- if (is_null($journal->id)) {+ if (null === $journal->id) {// error!Log::error('Could not store transaction journal: ', $journal->getErrors()->toArray());Session::flash('error', $journal->getErrors()->first());@@ -366,13 +364,13 @@ class SingleController extends ControllerPreferences::mark();// @codeCoverageIgnoreStart- if ($createAnother === true) {+ if (true === $createAnother) {Session::put('transactions.create.fromStore', true);return redirect(route('transactions.create', [$request->input('what')]))->withInput();}- if ($doSplit === true) {+ if (true === $doSplit) {return redirect(route('transactions.split.edit', [$journal->id]));}@@ -419,7 +417,7 @@ class SingleController extends ControllerPreferences::mark();// @codeCoverageIgnoreStart- if (intval($request->get('return_to_edit')) === 1) {+ if (1 === intval($request->get('return_to_edit'))) {Session::put('transactions.edit.fromUpdate', true);return redirect(route('transactions.edit', [$journal->id]))->withInput(['return_to_edit' => 1]);@@ -440,7 +438,7 @@ class SingleController extends Controller/** @var Account $account */foreach ($accounts as $account) {$type = $account->getMeta('accountRole');- if (strlen($type) === 0) {+ if (0 === strlen($type)) {$type = 'no_account_type';}$key = strval(trans('firefly.opt_group_' . $type));@@ -460,7 +458,7 @@ class SingleController extends Controller/** @var Account $account */foreach ($accounts as $account) {$type = $account->getMeta('accountRole');- if (strlen($type) === 0) {+ if (0 === strlen($type)) {$type = 'no_account_type';}$key = strval(trans('firefly.opt_group_' . $type));diff --git a/app/Http/Controllers/Transaction/SplitController.php b/app/Http/Controllers/Transaction/SplitController.phpindex 1a0e994b9c..a5fe0a63ef 100644--- a/app/Http/Controllers/Transaction/SplitController.php+++ b/app/Http/Controllers/Transaction/SplitController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers\Transaction;@@ -45,21 +44,17 @@ use Steam;use View;/**- * Class SplitController- *- * @package FireflyIII\Http\Controllers\Transaction- *+ * Class SplitController.*/class SplitController extends Controller{-- /** @var AccountRepositoryInterface */+ /** @var AccountRepositoryInterface */private $accounts;/** @var AttachmentHelperInterface */private $attachments;- /** @var BudgetRepositoryInterface */+ /** @var BudgetRepositoryInterface */private $budgets;/** @var CurrencyRepositoryInterface */@@ -75,7 +70,6 @@ class SplitController extends Controller{parent::__construct();-// some useful repositories:$this->middleware(function ($request, $next) {@@ -122,12 +116,11 @@ class SplitController extends Controller$accountArray[$account->id]['currency_id'] = intval($account->getMeta('currency_id'));}-Session::flash('gaEventCategory', 'transactions');Session::flash('gaEventAction', 'edit-split-' . $preFilled['what']);// put previous url in session if not redirect from store (not "return_to_edit").- if (session('transactions.edit-split.fromUpdate') !== true) {+ if (true !== session('transactions.edit-split.fromUpdate')) {$this->rememberPreviousUri('transactions.edit-split.uri');}Session::forget('transactions.edit-split.fromUpdate');@@ -150,7 +143,6 @@ class SplitController extends Controller);}-/*** @param SplitJournalFormRequest $request* @param JournalRepositoryInterface $repository@@ -183,7 +175,7 @@ class SplitController extends ControllerPreferences::mark();// @codeCoverageIgnoreStart- if (intval($request->get('return_to_edit')) === 1) {+ if (1 === intval($request->get('return_to_edit'))) {// set value so edit routine will not overwrite URL:Session::put('transactions.edit-split.fromUpdate', true);@@ -202,7 +194,7 @@ class SplitController extends Controller*/private function arrayFromInput(SplitJournalFormRequest $request): array{- $tags = is_null($request->get('tags')) ? '' : $request->get('tags');+ $tags = null === $request->get('tags') ? '' : $request->get('tags');$array = ['journal_description' => $request->get('journal_description'),'journal_source_account_id' => $request->get('journal_source_account_id'),@@ -225,7 +217,6 @@ class SplitController extends Controller'transactions' => $this->getTransactionDataFromRequest($request),];-return $array;}@@ -242,7 +233,7 @@ class SplitController extends Controller$notes = '';/** @var Note $note */$note = $journal->notes()->first();- if (!is_null($note)) {+ if (null !== $note) {$notes = $note->text;}$array = [@@ -303,11 +294,10 @@ class SplitController extends Controller'foreign_currency_id' => $transaction['foreign_currency_id'],'foreign_currency_code' => $transaction['foreign_currency_code'],'foreign_currency_symbol' => $transaction['foreign_currency_symbol'],-];// set initial category and/or budget:- if (count($transactions) === 1 && $index === 0) {+ if (1 === count($transactions) && 0 === $index) {$set['budget_id'] = $journal->budgetId();$set['category'] = $journal->categoryAsString();}@@ -340,7 +330,6 @@ class SplitController extends Controller'category' => $transaction['category'] ?? '','transaction_currency_id' => intval($transaction['transaction_currency_id']),'foreign_currency_id' => $transaction['foreign_currency_id'] ?? null,-];}Log::debug(sprintf('Found %d splits in request data.', count($return)));@@ -356,7 +345,7 @@ class SplitController extends Controller*/private function updateWithPrevious($array, $old): array{- if (count($old) === 0 || !isset($old['transactions'])) {+ if (0 === count($old) || !isset($old['transactions'])) {return $array;}$old = $old['transactions'];diff --git a/app/Http/Controllers/TransactionController.php b/app/Http/Controllers/TransactionController.phpindex 9e64cb5c10..ed2cf98897 100644--- a/app/Http/Controllers/TransactionController.php+++ b/app/Http/Controllers/TransactionController.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Controllers;@@ -42,9 +41,7 @@ use Response;use View;/**- * Class TransactionController- *- * @package FireflyIII\Http\Controllers+ * Class TransactionController.*/class TransactionController extends Controller{@@ -55,7 +52,6 @@ class TransactionController extends Controller{parent::__construct();-$this->middleware(function ($request, $next) {View::share('title', trans('firefly.transactions'));@@ -70,7 +66,6 @@ class TransactionController extends Controller* @param Request $request* @param JournalRepositoryInterface $repository* @param string $what- ** @param string $moment** @return View@@ -89,7 +84,7 @@ class TransactionController extends Controller$path = route('transactions.index', [$what]);// prep for "all" view.- if ($moment === 'all') {+ if ('all' === $moment) {$subTitle = trans('firefly.all_' . $what);$first = $repository->first();$start = $first->date ?? new Carbon;@@ -98,7 +93,7 @@ class TransactionController extends Controller}// prep for "specific date" view.- if (strlen($moment) > 0 && $moment !== 'all') {+ if (strlen($moment) > 0 && 'all' !== $moment) {$start = new Carbon($moment);$end = Navigation::endOfPeriod($start, $range);$path = route('transactions.index', [$what, $moment]);@@ -110,7 +105,7 @@ class TransactionController extends Controller}// prep for current period- if (strlen($moment) === 0) {+ if (0 === strlen($moment)) {$start = clone session('start', Navigation::startOfPeriod(new Carbon, $range));$end = clone session('end', Navigation::endOfPeriod(new Carbon, $range));$periods = $this->getPeriodOverview($what);@@ -127,7 +122,6 @@ class TransactionController extends Controller$transactions = $collector->getPaginatedJournals();$transactions->setPath($path);-return view('transactions.index', compact('subTitle', 'what', 'subTitleIcon', 'transactions', 'periods', 'start', 'end', 'moment'));}@@ -163,7 +157,7 @@ class TransactionController extends Controller$journal = $repository->find(intval($id));if ($journal && $journal->date->isSameDay($date)) {$repository->setOrder($journal, $order);- $order++;+ ++$order;}}}@@ -175,7 +169,6 @@ class TransactionController extends Controller/*** @param TransactionJournal $journal* @param JournalTaskerInterface $tasker- ** @param LinkTypeRepositoryInterface $linkTypeRepository** @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View@@ -199,6 +192,7 @@ class TransactionController extends Controller* @param string $what** @return Collection+ ** @throws FireflyException*/private function getPeriodOverview(string $what): Collection@@ -290,7 +284,7 @@ class TransactionController extends Controller}// save amount:$return[$currencyId]['sum'] = bcadd($return[$currencyId]['sum'], $transaction->transaction_amount);- $return[$currencyId]['count']++;+ ++$return[$currencyId]['count'];}asort($return);diff --git a/app/Http/Kernel.php b/app/Http/Kernel.phpindex 8f2808c3d8..d1e66021d3 100644--- a/app/Http/Kernel.php+++ b/app/Http/Kernel.php@@ -18,10 +18,8 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);-/*** Kernel.php* Copyright (c) 2017 [email protected]@@ -95,7 +93,6 @@ class Kernel extends HttpKernelSubstituteBindings::class,],-// MUST NOT be logged in. Does not care about 2FA or confirmation.'user-not-logged-in' => [Sandstorm::class,@@ -173,14 +170,12 @@ class Kernel extends HttpKernelBinder::class,],-'api' => ['throttle:60,1','bindings',],];-/*** The application's route middleware.*diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.phpindex 015770f866..bd07886e0a 100644--- a/app/Http/Middleware/Authenticate.php+++ b/app/Http/Middleware/Authenticate.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Middleware;@@ -29,18 +28,16 @@ use Illuminate\Support\Facades\Auth;use Session;/**- * Class Authenticate- *- * @package FireflyIII\Http\Middleware+ * Class Authenticate.*/class Authenticate{/*** Handle an incoming request.*- * @param \Illuminate\Http\Request $request- * @param \Closure $next- * @param string|null $guard+ * @param \Illuminate\Http\Request $request+ * @param \Closure $next+ * @param string|null $guard** @return mixed*/@@ -53,9 +50,9 @@ class Authenticatereturn redirect()->guest('login');}- if (intval(auth()->user()->blocked) === 1) {+ if (1 === intval(auth()->user()->blocked)) {$message = strval(trans('firefly.block_account_logout'));- if (auth()->user()->blocked_code === 'email_changed') {+ if ('email_changed' === auth()->user()->blocked_code) {$message = strval(trans('firefly.email_changed_logout'));}diff --git a/app/Http/Middleware/AuthenticateTwoFactor.php b/app/Http/Middleware/AuthenticateTwoFactor.phpindex 57aba99e62..970e834cbc 100644--- a/app/Http/Middleware/AuthenticateTwoFactor.php+++ b/app/Http/Middleware/AuthenticateTwoFactor.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Middleware;@@ -32,24 +31,21 @@ use Preferences;use Session;/**- * Class AuthenticateTwoFactor- *- * @package FireflyIII\Http\Middleware+ * Class AuthenticateTwoFactor.*/class AuthenticateTwoFactor{/*** Handle an incoming request.*- * @param \Illuminate\Http\Request $request- * @param \Closure $next- * @param string|null $guard+ * @param \Illuminate\Http\Request $request+ * @param \Closure $next+ * @param string|null $guard** @return mixed*/public function handle(Request $request, Closure $next, $guard = null){-// do the usual auth, again:if (Auth::guard($guard)->guest()) {if ($request->ajax()) {@@ -59,17 +55,17 @@ class AuthenticateTwoFactorreturn redirect()->guest('login');}- if (intval(auth()->user()->blocked) === 1) {+ if (1 === intval(auth()->user()->blocked)) {Auth::guard($guard)->logout();Session::flash('logoutMessage', trans('firefly.block_account_logout'));return redirect()->guest('login');}$is2faEnabled = Preferences::get('twoFactorAuthEnabled', false)->data;- $has2faSecret = !is_null(Preferences::get('twoFactorAuthSecret'));+ $has2faSecret = null !== Preferences::get('twoFactorAuthSecret');// grab 2auth information from cookie, not from session.- $is2faAuthed = Cookie::get('twoFactorAuthenticated') === 'true';+ $is2faAuthed = 'true' === Cookie::get('twoFactorAuthenticated');if ($is2faEnabled && $has2faSecret && !$is2faAuthed) {Log::debug('Does not seem to be 2 factor authed, redirect.');diff --git a/app/Http/Middleware/Binder.php b/app/Http/Middleware/Binder.phpindex 35b14b4fe1..056fff3f9a 100644--- a/app/Http/Middleware/Binder.php+++ b/app/Http/Middleware/Binder.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Middleware;@@ -28,9 +27,7 @@ use FireflyIII\Support\Domain;use Illuminate\Http\Request;/**- * Class Binder- *- * @package FireflyIII\Http\Middleware+ * Class Binder.*/class Binder{@@ -47,8 +44,8 @@ class Binder/*** Handle an incoming request.*- * @param \Illuminate\Http\Request $request- * @param \Closure $next+ * @param \Illuminate\Http\Request $request+ * @param \Closure $next** @return mixed*/diff --git a/app/Http/Middleware/EncryptCookies.php b/app/Http/Middleware/EncryptCookies.phpindex 168e27c01b..ef7bcceca5 100644--- a/app/Http/Middleware/EncryptCookies.php+++ b/app/Http/Middleware/EncryptCookies.php@@ -18,10 +18,8 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);-/*** EncryptCookies.php* Copyright (c) 2017 [email protected]@@ -44,6 +42,5 @@ class EncryptCookies extends Middleware*/protected $except= [- //];}diff --git a/app/Http/Middleware/IsAdmin.php b/app/Http/Middleware/IsAdmin.phpindex 887ecd0713..3fb6dbdd8e 100644--- a/app/Http/Middleware/IsAdmin.php+++ b/app/Http/Middleware/IsAdmin.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Middleware;@@ -29,18 +28,16 @@ use Illuminate\Http\Request;use Illuminate\Support\Facades\Auth;/**- * Class IsAdmin- *- * @package FireflyIII\Http\Middleware+ * Class IsAdmin.*/class IsAdmin{/*** Handle an incoming request. Must be admin.*- * @param \Illuminate\Http\Request $request- * @param \Closure $next- * @param string|null $guard+ * @param \Illuminate\Http\Request $request+ * @param \Closure $next+ * @param string|null $guard** @return mixed*/diff --git a/app/Http/Middleware/IsLimitedUser.php b/app/Http/Middleware/IsLimitedUser.phpindex ba998b8e20..01fc8163ea 100644--- a/app/Http/Middleware/IsLimitedUser.php+++ b/app/Http/Middleware/IsLimitedUser.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Middleware;@@ -30,18 +29,16 @@ use Illuminate\Support\Facades\Auth;use Session;/**- * Class IsAdmin- *- * @package FireflyIII\Http\Middleware+ * Class IsAdmin.*/class IsLimitedUser{/*** Handle an incoming request. May not be a limited user (ie. Sandstorm env. or demo user).*- * @param \Illuminate\Http\Request $request- * @param \Closure $next- * @param string|null $guard+ * @param \Illuminate\Http\Request $request+ * @param \Closure $next+ * @param string|null $guard** @return mixed*/@@ -62,7 +59,7 @@ class IsLimitedUserreturn redirect(route('index'));}- if (intval(getenv('SANDSTORM')) === 1) {+ if (1 === intval(getenv('SANDSTORM'))) {Session::flash('warning', strval(trans('firefly.sandstorm_not_available')));return redirect(route('index'));diff --git a/app/Http/Middleware/Range.php b/app/Http/Middleware/Range.phpindex 6e55ff3c56..8f5a9badcc 100644--- a/app/Http/Middleware/Range.php+++ b/app/Http/Middleware/Range.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Middleware;@@ -36,9 +35,7 @@ use Session;use View;/**- * Class SessionFilter- *- * @package FireflyIII\Http\Middleware+ * Class SessionFilter.*/class Range{@@ -52,8 +49,7 @@ class Range/*** Create a new filter instance.*- * @param Guard $auth- *+ * @param Guard $auth*/public function __construct(Guard $auth){@@ -63,16 +59,15 @@ class Range/*** Handle an incoming request.*- * @param \Illuminate\Http\Request $request- * @param Closure $next- * @param string|null $guard+ * @param \Illuminate\Http\Request $request+ * @param Closure $next+ * @param string|null $guard** @return mixed*/public function handle(Request $request, Closure $next, $guard = null){if (!Auth::guard($guard)->guest()) {-// set start, end and finish:$this->setRange();@@ -108,11 +103,10 @@ class Range$moneyResult = setlocale(LC_MONETARY, $locale);// send error to view if could not set money format- if ($moneyResult === false) {+ if (false === $moneyResult) {View::share('invalidMonetaryLocale', true);}-// save some formats:$monthAndDayFormat = (string)trans('config.month_and_day');$dateTimeFormat = (string)trans('config.date_time');@@ -144,7 +138,7 @@ class Range$journal = $repository->first();$first = Carbon::now()->startOfYear();- if (!is_null($journal->id)) {+ if (null !== $journal->id) {$first = $journal->date;}Session::put('first', $first);diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.phpindex 1794d539c5..8b6e5232fb 100644--- a/app/Http/Middleware/RedirectIfAuthenticated.php+++ b/app/Http/Middleware/RedirectIfAuthenticated.php@@ -18,10 +18,8 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);-/*** RedirectIfAuthenticated.php* Copyright (c) 2017 [email protected]@@ -41,9 +39,9 @@ class RedirectIfAuthenticated/*** Handle an incoming request.*- * @param \Illuminate\Http\Request $request- * @param \Closure $next- * @param string|null $guard+ * @param \Illuminate\Http\Request $request+ * @param \Closure $next+ * @param string|null $guard** @return mixed*/diff --git a/app/Http/Middleware/RedirectIfTwoFactorAuthenticated.php b/app/Http/Middleware/RedirectIfTwoFactorAuthenticated.phpindex 31fc050329..1e63bb21da 100644--- a/app/Http/Middleware/RedirectIfTwoFactorAuthenticated.php+++ b/app/Http/Middleware/RedirectIfTwoFactorAuthenticated.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Middleware;@@ -29,18 +28,16 @@ use Illuminate\Support\Facades\Auth;use Preferences;/**- * Class RedirectIfTwoFactorAuthenticated- *- * @package FireflyIII\Http\Middleware+ * Class RedirectIfTwoFactorAuthenticated.*/class RedirectIfTwoFactorAuthenticated{/*** Handle an incoming request.*- * @param \Illuminate\Http\Request $request- * @param \Closure $next- * @param string|null $guard+ * @param \Illuminate\Http\Request $request+ * @param \Closure $next+ * @param string|null $guard** @return mixed*/@@ -48,10 +45,10 @@ class RedirectIfTwoFactorAuthenticated{if (Auth::guard($guard)->check()) {$is2faEnabled = Preferences::get('twoFactorAuthEnabled', false)->data;- $has2faSecret = !is_null(Preferences::get('twoFactorAuthSecret'));+ $has2faSecret = null !== Preferences::get('twoFactorAuthSecret');// grab 2auth information from cookie- $is2faAuthed = Cookie::get('twoFactorAuthenticated') === 'true';+ $is2faAuthed = 'true' === Cookie::get('twoFactorAuthenticated');if ($is2faEnabled && $has2faSecret && $is2faAuthed) {return redirect('/');diff --git a/app/Http/Middleware/Sandstorm.php b/app/Http/Middleware/Sandstorm.phpindex b714853bd4..83759a0c96 100644--- a/app/Http/Middleware/Sandstorm.php+++ b/app/Http/Middleware/Sandstorm.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Middleware;@@ -33,9 +32,7 @@ use Illuminate\Http\Request;use View;/**- * Class Sandstorm- *- * @package FireflyIII\Http\Middleware+ * Class Sandstorm.*/class Sandstorm{@@ -43,18 +40,19 @@ class Sandstorm* Detects if is using Sandstorm, and responds by logging the user* in and/or creating an account.*- * @param \Illuminate\Http\Request $request- * @param \Closure $next- * @param string|null $guard+ * @param \Illuminate\Http\Request $request+ * @param \Closure $next+ * @param string|null $guard** @return mixed+ ** @throws FireflyException* @SuppressWarnings(PHPMD.CyclomaticComplexity)*/public function handle(Request $request, Closure $next, $guard = null){// is in Sandstorm environment?- $sandstorm = intval(getenv('SANDSTORM')) === 1;+ $sandstorm = 1 === intval(getenv('SANDSTORM'));View::share('SANDSTORM', $sandstorm);if (!$sandstorm) {return $next($request);@@ -72,7 +70,7 @@ class Sandstorm// access the same data so we have no choice but to simply login// the new user to the same account and just forget about Bob and Alice// and any other differences there may be between these users.- if ($count === 1 && strlen($userId) > 0) {+ if (1 === $count && strlen($userId) > 0) {// login as first user user.$user = User::first();Auth::guard($guard)->login($user);@@ -81,7 +79,7 @@ class Sandstormreturn $next($request);}- if ($count === 1 && strlen($userId) === 0) {+ if (1 === $count && 0 === strlen($userId)) {// login but indicate anonymous$user = User::first();Auth::guard($guard)->login($user);@@ -90,7 +88,7 @@ class Sandstormreturn $next($request);}- if ($count === 0 && strlen($userId) > 0) {+ if (0 === $count && strlen($userId) > 0) {// create new user.$email = $userId . '@firefly';/** @var User $user */@@ -110,7 +108,7 @@ class Sandstormreturn $next($request);}- if ($count === 0 && strlen($userId) === 0) {+ if (0 === $count && 0 === strlen($userId)) {throw new FireflyException('The first visit to a new Firefly III administration cannot be by a guest user.');}diff --git a/app/Http/Middleware/StartFireflySession.php b/app/Http/Middleware/StartFireflySession.phpindex a4e8604482..2653c10f0f 100644--- a/app/Http/Middleware/StartFireflySession.php+++ b/app/Http/Middleware/StartFireflySession.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Middleware;@@ -28,17 +27,15 @@ use Illuminate\Http\Request;use Illuminate\Session\Middleware\StartSession;/**- * Class StartFireflySession- *- * @package FireflyIII\Http\Middleware+ * Class StartFireflySession.*/class StartFireflySession extends StartSession{/*** Handle an incoming request.*- * @param \Illuminate\Http\Request $request- * @param Closure $next+ * @param \Illuminate\Http\Request $request+ * @param Closure $next** @return mixed*/@@ -50,16 +47,14 @@ class StartFireflySession extends StartSession/*** Store the current URL for the request if necessary.*- * @param \Illuminate\Http\Request $request- * @param \Illuminate\Contracts\Session\Session $session- *- * @return void+ * @param \Illuminate\Http\Request $request+ * @param \Illuminate\Contracts\Session\Session $session*/protected function storeCurrentUrl(Request $request, $session){$uri = $request->fullUrl();$strpos = strpos($uri, 'jscript');- if ($request->method() === 'GET' && $request->route() && !$request->ajax() && $strpos === false) {+ if ('GET' === $request->method() && $request->route() && !$request->ajax() && false === $strpos) {$session->setPreviousUrl($uri);}}diff --git a/app/Http/Middleware/TrimStrings.php b/app/Http/Middleware/TrimStrings.phpindex 7ad3a2e0fa..21d5495130 100644--- a/app/Http/Middleware/TrimStrings.php+++ b/app/Http/Middleware/TrimStrings.php@@ -18,10 +18,8 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);-/*** TrimStrings.php* Copyright (c) 2017 [email protected]diff --git a/app/Http/Middleware/TrustProxies.php b/app/Http/Middleware/TrustProxies.phpindex 878aa0ea98..68e8599322 100644--- a/app/Http/Middleware/TrustProxies.php+++ b/app/Http/Middleware/TrustProxies.php@@ -18,10 +18,8 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);-/*** TrustProxies.php* Copyright (c) 2017 [email protected]@@ -67,7 +65,7 @@ class TrustProxies extends Middlewarepublic function __construct(Repository $config){$trustedProxies = env('TRUSTED_PROXIES', null);- if (!is_null($trustedProxies) && strlen($trustedProxies) > 0) {+ if (null !== $trustedProxies && strlen($trustedProxies) > 0) {$this->proxies = $trustedProxies;}diff --git a/app/Http/Middleware/VerifyCsrfToken.php b/app/Http/Middleware/VerifyCsrfToken.phpindex 869a532515..838f340dcc 100644--- a/app/Http/Middleware/VerifyCsrfToken.php+++ b/app/Http/Middleware/VerifyCsrfToken.php@@ -18,10 +18,8 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);-/*** VerifyCsrfToken.php* Copyright (c) 2017 [email protected]@@ -44,6 +42,5 @@ class VerifyCsrfToken extends Middleware*/protected $except= [- //];}diff --git a/app/Http/Requests/AccountFormRequest.php b/app/Http/Requests/AccountFormRequest.phpindex 4f2b0d9f4d..eff6e1240f 100644--- a/app/Http/Requests/AccountFormRequest.php+++ b/app/Http/Requests/AccountFormRequest.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Requests;@@ -26,10 +25,7 @@ namespace FireflyIII\Http\Requests;use FireflyIII\Repositories\Account\AccountRepositoryInterface;/**- * Class AccountFormRequest- *- *- * @package FireflyIII\Http\Requests+ * Class AccountFormRequest.*/class AccountFormRequest extends Request{@@ -77,7 +73,7 @@ class AccountFormRequest extends Request$nameRule = 'required|min:1|uniqueAccountForUser';$idRule = '';- if (!is_null($repository->find(intval($this->get('id')))->id)) {+ if (null !== $repository->find(intval($this->get('id')))->id) {$idRule = 'belongsToUser:accounts';$nameRule = 'required|min:1|uniqueAccountForUser:' . intval($this->get('id'));}diff --git a/app/Http/Requests/AttachmentFormRequest.php b/app/Http/Requests/AttachmentFormRequest.phpindex 6acf0ad729..7797903735 100644--- a/app/Http/Requests/AttachmentFormRequest.php+++ b/app/Http/Requests/AttachmentFormRequest.php@@ -18,16 +18,12 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Requests;/**- * Class AttachmentFormRequest- *- *- * @package FireflyIII\Http\Requests+ * Class AttachmentFormRequest.*/class AttachmentFormRequest extends Request{diff --git a/app/Http/Requests/BillFormRequest.php b/app/Http/Requests/BillFormRequest.phpindex 5cddd73f60..c7d416064e 100644--- a/app/Http/Requests/BillFormRequest.php+++ b/app/Http/Requests/BillFormRequest.php@@ -18,16 +18,12 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Requests;/**- * Class BillFormRequest- *- *- * @package FireflyIII\Http\Requests+ * Class BillFormRequest.*/class BillFormRequest extends Request{diff --git a/app/Http/Requests/BudgetFormRequest.php b/app/Http/Requests/BudgetFormRequest.phpindex 428a766ed9..a7f8266aac 100644--- a/app/Http/Requests/BudgetFormRequest.php+++ b/app/Http/Requests/BudgetFormRequest.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Requests;@@ -26,10 +25,7 @@ namespace FireflyIII\Http\Requests;use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;/**- * Class BudgetFormRequest- *- *- * @package FireflyIII\Http\Requests+ * Class BudgetFormRequest.*/class BudgetFormRequest extends Request{@@ -61,7 +57,7 @@ class BudgetFormRequest extends Request/** @var BudgetRepositoryInterface $repository */$repository = app(BudgetRepositoryInterface::class);$nameRule = 'required|between:1,100|uniqueObjectForUser:budgets,name';- if (!is_null($repository->find(intval($this->get('id')))->id)) {+ if (null !== $repository->find(intval($this->get('id')))->id) {$nameRule = 'required|between:1,100|uniqueObjectForUser:budgets,name,' . intval($this->get('id'));}diff --git a/app/Http/Requests/BudgetIncomeRequest.php b/app/Http/Requests/BudgetIncomeRequest.phpindex 9dd7ce13cf..94fd15117a 100644--- a/app/Http/Requests/BudgetIncomeRequest.php+++ b/app/Http/Requests/BudgetIncomeRequest.php@@ -18,16 +18,12 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Requests;/**- * Class BudgetIncomeRequest- *- *- * @package FireflyIII\Http\Requests+ * Class BudgetIncomeRequest.*/class BudgetIncomeRequest extends Request{diff --git a/app/Http/Requests/CategoryFormRequest.php b/app/Http/Requests/CategoryFormRequest.phpindex 6b412ec859..316076b85f 100644--- a/app/Http/Requests/CategoryFormRequest.php+++ b/app/Http/Requests/CategoryFormRequest.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Requests;@@ -26,10 +25,7 @@ namespace FireflyIII\Http\Requests;use FireflyIII\Repositories\Category\CategoryRepositoryInterface;/**- * Class CategoryFormRequest- *- *- * @package FireflyIII\Http\Requests+ * Class CategoryFormRequest.*/class CategoryFormRequest extends Request{@@ -60,7 +56,7 @@ class CategoryFormRequest extends Request/** @var CategoryRepositoryInterface $repository */$repository = app(CategoryRepositoryInterface::class);$nameRule = 'required|between:1,100|uniqueObjectForUser:categories,name';- if (!is_null($repository->find(intval($this->get('id')))->id)) {+ if (null !== $repository->find(intval($this->get('id')))->id) {$nameRule = 'required|between:1,100|uniqueObjectForUser:categories,name,' . intval($this->get('id'));}diff --git a/app/Http/Requests/ConfigurationRequest.php b/app/Http/Requests/ConfigurationRequest.phpindex 51b12a7efb..facdf0652d 100644--- a/app/Http/Requests/ConfigurationRequest.php+++ b/app/Http/Requests/ConfigurationRequest.php@@ -18,16 +18,12 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Requests;/**- * Class ConfigurationRequest- *- *- * @package FireflyIII\Http\Requests+ * Class ConfigurationRequest.*/class ConfigurationRequest extends Request{diff --git a/app/Http/Requests/CurrencyFormRequest.php b/app/Http/Requests/CurrencyFormRequest.phpindex 7fc18f86ee..54f0a742de 100644--- a/app/Http/Requests/CurrencyFormRequest.php+++ b/app/Http/Requests/CurrencyFormRequest.php@@ -18,16 +18,12 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Requests;/**- * Class BillFormRequest- *- *- * @package FireflyIII\Http\Requests+ * Class BillFormRequest.*/class CurrencyFormRequest extends Request{diff --git a/app/Http/Requests/DeleteAccountFormRequest.php b/app/Http/Requests/DeleteAccountFormRequest.phpindex e14d0e9159..091e660feb 100644--- a/app/Http/Requests/DeleteAccountFormRequest.php+++ b/app/Http/Requests/DeleteAccountFormRequest.php@@ -18,16 +18,12 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Requests;/**- * Class DeleteAccountFormRequest- *- *- * @package FireflyIII\Http\Requests+ * Class DeleteAccountFormRequest.*/class DeleteAccountFormRequest extends Request{diff --git a/app/Http/Requests/EmailFormRequest.php b/app/Http/Requests/EmailFormRequest.phpindex 34f1b4e6bc..0574e39ac2 100644--- a/app/Http/Requests/EmailFormRequest.php+++ b/app/Http/Requests/EmailFormRequest.php@@ -18,16 +18,12 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Requests;/**- * Class EmailFormRequest- *- *- * @package FireflyIII\Http\Requests+ * Class EmailFormRequest.*/class EmailFormRequest extends Request{diff --git a/app/Http/Requests/ExportFormRequest.php b/app/Http/Requests/ExportFormRequest.phpindex 895f661acb..2b1dc46df0 100644--- a/app/Http/Requests/ExportFormRequest.php+++ b/app/Http/Requests/ExportFormRequest.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Requests;@@ -26,10 +25,7 @@ namespace FireflyIII\Http\Requests;use Carbon\Carbon;/**- * Class ExportFormRequest- *- *- * @package FireflyIII\Http\Requests+ * Class ExportFormRequest.*/class ExportFormRequest extends Request{diff --git a/app/Http/Requests/ImportUploadRequest.php b/app/Http/Requests/ImportUploadRequest.phpindex 813ad6bbd7..1a4ac97c9e 100644--- a/app/Http/Requests/ImportUploadRequest.php+++ b/app/Http/Requests/ImportUploadRequest.php@@ -18,16 +18,12 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Requests;/**- * Class ImportUploadRequest- *- *- * @package FireflyIII\Http\Requests+ * Class ImportUploadRequest.*/class ImportUploadRequest extends Request{diff --git a/app/Http/Requests/JournalFormRequest.php b/app/Http/Requests/JournalFormRequest.phpindex 7e3912a707..fc05104976 100644--- a/app/Http/Requests/JournalFormRequest.php+++ b/app/Http/Requests/JournalFormRequest.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Requests;@@ -27,10 +26,7 @@ use FireflyIII\Exceptions\FireflyException;use FireflyIII\Models\TransactionType;/**- * Class JournalFormRequest- *- *- * @package FireflyIII\Http\Requests+ * Class JournalFormRequest.*/class JournalFormRequest extends Request{@@ -81,7 +77,6 @@ class JournalFormRequest extends Request'native_amount' => $this->float('native_amount'),'source_amount' => $this->float('source_amount'),'destination_amount' => $this->float('destination_amount'),-];return $data;@@ -130,12 +125,13 @@ class JournalFormRequest extends Request}/**- * Inspired by https://www.youtube.com/watch?v=WwnI0RS6J5A+ * Inspired by https://www.youtube.com/watch?v=WwnI0RS6J5A.** @param string $what* @param array $rules** @return array+ ** @throws FireflyException*/private function enhanceRules(string $what, array $rules): arraydiff --git a/app/Http/Requests/JournalLinkRequest.php b/app/Http/Requests/JournalLinkRequest.phpindex 06bcdf4b95..85d8728e5c 100644--- a/app/Http/Requests/JournalLinkRequest.php+++ b/app/Http/Requests/JournalLinkRequest.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Requests;@@ -26,10 +25,7 @@ namespace FireflyIII\Http\Requests;use FireflyIII\Models\LinkType;/**- * Class JournalLink- *- *- * @package FireflyIII\Http\Requests+ * Class JournalLink.*/class JournalLinkRequest extends Request{@@ -54,7 +50,7 @@ class JournalLinkRequest extends Request$return['transaction_journal_id'] = $this->integer('link_journal_id');$return['comments'] = strlen($this->string('comments')) > 0 ? $this->string('comments') : null;$return['direction'] = $parts[1];- if ($return['transaction_journal_id'] === 0 && ctype_digit($this->string('link_other'))) {+ if (0 === $return['transaction_journal_id'] && ctype_digit($this->string('link_other'))) {$return['transaction_journal_id'] = $this->integer('link_other');}diff --git a/app/Http/Requests/LinkTypeFormRequest.php b/app/Http/Requests/LinkTypeFormRequest.phpindex 8895dd2199..b113f24a53 100644--- a/app/Http/Requests/LinkTypeFormRequest.php+++ b/app/Http/Requests/LinkTypeFormRequest.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Requests;@@ -26,10 +25,7 @@ namespace FireflyIII\Http\Requests;use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface;/**- * Class BillFormRequest- *- *- * @package FireflyIII\Http\Requests+ * Class BillFormRequest.*/class LinkTypeFormRequest extends Request{@@ -53,7 +49,7 @@ class LinkTypeFormRequest extends Request$repository = app(LinkTypeRepositoryInterface::class);$nameRule = 'required|min:1|unique:link_types,name';$idRule = '';- if (!is_null($repository->find($this->integer('id'))->id)) {+ if (null !== $repository->find($this->integer('id'))->id) {$idRule = 'exists:link_types,id';$nameRule = 'required|min:1';}diff --git a/app/Http/Requests/MassDeleteJournalRequest.php b/app/Http/Requests/MassDeleteJournalRequest.phpindex 7d5a65d394..dc386dca03 100644--- a/app/Http/Requests/MassDeleteJournalRequest.php+++ b/app/Http/Requests/MassDeleteJournalRequest.php@@ -18,16 +18,12 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Requests;/**- * Class MassDeleteJournalRequest- *- *- * @package FireflyIII\Http\Requests+ * Class MassDeleteJournalRequest.*/class MassDeleteJournalRequest extends Request{diff --git a/app/Http/Requests/MassEditJournalRequest.php b/app/Http/Requests/MassEditJournalRequest.phpindex eb82783c5b..0bf81bcfea 100644--- a/app/Http/Requests/MassEditJournalRequest.php+++ b/app/Http/Requests/MassEditJournalRequest.php@@ -18,16 +18,12 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Requests;/**- * Class MassEditJournalRequest- *- *- * @package FireflyIII\Http\Requests+ * Class MassEditJournalRequest.*/class MassEditJournalRequest extends Request{diff --git a/app/Http/Requests/NewUserFormRequest.php b/app/Http/Requests/NewUserFormRequest.phpindex bded8431d1..7cbcf455f2 100644--- a/app/Http/Requests/NewUserFormRequest.php+++ b/app/Http/Requests/NewUserFormRequest.php@@ -18,16 +18,12 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Requests;/**- * Class NewUserFormRequest- *- *- * @package FireflyIII\Http\Requests+ * Class NewUserFormRequest.*/class NewUserFormRequest extends Request{diff --git a/app/Http/Requests/PiggyBankFormRequest.php b/app/Http/Requests/PiggyBankFormRequest.phpindex d4525faf88..268a0287c8 100644--- a/app/Http/Requests/PiggyBankFormRequest.php+++ b/app/Http/Requests/PiggyBankFormRequest.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Requests;@@ -26,10 +25,7 @@ namespace FireflyIII\Http\Requests;use Carbon\Carbon;/**- * Class PiggyBankFormRequest- *- *- * @package FireflyIII\Http\Requests+ * Class PiggyBankFormRequest.*/class PiggyBankFormRequest extends Request{@@ -67,7 +63,6 @@ class PiggyBankFormRequest extends Request$nameRule = 'required|between:1,255|uniquePiggyBankForUser:' . intval($this->get('id'));}-$rules = ['name' => $nameRule,'account_id' => 'required|belongsToUser:accounts',@@ -76,7 +71,6 @@ class PiggyBankFormRequest extends Request'startdate' => 'date','targetdate' => 'date|nullable','order' => 'integer|min:1',-];return $rules;diff --git a/app/Http/Requests/ProfileFormRequest.php b/app/Http/Requests/ProfileFormRequest.phpindex e53eb5efe5..c12219d758 100644--- a/app/Http/Requests/ProfileFormRequest.php+++ b/app/Http/Requests/ProfileFormRequest.php@@ -18,16 +18,12 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Requests;/**- * Class ProfileFormRequest- *- *- * @package FireflyIII\Http\Requests+ * Class ProfileFormRequest.*/class ProfileFormRequest extends Request{diff --git a/app/Http/Requests/ReportFormRequest.php b/app/Http/Requests/ReportFormRequest.phpindex fa05499a90..40eee6037b 100644--- a/app/Http/Requests/ReportFormRequest.php+++ b/app/Http/Requests/ReportFormRequest.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Requests;@@ -33,10 +32,7 @@ use FireflyIII\Repositories\Tag\TagRepositoryInterface;use Illuminate\Support\Collection;/**- * Class CategoryFormRequest- *- *- * @package FireflyIII\Http\Requests+ * Class CategoryFormRequest.*/class ReportFormRequest extends Request{@@ -62,7 +58,7 @@ class ReportFormRequest extends Requestif (is_array($set)) {foreach ($set as $accountId) {$account = $repository->find(intval($accountId));- if (!is_null($account->id)) {+ if (null !== $account->id) {$collection->push($account);}}@@ -83,7 +79,7 @@ class ReportFormRequest extends Requestif (is_array($set)) {foreach ($set as $budgetId) {$budget = $repository->find(intval($budgetId));- if (!is_null($budget->id)) {+ if (null !== $budget->id) {$collection->push($budget);}}@@ -104,7 +100,7 @@ class ReportFormRequest extends Requestif (is_array($set)) {foreach ($set as $categoryId) {$category = $repository->find(intval($categoryId));- if (!is_null($category->id)) {+ if (null !== $category->id) {$collection->push($category);}}@@ -115,6 +111,7 @@ class ReportFormRequest extends Request/*** @return Carbon+ ** @throws FireflyException*/public function getEndDate(): Carbon@@ -122,7 +119,7 @@ class ReportFormRequest extends Request$date = new Carbon;$range = $this->get('daterange');$parts = explode(' - ', strval($range));- if (count($parts) === 2) {+ if (2 === count($parts)) {try {$date = new Carbon($parts[1]);} catch (Exception $e) {@@ -135,6 +132,7 @@ class ReportFormRequest extends Request/*** @return Carbon+ ** @throws FireflyException*/public function getStartDate(): Carbon@@ -142,7 +140,7 @@ class ReportFormRequest extends Request$date = new Carbon;$range = $this->get('daterange');$parts = explode(' - ', strval($range));- if (count($parts) === 2) {+ if (2 === count($parts)) {try {$date = new Carbon($parts[0]);} catch (Exception $e) {@@ -165,7 +163,7 @@ class ReportFormRequest extends Requestif (is_array($set)) {foreach ($set as $tagTag) {$tag = $repository->findByTag($tagTag);- if (!is_null($tag->id)) {+ if (null !== $tag->id) {$collection->push($tag);}}diff --git a/app/Http/Requests/Request.php b/app/Http/Requests/Request.phpindex 71c845b08a..f26c4113d6 100644--- a/app/Http/Requests/Request.php+++ b/app/Http/Requests/Request.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Requests;@@ -27,9 +26,7 @@ use Carbon\Carbon;use Illuminate\Foundation\Http\FormRequest;/**- * Class Request- *- * @package FireflyIII\Http\Requests+ * Class Request.*/class Request extends FormRequest{@@ -40,7 +37,7 @@ class Request extends FormRequest*/public function boolean(string $field): bool{- return intval($this->input($field)) === 1;+ return 1 === intval($this->input($field));}/**diff --git a/app/Http/Requests/RuleFormRequest.php b/app/Http/Requests/RuleFormRequest.phpindex 89f484a09a..eb4453070b 100644--- a/app/Http/Requests/RuleFormRequest.php+++ b/app/Http/Requests/RuleFormRequest.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Requests;@@ -26,10 +25,7 @@ namespace FireflyIII\Http\Requests;use FireflyIII\Repositories\Rule\RuleRepositoryInterface;/**- * Class RuleFormRequest- *- *- * @package FireflyIII\Http\Requests+ * Class RuleFormRequest.*/class RuleFormRequest extends Request{@@ -77,7 +73,7 @@ class RuleFormRequest extends Request$contextActions = join(',', config('firefly.rule-actions-text'));$titleRule = 'required|between:1,100|uniqueObjectForUser:rules,title';- if (!is_null($repository->find(intval($this->get('id')))->id)) {+ if (null !== $repository->find(intval($this->get('id')))->id) {$titleRule = 'required|between:1,100|uniqueObjectForUser:rules,title,' . intval($this->get('id'));}$rules = [@@ -91,7 +87,7 @@ class RuleFormRequest extends Request'rule-action.*' => 'required|in:' . join(',', $validActions),];// since Laravel does not support this stuff yet, here's a trick.- for ($i = 0; $i < 10; $i++) {+ for ($i = 0; $i < 10; ++$i) {$rules['rule-action-value.' . $i] = 'required_if:rule-action.' . $i . ',' . $contextActions . '|ruleActionValue';}diff --git a/app/Http/Requests/RuleGroupFormRequest.php b/app/Http/Requests/RuleGroupFormRequest.phpindex fa9163a177..539f647446 100644--- a/app/Http/Requests/RuleGroupFormRequest.php+++ b/app/Http/Requests/RuleGroupFormRequest.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Requests;@@ -26,10 +25,7 @@ namespace FireflyIII\Http\Requests;use FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface;/**- * Class RuleGroupFormRequest- *- *- * @package FireflyIII\Http\Requests+ * Class RuleGroupFormRequest.*/class RuleGroupFormRequest extends Request{@@ -62,7 +58,7 @@ class RuleGroupFormRequest extends Request/** @var RuleGroupRepositoryInterface $repository */$repository = app(RuleGroupRepositoryInterface::class);$titleRule = 'required|between:1,100|uniqueObjectForUser:rule_groups,title';- if (!is_null($repository->find(intval($this->get('id')))->id)) {+ if (null !== $repository->find(intval($this->get('id')))->id) {$titleRule = 'required|between:1,100|uniqueObjectForUser:rule_groups,title,' . intval($this->get('id'));}diff --git a/app/Http/Requests/SelectTransactionsRequest.php b/app/Http/Requests/SelectTransactionsRequest.phpindex 2ff802a032..1c96d0eb83 100644--- a/app/Http/Requests/SelectTransactionsRequest.php+++ b/app/Http/Requests/SelectTransactionsRequest.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Requests;@@ -26,10 +25,7 @@ namespace FireflyIII\Http\Requests;use Carbon\Carbon;/**- * Class ExportFormRequest- *- *- * @package FireflyIII\Http\Requests+ * Class ExportFormRequest.*/class SelectTransactionsRequest extends Request{diff --git a/app/Http/Requests/SplitJournalFormRequest.php b/app/Http/Requests/SplitJournalFormRequest.phpindex 0c7b41ca43..0865751fb4 100644--- a/app/Http/Requests/SplitJournalFormRequest.php+++ b/app/Http/Requests/SplitJournalFormRequest.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Requests;@@ -26,9 +25,7 @@ namespace FireflyIII\Http\Requests;use Steam;/**- * Class SplitJournalFormRequest- *- * @package FireflyIII\Http\Requests+ * Class SplitJournalFormRequest.*/class SplitJournalFormRequest extends Request{diff --git a/app/Http/Requests/TagFormRequest.php b/app/Http/Requests/TagFormRequest.phpindex 00ae83beed..dd835fd9a6 100644--- a/app/Http/Requests/TagFormRequest.php+++ b/app/Http/Requests/TagFormRequest.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Requests;@@ -26,10 +25,7 @@ namespace FireflyIII\Http\Requests;use FireflyIII\Repositories\Tag\TagRepositoryInterface;/**- * Class TagFormRequest- *- *- * @package FireflyIII\Http\Requests+ * Class TagFormRequest.*/class TagFormRequest extends Request{@@ -51,7 +47,7 @@ class TagFormRequest extends Request$longitude = null;$zoomLevel = null;- if ($this->get('tag_position_has_tag') === 'true') {+ if ('true' === $this->get('tag_position_has_tag')) {$latitude = $this->string('tag_position_latitude');$longitude = $this->string('tag_position_longitude');$zoomLevel = $this->integer('tag_position_zoomlevel');@@ -78,7 +74,7 @@ class TagFormRequest extends Request$repository = app(TagRepositoryInterface::class);$idRule = '';$tagRule = 'required|min:1|uniqueObjectForUser:tags,tag';- if (!is_null($repository->find(intval($this->get('id')))->id)) {+ if (null !== $repository->find(intval($this->get('id')))->id) {$idRule = 'belongsToUser:tags';$tagRule = 'required|min:1|uniqueObjectForUser:tags,tag,' . $this->get('id');}diff --git a/app/Http/Requests/TestRuleFormRequest.php b/app/Http/Requests/TestRuleFormRequest.phpindex 93454f522e..098315e0f9 100644--- a/app/Http/Requests/TestRuleFormRequest.php+++ b/app/Http/Requests/TestRuleFormRequest.php@@ -18,16 +18,12 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Requests;/**- * Class RuleFormRequest- *- *- * @package FireflyIII\Http\Requests+ * Class RuleFormRequest.*/class TestRuleFormRequest extends Request{diff --git a/app/Http/Requests/TokenFormRequest.php b/app/Http/Requests/TokenFormRequest.phpindex 4b9b17cbac..e3b2f3819f 100644--- a/app/Http/Requests/TokenFormRequest.php+++ b/app/Http/Requests/TokenFormRequest.php@@ -18,16 +18,12 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Requests;/**- * Class TokenFormRequest- *- *- * @package FireflyIII\Http\Requests+ * Class TokenFormRequest.*/class TokenFormRequest extends Request{diff --git a/app/Http/Requests/UserFormRequest.php b/app/Http/Requests/UserFormRequest.phpindex 5d21912927..ffb06350ea 100644--- a/app/Http/Requests/UserFormRequest.php+++ b/app/Http/Requests/UserFormRequest.php@@ -18,16 +18,12 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Requests;/**- * Class UserFormRequest- *- *- * @package FireflyIII\Http\Requests+ * Class UserFormRequest.*/class UserFormRequest extends Request{@@ -47,7 +43,7 @@ class UserFormRequest extends Request{return ['email' => $this->string('email'),- 'blocked' => $this->integer('blocked') === 1,+ 'blocked' => 1 === $this->integer('blocked'),'blocked_code' => $this->string('blocked_code'),'password' => $this->string('password'),];diff --git a/app/Http/Requests/UserRegistrationRequest.php b/app/Http/Requests/UserRegistrationRequest.phpindex c14439f810..dffe9a3223 100644--- a/app/Http/Requests/UserRegistrationRequest.php+++ b/app/Http/Requests/UserRegistrationRequest.php@@ -18,16 +18,12 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Http\Requests;/**- * Class UserRegistrationRequest- *- *- * @package FireflyIII\Http\Requests+ * Class UserRegistrationRequest.*/class UserRegistrationRequest extends Request{@@ -49,7 +45,6 @@ class UserRegistrationRequest extends Requestreturn ['email' => 'email|required','password' => 'confirmed|secure_password',-];}}diff --git a/app/Http/breadcrumbs.php b/app/Http/breadcrumbs.phpindex ff2b8e7227..a988150c12 100644--- a/app/Http/breadcrumbs.php+++ b/app/Http/breadcrumbs.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);use Carbon\Carbon;@@ -43,9 +42,7 @@ use FireflyIII\Models\TransactionType;use FireflyIII\User;use Illuminate\Support\Collection;-/**- * HOME- */+// HOMEBreadcrumbs::register('home',function (BreadCrumbGenerator $breadcrumbs) {@@ -60,9 +57,7 @@ Breadcrumbs::register(});-/**- * ACCOUNTS- */+// ACCOUNTSBreadcrumbs::register('accounts.index',function (BreadCrumbGenerator $breadcrumbs, string $what) {@@ -88,15 +83,15 @@ Breadcrumbs::register($breadcrumbs->push($account->name, route('accounts.show', [$account->id]));// push when is all:- if ($moment === 'all') {+ if ('all' === $moment) {$breadcrumbs->push(trans('firefly.everything'), route('accounts.show', [$account->id, 'all']));}// when is specific period or when empty:- if ($moment !== 'all' && $moment !== '(nothing)') {+ if ('all' !== $moment && '(nothing)' !== $moment) {$title = trans('firefly.between_dates_breadcrumb',['start' => $start->formatLocalized(strval(trans('config.month_and_day'))),- 'end' => $end->formatLocalized(strval(trans('config.month_and_day')))]+ 'end' => $end->formatLocalized(strval(trans('config.month_and_day'))),]);$breadcrumbs->push($title, route('accounts.show', [$account->id, $moment, $start, $end]));}@@ -111,7 +106,6 @@ Breadcrumbs::register(});-Breadcrumbs::register('accounts.edit',function (BreadCrumbGenerator $breadcrumbs, Account $account) {@@ -122,9 +116,7 @@ Breadcrumbs::register(});-/**- * ADMIN- */+// ADMINBreadcrumbs::register('admin.index',function (BreadCrumbGenerator $breadcrumbs) {@@ -179,7 +171,6 @@ Breadcrumbs::register(});-Breadcrumbs::register('admin.links.index',function (BreadCrumbGenerator $breadcrumbs) {@@ -228,9 +219,7 @@ Breadcrumbs::register(});-/**- * ATTACHMENTS- */+// ATTACHMENTSBreadcrumbs::register('attachments.edit',function (BreadCrumbGenerator $breadcrumbs, Attachment $attachment) {@@ -256,9 +245,7 @@ Breadcrumbs::register(});-/**- * BILLS- */+// BILLSBreadcrumbs::register('bills.index',function (BreadCrumbGenerator $breadcrumbs) {@@ -297,10 +284,7 @@ Breadcrumbs::register(});--/**- * BUDGETS- */+// BUDGETSBreadcrumbs::register('budgets.index',function (BreadCrumbGenerator $breadcrumbs) {@@ -338,15 +322,15 @@ Breadcrumbs::register($breadcrumbs->push(trans('firefly.journals_without_budget'), route('budgets.no-budget'));// push when is all:- if ($moment === 'all') {+ if ('all' === $moment) {$breadcrumbs->push(trans('firefly.everything'), route('budgets.no-budget', ['all']));}// when is specific period or when empty:- if ($moment !== 'all' && $moment !== '(nothing)') {+ if ('all' !== $moment && '(nothing)' !== $moment) {$title = trans('firefly.between_dates_breadcrumb',['start' => $start->formatLocalized(strval(trans('config.month_and_day'))),- 'end' => $end->formatLocalized(strval(trans('config.month_and_day')))]+ 'end' => $end->formatLocalized(strval(trans('config.month_and_day'))),]);$breadcrumbs->push($title, route('budgets.no-budget', [$moment]));}@@ -381,9 +365,7 @@ Breadcrumbs::register(});-/**- * CATEGORIES- */+// CATEGORIESBreadcrumbs::register('categories.index',function (BreadCrumbGenerator $breadcrumbs) {@@ -421,22 +403,21 @@ Breadcrumbs::register($breadcrumbs->push($category->name, route('categories.show', [$category->id]));// push when is all:- if ($moment === 'all') {+ if ('all' === $moment) {$breadcrumbs->push(trans('firefly.everything'), route('categories.show', [$category->id, 'all']));}// when is specific period or when empty:- if ($moment !== 'all' && $moment !== '(nothing)') {+ if ('all' !== $moment && '(nothing)' !== $moment) {$title = trans('firefly.between_dates_breadcrumb',['start' => $start->formatLocalized(strval(trans('config.month_and_day'))),- 'end' => $end->formatLocalized(strval(trans('config.month_and_day')))]+ 'end' => $end->formatLocalized(strval(trans('config.month_and_day'))),]);$breadcrumbs->push($title, route('categories.show', [$category->id, $moment]));}});-Breadcrumbs::register('categories.no-category',function (BreadCrumbGenerator $breadcrumbs, string $moment, Carbon $start, Carbon $end) {@@ -444,25 +425,22 @@ Breadcrumbs::register($breadcrumbs->push(trans('firefly.journals_without_category'), route('categories.no-category'));// push when is all:- if ($moment === 'all') {+ if ('all' === $moment) {$breadcrumbs->push(trans('firefly.everything'), route('categories.no-category', ['all']));}// when is specific period or when empty:- if ($moment !== 'all' && $moment !== '(nothing)') {+ if ('all' !== $moment && '(nothing)' !== $moment) {$title = trans('firefly.between_dates_breadcrumb',['start' => $start->formatLocalized(strval(trans('config.month_and_day'))),- 'end' => $end->formatLocalized(strval(trans('config.month_and_day')))]+ 'end' => $end->formatLocalized(strval(trans('config.month_and_day'))),]);$breadcrumbs->push($title, route('categories.no-category', [$moment]));}});--/**- * CURRENCIES- */+// CURRENCIESBreadcrumbs::register('currencies.index',function (BreadCrumbGenerator $breadcrumbs) {@@ -494,9 +472,7 @@ Breadcrumbs::register(});-/**- * EXPORT- */+// EXPORTBreadcrumbs::register('export.index',function (BreadCrumbGenerator $breadcrumbs) {@@ -505,9 +481,7 @@ Breadcrumbs::register(});-/**- * PIGGY BANKS- */+// PIGGY BANKSBreadcrumbs::register('piggy-banks.index',function (BreadCrumbGenerator $breadcrumbs) {@@ -565,9 +539,7 @@ Breadcrumbs::register(});-/**- * IMPORT- */+// IMPORTBreadcrumbs::register('import.index',function (BreadCrumbGenerator $breadcrumbs) {@@ -576,9 +548,7 @@ Breadcrumbs::register(});-/**- * FILE IMPORT- */+// FILE IMPORTBreadcrumbs::register('import.file.index',function (BreadCrumbGenerator $breadcrumbs) {@@ -602,9 +572,7 @@ Breadcrumbs::register(});-/**- * PREFERENCES- */+// PREFERENCESBreadcrumbs::register('preferences.index',function (BreadCrumbGenerator $breadcrumbs) {@@ -621,9 +589,7 @@ Breadcrumbs::register(});-/**- * PROFILE- */+// PROFILEBreadcrumbs::register('profile.index',function (BreadCrumbGenerator $breadcrumbs) {@@ -646,9 +612,7 @@ Breadcrumbs::register(});-/**- * REPORTS- */+// REPORTSBreadcrumbs::register('reports.index',function (BreadCrumbGenerator $breadcrumbs) {@@ -726,9 +690,7 @@ Breadcrumbs::register(});-/**- * New user Controller- */+// New user ControllerBreadcrumbs::register('new-user.index',function (BreadCrumbGenerator $breadcrumbs) {@@ -737,9 +699,7 @@ Breadcrumbs::register(});-/**- * Rules- */+// RulesBreadcrumbs::register('rules.index',function (BreadCrumbGenerator $breadcrumbs) {@@ -812,10 +772,7 @@ Breadcrumbs::register(});--/**- * SEARCH- */+// SEARCHBreadcrumbs::register('search.index',function (BreadCrumbGenerator $breadcrumbs, $query) {@@ -824,10 +781,7 @@ Breadcrumbs::register(});--/**- * TAGS- */+// TAGSBreadcrumbs::register('tags.index',function (BreadCrumbGenerator $breadcrumbs) {@@ -860,45 +814,42 @@ Breadcrumbs::register(});-Breadcrumbs::register('tags.show',function (BreadCrumbGenerator $breadcrumbs, Tag $tag, string $moment, Carbon $start, Carbon $end) {$breadcrumbs->parent('tags.index');$breadcrumbs->push(e($tag->tag), route('tags.show', [$tag->id, $moment]));- if ($moment === 'all') {+ if ('all' === $moment) {$breadcrumbs->push(trans('firefly.everything'), route('tags.show', [$tag->id, $moment]));}// when is specific period or when empty:- if ($moment !== 'all' && $moment !== '(nothing)') {+ if ('all' !== $moment && '(nothing)' !== $moment) {$title = trans('firefly.between_dates_breadcrumb',['start' => $start->formatLocalized(strval(trans('config.month_and_day'))),- 'end' => $end->formatLocalized(strval(trans('config.month_and_day')))]+ 'end' => $end->formatLocalized(strval(trans('config.month_and_day'))),]);$breadcrumbs->push($title, route('tags.show', [$tag->id, $moment]));}});-/**- * TRANSACTIONS- */+// TRANSACTIONSBreadcrumbs::register('transactions.index',function (BreadCrumbGenerator $breadcrumbs, string $what, string $moment = '', Carbon $start, Carbon $end) {$breadcrumbs->parent('home');$breadcrumbs->push(trans('breadcrumbs.' . $what . '_list'), route('transactions.index', [$what]));- if ($moment === 'all') {+ if ('all' === $moment) {$breadcrumbs->push(trans('firefly.everything'), route('transactions.index', [$what, 'all']));}// when is specific period or when empty:- if ($moment !== 'all' && $moment !== '(nothing)') {+ if ('all' !== $moment && '(nothing)' !== $moment) {$title = trans('firefly.between_dates_breadcrumb',['start' => $start->formatLocalized(strval(trans('config.month_and_day'))),- 'end' => $end->formatLocalized(strval(trans('config.month_and_day')))]+ 'end' => $end->formatLocalized(strval(trans('config.month_and_day'))),]);$breadcrumbs->push($title, route('transactions.index', [$what, $moment]));}@@ -948,9 +899,7 @@ Breadcrumbs::register(});-/**- * MASS TRANSACTION EDIT / DELETE- */+// MASS TRANSACTION EDIT / DELETEBreadcrumbs::register('transactions.mass.edit',function (BreadCrumbGenerator $breadcrumbs, Collection $journals): void {@@ -979,10 +928,7 @@ Breadcrumbs::register(});--/**- * SPLIT- */+// SPLITBreadcrumbs::register('transactions.split.edit',function (BreadCrumbGenerator $breadcrumbs, TransactionJournal $journal) {diff --git a/app/Import/Configurator/ConfiguratorInterface.php b/app/Import/Configurator/ConfiguratorInterface.phpindex 64230bc552..a6781310c7 100644--- a/app/Import/Configurator/ConfiguratorInterface.php+++ b/app/Import/Configurator/ConfiguratorInterface.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Import\Configurator;@@ -26,9 +25,7 @@ namespace FireflyIII\Import\Configurator;use FireflyIII\Models\ImportJob;/**- * Interface ConfiguratorInterface- *- * @package FireflyIII\Import\Configurator+ * Interface ConfiguratorInterface.*/interface ConfiguratorInterface{@@ -76,8 +73,6 @@ interface ConfiguratorInterface/*** @param ImportJob $job- *- * @return void*/public function setJob(ImportJob $job);}diff --git a/app/Import/Configurator/CsvConfigurator.php b/app/Import/Configurator/CsvConfigurator.phpindex 217b72b332..79593ca556 100644--- a/app/Import/Configurator/CsvConfigurator.php+++ b/app/Import/Configurator/CsvConfigurator.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Import\Configurator;@@ -32,13 +31,11 @@ use FireflyIII\Support\Import\Configuration\Csv\Roles;use Log;/**- * Class CsvConfigurator- *- * @package FireflyIII\Import\Configurator+ * Class CsvConfigurator.*/class CsvConfigurator implements ConfiguratorInterface{- /** @var ImportJob */+ /** @var ImportJob */private $job;/** @var string */@@ -57,6 +54,7 @@ class CsvConfigurator implements ConfiguratorInterface* @param array $data** @return bool+ ** @throws FireflyException*/public function configureJob(array $data): bool@@ -76,6 +74,7 @@ class CsvConfigurator implements ConfiguratorInterface* Return the data required for the next step in the job configuration.** @return array+ ** @throws FireflyException*/public function getNextData(): array@@ -91,6 +90,7 @@ class CsvConfigurator implements ConfiguratorInterface/*** @return string+ ** @throws FireflyException*/public function getNextView(): string@@ -146,7 +146,7 @@ class CsvConfigurator implements ConfiguratorInterfacepublic function setJob(ImportJob $job){$this->job = $job;- if (is_null($this->job->configuration) || count($this->job->configuration) === 0) {+ if (null === $this->job->configuration || 0 === count($this->job->configuration)) {Log::debug(sprintf('Gave import job %s initial configuration.', $this->job->key));$this->job->configuration = config('csv.default_config');$this->job->save();@@ -155,26 +155,27 @@ class CsvConfigurator implements ConfiguratorInterface/*** @return string+ ** @throws FireflyException*/private function getConfigurationClass(): string{$class = false;switch (true) {- case (!$this->job->configuration['initial-config-complete']):+ case !$this->job->configuration['initial-config-complete']:$class = Initial::class;break;- case (!$this->job->configuration['column-roles-complete']):+ case !$this->job->configuration['column-roles-complete']:$class = Roles::class;break;- case (!$this->job->configuration['column-mapping-complete']):+ case !$this->job->configuration['column-mapping-complete']:$class = Map::class;break;default:break;}- if ($class === false || strlen($class) === 0) {+ if (false === $class || 0 === strlen($class)) {throw new FireflyException('Cannot handle current job state in getConfigurationClass().');}if (!class_exists($class)) {diff --git a/app/Import/Converter/Amount.php b/app/Import/Converter/Amount.phpindex d9e98f73d8..e3180d9368 100644--- a/app/Import/Converter/Amount.php+++ b/app/Import/Converter/Amount.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Import\Converter;@@ -26,16 +25,13 @@ namespace FireflyIII\Import\Converter;use Log;/**- * Class RabobankDebetCredit- *- * @package FireflyIII\Import\Converter+ * Class RabobankDebetCredit.*/class Amount implements ConverterInterface{-/*** Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems.- * - Jamie Zawinski+ * - Jamie Zawinski.*** @param $value@@ -46,7 +42,7 @@ class Amount implements ConverterInterface*/public function convert($value): string{- if (is_null($value)) {+ if (null === $value) {return '0';}$value = strval($value);@@ -56,35 +52,35 @@ class Amount implements ConverterInterface$altPosition = $len - 2;$decimal = null;- if (($len > 2 && $value{$decimalPosition} === '.') || ($len > 2 && strpos($value, '.') > $decimalPosition)) {+ if (($len > 2 && '.' === $value[$decimalPosition]) || ($len > 2 && strpos($value, '.') > $decimalPosition)) {$decimal = '.';Log::debug(sprintf('Decimal character in "%s" seems to be a dot.', $value));}- if ($len > 2 && $value{$decimalPosition} === ',') {+ if ($len > 2 && ',' === $value[$decimalPosition]) {$decimal = ',';Log::debug(sprintf('Decimal character in "%s" seems to be a comma.', $value));}// decimal character is null? find out if "0.1" or ".1" or "0,1" or ",1"- if ($len > 1 && ($value{$altPosition} === '.' || $value{$altPosition} === ',')) {- $decimal = $value{$altPosition};+ if ($len > 1 && ('.' === $value[$altPosition] || ',' === $value[$altPosition])) {+ $decimal = $value[$altPosition];Log::debug(sprintf('Alternate search resulted in "%s" for decimal sign.', $decimal));}// if decimal is dot, replace all comma's and spaces with nothing. then parse as float (round to 4 pos)- if ($decimal === '.') {+ if ('.' === $decimal) {$search = [',', ' '];$oldValue = $value;$value = str_replace($search, '', $value);Log::debug(sprintf('Converted amount from "%s" to "%s".', $oldValue, $value));}- if ($decimal === ',') {+ if (',' === $decimal) {$search = ['.', ' '];$oldValue = $value;$value = str_replace($search, '', $value);$value = str_replace(',', '.', $value);Log::debug(sprintf('Converted amount from "%s" to "%s".', $oldValue, $value));}- if (is_null($decimal)) {+ if (null === $decimal) {// replace all:$search = ['.', ' ', ','];$oldValue = $value;diff --git a/app/Import/Converter/ConverterInterface.php b/app/Import/Converter/ConverterInterface.phpindex 4047c23924..20a4ba6411 100644--- a/app/Import/Converter/ConverterInterface.php+++ b/app/Import/Converter/ConverterInterface.php@@ -18,21 +18,17 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Import\Converter;/**- * Interface ConverterInterface- *- * @package FireflyIII\Import\Converter+ * Interface ConverterInterface.*/interface ConverterInterface{/*** @param $value- **/public function convert($value);}diff --git a/app/Import/Converter/INGDebetCredit.php b/app/Import/Converter/INGDebetCredit.phpindex 04eb26cfa3..2772100bd7 100644--- a/app/Import/Converter/INGDebetCredit.php+++ b/app/Import/Converter/INGDebetCredit.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Import\Converter;@@ -26,13 +25,10 @@ namespace FireflyIII\Import\Converter;use Log;/**- * Class INGDebetCredit- *- * @package FireflyIII\Import\Converter+ * Class INGDebetCredit.*/class INGDebetCredit implements ConverterInterface{-/*** @param $value*@@ -42,7 +38,7 @@ class INGDebetCredit implements ConverterInterface{Log::debug('Going to convert ing debet credit', ['value' => $value]);- if ($value === 'Af') {+ if ('Af' === $value) {Log::debug('Return -1');return -1;diff --git a/app/Import/Converter/RabobankDebetCredit.php b/app/Import/Converter/RabobankDebetCredit.phpindex 064a740f60..81dbd57f96 100644--- a/app/Import/Converter/RabobankDebetCredit.php+++ b/app/Import/Converter/RabobankDebetCredit.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Import\Converter;@@ -26,13 +25,10 @@ namespace FireflyIII\Import\Converter;use Log;/**- * Class RabobankDebetCredit- *- * @package FireflyIII\Import\Converter+ * Class RabobankDebetCredit.*/class RabobankDebetCredit implements ConverterInterface{-/*** @param $value*@@ -42,7 +38,7 @@ class RabobankDebetCredit implements ConverterInterface{Log::debug('Going to convert ', ['value' => $value]);- if ($value === 'D') {+ if ('D' === $value) {Log::debug('Return -1');return -1;diff --git a/app/Import/FileProcessor/CsvProcessor.php b/app/Import/FileProcessor/CsvProcessor.phpindex 7dd6e83da2..0b547eb026 100644--- a/app/Import/FileProcessor/CsvProcessor.php+++ b/app/Import/FileProcessor/CsvProcessor.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Import\FileProcessor;@@ -37,12 +36,10 @@ use Log;* Class CsvProcessor, as the name suggests, goes over CSV file line by line and creates* "ImportJournal" objects, which are used in another step to create new journals and transactions* and what-not.- *- * @package FireflyIII\Import\FileProcessor*/class CsvProcessor implements FileProcessorInterface{- /** @var ImportJob */+ /** @var ImportJob */private $job;/** @var Collection */private $objects;@@ -136,6 +133,7 @@ class CsvProcessor implements FileProcessorInterface* @param string $value** @return array+ ** @throws FireflyException*/private function annotateValue(int $index, string $value)@@ -167,7 +165,7 @@ class CsvProcessor implements FileProcessorInterface$config = $this->job->configuration;$reader = Reader::createFromString($content);$delimiter = $config['delimiter'];- if ($delimiter === 'tab') {+ if ('tab' === $delimiter) {$delimiter = "\t";}$reader->setDelimiter($delimiter);@@ -213,6 +211,7 @@ class CsvProcessor implements FileProcessorInterface* @param array $array** @return string+ ** @throws FireflyException*/private function getRowHash(array $array): string@@ -220,7 +219,7 @@ class CsvProcessor implements FileProcessorInterface$json = json_encode($array);$jsonError = json_last_error();- if ($json === false) {+ if (false === $json) {throw new FireflyException(sprintf('Error while encoding JSON for CSV row: %s', $this->getJsonError($jsonError)));}$hash = hash('sha256', $json);@@ -235,6 +234,7 @@ class CsvProcessor implements FileProcessorInterface* @param array $row** @return ImportJournal+ ** @throws FireflyException*/private function importRow(int $index, array $row): ImportJournal@@ -248,7 +248,7 @@ class CsvProcessor implements FileProcessorInterface$journal->setHash($hash);/**- * @var int $rowIndex+ * @var int* @var string $value*/foreach ($row as $rowIndex => $value) {@@ -280,7 +280,7 @@ class CsvProcessor implements FileProcessorInterface->where('data', $json)->where('name', 'importHash')->first();- if (!is_null($entry)) {+ if (null !== $entry) {return true;}@@ -293,6 +293,7 @@ class CsvProcessor implements FileProcessorInterface* @param array $row** @return array+ ** @throws FireflyException*/private function specifics(array $row): arraydiff --git a/app/Import/FileProcessor/FileProcessorInterface.php b/app/Import/FileProcessor/FileProcessorInterface.phpindex 3664e74f3d..94fd9bd0a5 100644--- a/app/Import/FileProcessor/FileProcessorInterface.php+++ b/app/Import/FileProcessor/FileProcessorInterface.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Import\FileProcessor;@@ -27,14 +26,10 @@ use FireflyIII\Models\ImportJob;use Illuminate\Support\Collection;/**- * Interface FileProcessorInterface- *- * @package FireflyIII\Import\FileProcessor+ * Interface FileProcessorInterface.*/interface FileProcessorInterface{--/*** @return Collection*/@@ -50,5 +45,5 @@ interface FileProcessorInterface** @return FileProcessorInterface*/- public function setJob(ImportJob $job): FileProcessorInterface;+ public function setJob(ImportJob $job): self;}diff --git a/app/Import/Logging/CommandHandler.php b/app/Import/Logging/CommandHandler.phpindex a21095a6fa..b55c1f9dc7 100644--- a/app/Import/Logging/CommandHandler.php+++ b/app/Import/Logging/CommandHandler.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Import\Logging;@@ -27,14 +26,11 @@ use Illuminate\Console\Command;use Monolog\Handler\AbstractProcessingHandler;/**- * Class CommandHandler- *- * @package FireflyIII\Import\Logging+ * Class CommandHandler.*/class CommandHandler extends AbstractProcessingHandler{-- /** @var Command */+ /** @var Command */private $command;/**@@ -51,11 +47,9 @@ class CommandHandler extends AbstractProcessingHandler}/**- * Writes the record down to the log of the implementing handler- *- * @param array $record+ * Writes the record down to the log of the implementing handler.*- * @return void+ * @param array $record*/protected function write(array $record){diff --git a/app/Import/Mapper/AssetAccountIbans.php b/app/Import/Mapper/AssetAccountIbans.phpindex b5d5699529..6a53db8941 100644--- a/app/Import/Mapper/AssetAccountIbans.php+++ b/app/Import/Mapper/AssetAccountIbans.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Import\Mapper;@@ -28,13 +27,10 @@ use FireflyIII\Models\AccountType;use FireflyIII\Repositories\Account\AccountRepositoryInterface;/**- * Class AssetAccounts- *- * @package FireflyIII\Import\Mapper+ * Class AssetAccounts.*/class AssetAccountIbans implements MapperInterface{-/*** @return array*/@@ -52,7 +48,7 @@ class AssetAccountIbans implements MapperInterfaceif (strlen($iban) > 0) {$topList[$account->id] = $account->iban . ' (' . $account->name . ')';}- if (strlen($iban) === 0) {+ if (0 === strlen($iban)) {$list[$account->id] = $account->name;}}diff --git a/app/Import/Mapper/AssetAccounts.php b/app/Import/Mapper/AssetAccounts.phpindex e12b33340d..43188a6833 100644--- a/app/Import/Mapper/AssetAccounts.php+++ b/app/Import/Mapper/AssetAccounts.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Import\Mapper;@@ -28,13 +27,10 @@ use FireflyIII\Models\AccountType;use FireflyIII\Repositories\Account\AccountRepositoryInterface;/**- * Class AssetAccounts- *- * @package FireflyIII\Import\Mapper+ * Class AssetAccounts.*/class AssetAccounts implements MapperInterface{-/*** @return array*/diff --git a/app/Import/Mapper/Bills.php b/app/Import/Mapper/Bills.phpindex 8770f8c988..b758b52dd1 100644--- a/app/Import/Mapper/Bills.php+++ b/app/Import/Mapper/Bills.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Import\Mapper;@@ -27,13 +26,10 @@ use FireflyIII\Models\Bill;use FireflyIII\Repositories\Bill\BillRepositoryInterface;/**- * Class Bills- *- * @package FireflyIII\Import\Mapper+ * Class Bills.*/class Bills implements MapperInterface{-/*** @return array*/diff --git a/app/Import/Mapper/Budgets.php b/app/Import/Mapper/Budgets.phpindex ab1b8bc151..eb1b73c9d8 100644--- a/app/Import/Mapper/Budgets.php+++ b/app/Import/Mapper/Budgets.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Import\Mapper;@@ -27,13 +26,10 @@ use FireflyIII\Models\Budget;use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;/**- * Class Budgets- *- * @package FireflyIII\Import\Mapper+ * Class Budgets.*/class Budgets implements MapperInterface{-/*** @return array*/diff --git a/app/Import/Mapper/Categories.php b/app/Import/Mapper/Categories.phpindex 76b3b60f55..d6e0bd3d0f 100644--- a/app/Import/Mapper/Categories.php+++ b/app/Import/Mapper/Categories.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Import\Mapper;@@ -27,13 +26,10 @@ use FireflyIII\Models\Category;use FireflyIII\Repositories\Category\CategoryRepositoryInterface;/**- * Class Categories- *- * @package FireflyIII\Import\Mapper+ * Class Categories.*/class Categories implements MapperInterface{-/*** @return array*/diff --git a/app/Import/Mapper/MapperInterface.php b/app/Import/Mapper/MapperInterface.phpindex 528e6e8d3c..b0ca4803b5 100644--- a/app/Import/Mapper/MapperInterface.php+++ b/app/Import/Mapper/MapperInterface.php@@ -18,19 +18,15 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Import\Mapper;/**- * Interface MapperInterface- *- * @package FireflyIII\Import\Mapper+ * Interface MapperInterface.*/interface MapperInterface{-/*** @return array*/diff --git a/app/Import/Mapper/OpposingAccountIbans.php b/app/Import/Mapper/OpposingAccountIbans.phpindex 476fd073ab..894ff7f509 100644--- a/app/Import/Mapper/OpposingAccountIbans.php+++ b/app/Import/Mapper/OpposingAccountIbans.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Import\Mapper;@@ -28,13 +27,10 @@ use FireflyIII\Models\AccountType;use FireflyIII\Repositories\Account\AccountRepositoryInterface;/**- * Class OpposingAccounts- *- * @package FireflyIII\Import\Mapper+ * Class OpposingAccounts.*/class OpposingAccountIbans implements MapperInterface{-/*** @return array*/@@ -58,7 +54,7 @@ class OpposingAccountIbans implements MapperInterfaceif (strlen($iban) > 0) {$topList[$account->id] = $account->iban . ' (' . $account->name . ')';}- if (strlen($iban) === 0) {+ if (0 === strlen($iban)) {$list[$account->id] = $account->name;}}@@ -68,7 +64,6 @@ class OpposingAccountIbans implements MapperInterface$list = $topList + $list;$list = [0 => trans('csv.map_do_not_map')] + $list;-return $list;}}diff --git a/app/Import/Mapper/OpposingAccounts.php b/app/Import/Mapper/OpposingAccounts.phpindex f880ff10d9..c80c1753ab 100644--- a/app/Import/Mapper/OpposingAccounts.php+++ b/app/Import/Mapper/OpposingAccounts.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Import\Mapper;@@ -28,13 +27,10 @@ use FireflyIII\Models\AccountType;use FireflyIII\Repositories\Account\AccountRepositoryInterface;/**- * Class OpposingAccounts- *- * @package FireflyIII\Import\Mapper+ * Class OpposingAccounts.*/class OpposingAccounts implements MapperInterface{-/*** @return array*/diff --git a/app/Import/Mapper/Tags.php b/app/Import/Mapper/Tags.phpindex a09a64c260..8a696ae082 100644--- a/app/Import/Mapper/Tags.php+++ b/app/Import/Mapper/Tags.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Import\Mapper;@@ -27,13 +26,10 @@ use FireflyIII\Models\Tag;use FireflyIII\Repositories\Tag\TagRepositoryInterface;/**- * Class Tags- *- * @package FireflyIII\Import\Mapper+ * Class Tags.*/class Tags implements MapperInterface{-/*** @return array*/diff --git a/app/Import/Mapper/TransactionCurrencies.php b/app/Import/Mapper/TransactionCurrencies.phpindex 2ba0703bd1..0a52533aee 100644--- a/app/Import/Mapper/TransactionCurrencies.php+++ b/app/Import/Mapper/TransactionCurrencies.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Import\Mapper;@@ -26,13 +25,10 @@ namespace FireflyIII\Import\Mapper;use FireflyIII\Models\TransactionCurrency;/**- * Class TransactionCurrencies- *- * @package FireflyIII\Import\Mapper+ * Class TransactionCurrencies.*/class TransactionCurrencies implements MapperInterface{-/*** @return array*/diff --git a/app/Import/MapperPreProcess/PreProcessorInterface.php b/app/Import/MapperPreProcess/PreProcessorInterface.phpindex 5c302557df..c8232d0239 100644--- a/app/Import/MapperPreProcess/PreProcessorInterface.php+++ b/app/Import/MapperPreProcess/PreProcessorInterface.php@@ -18,15 +18,12 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Import\MapperPreProcess;/**- * Interface PreProcessorInterface- *- * @package FireflyIII\Import\MapperPreProcess+ * Interface PreProcessorInterface.*/interface PreProcessorInterface{diff --git a/app/Import/MapperPreProcess/TagsComma.php b/app/Import/MapperPreProcess/TagsComma.phpindex 02032cadcd..a7534f0aeb 100644--- a/app/Import/MapperPreProcess/TagsComma.php+++ b/app/Import/MapperPreProcess/TagsComma.php@@ -18,19 +18,15 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Import\MapperPreProcess;/**- * Class TagsComma- *- * @package FireflyIII\Import\MapperPreProcess+ * Class TagsComma.*/class TagsComma implements PreProcessorInterface{-/*** @param string $value*diff --git a/app/Import/MapperPreProcess/TagsSpace.php b/app/Import/MapperPreProcess/TagsSpace.phpindex 2db886e10b..02f9bcebe9 100644--- a/app/Import/MapperPreProcess/TagsSpace.php+++ b/app/Import/MapperPreProcess/TagsSpace.php@@ -18,15 +18,12 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Import\MapperPreProcess;/**- * Class TagsSpace- *- * @package FireflyIII\Import\MapperPreProcess+ * Class TagsSpace.*/class TagsSpace implements PreProcessorInterface{diff --git a/app/Import/Object/ImportAccount.php b/app/Import/Object/ImportAccount.phpindex 7a26cf9f29..31786c2be5 100644--- a/app/Import/Object/ImportAccount.php+++ b/app/Import/Object/ImportAccount.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Import\Object;@@ -31,19 +30,15 @@ use Illuminate\Support\Collection;use Log;/**- *- * Class ImportAccount- *- * @package FireflyIII\Import\Object+ * Class ImportAccount.*/class ImportAccount{-- /** @var Account */+ /** @var Account */private $account;/** @var array */private $accountIban = [];- /** @var array */+ /** @var array */private $accountId = [];/** @var array */private $accountName = [];@@ -61,9 +56,9 @@ class ImportAccount* @var int*/private $forbiddenAccountId = 0;- /** @var AccountRepositoryInterface */+ /** @var AccountRepositoryInterface */private $repository;- /** @var User */+ /** @var User */private $user;/**@@ -82,7 +77,7 @@ class ImportAccount*/public function getAccount(): Account{- if (is_null($this->account->id)) {+ if (null === $this->account->id) {$this->store();}@@ -174,14 +169,14 @@ class ImportAccount$accountType = AccountType::whereType($this->expectedType)->first();// 1: find by ID, iban or name (and type)- if (count($this->accountId) === 3) {+ if (3 === count($this->accountId)) {Log::debug(sprintf('Finding account of type %d and ID %d', $accountType->id, $this->accountId['value']));/** @var Account $account */$account = $this->user->accounts()->where('id', '!=', $this->forbiddenAccountId)->where('account_type_id', $accountType->id)->where('id',$this->accountId['value'])->first();- if (!is_null($account)) {+ if (null !== $account) {Log::debug(sprintf('Found unmapped %s account by ID (#%d): %s', $this->expectedType, $account->id, $account->name));return $account;@@ -191,7 +186,7 @@ class ImportAccount/** @var Collection $accounts */$accounts = $this->repository->getAccountsByType([$accountType->type]);// Two: find by IBAN (and type):- if (count($this->accountIban) === 3) {+ if (3 === count($this->accountIban)) {$iban = $this->accountIban['value'];Log::debug(sprintf('Finding account of type %d and IBAN %s', $accountType->id, $iban));$filtered = $accounts->filter(@@ -207,14 +202,14 @@ class ImportAccountreturn null;});- if ($filtered->count() === 1) {+ if (1 === $filtered->count()) {return $filtered->first();}Log::debug('Found nothing.');}// Three: find by name (and type):- if (count($this->accountName) === 3) {+ if (3 === count($this->accountName)) {$name = $this->accountName['value'];Log::debug(sprintf('Finding account of type %d and name %s', $accountType->id, $name));$filtered = $accounts->filter(@@ -229,7 +224,7 @@ class ImportAccount});- if ($filtered->count() === 1) {+ if (1 === $filtered->count()) {return $filtered->first();}Log::debug('Found nothing.');@@ -253,7 +248,7 @@ class ImportAccountLog::debug(sprintf('Find mapped account based on field "%s" with value', $field), $array);// check if a pre-mapped object exists.$mapped = $this->getMappedObject($array);- if (!is_null($mapped->id)) {+ if (null !== $mapped->id) {Log::debug(sprintf('Found account #%d!', $mapped->id));return $mapped;@@ -272,13 +267,13 @@ class ImportAccountprivate function getMappedObject(array $array): Account{Log::debug('In getMappedObject() for Account');- if (count($array) === 0) {+ if (0 === count($array)) {Log::debug('Array is empty, nothing will come of this.');return new Account;}- if (array_key_exists('mapped', $array) && is_null($array['mapped'])) {+ if (array_key_exists('mapped', $array) && null === $array['mapped']) {Log::debug(sprintf('No map present for value "%s". Return NULL.', $array['value']));return new Account;@@ -289,7 +284,7 @@ class ImportAccount$search = intval($array['mapped']);$account = $this->repository->find($search);- if (is_null($account->id)) {+ if (null === $account->id) {Log::error(sprintf('There is no account with id #%d. Invalid mapping will be ignored!', $search));return new Account;@@ -297,7 +292,7 @@ class ImportAccount// must be of the same type// except when mapped is an asset, then it's fair game.// which only shows that user must map very carefully.- if ($account->accountType->type !== $this->expectedType && $account->accountType->type !== AccountType::ASSET) {+ if ($account->accountType->type !== $this->expectedType && AccountType::ASSET !== $account->accountType->type) {Log::error(sprintf('Mapped account #%d is of type "%s" but we expect a "%s"-account. Mapping will be ignored.',@@ -322,14 +317,14 @@ class ImportAccount{// 1: find mapped object:$mapped = $this->findMappedObject();- if (!is_null($mapped->id)) {+ if (null !== $mapped->id) {$this->account = $mapped;return true;}// 2: find existing by given values:$found = $this->findExistingObject();- if (!is_null($found->id)) {+ if (null !== $found->id) {$this->account = $found;return true;@@ -340,7 +335,7 @@ class ImportAccount$oldExpectedType = $this->expectedType;$this->expectedType = AccountType::ASSET;$found = $this->findExistingObject();- if (!is_null($found->id)) {+ if (null !== $found->id) {Log::debug('Found asset account!');$this->account = $found;@@ -349,7 +344,7 @@ class ImportAccount$this->expectedType = $oldExpectedType;// 4: if search for an asset account, fall back to given "default account" (mandatory)- if ($this->expectedType === AccountType::ASSET) {+ if (AccountType::ASSET === $this->expectedType) {$this->account = $this->repository->find($this->defaultAccountId);Log::debug(sprintf('Fall back to default account #%d "%s"', $this->account->id, $this->account->name));diff --git a/app/Import/Object/ImportBill.php b/app/Import/Object/ImportBill.phpindex 5a17423b6c..94cacfd7cf 100644--- a/app/Import/Object/ImportBill.php+++ b/app/Import/Object/ImportBill.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Import\Object;@@ -31,13 +30,10 @@ use Log;use Steam;/**- * Class ImportBill- *- * @package FireflyIII\Import\Object+ * Class ImportBill.*/class ImportBill{-/** @var string */private $amount = '1';/** @var Bill */@@ -48,7 +44,7 @@ class ImportBillprivate $name = [];/** @var BillRepositoryInterface */private $repository;- /** @var User */+ /** @var User */private $user;/**@@ -66,7 +62,7 @@ class ImportBill*/public function getBill(): Bill{- if (is_null($this->bill->id)) {+ if (null === $this->bill->id) {$this->store();}@@ -114,11 +110,11 @@ class ImportBillLog::debug('In findExistingObject() for Bill');// 1: find by ID, or name- if (count($this->id) === 3) {+ if (3 === count($this->id)) {Log::debug(sprintf('Finding bill with ID #%d', $this->id['value']));/** @var Bill $bill */$bill = $this->repository->find(intval($this->id['value']));- if (!is_null($bill->id)) {+ if (null !== $bill->id) {Log::debug(sprintf('Found unmapped bill by ID (#%d): %s', $bill->id, $bill->name));return $bill;@@ -126,7 +122,7 @@ class ImportBillLog::debug('Found nothing.');}// 2: find by name- if (count($this->name) === 3) {+ if (3 === count($this->name)) {/** @var Collection $bills */$bills = $this->repository->getBills();$name = $this->name['value'];@@ -143,7 +139,7 @@ class ImportBill});- if ($filtered->count() === 1) {+ if (1 === $filtered->count()) {return $filtered->first();}Log::debug('Found nothing.');@@ -167,7 +163,7 @@ class ImportBillLog::debug(sprintf('Find mapped bill based on field "%s" with value', $field), $array);// check if a pre-mapped object exists.$mapped = $this->getMappedObject($array);- if (!is_null($mapped->id)) {+ if (null !== $mapped->id) {Log::debug(sprintf('Found bill #%d!', $mapped->id));return $mapped;@@ -186,13 +182,13 @@ class ImportBillprivate function getMappedObject(array $array): Bill{Log::debug('In getMappedObject() for Bill');- if (count($array) === 0) {+ if (0 === count($array)) {Log::debug('Array is empty, nothing will come of this.');return new Bill;}- if (array_key_exists('mapped', $array) && is_null($array['mapped'])) {+ if (array_key_exists('mapped', $array) && null === $array['mapped']) {Log::debug(sprintf('No map present for value "%s". Return NULL.', $array['value']));return new Bill;@@ -203,13 +199,12 @@ class ImportBill$search = intval($array['mapped']);$bill = $this->repository->find($search);- if (is_null($bill->id)) {+ if (null === $bill->id) {Log::error(sprintf('There is no bill with id #%d. Invalid mapping will be ignored!', $search));return new Bill;}-Log::debug(sprintf('Found bill! #%d ("%s"). Return it', $bill->id, $bill->name));return $bill;@@ -222,21 +217,21 @@ class ImportBill{// 1: find mapped object:$mapped = $this->findMappedObject();- if (!is_null($mapped->id)) {+ if (null !== $mapped->id) {$this->bill = $mapped;return true;}// 2: find existing by given values:$found = $this->findExistingObject();- if (!is_null($found->id)) {+ if (null !== $found->id) {$this->bill = $found;return true;}$name = $this->name['value'] ?? '';- if (strlen($name) === 0) {+ if (0 === strlen($name)) {return true;}@@ -255,7 +250,6 @@ class ImportBillLog::debug('Found no bill so must create one ourselves. Assume default values.', $data);-$this->bill = $this->repository->store($data);Log::debug(sprintf('Successfully stored new bill #%d: %s', $this->bill->id, $this->bill->name));diff --git a/app/Import/Object/ImportBudget.php b/app/Import/Object/ImportBudget.phpindex 456eb466ce..e8d2a5acf9 100644--- a/app/Import/Object/ImportBudget.php+++ b/app/Import/Object/ImportBudget.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Import\Object;@@ -30,13 +29,10 @@ use Illuminate\Support\Collection;use Log;/**- * Class ImportBudget- *- * @package FireflyIII\Import\Object+ * Class ImportBudget.*/class ImportBudget{-/** @var Budget */private $budget;/** @var array */@@ -45,7 +41,7 @@ class ImportBudgetprivate $name = [];/** @var BudgetRepositoryInterface */private $repository;- /** @var User */+ /** @var User */private $user;/**@@ -63,7 +59,7 @@ class ImportBudget*/public function getBudget(): Budget{- if (is_null($this->budget->id)) {+ if (null === $this->budget->id) {$this->store();}@@ -103,11 +99,11 @@ class ImportBudgetLog::debug('In findExistingObject() for Budget');// 1: find by ID, or name- if (count($this->id) === 3) {+ if (3 === count($this->id)) {Log::debug(sprintf('Finding budget with ID #%d', $this->id['value']));/** @var Budget $budget */$budget = $this->repository->find(intval($this->id['value']));- if (!is_null($budget->id)) {+ if (null !== $budget->id) {Log::debug(sprintf('Found unmapped budget by ID (#%d): %s', $budget->id, $budget->name));return $budget;@@ -115,7 +111,7 @@ class ImportBudgetLog::debug('Found nothing.');}// 2: find by name- if (count($this->name) === 3) {+ if (3 === count($this->name)) {/** @var Collection $budgets */$budgets = $this->repository->getBudgets();$name = $this->name['value'];@@ -132,7 +128,7 @@ class ImportBudget});- if ($filtered->count() === 1) {+ if (1 === $filtered->count()) {return $filtered->first();}Log::debug('Found nothing.');@@ -156,7 +152,7 @@ class ImportBudgetLog::debug(sprintf('Find mapped budget based on field "%s" with value', $field), $array);// check if a pre-mapped object exists.$mapped = $this->getMappedObject($array);- if (!is_null($mapped->id)) {+ if (null !== $mapped->id) {Log::debug(sprintf('Found budget #%d!', $mapped->id));return $mapped;@@ -175,13 +171,13 @@ class ImportBudgetprivate function getMappedObject(array $array): Budget{Log::debug('In getMappedObject() for Budget');- if (count($array) === 0) {+ if (0 === count($array)) {Log::debug('Array is empty, nothing will come of this.');return new Budget;}- if (array_key_exists('mapped', $array) && is_null($array['mapped'])) {+ if (array_key_exists('mapped', $array) && null === $array['mapped']) {Log::debug(sprintf('No map present for value "%s". Return NULL.', $array['value']));return new Budget;@@ -192,7 +188,7 @@ class ImportBudget$search = intval($array['mapped']);$budget = $this->repository->find($search);- if (is_null($budget->id)) {+ if (null === $budget->id) {Log::error(sprintf('There is no budget with id #%d. Invalid mapping will be ignored!', $search));return new Budget;@@ -210,21 +206,21 @@ class ImportBudget{// 1: find mapped object:$mapped = $this->findMappedObject();- if (!is_null($mapped->id)) {+ if (null !== $mapped->id) {$this->budget = $mapped;return true;}// 2: find existing by given values:$found = $this->findExistingObject();- if (!is_null($found->id)) {+ if (null !== $found->id) {$this->budget = $found;return true;}$name = $this->name['value'] ?? '';- if (strlen($name) === 0) {+ if (0 === strlen($name)) {return true;}diff --git a/app/Import/Object/ImportCategory.php b/app/Import/Object/ImportCategory.phpindex e49c38acc4..fca23422ab 100644--- a/app/Import/Object/ImportCategory.php+++ b/app/Import/Object/ImportCategory.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Import\Object;@@ -39,7 +38,7 @@ class ImportCategoryprivate $name = [];/** @var CategoryRepositoryInterface */private $repository;- /** @var User */+ /** @var User */private $user;/**@@ -57,7 +56,7 @@ class ImportCategory*/public function getCategory(): Category{- if (is_null($this->category->id)) {+ if (null === $this->category->id) {$this->store();}@@ -97,11 +96,11 @@ class ImportCategoryLog::debug('In findExistingObject() for Category');// 1: find by ID, or name- if (count($this->id) === 3) {+ if (3 === count($this->id)) {Log::debug(sprintf('Finding category with ID #%d', $this->id['value']));/** @var Category $category */$category = $this->repository->find(intval($this->id['value']));- if (!is_null($category->id)) {+ if (null !== $category->id) {Log::debug(sprintf('Found unmapped category by ID (#%d): %s', $category->id, $category->name));return $category;@@ -109,7 +108,7 @@ class ImportCategoryLog::debug('Found nothing.');}// 2: find by name- if (count($this->name) === 3) {+ if (3 === count($this->name)) {/** @var Collection $categories */$categories = $this->repository->getCategories();$name = $this->name['value'];@@ -126,7 +125,7 @@ class ImportCategory});- if ($filtered->count() === 1) {+ if (1 === $filtered->count()) {return $filtered->first();}Log::debug('Found nothing.');@@ -150,7 +149,7 @@ class ImportCategoryLog::debug(sprintf('Find mapped category based on field "%s" with value', $field), $array);// check if a pre-mapped object exists.$mapped = $this->getMappedObject($array);- if (!is_null($mapped->id)) {+ if (null !== $mapped->id) {Log::debug(sprintf('Found category #%d!', $mapped->id));return $mapped;@@ -169,13 +168,13 @@ class ImportCategoryprivate function getMappedObject(array $array): Category{Log::debug('In getMappedObject() for Category');- if (count($array) === 0) {+ if (0 === count($array)) {Log::debug('Array is empty, nothing will come of this.');return new Category;}- if (array_key_exists('mapped', $array) && is_null($array['mapped'])) {+ if (array_key_exists('mapped', $array) && null === $array['mapped']) {Log::debug(sprintf('No map present for value "%s". Return NULL.', $array['value']));return new Category;@@ -186,7 +185,7 @@ class ImportCategory$search = intval($array['mapped']);$category = $this->repository->find($search);- if (is_null($category->id)) {+ if (null === $category->id) {Log::error(sprintf('There is no category with id #%d. Invalid mapping will be ignored!', $search));return new Category;@@ -204,21 +203,21 @@ class ImportCategory{// 1: find mapped object:$mapped = $this->findMappedObject();- if (!is_null($mapped->id)) {+ if (null !== $mapped->id) {$this->category = $mapped;return true;}// 2: find existing by given values:$found = $this->findExistingObject();- if (!is_null($found->id)) {+ if (null !== $found->id) {$this->category = $found;return true;}$name = $this->name['value'] ?? '';- if (strlen($name) === 0) {+ if (0 === strlen($name)) {return true;}diff --git a/app/Import/Object/ImportCurrency.php b/app/Import/Object/ImportCurrency.phpindex e826d65b8d..d995d7a2bb 100644--- a/app/Import/Object/ImportCurrency.php+++ b/app/Import/Object/ImportCurrency.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Import\Object;@@ -32,17 +31,17 @@ class ImportCurrency{/** @var array */private $code = [];- /** @var TransactionCurrency */+ /** @var TransactionCurrency */private $currency;/** @var array */private $id = [];/** @var array */private $name = [];- /** @var CurrencyRepositoryInterface */+ /** @var CurrencyRepositoryInterface */private $repository;/** @var array */private $symbol = [];- /** @var User */+ /** @var User */private $user;/**@@ -59,14 +58,14 @@ class ImportCurrency*/public function getTransactionCurrency(): TransactionCurrency{- if (!is_null($this->currency->id)) {+ if (null !== $this->currency->id) {return $this->currency;}Log::debug('In createCurrency()');// check if any of them is mapped:$mapped = $this->findMappedObject();- if (!is_null($mapped->id)) {+ if (null !== $mapped->id) {Log::debug('Mapped existing currency.', ['new' => $mapped->toArray()]);$this->currency = $mapped;@@ -74,7 +73,7 @@ class ImportCurrency}$searched = $this->findExistingObject();- if (!is_null($searched->id)) {+ if (null !== $searched->id) {Log::debug('Found existing currency.', ['found' => $searched->toArray()]);$this->currency = $searched;@@ -86,7 +85,7 @@ class ImportCurrency'name' => $this->name['value'] ?? null,'decimal_places' => 2,];- if (is_null($data['code'])) {+ if (null === $data['code']) {Log::debug('Need at least a code to create currency, return nothing.');return new TransactionCurrency();@@ -97,7 +96,6 @@ class ImportCurrency$this->currency = $currency;Log::info('Made new currency.', ['input' => $data, 'new' => $currency->toArray()]);-return $currency;}@@ -156,11 +154,11 @@ class ImportCurrency];foreach ($search as $field => $function) {$value = $this->$field['value'] ?? null;- if (!is_null($value)) {+ if (null !== $value) {Log::debug(sprintf('Searching for %s using function %s and value %s', $field, $function, $value));$currency = $this->repository->$function($value);- if (!is_null($currency->id)) {+ if (null !== $currency->id) {return $currency;}}@@ -181,7 +179,7 @@ class ImportCurrencyLog::debug(sprintf('Find mapped currency based on field "%s" with value', $field), $array);// check if a pre-mapped object exists.$mapped = $this->getMappedObject($array);- if (!is_null($mapped->id)) {+ if (null !== $mapped->id) {Log::debug(sprintf('Found currency #%d!', $mapped->id));return $mapped;@@ -200,13 +198,13 @@ class ImportCurrencyprivate function getMappedObject(array $array): TransactionCurrency{Log::debug('In getMappedObject()');- if (count($array) === 0) {+ if (0 === count($array)) {Log::debug('Array is empty, nothing will come of this.');return new TransactionCurrency;}- if (array_key_exists('mapped', $array) && is_null($array['mapped'])) {+ if (array_key_exists('mapped', $array) && null === $array['mapped']) {Log::debug(sprintf('No map present for value "%s". Return NULL.', $array['value']));return new TransactionCurrency;@@ -217,8 +215,7 @@ class ImportCurrency$search = intval($array['mapped']);$currency = $this->repository->find($search);-- if (is_null($currency->id)) {+ if (null === $currency->id) {Log::error(sprintf('There is no currency with id #%d. Invalid mapping will be ignored!', $search));return new TransactionCurrency;diff --git a/app/Import/Object/ImportJournal.php b/app/Import/Object/ImportJournal.phpindex 2d51098c4f..b78fe908e8 100644--- a/app/Import/Object/ImportJournal.php+++ b/app/Import/Object/ImportJournal.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Import\Object;@@ -34,25 +33,23 @@ use Log;use Steam;/**- * Class ImportJournal- *- * @package FireflyIII\Import\Object+ * Class ImportJournal.*/class ImportJournal{/** @var ImportAccount */public $asset;- /** @var ImportBill */+ /** @var ImportBill */public $bill;/** @var ImportBudget */public $budget;/** @var ImportCategory */public $category;- /** @var ImportCurrency */+ /** @var ImportCurrency */public $currency;- /** @var string */+ /** @var string */public $description = '';- /** @var string */+ /** @var string */public $hash;/** @var array */public $metaDates = [];@@ -64,7 +61,7 @@ class ImportJournalpublic $tags = [];/** @var string */private $amount;- /** @var string */+ /** @var string */private $convertedAmount = null;/** @var string */private $date = '';@@ -72,7 +69,7 @@ class ImportJournalprivate $externalId = '';/** @var array */private $modifiers = [];- /** @var User */+ /** @var User */private $user;/**@@ -98,12 +95,13 @@ class ImportJournal/*** @return string+ ** @throws FireflyException*/public function getAmount(): string{Log::debug('Now in getAmount()');- if (is_null($this->convertedAmount)) {+ if (null === $this->convertedAmount) {Log::debug('convertedAmount is NULL');/** @var ConverterInterface $amountConverter */$amountConverter = app(Amount::class);@@ -124,7 +122,7 @@ class ImportJournalLog::debug(sprintf('After modifiers the result is: "%s"', $this->convertedAmount));}Log::debug(sprintf('convertedAmount is: "%s"', $this->convertedAmount));- if (bccomp($this->convertedAmount, '0') === 0) {+ if (0 === bccomp($this->convertedAmount, '0')) {throw new FireflyException('Amount is zero.');}@@ -154,7 +152,7 @@ class ImportJournal*/public function getDescription(): string{- if ($this->description === '') {+ if ('' === $this->description) {return '(no description)';}diff --git a/app/Import/Routine/ImportRoutine.php b/app/Import/Routine/ImportRoutine.phpindex 9fe520e137..74dc52150c 100644--- a/app/Import/Routine/ImportRoutine.php+++ b/app/Import/Routine/ImportRoutine.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Import\Routine;@@ -35,19 +34,17 @@ use Log;class ImportRoutine{-- /** @var Collection */+ /** @var Collection */public $errors;- /** @var Collection */+ /** @var Collection */public $journals;/** @var int */public $lines = 0;- /** @var ImportJob */+ /** @var ImportJob */private $job;/*** ImportRoutine constructor.- **/public function __construct(){@@ -60,7 +57,7 @@ class ImportRoutine*/public function run(): bool{- if ($this->job->status !== 'configured') {+ if ('configured' !== $this->job->status) {Log::error(sprintf('Job %s is in state "%s" so it cannot be started.', $this->job->key, $this->job->status));return false;@@ -93,7 +90,6 @@ class ImportRoutineLog::info(sprintf('Done with import job %s', $this->job->key));-return true;}@@ -117,8 +113,7 @@ class ImportRoutine$processor = app($class);$processor->setJob($this->job);- if ($this->job->status === 'configured') {-+ if ('configured' === $this->job->status) {// set job as "running"...$this->job->status = 'running';$this->job->save();diff --git a/app/Import/Specifics/AbnAmroDescription.php b/app/Import/Specifics/AbnAmroDescription.phpindex 6a754c50cc..cd884c7c29 100644--- a/app/Import/Specifics/AbnAmroDescription.php+++ b/app/Import/Specifics/AbnAmroDescription.php@@ -18,24 +18,21 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Import\Specifics;/**- * Class AbnAmroDescription+ * Class AbnAmroDescription.** Parses the description from txt files for ABN AMRO bank accounts.** Based on the logic as described in the following Gist:* https://gist.github.com/vDorst/68d555a6a90f62fec004- *- * @package FireflyIII\Import\Specifics*/class AbnAmroDescription implements SpecificInterface{- /** @var array */+ /** @var array */public $row;/**@@ -70,7 +67,6 @@ class AbnAmroDescription implements SpecificInterface// Try to parse the description in known formats.$parsed = $this->parseSepaDescription() || $this->parseTRTPDescription() || $this->parseGEABEADescription() || $this->parseABNAMRODescription();-// If the description could not be parsed, specify an unknown opposing// account, as an opposing account is requiredif (!$parsed) {@@ -81,7 +77,7 @@ class AbnAmroDescription implements SpecificInterface}/**- * Parses the current description with costs from ABN AMRO itself+ * Parses the current description with costs from ABN AMRO itself.** @return bool true if the description is GEA/BEA-format, false otherwise*/@@ -99,7 +95,7 @@ class AbnAmroDescription implements SpecificInterface}/**- * Parses the current description in GEA/BEA format+ * Parses the current description in GEA/BEA format.** @return bool true if the description is GEA/BEAformat, false otherwise*/@@ -107,12 +103,11 @@ class AbnAmroDescription implements SpecificInterface{// See if the current description is formatted in GEA/BEA formatif (preg_match('/([BG]EA) +(NR:[a-zA-Z:0-9]+) +([0-9.\/]+) +([^,]*)/', $this->row[7], $matches)) {-// description and opposing account will be the same.$this->row[8] = $matches[4]; // 'opposing-account-name'$this->row[7] = $matches[4]; // 'description'- if ($matches[1] === 'GEA') {+ if ('GEA' === $matches[1]) {$this->row[7] = 'GEA ' . $matches[4]; // 'description'}@@ -123,7 +118,8 @@ class AbnAmroDescription implements SpecificInterface}/**- * Parses the current description in SEPA format+ * Parses the current description in SEPA format.+ ** @SuppressWarnings(PHPMD.CyclomaticComplexity)** @return bool true if the description is SEPA format, false otherwise@@ -167,7 +163,7 @@ class AbnAmroDescription implements SpecificInterface// Set a new description for the current transaction. If none was given// set the description to type, name and reference$this->row[7] = $newDescription;- if (strlen($newDescription) === 0) {+ if (0 === strlen($newDescription)) {$this->row[7] = sprintf('%s - %s (%s)', $type, $name, $reference);}@@ -178,7 +174,7 @@ class AbnAmroDescription implements SpecificInterface}/**- * Parses the current description in TRTP format+ * Parses the current description in TRTP format.** @return bool true if the description is TRTP format, false otherwise*/@@ -222,7 +218,7 @@ class AbnAmroDescription implements SpecificInterface// Set a new description for the current transaction. If none was given// set the description to type, name and reference$this->row[7] = $newDescription;- if (strlen($newDescription) === 0) {+ if (0 === strlen($newDescription)) {$this->row[7] = sprintf('%s - %s (%s)', $type, $name, $reference);}}diff --git a/app/Import/Specifics/IngDescription.php b/app/Import/Specifics/IngDescription.phpindex 781f7e3395..010b93801d 100644--- a/app/Import/Specifics/IngDescription.php+++ b/app/Import/Specifics/IngDescription.php@@ -1,7 +1,7 @@<?php/*** IngDescription.php- * Copyright (C) 2016 https://github.com/tomwerf+ * Copyright (C) 2016 https://github.com/tomwerf.** This file is part of Firefly III.*@@ -18,13 +18,12 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Import\Specifics;/**- * Class IngDescription+ * Class IngDescription.** Parses the description from CSV files for Ing bank accounts.*@@ -32,12 +31,10 @@ namespace FireflyIII\Import\Specifics;* 'Incasso' the Name of Opposing account the Opposing IBAN number are in the* Description. This class will remove them, and add Name in description by* 'Betaalautomaat' so those are easily recognizable- *- * @package FireflyIII\Import\Specifics*/class IngDescription implements SpecificInterface{- /** @var array */+ /** @var array */public $row;/**@@ -84,7 +81,7 @@ class IngDescription implements SpecificInterface/*** Add the Opposing name from cell 1 in the description for Betaalautomaten- * Otherwise the description is only: 'Pasvolgnr:<nr> <date> Transactie:<NR> Term:<nr>'+ * Otherwise the description is only: 'Pasvolgnr:<nr> <date> Transactie:<NR> Term:<nr>'.** @return bool true*/@@ -97,7 +94,7 @@ class IngDescription implements SpecificInterface/*** Remove IBAN number out of the description- * Default description of Description is: Naam: <OPPOS NAME> Omschrijving: <DESCRIPTION> IBAN: <OPPOS IBAN NR>+ * Default description of Description is: Naam: <OPPOS NAME> Omschrijving: <DESCRIPTION> IBAN: <OPPOS IBAN NR>.** @return bool true*/@@ -110,7 +107,7 @@ class IngDescription implements SpecificInterface}/**- * Remove name from the description (Remove everything before the description incl the word 'Omschrijving' )+ * Remove name from the description (Remove everything before the description incl the word 'Omschrijving' ).** @return bool true*/diff --git a/app/Import/Specifics/PresidentsChoice.php b/app/Import/Specifics/PresidentsChoice.phpindex 7a0331a475..1c0d5ca1ba 100644--- a/app/Import/Specifics/PresidentsChoice.php+++ b/app/Import/Specifics/PresidentsChoice.php@@ -18,19 +18,15 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Import\Specifics;/**- * Class PresidentsChoice- *- * @package FireflyIII\Import\Specifics+ * Class PresidentsChoice.*/class PresidentsChoice implements SpecificInterface{-/*** @return string*/@@ -56,7 +52,7 @@ class PresidentsChoice implements SpecificInterface{// first, if column 2 is empty and 3 is not, do nothing.// if column 3 is empty and column 2 is not, move amount to column 3, *-1- if (isset($row[3]) && strlen($row[3]) === 0) {+ if (isset($row[3]) && 0 === strlen($row[3])) {$row[3] = bcmul($row[2], '-1');}if (isset($row[1])) {diff --git a/app/Import/Specifics/RabobankDescription.php b/app/Import/Specifics/RabobankDescription.phpindex cebaa8aaec..94a9e1f559 100644--- a/app/Import/Specifics/RabobankDescription.php+++ b/app/Import/Specifics/RabobankDescription.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Import\Specifics;@@ -26,9 +25,7 @@ namespace FireflyIII\Import\Specifics;use Log;/**- * Class RabobankDescription- *- * @package FireflyIII\Import\Specifics+ * Class RabobankDescription.*/class RabobankDescription implements SpecificInterface{diff --git a/app/Import/Specifics/SnsDescription.php b/app/Import/Specifics/SnsDescription.phpindex d36aefa82e..3f52171846 100644--- a/app/Import/Specifics/SnsDescription.php+++ b/app/Import/Specifics/SnsDescription.php@@ -21,22 +21,19 @@/*** snsDescription.php- * Author 2017 [email protected]+ * Author 2017 [email protected].** This software may be modified and distributed under the terms of the* Creative Commons Attribution-ShareAlike 4.0 International License.** See the LICENSE file for details.*/-declare(strict_types=1);namespace FireflyIII\Import\Specifics;/**- * Class SnsDescription- *- * @package FireflyIII\Import\Specifics+ * Class SnsDescription.*/class SnsDescription implements SpecificInterface{diff --git a/app/Import/Specifics/SpecificInterface.php b/app/Import/Specifics/SpecificInterface.phpindex c6c1f0a444..837966be3e 100644--- a/app/Import/Specifics/SpecificInterface.php+++ b/app/Import/Specifics/SpecificInterface.php@@ -18,15 +18,12 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Import\Specifics;/**- * Interface SpecificInterface- *- * @package FireflyIII\Import\Specifics+ * Interface SpecificInterface.*/interface SpecificInterface{diff --git a/app/Import/Storage/ImportStorage.php b/app/Import/Storage/ImportStorage.phpindex 02e3ab90cc..47ba783826 100644--- a/app/Import/Storage/ImportStorage.php+++ b/app/Import/Storage/ImportStorage.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Import\Storage;@@ -35,21 +34,19 @@ use Log;/*** Is capable of storing individual ImportJournal objects.- * Class ImportStorage- *- * @package FireflyIII\Import\Storage+ * Class ImportStorage.*/class ImportStorage{use ImportSupport;- /** @var Collection */+ /** @var Collection */public $errors;/** @var Collection */public $journals;- /** @var int */+ /** @var int */protected $defaultCurrencyId = 1; // yes, hard coded- /** @var ImportJob */+ /** @var ImportJob */protected $job;/** @var Collection */protected $rules;@@ -57,7 +54,7 @@ class ImportStorageprivate $dateFormat = 'Ymd';/** @var Collection */private $objects;- /** @var array */+ /** @var array */private $transfers = [];/**@@ -125,6 +122,7 @@ class ImportStorage* @param ImportJournal $importJournal** @return bool+ ** @throws FireflyException*/protected function storeImportJournal(int $index, ImportJournal $importJournal): bool@@ -139,7 +137,7 @@ class ImportStorage$transactionType = $this->getTransactionType($amount, $opposingAccount);$description = $importJournal->getDescription();- /*** First step done! */+ // First step done!$this->job->addStepsDone(1);/**@@ -173,12 +171,11 @@ class ImportStorage'date' => $date,'hash' => $importJournal->hash,'amount' => $amount,-];$journal = $this->storeJournal($parameters);unset($parameters);- /*** Another step done! */+ // Another step done!$this->job->addStepsDone(1);// store meta object things:@@ -202,12 +199,12 @@ class ImportStorage$journal->completed = true;$journal->save();- /*** Another step done! */+ // Another step done!$this->job->addStepsDone(1);// run rules:$this->applyRules($journal);- /*** Another step done! */+ // Another step done!$this->job->addStepsDone(1);$this->journals->push($journal);@@ -224,7 +221,7 @@ class ImportStorageprivate function isDoubleTransfer(array $parameters): bool{Log::debug('Check if is a double transfer.');- if ($parameters['type'] !== TransactionType::TRANSFER) {+ if (TransactionType::TRANSFER !== $parameters['type']) {Log::debug(sprintf('Is a %s, not a transfer so no.', $parameters['type']));return false;@@ -239,23 +236,23 @@ class ImportStorageforeach ($this->transfers as $transfer) {$hits = 0;if ($parameters['description'] === $transfer['description']) {- $hits++;+ ++$hits;Log::debug(sprintf('Description "%s" equals "%s", hits = %d', $parameters['description'], $transfer['description'], $hits));}if ($names === $transfer['names']) {- $hits++;+ ++$hits;Log::debug(sprintf('Involved accounts, "%s" equals "%s", hits = %d', join(',', $names), join(',', $transfer['names']), $hits));}- if (bccomp($amount, $transfer['amount']) === 0) {- $hits++;+ if (0 === bccomp($amount, $transfer['amount'])) {+ ++$hits;Log::debug(sprintf('Amount %s equals %s, hits = %d', $amount, $transfer['amount'], $hits));}if ($parameters['date'] === $transfer['date']) {- $hits++;+ ++$hits;Log::debug(sprintf('Date %s equals %s, hits = %d', $parameters['date'], $transfer['date'], $hits));}// number of hits is 4? Then it's a match- if ($hits === 4) {+ if (4 === $hits) {Log::error('There already is a transfer imported with these properties. Compare existing with new. ',['existing' => $transfer, 'new' => $parameters]@@ -265,7 +262,6 @@ class ImportStorage}}-return false;}}diff --git a/app/Import/Storage/ImportSupport.php b/app/Import/Storage/ImportSupport.phpindex b594d27ee8..248fd2074f 100644--- a/app/Import/Storage/ImportSupport.php+++ b/app/Import/Storage/ImportSupport.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Import\Storage;@@ -46,17 +45,15 @@ use Illuminate\Support\Collection;use Log;/**- * Trait ImportSupport- *- * @package FireflyIII\Import\Storage+ * Trait ImportSupport.*/trait ImportSupport{/** @var int */protected $defaultCurrencyId = 1;- /** @var ImportJob */+ /** @var ImportJob */protected $job;- /** @var Collection */+ /** @var Collection */protected $rules;/**@@ -88,6 +85,7 @@ trait ImportSupport* @param array $parameters** @return bool+ ** @throws FireflyException*/private function createTransaction(array $parameters): bool@@ -100,7 +98,7 @@ trait ImportSupport$transaction->foreign_currency_id = $parameters['foreign_currency'];$transaction->foreign_amount = $parameters['foreign_amount'];$transaction->save();- if (is_null($transaction->id)) {+ if (null === $transaction->id) {$errorText = join(', ', $transaction->getErrors()->all());throw new FireflyException($errorText);}@@ -129,7 +127,7 @@ trait ImportSupport// use given currency$currency = $importJournal->currency->getTransactionCurrency();- if (!is_null($currency->id)) {+ if (null !== $currency->id) {return $currency->id;}@@ -154,7 +152,7 @@ trait ImportSupport{// use given currency by import journal.$currency = $importJournal->currency->getTransactionCurrency();- if (!is_null($currency->id) && $currency->id !== $currencyId) {+ if (null !== $currency->id && $currency->id !== $currencyId) {return $currency->id;}@@ -226,7 +224,9 @@ trait ImportSupport* @param Account $account** @return string+ ** @throws FireflyException+ ** @see ImportSupport::getOpposingAccount()*/private function getTransactionType(string $amount, Account $account): string@@ -237,18 +237,18 @@ trait ImportSupport$transactionType = TransactionType::WITHDRAWAL;}- if (bccomp($amount, '0') === 1) {+ if (1 === bccomp($amount, '0')) {$transactionType = TransactionType::DEPOSIT;}// if opposing is an asset account, it's a transfer:- if ($account->accountType->type === AccountType::ASSET) {+ if (AccountType::ASSET === $account->accountType->type) {Log::debug(sprintf('Opposing account #%d %s is an asset account, make transfer.', $account->id, $account->name));$transactionType = TransactionType::TRANSFER;}// verify that opposing account is of the correct type:- if ($account->accountType->type === AccountType::EXPENSE && $transactionType !== TransactionType::WITHDRAWAL) {+ if (AccountType::EXPENSE === $account->accountType->type && TransactionType::WITHDRAWAL !== $transactionType) {$message = 'This row is imported as a withdrawal but opposing is an expense account. This cannot be!';Log::error($message);throw new FireflyException($message);@@ -289,8 +289,8 @@ trait ImportSupport->where('transaction_types.type', TransactionType::TRANSFER)->get(['transaction_journals.id', 'transaction_journals.encrypted', 'transaction_journals.description',- 'source_accounts.name as source_name', 'destination_accounts.name as destination_name', 'destination.amount'- , 'transaction_journals.date']+ 'source_accounts.name as source_name', 'destination_accounts.name as destination_name', 'destination.amount',+ 'transaction_journals.date',]);$array = [];/** @var TransactionJournal $entry */@@ -323,7 +323,7 @@ trait ImportSupport->where('data', $json)->where('name', 'importHash')->first();- if (!is_null($entry)) {+ if (null !== $entry) {Log::error(sprintf('A journal with hash %s has already been imported (spoiler: it\'s journal #%d)', $hash, $entry->transaction_journal_id));return true;@@ -338,7 +338,7 @@ trait ImportSupport*/private function storeBill(TransactionJournal $journal, Bill $bill){- if (!is_null($bill->id)) {+ if (null !== $bill->id) {Log::debug(sprintf('Linked bill #%d to journal #%d', $bill->id, $journal->id));$journal->bill()->associate($bill);$journal->save();@@ -351,7 +351,7 @@ trait ImportSupport*/private function storeBudget(TransactionJournal $journal, Budget $budget){- if (!is_null($budget->id)) {+ if (null !== $budget->id) {Log::debug(sprintf('Linked budget #%d to journal #%d', $budget->id, $journal->id));$journal->budgets()->save($budget);}@@ -363,7 +363,7 @@ trait ImportSupport*/private function storeCategory(TransactionJournal $journal, Category $category){- if (!is_null($category->id)) {+ if (null !== $category->id) {Log::debug(sprintf('Linked category #%d to journal #%d', $category->id, $journal->id));$journal->categories()->save($category);}@@ -403,7 +403,7 @@ trait ImportSupport'currency' => $parameters['currency'],'amount' => $parameters['amount'],'foreign_currency' => $parameters['foreign_currency'],- 'foreign_amount' => is_null($parameters['foreign_currency']) ? null : $parameters['amount'],+ 'foreign_amount' => null === $parameters['foreign_currency'] ? null : $parameters['amount'],];$opposite = app('steam')->opposite($parameters['amount']);$two = [@@ -412,7 +412,7 @@ trait ImportSupport'currency' => $parameters['currency'],'amount' => $opposite,'foreign_currency' => $parameters['foreign_currency'],- 'foreign_amount' => is_null($parameters['foreign_currency']) ? null : $opposite,+ 'foreign_amount' => null === $parameters['foreign_currency'] ? null : $opposite,];$this->createTransaction($one);$this->createTransaction($two);@@ -449,10 +449,10 @@ trait ImportSupportforeach ($tags as $tag) {$dbTag = $repository->findByTag($tag);- if (is_null($dbTag->id)) {+ if (null === $dbTag->id) {$dbTag = $repository->store(['tag' => $tag, 'date' => null, 'description' => null, 'latitude' => null, 'longitude' => null,- 'zoomLevel' => null, 'tagMode' => 'nothing']+ 'zoomLevel' => null, 'tagMode' => 'nothing',]);}$journal->tags()->save($dbTag);diff --git a/app/Jobs/ExecuteRuleGroupOnExistingTransactions.php b/app/Jobs/ExecuteRuleGroupOnExistingTransactions.phpindex 629a03992c..77aa4174f4 100644--- a/app/Jobs/ExecuteRuleGroupOnExistingTransactions.php+++ b/app/Jobs/ExecuteRuleGroupOnExistingTransactions.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Jobs;@@ -34,9 +33,7 @@ use Illuminate\Queue\SerializesModels;use Illuminate\Support\Collection;/**- * Class ExecuteRuleGroupOnExistingTransactions- *- * @package FireflyIII\Jobs+ * Class ExecuteRuleGroupOnExistingTransactions.*/class ExecuteRuleGroupOnExistingTransactions extends Job implements ShouldQueue{@@ -44,13 +41,13 @@ class ExecuteRuleGroupOnExistingTransactions extends Job implements ShouldQueue/** @var Collection */private $accounts;- /** @var Carbon */+ /** @var Carbon */private $endDate;/** @var RuleGroup */private $ruleGroup;- /** @var Carbon */+ /** @var Carbon */private $startDate;- /** @var User */+ /** @var User */private $user;/**@@ -72,7 +69,6 @@ class ExecuteRuleGroupOnExistingTransactions extends Job implements ShouldQueue}/**- ** @param Collection $accounts*/public function setAccounts(Collection $accounts)@@ -89,7 +85,6 @@ class ExecuteRuleGroupOnExistingTransactions extends Job implements ShouldQueue}/**- ** @param Carbon $date*/public function setEndDate(Carbon $date)@@ -106,7 +101,6 @@ class ExecuteRuleGroupOnExistingTransactions extends Job implements ShouldQueue}/**- ** @param Carbon $date*/public function setStartDate(Carbon $date)@@ -123,7 +117,6 @@ class ExecuteRuleGroupOnExistingTransactions extends Job implements ShouldQueue}/**- ** @param User $user*/public function setUser(User $user)@@ -133,8 +126,6 @@ class ExecuteRuleGroupOnExistingTransactions extends Job implements ShouldQueue/*** Execute the job.- *- * @return void*/public function handle(){@@ -159,7 +150,7 @@ class ExecuteRuleGroupOnExistingTransactions extends Job implements ShouldQueue}/**- * Collect all journals that should be processed+ * Collect all journals that should be processed.** @return Collection*/@@ -174,7 +165,7 @@ class ExecuteRuleGroupOnExistingTransactions extends Job implements ShouldQueue}/**- * Collects a list of rule processors, one for each rule within the rule group+ * Collects a list of rule processors, one for each rule within the rule group.** @return array*/diff --git a/app/Jobs/ExecuteRuleOnExistingTransactions.php b/app/Jobs/ExecuteRuleOnExistingTransactions.phpindex b331e3a300..0c7fbd7fd1 100644--- a/app/Jobs/ExecuteRuleOnExistingTransactions.php+++ b/app/Jobs/ExecuteRuleOnExistingTransactions.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Jobs;@@ -35,9 +34,7 @@ use Illuminate\Support\Collection;use Log;/**- * Class ExecuteRuleOnExistingTransactions- *- * @package FireflyIII\Jobs+ * Class ExecuteRuleOnExistingTransactions.*/class ExecuteRuleOnExistingTransactions extends Job implements ShouldQueue{@@ -45,13 +42,13 @@ class ExecuteRuleOnExistingTransactions extends Job implements ShouldQueue/** @var Collection */private $accounts;- /** @var Carbon */+ /** @var Carbon */private $endDate;/** @var Rule */private $rule;- /** @var Carbon */+ /** @var Carbon */private $startDate;- /** @var User */+ /** @var User */private $user;/**@@ -73,7 +70,6 @@ class ExecuteRuleOnExistingTransactions extends Job implements ShouldQueue}/**- ** @param Collection $accounts*/public function setAccounts(Collection $accounts)@@ -90,7 +86,6 @@ class ExecuteRuleOnExistingTransactions extends Job implements ShouldQueue}/**- ** @param Carbon $date*/public function setEndDate(Carbon $date)@@ -107,7 +102,6 @@ class ExecuteRuleOnExistingTransactions extends Job implements ShouldQueue}/**- ** @param Carbon $date*/public function setStartDate(Carbon $date)@@ -124,7 +118,6 @@ class ExecuteRuleOnExistingTransactions extends Job implements ShouldQueue}/**- ** @param User $user*/public function setUser(User $user)@@ -134,8 +127,6 @@ class ExecuteRuleOnExistingTransactions extends Job implements ShouldQueue/*** Execute the job.- *- * @return void*/public function handle(){@@ -147,13 +138,13 @@ class ExecuteRuleOnExistingTransactions extends Job implements ShouldQueue$total = 0;// Execute the rules for each transactionforeach ($transactions as $transaction) {- $total++;+ ++$total;$result = $processor->handleTransaction($transaction);if ($result) {- $hits++;+ ++$hits;}if (!$result) {- $misses++;+ ++$misses;}Log::info(sprintf('Current progress: %d Transactions. Hits: %d, misses: %d', $total, $hits, $misses));// Stop processing this group if the rule specifies 'stop_processing'@@ -165,7 +156,7 @@ class ExecuteRuleOnExistingTransactions extends Job implements ShouldQueue}/**- * Collect all journals that should be processed+ * Collect all journals that should be processed.** @return Collection*/diff --git a/app/Jobs/Job.php b/app/Jobs/Job.phpindex 51dc805c71..738c8a0ff6 100644--- a/app/Jobs/Job.php+++ b/app/Jobs/Job.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Jobs;@@ -26,9 +25,7 @@ namespace FireflyIII\Jobs;use Illuminate\Bus\Queueable;/**- * Class Job- *- * @package FireflyIII\Jobs+ * Class Job.*/abstract class Job{diff --git a/app/Jobs/MailError.php b/app/Jobs/MailError.phpindex a7d6d47e41..58835eb59f 100644--- a/app/Jobs/MailError.php+++ b/app/Jobs/MailError.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Jobs;@@ -33,21 +32,19 @@ use Mail;use Swift_TransportException;/**- * Class MailError- *- * @package FireflyIII\Jobs+ * Class MailError.*/class MailError extends Job implements ShouldQueue{use InteractsWithQueue, SerializesModels;- /** @var string */+ /** @var string */protected $destination;- /** @var array */+ /** @var array */protected $exception;- /** @var string */+ /** @var string */protected $ipAddress;- /** @var array */+ /** @var array */protected $userData;/**@@ -57,7 +54,6 @@ class MailError extends Job implements ShouldQueue* @param string $destination* @param string $ipAddress* @param array $exceptionData- **/public function __construct(array $userData, string $destination, string $ipAddress, array $exceptionData){@@ -72,8 +68,6 @@ class MailError extends Job implements ShouldQueue/*** Execute the job.- *- * @return void*/public function handle(){@@ -90,7 +84,7 @@ class MailError extends Job implements ShouldQueue['emails.error-html', 'emails.error-text'],$args,function (Message $message) use ($email) {- if ($email !== '[email protected]') {+ if ('[email protected]' !== $email) {$message->to($email, $email)->subject('Caught an error in Firely III');}}diff --git a/app/Mail/AdminTestMail.php b/app/Mail/AdminTestMail.phpindex 20ffc93d85..a0402718d3 100644--- a/app/Mail/AdminTestMail.php+++ b/app/Mail/AdminTestMail.php@@ -1,4 +1,5 @@<?php+declare(strict_types=1);/**@@ -28,17 +29,15 @@ use Illuminate\Mail\Mailable;use Illuminate\Queue\SerializesModels;/**- * Class AdminTestMail- *- * @package FireflyIII\Mail+ * Class AdminTestMail.*/class AdminTestMail extends Mailable{use Queueable, SerializesModels;- /** @var string */+ /** @var string */public $email;- /** @var string */+ /** @var string */public $ipAddress;/**diff --git a/app/Mail/ConfirmEmailChangeMail.php b/app/Mail/ConfirmEmailChangeMail.phpindex cac7ae1d6c..c079c4aac8 100644--- a/app/Mail/ConfirmEmailChangeMail.php+++ b/app/Mail/ConfirmEmailChangeMail.php@@ -1,4 +1,5 @@<?php+declare(strict_types=1);/**@@ -31,13 +32,13 @@ class ConfirmEmailChangeMail extends Mailable{use Queueable, SerializesModels;- /** @var string */+ /** @var string */public $ipAddress;- /** @var string */+ /** @var string */public $newEmail;- /** @var string */+ /** @var string */public $oldEmail;- /** @var string */+ /** @var string */public $uri;/**diff --git a/app/Mail/RegisteredUser.php b/app/Mail/RegisteredUser.phpindex 2b59f302f7..ea8914883f 100644--- a/app/Mail/RegisteredUser.php+++ b/app/Mail/RegisteredUser.php@@ -19,10 +19,8 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);-/*** RegisteredUser.php* Copyright (c) 2017 [email protected]@@ -41,9 +39,9 @@ use Illuminate\Queue\SerializesModels;class RegisteredUser extends Mailable{use Queueable, SerializesModels;- /** @var string */+ /** @var string */public $address;- /** @var string */+ /** @var string */public $ipAddress;/**diff --git a/app/Mail/RequestedNewPassword.php b/app/Mail/RequestedNewPassword.phpindex 3f28c654da..1d236adb5d 100644--- a/app/Mail/RequestedNewPassword.php+++ b/app/Mail/RequestedNewPassword.php@@ -19,10 +19,8 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);-/*** RequestedNewPassword.php* Copyright (c) 2017 [email protected]@@ -41,9 +39,9 @@ use Illuminate\Queue\SerializesModels;class RequestedNewPassword extends Mailable{use Queueable, SerializesModels;- /** @var string */+ /** @var string */public $ipAddress;- /** @var string */+ /** @var string */public $url;/**diff --git a/app/Mail/UndoEmailChangeMail.php b/app/Mail/UndoEmailChangeMail.phpindex 13d61426aa..bc20ed3717 100644--- a/app/Mail/UndoEmailChangeMail.php+++ b/app/Mail/UndoEmailChangeMail.php@@ -1,4 +1,5 @@<?php+declare(strict_types=1);/**@@ -31,13 +32,13 @@ class UndoEmailChangeMail extends Mailable{use Queueable, SerializesModels;- /** @var string */+ /** @var string */public $ipAddress;- /** @var string */+ /** @var string */public $newEmail;- /** @var string */+ /** @var string */public $oldEmail;- /** @var string */+ /** @var string */public $uri;/**diff --git a/app/Models/Account.php b/app/Models/Account.phpindex 09f4499b0e..f076c42aec 100644--- a/app/Models/Account.php+++ b/app/Models/Account.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Models;@@ -37,9 +36,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;use Watson\Validating\ValidatingTrait;/**- * Class Account- *- * @package FireflyIII\Models+ * Class Account.*/class Account extends Model{@@ -70,13 +67,14 @@ class Account extends Model'active' => 'required|boolean','iban' => 'between:1,50|iban',];- /** @var bool */+ /** @var bool */private $joinedAccountTypes;/*** @param array $fields** @return Account+ ** @throws FireflyException*/public static function firstOrCreateEncrypted(array $fields)@@ -99,7 +97,6 @@ class Account extends Model$fields['name'] = $fields['iban'];}-/** @var Account $account */foreach ($set as $account) {if ($account->name === $fields['name']) {@@ -118,7 +115,7 @@ class Account extends Model** @return Account*/- public static function routeBinder(Account $value)+ public static function routeBinder(self $value){if (auth()->check()) {if (intval($value->user_id) === auth()->user()->id) {@@ -151,7 +148,7 @@ class Account extends Model{$name = $this->name;- if ($this->accountType->type === AccountType::CASH) {+ if (AccountType::CASH === $this->accountType->type) {return '';}@@ -159,16 +156,17 @@ class Account extends Model}/**- * FIxxME can return null+ * FIxxME can return null.** @param $value** @return string+ ** @throws FireflyException*/public function getIbanAttribute($value): string{- if (is_null($value) || strlen(strval($value)) === 0) {+ if (null === $value || 0 === strlen(strval($value))) {return '';}try {@@ -176,7 +174,7 @@ class Account extends Model} catch (DecryptException $e) {throw new FireflyException('Cannot decrypt value "' . $value . '" for account #' . $this->id);}- if (is_null($result)) {+ if (null === $result) {return '';}@@ -184,7 +182,6 @@ class Account extends Model}/**- ** @param string $fieldName** @return string@@ -201,7 +198,6 @@ class Account extends Model}/**- ** @param $value** @return string@@ -216,9 +212,10 @@ class Account extends Model}/**- * Returns the opening balance+ * Returns the opening balance.** @return TransactionJournal+ ** @throws FireflyException*/public function getOpeningBalance(): TransactionJournal@@ -228,7 +225,7 @@ class Account extends Model->where('transactions.account_id', $this->id)->transactionTypes([TransactionType::OPENING_BALANCE])->first(['transaction_journals.*']);- if (is_null($journal)) {+ if (null === $journal) {return new TransactionJournal;}@@ -239,6 +236,7 @@ class Account extends Model* Returns the amount of the opening balance for this account.** @return string+ ** @throws FireflyException*/public function getOpeningBalanceAmount(): string@@ -248,16 +246,16 @@ class Account extends Model->where('transactions.account_id', $this->id)->transactionTypes([TransactionType::OPENING_BALANCE])->first(['transaction_journals.*']);- if (is_null($journal)) {+ if (null === $journal) {return '0';}$count = $journal->transactions()->count();- if ($count !== 2) {+ if (2 !== $count) {throw new FireflyException(sprintf('Cannot use getFirstTransaction on journal #%d', $journal->id));}$transaction = $journal->transactions()->where('account_id', $this->id)->first();- if (is_null($transaction)) {+ if (null === $transaction) {return '0';}@@ -265,9 +263,10 @@ class Account extends Model}/**- * Returns the date of the opening balance for this account. If no date, will return 01-01-1900+ * Returns the date of the opening balance for this account. If no date, will return 01-01-1900.** @return Carbon+ ** @throws FireflyException*/public function getOpeningBalanceDate(): Carbon@@ -278,7 +277,7 @@ class Account extends Model->where('transactions.account_id', $this->id)->transactionTypes([TransactionType::OPENING_BALANCE])->first(['transaction_journals.*']);- if (is_null($journal)) {+ if (null === $journal) {return $date;}@@ -294,13 +293,12 @@ class Account extends Model}/**- ** @param EloquentBuilder $query* @param array $types*/public function scopeAccountTypeIn(EloquentBuilder $query, array $types){- if (is_null($this->joinedAccountTypes)) {+ if (null === $this->joinedAccountTypes) {$query->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id');$this->joinedAccountTypes = true;}@@ -308,7 +306,6 @@ class Account extends Model}/**- ** @param EloquentBuilder $query* @param string $name* @param string $value@@ -326,7 +323,6 @@ class Account extends Model}/**- ** @param $value*/public function setIbanAttribute($value)@@ -335,7 +331,6 @@ class Account extends Model}/**- ** @param $value*/public function setNameAttribute($value)@@ -347,7 +342,6 @@ class Account extends Model/*** @param $value- **/public function setVirtualBalanceAttribute($value){diff --git a/app/Models/AccountMeta.php b/app/Models/AccountMeta.phpindex 9eb33eae71..b4e6c3053f 100644--- a/app/Models/AccountMeta.php+++ b/app/Models/AccountMeta.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Models;@@ -27,13 +26,10 @@ use Illuminate\Database\Eloquent\Model;use Illuminate\Database\Eloquent\Relations\BelongsTo;/**- * Class AccountMeta- *- * @package FireflyIII\Models+ * Class AccountMeta.*/class AccountMeta extends Model{-/*** The attributes that should be casted to native types.*@@ -49,7 +45,6 @@ class AccountMeta extends Modelprotected $table = 'account_meta';/**- ** @return BelongsTo*/public function account(): BelongsTo@@ -57,7 +52,6 @@ class AccountMeta extends Modelreturn $this->belongsTo('FireflyIII\Models\Account');}-/*** @param $value*diff --git a/app/Models/AccountType.php b/app/Models/AccountType.phpindex 6e2a93de3c..0b00a1bce4 100644--- a/app/Models/AccountType.php+++ b/app/Models/AccountType.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Models;@@ -27,9 +26,7 @@ use Illuminate\Database\Eloquent\Model;use Illuminate\Database\Eloquent\Relations\HasMany;/**- * Class AccountType- *- * @package FireflyIII\Models+ * Class AccountType.*/class AccountType extends Model{@@ -42,7 +39,6 @@ class AccountType extends Modelconst BENEFICIARY = 'Beneficiary account';const IMPORT = 'Import account';-/*** The attributes that should be casted to native types.*diff --git a/app/Models/Attachment.php b/app/Models/Attachment.phpindex 268d16fb18..47075945dc 100644--- a/app/Models/Attachment.php+++ b/app/Models/Attachment.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Models;@@ -31,9 +30,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;/**- * Class Attachment- *- * @package FireflyIII\Models+ * Class Attachment.*/class Attachment extends Model{@@ -59,7 +56,7 @@ class Attachment extends Model** @return Attachment*/- public static function routeBinder(Attachment $value)+ public static function routeBinder(self $value){if (auth()->check()) {if (intval($value->user_id) === auth()->user()->id) {@@ -96,7 +93,7 @@ class Attachment extends Model*/public function getDescriptionAttribute($value){- if (is_null($value) || strlen($value) === 0) {+ if (null === $value || 0 === strlen($value)) {return null;}@@ -110,7 +107,7 @@ class Attachment extends Model*/public function getFilenameAttribute($value){- if (is_null($value) || strlen($value) === 0) {+ if (null === $value || 0 === strlen($value)) {return null;}@@ -124,7 +121,7 @@ class Attachment extends Model*/public function getMimeAttribute($value){- if (is_null($value) || strlen($value) === 0) {+ if (null === $value || 0 === strlen($value)) {return null;}@@ -132,14 +129,13 @@ class Attachment extends Model}/**- ** @param $value** @return null|string*/public function getNotesAttribute($value){- if (is_null($value) || strlen($value) === 0) {+ if (null === $value || 0 === strlen($value)) {return null;}@@ -147,14 +143,13 @@ class Attachment extends Model}/**- ** @param $value** @return null|string*/public function getTitleAttribute($value){- if (is_null($value) || strlen($value) === 0) {+ if (null === $value || 0 === strlen($value)) {return null;}diff --git a/app/Models/AvailableBudget.php b/app/Models/AvailableBudget.phpindex bbb342f40e..9e90b2572f 100644--- a/app/Models/AvailableBudget.php+++ b/app/Models/AvailableBudget.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Models;@@ -28,9 +27,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;use Illuminate\Database\Eloquent\SoftDeletes;/**- * Class AvailableBudget- *- * @package FireflyIII\Models+ * Class AvailableBudget.*/class AvailableBudget extends Model{diff --git a/app/Models/Bill.php b/app/Models/Bill.phpindex a4e4655133..2154088715 100644--- a/app/Models/Bill.php+++ b/app/Models/Bill.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Models;@@ -32,9 +31,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;use Watson\Validating\ValidatingTrait;/**- * Class Bill- *- * @package FireflyIII\Models+ * Class Bill.*/class Bill extends Model{@@ -60,14 +57,14 @@ class Bill extends Model= ['name', 'match', 'amount_min', 'match_encrypted', 'name_encrypted', 'user_id', 'amount_max', 'date', 'repeat_freq', 'skip','automatch', 'active',];protected $hidden = ['amount_min_encrypted', 'amount_max_encrypted', 'name_encrypted', 'match_encrypted'];- protected $rules = ['name' => 'required|between:1,200',];+ protected $rules = ['name' => 'required|between:1,200'];/*** @param Bill $value** @return Bill*/- public static function routeBinder(Bill $value)+ public static function routeBinder(self $value){if (auth()->check()) {if (intval($value->user_id) === auth()->user()->id) {@@ -84,7 +81,7 @@ class Bill extends Model*/public function getMatchAttribute($value){- if (intval($this->match_encrypted) === 1) {+ if (1 === intval($this->match_encrypted)) {return Crypt::decrypt($value);}@@ -98,7 +95,7 @@ class Bill extends Model*/public function getNameAttribute($value){- if (intval($this->name_encrypted) === 1) {+ if (1 === intval($this->name_encrypted)) {return Crypt::decrypt($value);}diff --git a/app/Models/Budget.php b/app/Models/Budget.phpindex 5ce779ad83..ccc9774480 100644--- a/app/Models/Budget.php+++ b/app/Models/Budget.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Models;@@ -31,9 +30,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;use Watson\Validating\ValidatingTrait;/**- * Class Budget- *- * @package FireflyIII\Models+ * Class Budget.*/class Budget extends Model{@@ -57,7 +54,7 @@ class Budget extends Model/** @var array */protected $hidden = ['encrypted'];/** @var array */- protected $rules = ['name' => 'required|between:1,200',];+ protected $rules = ['name' => 'required|between:1,200'];/*** @param array $fields@@ -91,7 +88,7 @@ class Budget extends Model** @return Budget*/- public static function routeBinder(Budget $value)+ public static function routeBinder(self $value){if (auth()->check()) {if (intval($value->user_id) === auth()->user()->id) {@@ -102,7 +99,6 @@ class Budget extends Model}/**- ** @return \Illuminate\Database\Eloquent\Relations\HasMany*/public function budgetlimits()diff --git a/app/Models/BudgetLimit.php b/app/Models/BudgetLimit.phpindex f120cd5a5b..00c7271711 100644--- a/app/Models/BudgetLimit.php+++ b/app/Models/BudgetLimit.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Models;@@ -27,13 +26,10 @@ use Illuminate\Database\Eloquent\Model;use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;/**- * Class BudgetLimit- *- * @package FireflyIII\Models+ * Class BudgetLimit.*/class BudgetLimit extends Model{-/*** The attributes that should be casted to native types.*@@ -85,7 +81,6 @@ class BudgetLimit extends Modelreturn $this->hasMany('FireflyIII\Models\LimitRepetition');}-/*** @param $value*/diff --git a/app/Models/Category.php b/app/Models/Category.phpindex a6760c5d8f..1edc7f8432 100644--- a/app/Models/Category.php+++ b/app/Models/Category.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Models;@@ -31,9 +30,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;use Watson\Validating\ValidatingTrait;/**- * Class Category- *- * @package FireflyIII\Models+ * Class Category.*/class Category extends Model{@@ -56,7 +53,7 @@ class Category extends Model/** @var array */protected $hidden = ['encrypted'];/** @var array */- protected $rules = ['name' => 'required|between:1,200',];+ protected $rules = ['name' => 'required|between:1,200'];/*** @param array $fields@@ -90,7 +87,7 @@ class Category extends Model** @return Category*/- public static function routeBinder(Category $value)+ public static function routeBinder(self $value){if (auth()->check()) {if (intval($value->user_id) === auth()->user()->id) {@@ -101,7 +98,6 @@ class Category extends Model}/**- ** @param $value** @return string@@ -116,7 +112,6 @@ class Category extends Model}/**- ** @param $value*/public function setNameAttribute($value)diff --git a/app/Models/Configuration.php b/app/Models/Configuration.phpindex d399ffee55..028f5faf57 100644--- a/app/Models/Configuration.php+++ b/app/Models/Configuration.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Models;@@ -27,9 +26,7 @@ use Illuminate\Database\Eloquent\Model;use Illuminate\Database\Eloquent\SoftDeletes;/**- * Class Configuration- *- * @package FireflyIII\Models+ * Class Configuration.*/class Configuration extends Model{diff --git a/app/Models/CurrencyExchangeRate.php b/app/Models/CurrencyExchangeRate.phpindex 27c44b51ba..acea35d9f2 100644--- a/app/Models/CurrencyExchangeRate.php+++ b/app/Models/CurrencyExchangeRate.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Models;@@ -28,13 +27,10 @@ use Illuminate\Database\Eloquent\Model;use Illuminate\Database\Eloquent\Relations\BelongsTo;/**- * Class CurrencyExchange- *- * @package FireflyIII\Models+ * Class CurrencyExchange.*/class CurrencyExchangeRate extends Model{-/** @var array */protected $dates = ['date'];diff --git a/app/Models/ExportJob.php b/app/Models/ExportJob.phpindex 2d223402f0..599b6bdba9 100644--- a/app/Models/ExportJob.php+++ b/app/Models/ExportJob.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Models;@@ -28,11 +27,9 @@ use Illuminate\Database\Eloquent\Model;use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;/**- * Class ExportJob+ * Class ExportJob.** @property User $user- *- * @package FireflyIII\Models*/class ExportJob extends Model{@@ -47,13 +44,14 @@ class ExportJob extends Model* @param $value** @return mixed+ ** @throws NotFoundHttpException*/public static function routeBinder($value){if (auth()->check()) {$model = self::where('key', $value)->where('user_id', auth()->user()->id)->first();- if (!is_null($model)) {+ if (null !== $model) {return $model;}}diff --git a/app/Models/ImportJob.php b/app/Models/ImportJob.phpindex 781ea2f27c..74c7e591f9 100644--- a/app/Models/ImportJob.php+++ b/app/Models/ImportJob.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Models;@@ -30,13 +29,10 @@ use Storage;use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;/**- * Class ImportJob- *- * @package FireflyIII\Models+ * Class ImportJob.*/class ImportJob extends Model{-/*** The attributes that should be casted to native types.*@@ -61,13 +57,14 @@ class ImportJob extends Model* @param $value** @return mixed+ ** @throws NotFoundHttpException*/public static function routeBinder($value){if (auth()->check()) {$model = self::where('key', $value)->where('user_id', auth()->user()->id)->first();- if (!is_null($model)) {+ if (null !== $model) {return $model;}}@@ -127,10 +124,10 @@ class ImportJob extends Model*/public function getConfigurationAttribute($value){- if (is_null($value)) {+ if (null === $value) {return [];}- if (strlen($value) === 0) {+ if (0 === strlen($value)) {return [];}@@ -144,7 +141,7 @@ class ImportJob extends Model*/public function getExtendedStatusAttribute($value){- if (strlen($value) === 0) {+ if (0 === strlen($value)) {return [];}diff --git a/app/Models/LimitRepetition.php b/app/Models/LimitRepetition.phpindex 5b049fdb33..2493c9ac1f 100644--- a/app/Models/LimitRepetition.php+++ b/app/Models/LimitRepetition.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Models;@@ -28,14 +27,12 @@ use Illuminate\Database\Eloquent\Builder;use Illuminate\Database\Eloquent\Model;/**- * Class LimitRepetition+ * Class LimitRepetition.** @deprecated- * @package FireflyIII\Models*/class LimitRepetition extends Model{-/*** The attributes that should be casted to native types.*@@ -62,10 +59,8 @@ class LimitRepetition extends Model}/**- ** @param Builder $query* @param Carbon $date- **/public function scopeAfter(Builder $query, Carbon $date){@@ -73,10 +68,8 @@ class LimitRepetition extends Model}/**- ** @param Builder $query* @param Carbon $date- **/public function scopeBefore(Builder $query, Carbon $date){diff --git a/app/Models/LinkType.php b/app/Models/LinkType.phpindex 25c64ee0af..0c0e0cfac7 100644--- a/app/Models/LinkType.php+++ b/app/Models/LinkType.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Models;@@ -29,8 +28,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;/*** @property int $journalCount* Class LinkType- *- * @package FireflyIII\Models*/class LinkType extends Model{@@ -54,13 +51,14 @@ class LinkType extends Model* @param $value** @return mixed+ ** @throws NotFoundHttpException*/public static function routeBinder($value){if (auth()->check()) {$model = self::where('id', $value)->first();- if (!is_null($model)) {+ if (null !== $model) {return $model;}}diff --git a/app/Models/Note.php b/app/Models/Note.phpindex 9f8a1b410b..4d5d2bfafb 100644--- a/app/Models/Note.php+++ b/app/Models/Note.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Models;@@ -27,9 +26,7 @@ use Illuminate\Database\Eloquent\Model;use League\CommonMark\CommonMarkConverter;/**- * Class Note- *- * @package FireflyIII\Models+ * Class Note.*/class Note extends Model{@@ -59,7 +56,7 @@ class Note extends Model/*** Get all of the owning noteable models. Currently piggy bank and- * transaction journal+ * transaction journal.*/public function noteable(){diff --git a/app/Models/PiggyBank.php b/app/Models/PiggyBank.phpindex 1bb4dd2952..ebb5f74887 100644--- a/app/Models/PiggyBank.php+++ b/app/Models/PiggyBank.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Models;@@ -32,9 +31,7 @@ use Steam;use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;/**- * Class PiggyBank- *- * @package FireflyIII\Models+ * Class PiggyBank.*/class PiggyBank extends Model{@@ -68,7 +65,7 @@ class PiggyBank extends Model** @return PiggyBank*/- public static function routeBinder(PiggyBank $value)+ public static function routeBinder(self $value){if (auth()->check()) {if (intval($value->account->user_id) === auth()->user()->id) {@@ -87,19 +84,19 @@ class PiggyBank extends Model}/**- * Grabs the PiggyBankRepetition that's currently relevant / active+ * Grabs the PiggyBankRepetition that's currently relevant / active.** @returns PiggyBankRepetition*/public function currentRelevantRep(): PiggyBankRepetition{- if (!is_null($this->currentRep)) {+ if (null !== $this->currentRep) {return $this->currentRep;}// repeating piggy banks are no longer supported./** @var PiggyBankRepetition $rep */$rep = $this->piggyBankRepetitions()->first(['piggy_bank_repetitions.*']);- if (is_null($rep)) {+ if (null === $rep) {return new PiggyBankRepetition();}$this->currentRep = $rep;@@ -108,7 +105,6 @@ class PiggyBank extends Model}/**- ** @param $value** @return string@@ -134,12 +130,12 @@ class PiggyBank extends Model$remainingAmount = bcsub($this->targetamount, $this->currentRelevantRep()->currentamount);// more than 1 month to go and still need money to save:- if ($diffInMonths > 0 && bccomp($remainingAmount, '0') === 1) {+ if ($diffInMonths > 0 && 1 === bccomp($remainingAmount, '0')) {$savePerMonth = bcdiv($remainingAmount, strval($diffInMonths));}// less than 1 month to go but still need money to save:- if ($diffInMonths === 0 && bccomp($remainingAmount, '0') === 1) {+ if (0 === $diffInMonths && 1 === bccomp($remainingAmount, '0')) {$savePerMonth = $remainingAmount;}}@@ -148,7 +144,6 @@ class PiggyBank extends Model}/**- ** @param Carbon $date** @return string@@ -156,7 +151,7 @@ class PiggyBank extends Modelpublic function leftOnAccount(Carbon $date): string{$balance = Steam::balanceIgnoreVirtual($this->account, $date);- /** @var PiggyBank $p */+ // @var PiggyBank $pforeach ($this->account->piggyBanks as $piggyBank) {$currentAmount = $piggyBank->currentRelevantRep()->currentamount ?? '0';@@ -191,7 +186,6 @@ class PiggyBank extends Model}/**- ** @param $value*/public function setNameAttribute($value)diff --git a/app/Models/PiggyBankEvent.php b/app/Models/PiggyBankEvent.phpindex 389c8607a7..4ec1836c9b 100644--- a/app/Models/PiggyBankEvent.php+++ b/app/Models/PiggyBankEvent.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Models;@@ -26,13 +25,10 @@ namespace FireflyIII\Models;use Illuminate\Database\Eloquent\Model;/**- * Class PiggyBankEvent- *- * @package FireflyIII\Models+ * Class PiggyBankEvent.*/class PiggyBankEvent extends Model{-/*** The attributes that should be casted to native types.*diff --git a/app/Models/PiggyBankRepetition.php b/app/Models/PiggyBankRepetition.phpindex 801eb44ad0..edb2f51841 100644--- a/app/Models/PiggyBankRepetition.php+++ b/app/Models/PiggyBankRepetition.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Models;@@ -28,13 +27,10 @@ use Illuminate\Database\Eloquent\Builder as EloquentBuilder;use Illuminate\Database\Eloquent\Model;/**- * Class PiggyBankRepetition- *- * @package FireflyIII\Models+ * Class PiggyBankRepetition.*/class PiggyBankRepetition extends Model{-/*** The attributes that should be casted to native types.*diff --git a/app/Models/Preference.php b/app/Models/Preference.phpindex 5aee3161ab..a5296a2036 100644--- a/app/Models/Preference.php+++ b/app/Models/Preference.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Models;@@ -31,13 +30,10 @@ use Illuminate\Database\Eloquent\Model;use Log;/**- * Class Preference- *- * @package FireflyIII\Models+ * Class Preference.*/class Preference extends Model{-/*** The attributes that should be casted to native types.*@@ -56,6 +52,7 @@ class Preference extends Model* @param $value** @return mixed+ ** @throws FireflyException*/public function getDataAttribute($value)@@ -74,7 +71,7 @@ class Preference extends Model} catch (Exception $e) {// don't care, assume is false.}- if (!($unserialized === false)) {+ if (!(false === $unserialized)) {return $unserialized;}diff --git a/app/Models/Role.php b/app/Models/Role.phpindex 6b3eb96012..27a01851d5 100644--- a/app/Models/Role.php+++ b/app/Models/Role.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Models;@@ -27,9 +26,7 @@ use Illuminate\Database\Eloquent\Model;use Illuminate\Database\Eloquent\Relations\BelongsToMany;/**- * Class Role- *- * @package FireflyIII\Models+ * Class Role.*/class Role extends Model{@@ -44,7 +41,6 @@ class Role extends Model'updated_at' => 'datetime',];-/*** @return \Illuminate\Database\Eloquent\Relations\BelongsToMany*/diff --git a/app/Models/Rule.php b/app/Models/Rule.phpindex d327b3c6b9..6e2101b1d4 100644--- a/app/Models/Rule.php+++ b/app/Models/Rule.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Models;@@ -28,9 +27,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;/**- * Class Rule- *- * @package FireflyIII\Models+ * Class Rule.*/class Rule extends Model{@@ -56,7 +53,7 @@ class Rule extends Model** @return Rule*/- public static function routeBinder(Rule $value)+ public static function routeBinder(self $value){if (auth()->check()) {if (intval($value->user_id) === auth()->user()->id) {diff --git a/app/Models/RuleAction.php b/app/Models/RuleAction.phpindex c26359ab62..3bfdacc406 100644--- a/app/Models/RuleAction.php+++ b/app/Models/RuleAction.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Models;@@ -26,9 +25,7 @@ namespace FireflyIII\Models;use Illuminate\Database\Eloquent\Model;/**- * Class RuleAction- *- * @package FireflyIII\Models+ * Class RuleAction.*/class RuleAction extends Model{diff --git a/app/Models/RuleGroup.php b/app/Models/RuleGroup.phpindex e2d13773ec..e022f486d1 100644--- a/app/Models/RuleGroup.php+++ b/app/Models/RuleGroup.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Models;@@ -28,9 +27,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;/**- * Class RuleGroup- *- * @package FireflyIII\Models+ * Class RuleGroup.*/class RuleGroup extends Model{@@ -56,7 +53,7 @@ class RuleGroup extends Model** @return RuleGroup*/- public static function routeBinder(RuleGroup $value)+ public static function routeBinder(self $value){if (auth()->check()) {if (intval($value->user_id) === auth()->user()->id) {diff --git a/app/Models/RuleTrigger.php b/app/Models/RuleTrigger.phpindex 629b283ee1..bf867571a6 100644--- a/app/Models/RuleTrigger.php+++ b/app/Models/RuleTrigger.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Models;@@ -26,9 +25,7 @@ namespace FireflyIII\Models;use Illuminate\Database\Eloquent\Model;/**- * Class RuleTrigger- *- * @package FireflyIII\Models+ * Class RuleTrigger.*/class RuleTrigger extends Model{diff --git a/app/Models/Tag.php b/app/Models/Tag.phpindex 060003a0d7..ff4b2dba32 100644--- a/app/Models/Tag.php+++ b/app/Models/Tag.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Models;@@ -30,9 +29,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;use Watson\Validating\ValidatingTrait;/**- * Class Tag- *- * @package FireflyIII\Models+ * Class Tag.*/class Tag extends Model{@@ -50,15 +47,13 @@ class Tag extends Model'deleted_at' => 'datetime','date' => 'date','zoomLevel' => 'int',-];/** @var array */protected $dates = ['date'];/** @var array */protected $fillable = ['user_id', 'tag', 'date', 'description', 'longitude', 'latitude', 'zoomLevel', 'tagMode'];/** @var array */- protected $rules = ['tag' => 'required|between:1,200',];-+ protected $rules = ['tag' => 'required|between:1,200'];/*** @param array $fields@@ -96,7 +91,7 @@ class Tag extends Model** @return Tag*/- public static function routeBinder(Tag $value)+ public static function routeBinder(self $value){if (auth()->check()) {if (intval($value->user_id) === auth()->user()->id) {@@ -111,7 +106,7 @@ class Tag extends Model** @return string*/- public static function tagSum(Tag $tag): string+ public static function tagSum(self $tag): string{$sum = '0';/** @var TransactionJournal $journal */@@ -123,14 +118,13 @@ class Tag extends Model}/**- ** @param $value** @return string*/public function getDescriptionAttribute($value){- if (is_null($value)) {+ if (null === $value) {return $value;}@@ -138,14 +132,13 @@ class Tag extends Model}/**- ** @param $value** @return string*/public function getTagAttribute($value){- if (is_null($value)) {+ if (null === $value) {return null;}@@ -155,7 +148,7 @@ class Tag extends Model/*** Save the model to the database.*- * @param array $options+ * @param array $options** @return bool*/@@ -171,7 +164,6 @@ class Tag extends Model}/**- ** @param $value*/public function setDescriptionAttribute($value)@@ -180,7 +172,6 @@ class Tag extends Model}/**- ** @param $value*/public function setTagAttribute($value)diff --git a/app/Models/Transaction.php b/app/Models/Transaction.phpindex 504782567b..ca77193672 100644--- a/app/Models/Transaction.php+++ b/app/Models/Transaction.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Models;@@ -30,53 +29,43 @@ use Illuminate\Database\Eloquent\SoftDeletes;use Watson\Validating\ValidatingTrait;/**- * Class Transaction- *- * @property-read int $journal_id- * @property Carbon $date- * @property-read string $transaction_description- * @property string $transaction_amount- * @property string $transaction_foreign_amount- * @property string $transaction_type_type- * @property string $foreign_currency_symbol- * @property int $foreign_currency_dp- *- * @property int $account_id- * @property string $account_name- * @property string $account_iban- * @property string $account_number- * @property string $account_bic- * @property string $account_currency_code- *- * @property int $opposing_account_id- * @property string $opposing_account_name- * @property string $opposing_account_iban- * @property string $opposing_account_number- * @property string $opposing_account_bic- * @property string $opposing_currency_code- *- *- * @property int $transaction_budget_id- * @property string $transaction_budget_name- * @property int $transaction_journal_budget_id- * @property string $transaction_journal_budget_name- *- * @property-read int $transaction_category_id- * @property-read string $transaction_category_name- * @property-read int $transaction_journal_category_id- * @property-read string $transaction_journal_category_name+ * Class Transaction.*- * @property-read int $bill_id- * @property string $bill_name- *- * @property string $notes- * @property string $tags- *- * @property string $transaction_currency_symbol- * @property int $transaction_currency_dp- * @property string $transaction_currency_code- *- * @package FireflyIII\Models+ * @property int $journal_id+ * @property Carbon $date+ * @property string $transaction_description+ * @property string $transaction_amount+ * @property string $transaction_foreign_amount+ * @property string $transaction_type_type+ * @property string $foreign_currency_symbol+ * @property int $foreign_currency_dp+ * @property int $account_id+ * @property string $account_name+ * @property string $account_iban+ * @property string $account_number+ * @property string $account_bic+ * @property string $account_currency_code+ * @property int $opposing_account_id+ * @property string $opposing_account_name+ * @property string $opposing_account_iban+ * @property string $opposing_account_number+ * @property string $opposing_account_bic+ * @property string $opposing_currency_code+ * @property int $transaction_budget_id+ * @property string $transaction_budget_name+ * @property int $transaction_journal_budget_id+ * @property string $transaction_journal_budget_name+ * @property int $transaction_category_id+ * @property string $transaction_category_name+ * @property int $transaction_journal_category_id+ * @property string $transaction_journal_category_name+ * @property int $bill_id+ * @property string $bill_name+ * @property string $notes+ * @property string $tags+ * @property string $transaction_currency_symbol+ * @property int $transaction_currency_dp+ * @property string $transaction_currency_code*/class Transaction extends Model{@@ -97,7 +86,7 @@ class Transaction extends Model];protected $fillable= ['account_id', 'transaction_journal_id', 'description', 'amount', 'identifier', 'transaction_currency_id', 'foreign_currency_id',- 'foreign_amount'];+ 'foreign_amount',];protected $hidden = ['encrypted'];protected $rules= [@@ -117,7 +106,7 @@ class Transaction extends Modelpublic static function isJoined(Builder $query, string $table): bool{$joins = $query->getQuery()->joins;- if (is_null($joins)) {+ if (null === $joins) {return false;}foreach ($joins as $join) {@@ -174,7 +163,6 @@ class Transaction extends Model}/**- ** @param Builder $query* @param Carbon $date*/@@ -187,10 +175,8 @@ class Transaction extends Model}/**- ** @param Builder $query* @param Carbon $date- **/public function scopeBefore(Builder $query, Carbon $date){@@ -201,7 +187,6 @@ class Transaction extends Model}/**- ** @param Builder $query* @param array $types*/diff --git a/app/Models/TransactionCurrency.php b/app/Models/TransactionCurrency.phpindex 7737175352..5e8b4dfe7f 100644--- a/app/Models/TransactionCurrency.php+++ b/app/Models/TransactionCurrency.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Models;@@ -28,9 +27,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;/**- * Class TransactionCurrency- *- * @package FireflyIII\Models+ * Class TransactionCurrency.*/class TransactionCurrency extends Model{@@ -58,7 +55,7 @@ class TransactionCurrency extends Model** @return TransactionCurrency*/- public static function routeBinder(TransactionCurrency $currency)+ public static function routeBinder(self $currency){if (auth()->check()) {return $currency;diff --git a/app/Models/TransactionJournal.php b/app/Models/TransactionJournal.phpindex 545890814b..c1001ee2d2 100644--- a/app/Models/TransactionJournal.php+++ b/app/Models/TransactionJournal.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Models;@@ -38,9 +37,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;use Watson\Validating\ValidatingTrait;/**- * Class TransactionJournal- *- * @package FireflyIII\Models+ * Class TransactionJournal.*/class TransactionJournal extends Model{@@ -71,7 +68,7 @@ class TransactionJournal extends Modelprotected $fillable= ['user_id', 'transaction_type_id', 'bill_id', 'interest_date', 'book_date', 'process_date','transaction_currency_id', 'description', 'completed',- 'date', 'rent_date', 'encrypted', 'tag_count'];+ 'date', 'rent_date', 'encrypted', 'tag_count',];/** @var array */protected $hidden = ['encrypted'];/** @var array */@@ -89,6 +86,7 @@ class TransactionJournal extends Model* @param $value** @return mixed+ ** @throws NotFoundHttpException*/public static function routeBinder($value)@@ -98,7 +96,7 @@ class TransactionJournal extends Model->with('transactionType')->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')->where('user_id', auth()->user()->id)->first(['transaction_journals.*']);- if (!is_null($object)) {+ if (null !== $object) {return $object;}}@@ -159,7 +157,6 @@ class TransactionJournal extends Model}/**- ** @param $value** @return string@@ -174,7 +171,6 @@ class TransactionJournal extends Model}/**- ** @param string $name** @return string@@ -193,14 +189,14 @@ class TransactionJournal extends ModelLog::debug(sprintf('Looking for journal #%d meta field "%s".', $this->id, $name));$entry = $this->transactionJournalMeta()->where('name', $name)->first();- if (!is_null($entry)) {+ if (null !== $entry) {$value = $entry->data;// cache:$cache->store($value);}// convert to Carbon if name is _date- if (!is_null($value) && substr($name, -5) === '_date') {+ if (null !== $value && '_date' === substr($name, -5)) {$value = new Carbon($value);// cache:$cache->store($value);@@ -216,7 +212,7 @@ class TransactionJournal extends Model*/public function hasMeta(string $name): bool{- return !is_null($this->getMeta($name));+ return null !== $this->getMeta($name);}/**@@ -224,47 +220,44 @@ class TransactionJournal extends Model*/public function isDeposit(): bool{- if (!is_null($this->transaction_type_type)) {- return $this->transaction_type_type === TransactionType::DEPOSIT;+ if (null !== $this->transaction_type_type) {+ return TransactionType::DEPOSIT === $this->transaction_type_type;}return $this->transactionType->isDeposit();}/**- ** @return bool*/public function isOpeningBalance(): bool{- if (!is_null($this->transaction_type_type)) {- return $this->transaction_type_type === TransactionType::OPENING_BALANCE;+ if (null !== $this->transaction_type_type) {+ return TransactionType::OPENING_BALANCE === $this->transaction_type_type;}return $this->transactionType->isOpeningBalance();}/**- ** @return bool*/public function isTransfer(): bool{- if (!is_null($this->transaction_type_type)) {- return $this->transaction_type_type === TransactionType::TRANSFER;+ if (null !== $this->transaction_type_type) {+ return TransactionType::TRANSFER === $this->transaction_type_type;}return $this->transactionType->isTransfer();}/**- ** @return bool*/public function isWithdrawal(): bool{- if (!is_null($this->transaction_type_type)) {- return $this->transaction_type_type === TransactionType::WITHDRAWAL;+ if (null !== $this->transaction_type_type) {+ return TransactionType::WITHDRAWAL === $this->transaction_type_type;}return $this->transactionType->isWithdrawal();@@ -289,7 +282,7 @@ class TransactionJournal extends Model/*** Save the model to the database.*- * @param array $options+ * @param array $options** @return bool*/@@ -302,7 +295,6 @@ class TransactionJournal extends Model}/**- ** @param EloquentBuilder $query* @param Carbon $date*@@ -314,7 +306,6 @@ class TransactionJournal extends Model}/**- ** @param EloquentBuilder $query* @param Carbon $date*@@ -336,7 +327,6 @@ class TransactionJournal extends Model}/**- ** @param EloquentBuilder $query* @param array $types*/@@ -351,7 +341,6 @@ class TransactionJournal extends Model}/**- ** @param $value*/public function setDescriptionAttribute($value)@@ -369,12 +358,12 @@ class TransactionJournal extends Model*/public function setMeta(string $name, $value): TransactionJournalMeta{- if (is_null($value)) {+ if (null === $value) {$this->deleteMeta($name);return new TransactionJournalMeta();}- if (is_string($value) && strlen($value) === 0) {+ if (is_string($value) && 0 === strlen($value)) {return new TransactionJournalMeta();}@@ -384,7 +373,7 @@ class TransactionJournal extends ModelLog::debug(sprintf('Going to set "%s" with value "%s"', $name, json_encode($value)));$entry = $this->transactionJournalMeta()->where('name', $name)->first();- if (is_null($entry)) {+ if (null === $entry) {$entry = new TransactionJournalMeta();$entry->transactionJournal()->associate($this);$entry->name = $name;diff --git a/app/Models/TransactionJournalLink.php b/app/Models/TransactionJournalLink.phpindex 45036b5d29..c3a001f556 100644--- a/app/Models/TransactionJournalLink.php+++ b/app/Models/TransactionJournalLink.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Models;@@ -29,9 +28,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;/**- * Class TransactionJournalLink- *- * @package FireflyIII\Models+ * Class TransactionJournalLink.*/class TransactionJournalLink extends Model{@@ -41,6 +38,7 @@ class TransactionJournalLink extends Model* @param $value** @return mixed+ ** @throws NotFoundHttpException*/public static function routeBinder($value)@@ -52,7 +50,7 @@ class TransactionJournalLink extends Model->where('t_a.user_id', auth()->user()->id)->where('t_b.user_id', auth()->user()->id)->first(['journal_links.*']);- if (!is_null($model)) {+ if (null !== $model) {return $model;}}@@ -74,7 +72,7 @@ class TransactionJournalLink extends Model*/public function getCommentAttribute($value): ?string{- if (!is_null($value)) {+ if (null !== $value) {return Crypt::decrypt($value);}@@ -90,12 +88,11 @@ class TransactionJournalLink extends Model}/**- ** @param $value*/public function setCommentAttribute($value): void{- if (!is_null($value) && strlen($value) > 0) {+ if (null !== $value && strlen($value) > 0) {$this->attributes['comment'] = Crypt::encrypt($value);return;diff --git a/app/Models/TransactionJournalMeta.php b/app/Models/TransactionJournalMeta.phpindex f673fbb8cc..8a93df7870 100644--- a/app/Models/TransactionJournalMeta.php+++ b/app/Models/TransactionJournalMeta.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Models;@@ -28,9 +27,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;use Illuminate\Database\Eloquent\SoftDeletes;/**- * Class TransactionJournalMeta- *- * @package FireflyIII\Models+ * Class TransactionJournalMeta.*/class TransactionJournalMeta extends Model{@@ -72,7 +69,6 @@ class TransactionJournalMeta extends Model}/**- ** @return \Illuminate\Database\Eloquent\Relations\BelongsTo*/public function transactionJournal(): BelongsTodiff --git a/app/Models/TransactionType.php b/app/Models/TransactionType.phpindex ea09c65b9f..a915e849a0 100644--- a/app/Models/TransactionType.php+++ b/app/Models/TransactionType.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Models;@@ -28,9 +27,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;/**- * Class TransactionType- *- * @package FireflyIII\Models+ * Class TransactionType.*/class TransactionType extends Model{@@ -64,19 +61,18 @@ class TransactionType extends Modelthrow new NotFoundHttpException;}$transactionType = self::where('type', ucfirst($type))->first();- if (!is_null($transactionType)) {+ if (null !== $transactionType) {return $transactionType;}throw new NotFoundHttpException;}-/*** @return bool*/public function isDeposit(){- return $this->type === self::DEPOSIT;+ return self::DEPOSIT === $this->type;}/**@@ -84,7 +80,7 @@ class TransactionType extends Model*/public function isOpeningBalance(){- return $this->type === self::OPENING_BALANCE;+ return self::OPENING_BALANCE === $this->type;}/**@@ -92,7 +88,7 @@ class TransactionType extends Model*/public function isTransfer(){- return $this->type === self::TRANSFER;+ return self::TRANSFER === $this->type;}/**@@ -100,11 +96,10 @@ class TransactionType extends Model*/public function isWithdrawal(){- return $this->type === self::WITHDRAWAL;+ return self::WITHDRAWAL === $this->type;}/**- ** @return \Illuminate\Database\Eloquent\Relations\HasMany*/public function transactionJournals()diff --git a/app/Providers/AccountServiceProvider.php b/app/Providers/AccountServiceProvider.phpindex 946dc65fd3..b2d35d3a4c 100644--- a/app/Providers/AccountServiceProvider.php+++ b/app/Providers/AccountServiceProvider.php@@ -18,10 +18,8 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);-namespace FireflyIII\Providers;use FireflyIII\Repositories\Account\AccountRepository;@@ -32,26 +30,19 @@ use Illuminate\Foundation\Application;use Illuminate\Support\ServiceProvider;/**- * Class AccountServiceProvider- *- * @package FireflyIII\Providers+ * Class AccountServiceProvider.*/class AccountServiceProvider extends ServiceProvider{/*** Bootstrap the application services.- *- * @return void*/public function boot(){- //}/*** Register the application services.- *- * @return void*/public function register(){diff --git a/app/Providers/AdminServiceProvider.php b/app/Providers/AdminServiceProvider.phpindex f75b40bc25..e2afa5d433 100644--- a/app/Providers/AdminServiceProvider.php+++ b/app/Providers/AdminServiceProvider.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Providers;@@ -32,8 +31,6 @@ class AdminServiceProvider extends ServiceProvider{/*** Bootstrap the application services.- *- * @return void*/public function boot(){@@ -41,8 +38,6 @@ class AdminServiceProvider extends ServiceProvider/*** Register the application services.- *- * @return void*/public function register(){diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.phpindex 7d8752abe6..a0af9c7ee7 100644--- a/app/Providers/AppServiceProvider.php+++ b/app/Providers/AppServiceProvider.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Providers;@@ -27,16 +26,12 @@ use Illuminate\Support\Facades\Schema;use Illuminate\Support\ServiceProvider;/**- * Class AppServiceProvider- *- * @package FireflyIII\Providers+ * Class AppServiceProvider.*/class AppServiceProvider extends ServiceProvider{/*** Bootstrap any application services.- *- * @return void*/public function boot(){@@ -45,8 +40,6 @@ class AppServiceProvider extends ServiceProvider/*** Register any application services.- *- * @return void*/public function register(){diff --git a/app/Providers/AttachmentServiceProvider.php b/app/Providers/AttachmentServiceProvider.phpindex a00ae75d42..4725f7cb0d 100644--- a/app/Providers/AttachmentServiceProvider.php+++ b/app/Providers/AttachmentServiceProvider.php@@ -18,10 +18,8 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);-namespace FireflyIII\Providers;use FireflyIII\Repositories\Attachment\AttachmentRepository;@@ -30,26 +28,19 @@ use Illuminate\Foundation\Application;use Illuminate\Support\ServiceProvider;/**- * Class AttachmentServiceProvider- *- * @package FireflyIII\Providers+ * Class AttachmentServiceProvider.*/class AttachmentServiceProvider extends ServiceProvider{/*** Bootstrap the application services.- *- * @return void*/public function boot(){- //}/*** Register the application services.- *- * @return void*/public function register(){diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.phpindex d03e8bc6de..3522b9cc71 100644--- a/app/Providers/AuthServiceProvider.php+++ b/app/Providers/AuthServiceProvider.php@@ -18,10 +18,8 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);-/*** AuthServiceProvider.php* Copyright (c) 2017 [email protected]@@ -49,13 +47,9 @@ class AuthServiceProvider extends ServiceProvider/*** Register any authentication / authorization services.- *- * @return void*/public function boot(){$this->registerPolicies();-- //}}diff --git a/app/Providers/BillServiceProvider.php b/app/Providers/BillServiceProvider.phpindex dea438c324..f0377d8ca8 100644--- a/app/Providers/BillServiceProvider.php+++ b/app/Providers/BillServiceProvider.php@@ -18,10 +18,8 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);-namespace FireflyIII\Providers;use FireflyIII\Repositories\Bill\BillRepository;@@ -30,26 +28,19 @@ use Illuminate\Foundation\Application;use Illuminate\Support\ServiceProvider;/**- * Class BillServiceProvider- *- * @package FireflyIII\Providers+ * Class BillServiceProvider.*/class BillServiceProvider extends ServiceProvider{/*** Bootstrap the application services.- *- * @return void*/public function boot(){- //}/*** Register the application services.- *- * @return void*/public function register(){diff --git a/app/Providers/BroadcastServiceProvider.php b/app/Providers/BroadcastServiceProvider.phpindex 64725f48ae..8a1be3536b 100644--- a/app/Providers/BroadcastServiceProvider.php+++ b/app/Providers/BroadcastServiceProvider.php@@ -18,10 +18,8 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);-/*** BroadcastServiceProvider.php* Copyright (c) 2017 [email protected]@@ -40,8 +38,6 @@ class BroadcastServiceProvider extends ServiceProvider{/*** Bootstrap any application services.- *- * @return void*/public function boot(){diff --git a/app/Providers/BudgetServiceProvider.php b/app/Providers/BudgetServiceProvider.phpindex 2818cc89e7..49fd527457 100644--- a/app/Providers/BudgetServiceProvider.php+++ b/app/Providers/BudgetServiceProvider.php@@ -18,10 +18,8 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);-namespace FireflyIII\Providers;use FireflyIII\Repositories\Budget\BudgetRepository;@@ -30,26 +28,19 @@ use Illuminate\Foundation\Application;use Illuminate\Support\ServiceProvider;/**- * Class BudgetServiceProvider- *- * @package FireflyIII\Providers+ * Class BudgetServiceProvider.*/class BudgetServiceProvider extends ServiceProvider{/*** Bootstrap the application services.- *- * @return void*/public function boot(){- //}/*** Register the application services.- *- * @return void*/public function register(){diff --git a/app/Providers/CategoryServiceProvider.php b/app/Providers/CategoryServiceProvider.phpindex f39ef1c44c..2be853ccf0 100644--- a/app/Providers/CategoryServiceProvider.php+++ b/app/Providers/CategoryServiceProvider.php@@ -18,10 +18,8 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);-namespace FireflyIII\Providers;use FireflyIII\Repositories\Category\CategoryRepository;@@ -30,26 +28,19 @@ use Illuminate\Foundation\Application;use Illuminate\Support\ServiceProvider;/**- * Class CategoryServiceProvider- *- * @package FireflyIII\Providers+ * Class CategoryServiceProvider.*/class CategoryServiceProvider extends ServiceProvider{/*** Bootstrap the application services.- *- * @return void*/public function boot(){- //}/*** Register the application services.- *- * @return void*/public function register(){diff --git a/app/Providers/CurrencyServiceProvider.php b/app/Providers/CurrencyServiceProvider.phpindex e00c5013b6..76a41f6f98 100644--- a/app/Providers/CurrencyServiceProvider.php+++ b/app/Providers/CurrencyServiceProvider.php@@ -18,10 +18,8 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);-namespace FireflyIII\Providers;use FireflyIII\Repositories\Currency\CurrencyRepository;@@ -30,26 +28,19 @@ use Illuminate\Foundation\Application;use Illuminate\Support\ServiceProvider;/**- * Class CurrencyServiceProvider- *- * @package FireflyIII\Providers+ * Class CurrencyServiceProvider.*/class CurrencyServiceProvider extends ServiceProvider{/*** Bootstrap the application services.- *- * @return void*/public function boot(){- //}/*** Register the application services.- *- * @return void*/public function register(){diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.phpindex fccd71f715..3f415111e2 100644--- a/app/Providers/EventServiceProvider.php+++ b/app/Providers/EventServiceProvider.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Providers;@@ -33,9 +32,7 @@ use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProviuse Log;/**- * Class EventServiceProvider- *- * @package FireflyIII\Providers+ * Class EventServiceProvider.*/class EventServiceProvider extends ServiceProvider{@@ -47,11 +44,10 @@ class EventServiceProvider extends ServiceProviderprotected $listen= [// is a User related event.- 'FireflyIII\Events\RegisteredUser' =>- [- 'FireflyIII\Handlers\Events\UserEventHandler@sendRegistrationMail',- 'FireflyIII\Handlers\Events\UserEventHandler@attachUserRole',- ],+ 'FireflyIII\Events\RegisteredUser' => [+ 'FireflyIII\Handlers\Events\UserEventHandler@sendRegistrationMail',+ 'FireflyIII\Handlers\Events\UserEventHandler@attachUserRole',+ ],// is a User related event.'FireflyIII\Events\RequestedNewPassword' => ['FireflyIII\Handlers\Events\UserEventHandler@sendNewPassword',@@ -66,25 +62,20 @@ class EventServiceProvider extends ServiceProvider'FireflyIII\Handlers\Events\AdminEventHandler@sendTestMessage',],// is a Transaction Journal related event.- 'FireflyIII\Events\StoredTransactionJournal' =>- [- 'FireflyIII\Handlers\Events\StoredJournalEventHandler@scanBills',- 'FireflyIII\Handlers\Events\StoredJournalEventHandler@connectToPiggyBank',- 'FireflyIII\Handlers\Events\StoredJournalEventHandler@processRules',- ],+ 'FireflyIII\Events\StoredTransactionJournal' => [+ 'FireflyIII\Handlers\Events\StoredJournalEventHandler@scanBills',+ 'FireflyIII\Handlers\Events\StoredJournalEventHandler@connectToPiggyBank',+ 'FireflyIII\Handlers\Events\StoredJournalEventHandler@processRules',+ ],// is a Transaction Journal related event.- 'FireflyIII\Events\UpdatedTransactionJournal' =>- [- 'FireflyIII\Handlers\Events\UpdatedJournalEventHandler@scanBills',- 'FireflyIII\Handlers\Events\UpdatedJournalEventHandler@processRules',- ],-+ 'FireflyIII\Events\UpdatedTransactionJournal' => [+ 'FireflyIII\Handlers\Events\UpdatedJournalEventHandler@scanBills',+ 'FireflyIII\Handlers\Events\UpdatedJournalEventHandler@processRules',+ ],];/*** Register any events for your application.- *- * @return void*/public function boot(){@@ -98,15 +89,14 @@ class EventServiceProvider extends ServiceProvider*/protected function registerCreateEvents(){-// move this routine to a filter// in case of repeated piggy banks and/or other problems.PiggyBank::created(function (PiggyBank $piggyBank) {$repetition = new PiggyBankRepetition;$repetition->piggyBank()->associate($piggyBank);- $repetition->startdate = is_null($piggyBank->startdate) ? null : $piggyBank->startdate;- $repetition->targetdate = is_null($piggyBank->targetdate) ? null : $piggyBank->targetdate;+ $repetition->startdate = null === $piggyBank->startdate ? null : $piggyBank->startdate;+ $repetition->targetdate = null === $piggyBank->targetdate ? null : $piggyBank->targetdate;$repetition->currentamount = 0;$repetition->save();}@@ -125,7 +115,7 @@ class EventServiceProvider extends ServiceProviderforeach ($account->transactions()->get() as $transaction) {Log::debug('Now at transaction #' . $transaction->id);$journal = $transaction->transactionJournal()->first();- if (!is_null($journal)) {+ if (null !== $journal) {Log::debug('Call for deletion of journal #' . $journal->id);$journal->delete();}diff --git a/app/Providers/ExportJobServiceProvider.php b/app/Providers/ExportJobServiceProvider.phpindex 5072d617a4..143d8daf07 100644--- a/app/Providers/ExportJobServiceProvider.php+++ b/app/Providers/ExportJobServiceProvider.php@@ -18,10 +18,8 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);-namespace FireflyIII\Providers;use FireflyIII\Repositories\ExportJob\ExportJobRepository;@@ -32,16 +30,12 @@ use Illuminate\Foundation\Application;use Illuminate\Support\ServiceProvider;/**- * Class ExportJobServiceProvider- *- * @package FireflyIII\Providers+ * Class ExportJobServiceProvider.*/class ExportJobServiceProvider extends ServiceProvider{/*** Bootstrap the application services.- *- * @return void*/public function boot(){@@ -49,8 +43,6 @@ class ExportJobServiceProvider extends ServiceProvider/*** Register the application services.- *- * @return void*/public function register(){diff --git a/app/Providers/FireflyServiceProvider.php b/app/Providers/FireflyServiceProvider.phpindex 771f3a1ae7..398c45bd4a 100644--- a/app/Providers/FireflyServiceProvider.php+++ b/app/Providers/FireflyServiceProvider.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Providers;@@ -70,9 +69,7 @@ use TwigBridge\Extension\Loader\Functions;use Validator;/**- * Class FireflyServiceProvider- *- * @package FireflyIII\Providers+ * Class FireflyServiceProvider.*/class FireflyServiceProvider extends ServiceProvider{diff --git a/app/Providers/FireflySessionProvider.php b/app/Providers/FireflySessionProvider.phpindex 114c569deb..7e70201de8 100644--- a/app/Providers/FireflySessionProvider.php+++ b/app/Providers/FireflySessionProvider.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Providers;@@ -31,8 +30,6 @@ class FireflySessionProvider extends ServiceProvider{/*** Register the service provider.- *- * @return void*/public function register(){@@ -45,8 +42,6 @@ class FireflySessionProvider extends ServiceProvider/*** Register the session driver instance.- *- * @return void*/protected function registerSessionDriver(){@@ -63,8 +58,6 @@ class FireflySessionProvider extends ServiceProvider/*** Register the session manager instance.- *- * @return void*/protected function registerSessionManager(){diff --git a/app/Providers/JournalServiceProvider.php b/app/Providers/JournalServiceProvider.phpindex 03c22f3160..5ed46fffa0 100644--- a/app/Providers/JournalServiceProvider.php+++ b/app/Providers/JournalServiceProvider.php@@ -18,10 +18,8 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);-namespace FireflyIII\Providers;use FireflyIII\Helpers\Collector\JournalCollector;@@ -34,26 +32,19 @@ use Illuminate\Foundation\Application;use Illuminate\Support\ServiceProvider;/**- * Class JournalServiceProvider- *- * @package FireflyIII\Providers+ * Class JournalServiceProvider.*/class JournalServiceProvider extends ServiceProvider{/*** Bootstrap the application services.- *- * @return void*/public function boot(){- //}/*** Register the application services.- *- * @return void*/public function register(){@@ -76,7 +67,6 @@ class JournalServiceProvider extends ServiceProvider$collector->setUser(auth()->user());}-return $collector;});diff --git a/app/Providers/LogServiceProvider.php b/app/Providers/LogServiceProvider.phpindex 168a0a2e0b..bdfb6cc6bb 100644--- a/app/Providers/LogServiceProvider.php+++ b/app/Providers/LogServiceProvider.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Providers;@@ -27,18 +26,14 @@ use Illuminate\Log\LogServiceProvider as LaravelLogServiceProvider;use Illuminate\Log\Writer;/**- * Class LogServiceProvider- *- * @package FireflyIII\Providers+ * Class LogServiceProvider.*/class LogServiceProvider extends LaravelLogServiceProvider{/*** Configure the Monolog handlers for the application.*- * @param \Illuminate\Log\Writer $log- *- * @return void+ * @param \Illuminate\Log\Writer $log*/protected function configureDailyHandler(Writer $log){@@ -52,9 +47,7 @@ class LogServiceProvider extends LaravelLogServiceProvider/*** Configure the Monolog handlers for the application.*- * @param \Illuminate\Log\Writer $log- *- * @return void+ * @param \Illuminate\Log\Writer $log*/protected function configureSingleHandler(Writer $log){diff --git a/app/Providers/PiggyBankServiceProvider.php b/app/Providers/PiggyBankServiceProvider.phpindex b9f0569643..2655f5b522 100644--- a/app/Providers/PiggyBankServiceProvider.php+++ b/app/Providers/PiggyBankServiceProvider.php@@ -18,10 +18,8 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);-namespace FireflyIII\Providers;use FireflyIII\Repositories\PiggyBank\PiggyBankRepository;@@ -30,26 +28,19 @@ use Illuminate\Foundation\Application;use Illuminate\Support\ServiceProvider;/**- * Class PiggyBankServiceProvider- *- * @package FireflyIII\Providers+ * Class PiggyBankServiceProvider.*/class PiggyBankServiceProvider extends ServiceProvider{/*** Bootstrap the application services.- *- * @return void*/public function boot(){- //}/*** Register the application services.- *- * @return void*/public function register(){diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.phpindex a12f9ef45e..1be7d7c064 100644--- a/app/Providers/RouteServiceProvider.php+++ b/app/Providers/RouteServiceProvider.php@@ -18,10 +18,8 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);-/*** RouteServiceProvider.php* Copyright (c) 2017 [email protected]@@ -49,36 +47,26 @@ class RouteServiceProvider extends ServiceProvider/*** Define your route model bindings, pattern filters, etc.- *- * @return void*/public function boot(){- //-parent::boot();}/*** Define the routes for the application.- *- * @return void*/public function map(){$this->mapApiRoutes();$this->mapWebRoutes();-- //}/*** Define the "api" routes for the application.** These routes are typically stateless.- *- * @return void*/protected function mapApiRoutes(){@@ -92,8 +80,6 @@ class RouteServiceProvider extends ServiceProvider* Define the "web" routes for the application.** These routes all receive session state, CSRF protection, etc.- *- * @return void*/protected function mapWebRoutes(){diff --git a/app/Providers/RuleGroupServiceProvider.php b/app/Providers/RuleGroupServiceProvider.phpindex 54173feb0b..07c9ee2e0a 100644--- a/app/Providers/RuleGroupServiceProvider.php+++ b/app/Providers/RuleGroupServiceProvider.php@@ -18,10 +18,8 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);-namespace FireflyIII\Providers;use FireflyIII\Repositories\RuleGroup\RuleGroupRepository;@@ -30,26 +28,19 @@ use Illuminate\Foundation\Application;use Illuminate\Support\ServiceProvider;/**- * Class RuleGroupServiceProvider- *- * @package FireflyIII\Providers+ * Class RuleGroupServiceProvider.*/class RuleGroupServiceProvider extends ServiceProvider{/*** Bootstrap the application services.- *- * @return void*/public function boot(){- //}/*** Register the application services.- *- * @return void*/public function register(){diff --git a/app/Providers/RuleServiceProvider.php b/app/Providers/RuleServiceProvider.phpindex 1af440b191..bf49190da9 100644--- a/app/Providers/RuleServiceProvider.php+++ b/app/Providers/RuleServiceProvider.php@@ -18,10 +18,8 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);-namespace FireflyIII\Providers;use FireflyIII\Repositories\Rule\RuleRepository;@@ -30,26 +28,19 @@ use Illuminate\Foundation\Application;use Illuminate\Support\ServiceProvider;/**- * Class RuleServiceProvider- *- * @package FireflyIII\Providers+ * Class RuleServiceProvider.*/class RuleServiceProvider extends ServiceProvider{/*** Bootstrap the application services.- *- * @return void*/public function boot(){- //}/*** Register the application services.- *- * @return void*/public function register(){diff --git a/app/Providers/SearchServiceProvider.php b/app/Providers/SearchServiceProvider.phpindex d7fa9c6ec6..97c5072950 100644--- a/app/Providers/SearchServiceProvider.php+++ b/app/Providers/SearchServiceProvider.php@@ -18,10 +18,8 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);-namespace FireflyIII\Providers;use FireflyIII\Support\Search\Search;@@ -30,26 +28,19 @@ use Illuminate\Foundation\Application;use Illuminate\Support\ServiceProvider;/**- * Class SearchServiceProvider- *- * @package FireflyIII\Providers+ * Class SearchServiceProvider.*/class SearchServiceProvider extends ServiceProvider{/*** Bootstrap the application services.- *- * @return void*/public function boot(){- //}/*** Register the application services.- *- * @return void*/public function register(){diff --git a/app/Providers/SessionServiceProvider.php b/app/Providers/SessionServiceProvider.phpindex 7cf1fbed69..7143eafff9 100644--- a/app/Providers/SessionServiceProvider.php+++ b/app/Providers/SessionServiceProvider.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Providers;@@ -27,16 +26,12 @@ use FireflyIII\Http\Middleware\StartFireflySession;use Illuminate\Session\SessionServiceProvider as BaseSessionServiceProvider;/**- * Class SessionServiceProvider- *- * @package FireflyIII\Providers+ * Class SessionServiceProvider.*/class SessionServiceProvider extends BaseSessionServiceProvider{/*** Register the service provider.- *- * @return void*/public function register(){diff --git a/app/Providers/TagServiceProvider.php b/app/Providers/TagServiceProvider.phpindex aac1d9c1f8..acbf9e18cd 100644--- a/app/Providers/TagServiceProvider.php+++ b/app/Providers/TagServiceProvider.php@@ -18,10 +18,8 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);-namespace FireflyIII\Providers;use FireflyIII\Repositories\Tag\TagRepository;@@ -30,26 +28,19 @@ use Illuminate\Foundation\Application;use Illuminate\Support\ServiceProvider;/**- * Class TagServiceProvider- *- * @package FireflyIII\Providers+ * Class TagServiceProvider.*/class TagServiceProvider extends ServiceProvider{/*** Bootstrap the application services.- *- * @return void*/public function boot(){- //}/*** Register the application services.- *- * @return void*/public function register(){diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.phpindex fac886b38a..a3641779a8 100644--- a/app/Repositories/Account/AccountRepository.php+++ b/app/Repositories/Account/AccountRepository.php@@ -18,10 +18,8 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);-namespace FireflyIII\Repositories\Account;use Carbon\Carbon;@@ -38,10 +36,7 @@ use Log;use Validator;/**- *- * Class AccountRepository- *- * @package FireflyIII\Repositories\Account+ * Class AccountRepository.*/class AccountRepository implements AccountRepositoryInterface{@@ -53,7 +48,7 @@ class AccountRepository implements AccountRepositoryInterfaceprivate $validFields = ['accountRole', 'ccMonthlyPaymentDate', 'ccType', 'accountNumber', 'currency_id', 'BIC'];/**- * Moved here from account CRUD+ * Moved here from account CRUD.** @param array $types*@@ -76,10 +71,10 @@ class AccountRepository implements AccountRepositoryInterface*/public function destroy(Account $account, Account $moveTo): bool{- if (!is_null($moveTo->id)) {+ if (null !== $moveTo->id) {DB::table('transactions')->where('account_id', $account->id)->update(['account_id' => $moveTo->id]);}- if (!is_null($account)) {+ if (null !== $account) {$account->delete();}@@ -102,7 +97,7 @@ class AccountRepository implements AccountRepositoryInterface->orderBy('transaction_journals.order', 'ASC')->orderBy('transaction_journals.id', 'DESC')->first(['transaction_journals.date']);- if (!is_null($date)) {+ if (null !== $date) {$last = new Carbon($date->date);}@@ -125,7 +120,7 @@ class AccountRepository implements AccountRepositoryInterface->where('transaction_journals.user_id', $this->user->id)->orderBy('transaction_journals.id', 'ASC')->first(['transaction_journals.id']);- if (!is_null($first)) {+ if (null !== $first) {return TransactionJournal::find(intval($first->id));}@@ -142,7 +137,7 @@ class AccountRepository implements AccountRepositoryInterfacepublic function oldestJournalDate(Account $account): Carbon{$journal = $this->oldestJournal($account);- if (is_null($journal->id)) {+ if (null === $journal->id) {return new Carbon;}@@ -206,7 +201,7 @@ class AccountRepository implements AccountRepositoryInterfaceprotected function deleteInitialBalance(Account $account){$journal = $this->openingBalanceTransaction($account);- if (!is_null($journal->id)) {+ if (null !== $journal->id) {$journal->delete();}}@@ -222,7 +217,7 @@ class AccountRepository implements AccountRepositoryInterface->where('transactions.account_id', $account->id)->transactionTypes([TransactionType::OPENING_BALANCE])->first(['transaction_journals.*']);- if (is_null($journal)) {+ if (null === $journal) {Log::debug('Could not find a opening balance journal, return empty one.');return new TransactionJournal;@@ -236,6 +231,7 @@ class AccountRepository implements AccountRepositoryInterface* @param array $data** @return Account+ ** @throws FireflyException*/protected function storeAccount(array $data): Account@@ -245,13 +241,13 @@ class AccountRepository implements AccountRepositoryInterface$accountType = AccountType::whereType($type)->first();$data['iban'] = $this->filterIban($data['iban']);// verify account type- if (is_null($accountType)) {+ if (null === $accountType) {throw new FireflyException(sprintf('Account type "%s" is invalid. Cannot create account.', $data['accountType']));}// account may exist already:$existingAccount = $this->findByName($data['name'], [$type]);- if (!is_null($existingAccount->id)) {+ if (null !== $existingAccount->id) {Log::warning(sprintf('There already is an account named "%s" of type "%s".', $data['name'], $type));return $existingAccount;@@ -264,14 +260,14 @@ class AccountRepository implements AccountRepositoryInterface'account_type_id' => $accountType->id,'name' => $data['name'],'virtual_balance' => $data['virtualBalance'],- 'active' => $data['active'] === true ? true : false,+ 'active' => true === $data['active'] ? true : false,'iban' => $data['iban'],];$newAccount = new Account($databaseData);Log::debug('Final account creation dataset', $databaseData);$newAccount->save();// verify its creation:- if (is_null($newAccount->id)) {+ if (null === $newAccount->id) {Log::error(sprintf('Could not create account "%s" (%d error(s))', $data['name'], $newAccount->getErrors()->count()),$newAccount->getErrors()->toArray()@@ -296,7 +292,7 @@ class AccountRepository implements AccountRepositoryInterface$amount = strval($data['openingBalance']);Log::debug(sprintf('Submitted amount is %s', $amount));- if (bccomp($amount, '0') === 0) {+ if (0 === bccomp($amount, '0')) {return new TransactionJournal;}@@ -340,7 +336,7 @@ class AccountRepository implements AccountRepositoryInterface'transaction_currency_id' => $currencyId,]);- $one->save();// first transaction: from+ $one->save(); // first transaction: from$two = new Transaction([@@ -376,7 +372,6 @@ class AccountRepository implements AccountRepositoryInterface}/**- ** @param Account $account* @param array $data*@@ -388,14 +383,14 @@ class AccountRepository implements AccountRepositoryInterface$openingBalance = $this->openingBalanceTransaction($account);// no opening balance journal? create it:- if (is_null($openingBalance->id)) {+ if (null === $openingBalance->id) {Log::debug('No opening balance journal yet, create journal.');$this->storeInitialBalance($account, $data);return true;}// opening balance data? update it!- if (!is_null($openingBalance->id)) {+ if (null !== $openingBalance->id) {Log::debug('Opening balance journal found, update journal.');$this->updateOpeningBalanceJournal($account, $openingBalance, $data);@@ -408,7 +403,6 @@ class AccountRepository implements AccountRepositoryInterface/*** @param Account $account* @param array $data- **/protected function updateMetadata(Account $account, array $data){@@ -417,7 +411,7 @@ class AccountRepository implements AccountRepositoryInterface$entry = $account->accountMeta()->where('name', $field)->first();// if $data has field and $entry is null, create new one:- if (isset($data[$field]) && is_null($entry)) {+ if (isset($data[$field]) && null === $entry) {Log::debug(sprintf('Created meta-field "%s":"%s" for account #%d ("%s") ',@@ -437,7 +431,7 @@ class AccountRepository implements AccountRepositoryInterface}// if $data has field and $entry is not null, update $entry:- if (isset($data[$field]) && !is_null($entry)) {+ if (isset($data[$field]) && null !== $entry) {$entry->data = $data[$field];$entry->save();Log::debug(@@ -468,7 +462,7 @@ class AccountRepository implements AccountRepositoryInterfaceLog::debug(sprintf('Submitted amount for opening balance to update is %s', $amount));- if (bccomp($amount, '0') === 0) {+ if (0 === bccomp($amount, '0')) {$journal->delete();return true;@@ -500,7 +494,6 @@ class AccountRepository implements AccountRepositoryInterfacereturn true;}-/*** @param array $data*@@ -509,7 +502,7 @@ class AccountRepository implements AccountRepositoryInterfaceprotected function validOpeningBalanceData(array $data): bool{$data['openingBalance'] = strval($data['openingBalance'] ?? '');- if (isset($data['openingBalance']) && !is_null($data['openingBalance']) && strlen($data['openingBalance']) > 0+ if (isset($data['openingBalance']) && null !== $data['openingBalance'] && strlen($data['openingBalance']) > 0&& isset($data['openingBalanceDate'])) {Log::debug('Array has valid opening balance data.');@@ -527,7 +520,7 @@ class AccountRepository implements AccountRepositoryInterface*/private function filterIban(?string $iban){- if (is_null($iban)) {+ if (null === $iban) {return null;}$data = ['iban' => $iban];diff --git a/app/Repositories/Account/AccountRepositoryInterface.php b/app/Repositories/Account/AccountRepositoryInterface.phpindex 7457bbcc39..05b4ae3aa0 100644--- a/app/Repositories/Account/AccountRepositoryInterface.php+++ b/app/Repositories/Account/AccountRepositoryInterface.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Repositories\Account;@@ -30,13 +29,10 @@ use FireflyIII\User;use Illuminate\Support\Collection;/**- * Interface AccountRepositoryInterface- *- * @package FireflyIII\Repositories\Account+ * Interface AccountRepositoryInterface.*/interface AccountRepositoryInterface{-/*** Moved here from account CRUD.*diff --git a/app/Repositories/Account/AccountTasker.php b/app/Repositories/Account/AccountTasker.phpindex 292ed3f030..04b5c18f84 100644--- a/app/Repositories/Account/AccountTasker.php+++ b/app/Repositories/Account/AccountTasker.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Repositories\Account;@@ -33,9 +32,7 @@ use Log;use Steam;/**- * Class AccountTasker- *- * @package FireflyIII\Repositories\Account+ * Class AccountTasker.*/class AccountTasker implements AccountTaskerInterface{@@ -83,7 +80,7 @@ class AccountTasker implements AccountTaskerInterface$entry['end_balance'] = $endSet[$account->id] ?? '0';// first journal exists, and is on start, then this is the actual opening balance:- if (!is_null($first->id) && $first->date->isSameDay($start)) {+ if (null !== $first->id && $first->date->isSameDay($start)) {Log::debug(sprintf('Date of first journal for %s is %s', $account->name, $first->date->format('Y-m-d')));$entry['start_balance'] = $first->transactions()->where('account_id', $account->id)->first()->amount;Log::debug(sprintf('Account %s was opened on %s, so opening balance is %f', $account->name, $start->format('Y-m-d'), $entry['start_balance']));@@ -162,7 +159,7 @@ class AccountTasker implements AccountTaskerInterface$transactions = $transactions->filter(function (Transaction $transaction) {// return positive amounts only.- if (bccomp($transaction->transaction_amount, '0') === 1) {+ if (1 === bccomp($transaction->transaction_amount, '0')) {return $transaction;}@@ -213,7 +210,7 @@ class AccountTasker implements AccountTaskerInterface];}$expenses[$opposingId]['sum'] = bcadd($expenses[$opposingId]['sum'], $transaction->transaction_amount);- $expenses[$opposingId]['count']++;+ ++$expenses[$opposingId]['count'];}// do averages:$keys = array_keys($expenses);@@ -223,7 +220,6 @@ class AccountTasker implements AccountTaskerInterface}}-return $expenses;}}diff --git a/app/Repositories/Account/AccountTaskerInterface.php b/app/Repositories/Account/AccountTaskerInterface.phpindex f3b4e6fca3..3e3f022a68 100644--- a/app/Repositories/Account/AccountTaskerInterface.php+++ b/app/Repositories/Account/AccountTaskerInterface.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Repositories\Account;@@ -28,9 +27,7 @@ use FireflyIII\User;use Illuminate\Support\Collection;/**- * Interface AccountTaskerInterface- *- * @package FireflyIII\Repositories\Account+ * Interface AccountTaskerInterface.*/interface AccountTaskerInterface{diff --git a/app/Repositories/Account/FindAccountsTrait.php b/app/Repositories/Account/FindAccountsTrait.phpindex e040ee8408..7a06298410 100644--- a/app/Repositories/Account/FindAccountsTrait.php+++ b/app/Repositories/Account/FindAccountsTrait.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Repositories\Account;@@ -34,8 +33,6 @@ use Log;* @property User $user** Trait FindAccountsTrait- *- * @package FireflyIII\Repositories\Account*/trait FindAccountsTrait{@@ -47,7 +44,7 @@ trait FindAccountsTraitpublic function find(int $accountId): Account{$account = $this->user->accounts()->find($accountId);- if (is_null($account)) {+ if (null === $account) {return new Account;}diff --git a/app/Repositories/Attachment/AttachmentRepository.php b/app/Repositories/Attachment/AttachmentRepository.phpindex d3b2e73008..a0e62e508e 100644--- a/app/Repositories/Attachment/AttachmentRepository.php+++ b/app/Repositories/Attachment/AttachmentRepository.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Repositories\Attachment;@@ -33,9 +32,7 @@ use Log;use Storage;/**- * Class AttachmentRepository- *- * @package FireflyIII\Repositories\Attachment+ * Class AttachmentRepository.*/class AttachmentRepository implements AttachmentRepositoryInterface{@@ -80,7 +77,7 @@ class AttachmentRepository implements AttachmentRepositoryInterfacepublic function find(int $id): Attachment{$attachment = $this->user->attachments()->find($id);- if (is_null($attachment)) {+ if (null === $attachment) {return new Attachment;}@@ -95,7 +92,7 @@ class AttachmentRepository implements AttachmentRepositoryInterfacepublic function findWithoutUser(int $id): Attachment{$attachment = Attachment::find($id);- if (is_null($attachment)) {+ if (null === $attachment) {return new Attachment;}diff --git a/app/Repositories/Attachment/AttachmentRepositoryInterface.php b/app/Repositories/Attachment/AttachmentRepositoryInterface.phpindex 7decdab90d..bf15bbea35 100644--- a/app/Repositories/Attachment/AttachmentRepositoryInterface.php+++ b/app/Repositories/Attachment/AttachmentRepositoryInterface.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Repositories\Attachment;@@ -29,13 +28,10 @@ use FireflyIII\User;use Illuminate\Support\Collection;/**- * Interface AttachmentRepositoryInterface- *- * @package FireflyIII\Repositories\Attachment+ * Interface AttachmentRepositoryInterface.*/interface AttachmentRepositoryInterface{-/*** @param Attachment $attachment*diff --git a/app/Repositories/Bill/BillRepository.php b/app/Repositories/Bill/BillRepository.phpindex ee77dbc9fa..f51f3b5fd4 100644--- a/app/Repositories/Bill/BillRepository.php+++ b/app/Repositories/Bill/BillRepository.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Repositories\Bill;@@ -37,13 +36,10 @@ use Log;use Navigation;/**- * Class BillRepository- *- * @package FireflyIII\Repositories\Bill+ * Class BillRepository.*/class BillRepository implements BillRepositoryInterface{-/** @var User */private $user;@@ -69,7 +65,7 @@ class BillRepository implements BillRepositoryInterfacepublic function find(int $billId): Bill{$bill = $this->user->bills()->find($billId);- if (is_null($bill)) {+ if (null === $bill) {$bill = new Bill;}@@ -156,7 +152,7 @@ class BillRepository implements BillRepositoryInterface'bills.automatch','bills.active','bills.name_encrypted',- 'bills.match_encrypted'];+ 'bills.match_encrypted',];$ids = $accounts->pluck('id')->toArray();$set = $this->user->bills()->leftJoin(@@ -178,7 +174,7 @@ class BillRepository implements BillRepositoryInterface$set = $set->sortBy(function (Bill $bill) {- $int = $bill->active === 1 ? 0 : 1;+ $int = 1 === $bill->active ? 0 : 1;return $int . strtolower($bill->name);}@@ -300,9 +296,7 @@ class BillRepository implements BillRepositoryInterface$set = new Collection;Log::debug(sprintf('Now at bill "%s" (%s)', $bill->name, $bill->repeat_freq));- /*- * Start at 2016-10-01, see when we expect the bill to hit:- */+ // Start at 2016-10-01, see when we expect the bill to hit:$currentStart = clone $start;Log::debug(sprintf('First currentstart is %s', $currentStart->format('Y-m-d')));@@ -310,9 +304,7 @@ class BillRepository implements BillRepositoryInterfaceLog::debug(sprintf('Currentstart is now %s.', $currentStart->format('Y-m-d')));$nextExpectedMatch = $this->nextDateMatch($bill, $currentStart);Log::debug(sprintf('Next Date match after %s is %s', $currentStart->format('Y-m-d'), $nextExpectedMatch->format('Y-m-d')));- /*- * If nextExpectedMatch is after end, we continue:- */+ // If nextExpectedMatch is after end, we continue:if ($nextExpectedMatch > $end) {Log::debug(sprintf('nextExpectedMatch %s is after %s, so we skip this bill now.', $nextExpectedMatch->format('Y-m-d'), $end->format('Y-m-d'))@@ -337,7 +329,6 @@ class BillRepository implements BillRepositoryInterface);Log::debug(sprintf('Found dates between %s and %s:', $start->format('Y-m-d'), $end->format('Y-m-d')), $simple->toArray());-return $set;}@@ -482,9 +473,7 @@ class BillRepository implements BillRepositoryInterface*/public function scan(Bill $bill, TransactionJournal $journal): bool{- /*- * Can only support withdrawals.- */+ // Can only support withdrawals.if (false === $journal->isWithdrawal()) {return false;}@@ -498,10 +487,7 @@ class BillRepository implements BillRepositoryInterface$wordMatch = $this->doWordMatch($matches, $description);$amountMatch = $this->doAmountMatch($journal->amountPositive(), $bill->amount_min, $bill->amount_max);-- /*- * If both, update!- */+ // If both, update!if ($wordMatch && $amountMatch) {$journal->bill()->associate($bill);$journal->save();@@ -547,7 +533,6 @@ class BillRepository implements BillRepositoryInterface'skip' => $data['skip'],'automatch' => $data['automatch'],'active' => $data['active'],-]);@@ -603,8 +588,8 @@ class BillRepository implements BillRepositoryInterface$wordMatch = false;$count = 0;foreach ($matches as $word) {- if (!(strpos($description, strtolower($word)) === false)) {- $count++;+ if (!(false === strpos($description, strtolower($word)))) {+ ++$count;}}if ($count >= count($matches)) {diff --git a/app/Repositories/Bill/BillRepositoryInterface.php b/app/Repositories/Bill/BillRepositoryInterface.phpindex 0705dba846..acc5b9b977 100644--- a/app/Repositories/Bill/BillRepositoryInterface.php+++ b/app/Repositories/Bill/BillRepositoryInterface.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Repositories\Bill;@@ -30,9 +29,7 @@ use FireflyIII\User;use Illuminate\Support\Collection;/**- * Interface BillRepositoryInterface- *- * @package FireflyIII\Repositories\Bill+ * Interface BillRepositoryInterface.*/interface BillRepositoryInterface{diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.phpindex 9a8ed2f65a..e4be053696 100644--- a/app/Repositories/Budget/BudgetRepository.php+++ b/app/Repositories/Budget/BudgetRepository.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Repositories\Budget;@@ -42,9 +41,7 @@ use Navigation;use stdClass;/**- * Class BudgetRepository- *- * @package FireflyIII\Repositories\Budget+ * Class BudgetRepository.*/class BudgetRepository implements BudgetRepositoryInterface{@@ -133,7 +130,7 @@ class BudgetRepository implements BudgetRepositoryInterface}/**- * Filters entries from the result set generated by getBudgetPeriodReport+ * Filters entries from the result set generated by getBudgetPeriodReport.** @param Collection $set* @param int $budgetId@@ -155,7 +152,7 @@ class BudgetRepository implements BudgetRepositoryInterface});$amount = '0';- if (!is_null($result->first())) {+ if (null !== $result->first()) {$amount = $result->first()->sum_of_period;}@@ -175,7 +172,7 @@ class BudgetRepository implements BudgetRepositoryInterfacepublic function find(int $budgetId): Budget{$budget = $this->user->budgets()->find($budgetId);- if (is_null($budget)) {+ if (null === $budget) {$budget = new Budget;}@@ -214,7 +211,7 @@ class BudgetRepository implements BudgetRepositoryInterface{$oldest = Carbon::create()->startOfYear();$journal = $budget->transactionJournals()->orderBy('date', 'ASC')->first();- if (!is_null($journal)) {+ if (null !== $journal) {$oldest = $journal->date < $oldest ? $journal->date : $oldest;}@@ -222,7 +219,7 @@ class BudgetRepository implements BudgetRepositoryInterface->transactions()->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.id')->orderBy('transaction_journals.date', 'ASC')->first(['transactions.*', 'transaction_journals.date']);- if (!is_null($transaction)) {+ if (null !== $transaction) {$carbon = new Carbon($transaction->date);$oldest = $carbon < $oldest ? $carbon : $oldest;}@@ -303,7 +300,7 @@ class BudgetRepository implements BudgetRepositoryInterface->where('transaction_currency_id', $currency->id)->where('start_date', $start->format('Y-m-d'))->where('end_date', $end->format('Y-m-d'))->first();- if (!is_null($availableBudget)) {+ if (null !== $availableBudget) {$amount = strval($availableBudget->amount);}@@ -478,7 +475,7 @@ class BudgetRepository implements BudgetRepositoryInterface->where('transaction_currency_id', $currency->id)->where('start_date', $start->format('Y-m-d'))->where('end_date', $end->format('Y-m-d'))->first();- if (is_null($availableBudget)) {+ if (null === $availableBudget) {$availableBudget = new AvailableBudget;$availableBudget->user()->associate($this->user);$availableBudget->transactionCurrency()->associate($currency);@@ -517,7 +514,7 @@ class BudgetRepository implements BudgetRepositoryInterfaceif ($accounts->count() > 0) {$collector->setAccounts($accounts);}- if ($accounts->count() === 0) {+ if (0 === $accounts->count()) {$collector->setAllAssetAccounts();}@@ -544,7 +541,7 @@ class BudgetRepository implements BudgetRepositoryInterfaceif ($accounts->count() > 0) {$collector->setAccounts($accounts);}- if ($accounts->count() === 0) {+ if (0 === $accounts->count()) {$collector->setAllAssetAccounts();}@@ -621,7 +618,7 @@ class BudgetRepository implements BudgetRepositoryInterface->first(['budget_limits.*']);// if more than 1 limit found, delete the others:- if ($limits > 1 && !is_null($limit)) {+ if ($limits > 1 && null !== $limit) {$budget->budgetlimits()->where('budget_limits.start_date', $start->format('Y-m-d'))->where('budget_limits.end_date', $end->format('Y-m-d'))@@ -629,13 +626,13 @@ class BudgetRepository implements BudgetRepositoryInterface}// delete if amount is zero.- if (!is_null($limit) && $amount <= 0.0) {+ if (null !== $limit && $amount <= 0.0) {$limit->delete();return new BudgetLimit;}// update if exists:- if (!is_null($limit)) {+ if (null !== $limit) {$limit->amount = $amount;$limit->save();diff --git a/app/Repositories/Budget/BudgetRepositoryInterface.php b/app/Repositories/Budget/BudgetRepositoryInterface.phpindex e419a0b0f0..ee4a15d9d2 100644--- a/app/Repositories/Budget/BudgetRepositoryInterface.php+++ b/app/Repositories/Budget/BudgetRepositoryInterface.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Repositories\Budget;@@ -31,9 +30,7 @@ use FireflyIII\User;use Illuminate\Support\Collection;/**- * Interface BudgetRepositoryInterface- *- * @package FireflyIII\Repositories\Budget+ * Interface BudgetRepositoryInterface.*/interface BudgetRepositoryInterface{@@ -62,7 +59,7 @@ interface BudgetRepositoryInterfacepublic function destroy(Budget $budget): bool;/**- * Filters entries from the result set generated by getBudgetPeriodReport+ * Filters entries from the result set generated by getBudgetPeriodReport.** @param Collection $set* @param int $budgetId@@ -132,7 +129,6 @@ interface BudgetRepositoryInterfacepublic function getBudgetLimits(Budget $budget, Carbon $start, Carbon $end): Collection;/**- ** @param Collection $budgets* @param Collection $accounts* @param Carbon $startdiff --git a/app/Repositories/Category/CategoryRepository.php b/app/Repositories/Category/CategoryRepository.phpindex 7c6f1e6f88..659e5dde38 100644--- a/app/Repositories/Category/CategoryRepository.php+++ b/app/Repositories/Category/CategoryRepository.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Repositories\Category;@@ -34,9 +33,7 @@ use Log;use Navigation;/**- * Class CategoryRepository- *- * @package FireflyIII\Repositories\Category+ * Class CategoryRepository.*/class CategoryRepository implements CategoryRepositoryInterface{@@ -76,7 +73,7 @@ class CategoryRepository implements CategoryRepositoryInterface}/**- * Find a category+ * Find a category.** @param int $categoryId*@@ -85,7 +82,7 @@ class CategoryRepository implements CategoryRepositoryInterfacepublic function find(int $categoryId): Category{$category = $this->user->categories()->find($categoryId);- if (is_null($category)) {+ if (null === $category) {$category = new Category;}@@ -93,7 +90,7 @@ class CategoryRepository implements CategoryRepositoryInterface}/**- * Find a category+ * Find a category.** @param string $name*@@ -121,13 +118,13 @@ class CategoryRepository implements CategoryRepositoryInterface$firstJournalDate = $this->getFirstJournalDate($category);$firstTransactionDate = $this->getFirstTransactionDate($category);- if (is_null($firstTransactionDate) && is_null($firstJournalDate)) {+ if (null === $firstTransactionDate && null === $firstJournalDate) {return null;}- if (is_null($firstTransactionDate)) {+ if (null === $firstTransactionDate) {return $firstJournalDate;}- if (is_null($firstJournalDate)) {+ if (null === $firstJournalDate) {return $firstTransactionDate;}@@ -167,13 +164,13 @@ class CategoryRepository implements CategoryRepositoryInterface$lastJournalDate = $this->getLastJournalDate($category, $accounts);$lastTransactionDate = $this->getLastTransactionDate($category, $accounts);- if (is_null($lastTransactionDate) && is_null($lastJournalDate)) {+ if (null === $lastTransactionDate && null === $lastJournalDate) {return null;}- if (is_null($lastTransactionDate)) {+ if (null === $lastTransactionDate) {return $lastJournalDate;}- if (is_null($lastJournalDate)) {+ if (null === $lastJournalDate) {return $lastTransactionDate;}@@ -218,7 +215,7 @@ class CategoryRepository implements CategoryRepositoryInterface/** @var Transaction $transaction */foreach ($transactions as $transaction) {// if positive, skip:- if (bccomp($transaction->transaction_amount, '0') === 1) {+ if (1 === bccomp($transaction->transaction_amount, '0')) {continue;}$categoryId = max(intval($transaction->transaction_journal_category_id), intval($transaction->transaction_category_id));@@ -253,7 +250,7 @@ class CategoryRepository implements CategoryRepositoryInterfaceforeach ($transactions as $transaction) {// if positive, skip:- if (bccomp($transaction->transaction_amount, '0') === 1) {+ if (1 === bccomp($transaction->transaction_amount, '0')) {continue;}$date = $transaction->date->format($carbonFormat);@@ -336,7 +333,6 @@ class CategoryRepository implements CategoryRepositoryInterface];Log::debug('Looping transactions..');foreach ($transactions as $transaction) {-// if negative, skip:if (bccomp($transaction->transaction_amount, '0') === -1) {continue;@@ -377,15 +373,13 @@ class CategoryRepository implements CategoryRepositoryInterface$collector->setUser($this->user);$collector->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL])->setCategories($categories);-if ($accounts->count() > 0) {$collector->setAccounts($accounts);}- if ($accounts->count() === 0) {+ if (0 === $accounts->count()) {$collector->setAllAssetAccounts();}-$set = $collector->getJournals();$sum = strval($set->sum('transaction_amount'));@@ -409,7 +403,7 @@ class CategoryRepository implements CategoryRepositoryInterfaceif ($accounts->count() > 0) {$collector->setAccounts($accounts);}- if ($accounts->count() === 0) {+ if (0 === $accounts->count()) {$collector->setAllAssetAccounts();}@@ -472,7 +466,7 @@ class CategoryRepository implements CategoryRepositoryInterface$query = $category->transactionJournals()->orderBy('date', 'ASC');$result = $query->first(['transaction_journals.*']);- if (!is_null($result)) {+ if (null !== $result) {return $result->date;}@@ -492,7 +486,7 @@ class CategoryRepository implements CategoryRepositoryInterface->orderBy('transaction_journals.date', 'DESC');$lastTransaction = $query->first(['transaction_journals.*']);- if (!is_null($lastTransaction)) {+ if (null !== $lastTransaction) {return new Carbon($lastTransaction->date);}@@ -516,7 +510,7 @@ class CategoryRepository implements CategoryRepositoryInterface$result = $query->first(['transaction_journals.*']);- if (!is_null($result)) {+ if (null !== $result) {return $result->date;}@@ -541,7 +535,7 @@ class CategoryRepository implements CategoryRepositoryInterface}$lastTransaction = $query->first(['transaction_journals.*']);- if (!is_null($lastTransaction)) {+ if (null !== $lastTransaction) {return new Carbon($lastTransaction->date);}diff --git a/app/Repositories/Category/CategoryRepositoryInterface.php b/app/Repositories/Category/CategoryRepositoryInterface.phpindex 7dc423800b..2444678ca5 100644--- a/app/Repositories/Category/CategoryRepositoryInterface.php+++ b/app/Repositories/Category/CategoryRepositoryInterface.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Repositories\Category;@@ -29,9 +28,7 @@ use FireflyIII\User;use Illuminate\Support\Collection;/**- * Interface CategoryRepositoryInterface- *- * @package FireflyIII\Repositories\Category+ * Interface CategoryRepositoryInterface.*/interface CategoryRepositoryInterface{@@ -53,7 +50,7 @@ interface CategoryRepositoryInterfacepublic function earnedInPeriod(Collection $categories, Collection $accounts, Carbon $start, Carbon $end): string;/**- * Find a category+ * Find a category.** @param int $categoryId*@@ -62,7 +59,7 @@ interface CategoryRepositoryInterfacepublic function find(int $categoryId): Category;/**- * Find a category+ * Find a category.** @param string $name*diff --git a/app/Repositories/Currency/CurrencyRepository.php b/app/Repositories/Currency/CurrencyRepository.phpindex eda842ccdd..0edb00f25a 100644--- a/app/Repositories/Currency/CurrencyRepository.php+++ b/app/Repositories/Currency/CurrencyRepository.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Repositories\Currency;@@ -33,9 +32,7 @@ use Log;use Preferences;/**- * Class CurrencyRepository- *- * @package FireflyIII\Repositories\Currency+ * Class CurrencyRepository.*/class CurrencyRepository implements CurrencyRepositoryInterface{@@ -54,7 +51,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface}// is the only currency left- if ($this->get()->count() === 1) {+ if (1 === $this->get()->count()) {return false;}@@ -99,7 +96,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface}/**- * Find by ID+ * Find by ID.** @param int $currencyId*@@ -108,7 +105,7 @@ class CurrencyRepository implements CurrencyRepositoryInterfacepublic function find(int $currencyId): TransactionCurrency{$currency = TransactionCurrency::find($currencyId);- if (is_null($currency)) {+ if (null === $currency) {$currency = new TransactionCurrency;}@@ -116,7 +113,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface}/**- * Find by currency code+ * Find by currency code.** @param string $currencyCode*@@ -125,7 +122,7 @@ class CurrencyRepository implements CurrencyRepositoryInterfacepublic function findByCode(string $currencyCode): TransactionCurrency{$currency = TransactionCurrency::where('code', $currencyCode)->first();- if (is_null($currency)) {+ if (null === $currency) {$currency = new TransactionCurrency;}@@ -133,7 +130,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface}/**- * Find by currency name+ * Find by currency name.** @param string $currencyName*@@ -142,7 +139,7 @@ class CurrencyRepository implements CurrencyRepositoryInterfacepublic function findByName(string $currencyName): TransactionCurrency{$preferred = TransactionCurrency::whereName($currencyName)->first();- if (is_null($preferred)) {+ if (null === $preferred) {$preferred = new TransactionCurrency;}@@ -150,7 +147,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface}/**- * Find by currency symbol+ * Find by currency symbol.** @param string $currencySymbol*@@ -159,7 +156,7 @@ class CurrencyRepository implements CurrencyRepositoryInterfacepublic function findBySymbol(string $currencySymbol): TransactionCurrency{$currency = TransactionCurrency::whereSymbol($currencySymbol)->first();- if (is_null($currency)) {+ if (null === $currency) {$currency = new TransactionCurrency;}@@ -192,7 +189,7 @@ class CurrencyRepository implements CurrencyRepositoryInterfacepublic function getCurrencyByPreference(Preference $preference): TransactionCurrency{$preferred = TransactionCurrency::where('code', $preference->data)->first();- if (is_null($preferred)) {+ if (null === $preferred) {$preferred = TransactionCurrency::first();}@@ -220,7 +217,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface->where('from_currency_id', $fromCurrency->id)->where('to_currency_id', $toCurrency->id)->where('date', $date->format('Y-m-d'))->first();- if (!is_null($rate)) {+ if (null !== $rate) {Log::debug(sprintf('Found cached exchange rate in database for %s to %s on %s', $fromCurrency->code, $toCurrency->code, $date->format('Y-m-d')));return $rate;diff --git a/app/Repositories/Currency/CurrencyRepositoryInterface.php b/app/Repositories/Currency/CurrencyRepositoryInterface.phpindex 1e6982e63a..233e59044a 100644--- a/app/Repositories/Currency/CurrencyRepositoryInterface.php+++ b/app/Repositories/Currency/CurrencyRepositoryInterface.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Repositories\Currency;@@ -31,9 +30,7 @@ use FireflyIII\User;use Illuminate\Support\Collection;/**- * Interface CurrencyRepositoryInterface- *- * @package FireflyIII\Repositories\Currency+ * Interface CurrencyRepositoryInterface.*/interface CurrencyRepositoryInterface{@@ -59,7 +56,7 @@ interface CurrencyRepositoryInterfacepublic function destroy(TransactionCurrency $currency): bool;/**- * Find by ID+ * Find by ID.** @param int $currencyId*@@ -68,7 +65,7 @@ interface CurrencyRepositoryInterfacepublic function find(int $currencyId): TransactionCurrency;/**- * Find by currency code+ * Find by currency code.** @param string $currencyCode*@@ -77,7 +74,7 @@ interface CurrencyRepositoryInterfacepublic function findByCode(string $currencyCode): TransactionCurrency;/**- * Find by currency name+ * Find by currency name.** @param string $currencyName*@@ -86,7 +83,7 @@ interface CurrencyRepositoryInterfacepublic function findByName(string $currencyName): TransactionCurrency;/**- * Find by currency symbol+ * Find by currency symbol.** @param string $currencySymbol*diff --git a/app/Repositories/ExportJob/ExportJobRepository.php b/app/Repositories/ExportJob/ExportJobRepository.phpindex 73a5306109..85fc0cb189 100644--- a/app/Repositories/ExportJob/ExportJobRepository.php+++ b/app/Repositories/ExportJob/ExportJobRepository.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Repositories\ExportJob;@@ -31,9 +30,7 @@ use Log;use Storage;/**- * Class ExportJobRepository- *- * @package FireflyIII\Repositories\ExportJob+ * Class ExportJobRepository.*/class ExportJobRepository implements ExportJobRepositoryInterface{@@ -91,7 +88,7 @@ class ExportJobRepository implements ExportJobRepositoryInterfacewhile ($count < 30) {$key = Str::random(12);$existing = $this->findByKey($key);- if (is_null($existing->id)) {+ if (null === $existing->id) {$exportJob = new ExportJob;$exportJob->user()->associate($this->user);$exportJob->key = Str::random(12);@@ -102,7 +99,7 @@ class ExportJobRepository implements ExportJobRepositoryInterfacereturn $exportJob;}- $count++;+ ++$count;}return new ExportJob;@@ -129,7 +126,7 @@ class ExportJobRepository implements ExportJobRepositoryInterfacepublic function findByKey(string $key): ExportJob{$result = $this->user->exportJobs()->where('key', $key)->first(['export_jobs.*']);- if (is_null($result)) {+ if (null === $result) {return new ExportJob;}diff --git a/app/Repositories/ExportJob/ExportJobRepositoryInterface.php b/app/Repositories/ExportJob/ExportJobRepositoryInterface.phpindex 6e513e57a2..34c1eb3b29 100644--- a/app/Repositories/ExportJob/ExportJobRepositoryInterface.php+++ b/app/Repositories/ExportJob/ExportJobRepositoryInterface.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Repositories\ExportJob;@@ -27,9 +26,7 @@ use FireflyIII\Models\ExportJob;use FireflyIII\User;/**- * Interface ExportJobRepositoryInterface- *- * @package FireflyIII\Repositories\ExportJob+ * Interface ExportJobRepositoryInterface.*/interface ExportJobRepositoryInterface{diff --git a/app/Repositories/ImportJob/ImportJobRepository.php b/app/Repositories/ImportJob/ImportJobRepository.phpindex 38f900d938..c3bef54aee 100644--- a/app/Repositories/ImportJob/ImportJobRepository.php+++ b/app/Repositories/ImportJob/ImportJobRepository.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Repositories\ImportJob;@@ -35,9 +34,7 @@ use Storage;use Symfony\Component\HttpFoundation\File\UploadedFile;/**- * Class ImportJobRepository- *- * @package FireflyIII\Repositories\ImportJob+ * Class ImportJobRepository.*/class ImportJobRepository implements ImportJobRepositoryInterface{@@ -48,6 +45,7 @@ class ImportJobRepository implements ImportJobRepositoryInterface* @param string $fileType** @return ImportJob+ ** @throws FireflyException*/public function create(string $fileType): ImportJob@@ -62,7 +60,7 @@ class ImportJobRepository implements ImportJobRepositoryInterfacewhile ($count < 30) {$key = Str::random(12);$existing = $this->findByKey($key);- if (is_null($existing->id)) {+ if (null === $existing->id) {$importJob = new ImportJob;$importJob->user()->associate($this->user);$importJob->file_type = $fileType;@@ -80,7 +78,7 @@ class ImportJobRepository implements ImportJobRepositoryInterface// breaks the loop:return $importJob;}- $count++;+ ++$count;}return new ImportJob;@@ -94,7 +92,7 @@ class ImportJobRepository implements ImportJobRepositoryInterfacepublic function findByKey(string $key): ImportJob{$result = $this->user->importJobs()->where('key', $key)->first(['import_jobs.*']);- if (is_null($result)) {+ if (null === $result) {return new ImportJob;}@@ -122,7 +120,7 @@ class ImportJobRepository implements ImportJobRepositoryInterface$configRaw = $configFileObject->fread($configFileObject->getSize());$configuration = json_decode($configRaw, true);- if (!is_null($configuration) && is_array($configuration)) {+ if (null !== $configuration && is_array($configuration)) {Log::debug('Found configuration', $configuration);$this->setConfiguration($job, $configuration);}@@ -147,7 +145,6 @@ class ImportJobRepository implements ImportJobRepositoryInterface$contentEncrypted = Crypt::encrypt($content);$disk = Storage::disk('upload');-// user is demo user, replace upload with prepared file.if ($repository->hasRole($this->user, 'demo')) {$stubsDisk = Storage::disk('stubs');diff --git a/app/Repositories/ImportJob/ImportJobRepositoryInterface.php b/app/Repositories/ImportJob/ImportJobRepositoryInterface.phpindex 91d2d5449a..ad74c4e021 100644--- a/app/Repositories/ImportJob/ImportJobRepositoryInterface.php+++ b/app/Repositories/ImportJob/ImportJobRepositoryInterface.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Repositories\ImportJob;@@ -28,9 +27,7 @@ use FireflyIII\User;use Symfony\Component\HttpFoundation\File\UploadedFile;/**- * Interface ImportJobRepositoryInterface- *- * @package FireflyIII\Repositories\ImportJob+ * Interface ImportJobRepositoryInterface.*/interface ImportJobRepositoryInterface{diff --git a/app/Repositories/Journal/CreateJournalsTrait.php b/app/Repositories/Journal/CreateJournalsTrait.phpindex cac82799ef..e9b9e1be87 100644--- a/app/Repositories/Journal/CreateJournalsTrait.php+++ b/app/Repositories/Journal/CreateJournalsTrait.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Repositories\Journal;@@ -39,8 +38,6 @@ use Log;* @property User $user** Trait CreateJournalsTrait- *- * @package FireflyIII\Repositories\Journal*/trait CreateJournalsTrait{@@ -54,7 +51,6 @@ trait CreateJournalsTraitabstract public function storeAccounts(User $user, TransactionType $type, array $data): array;/**- ** * Remember: a balancingAct takes at most one expense and one transfer.* an advancePayment takes at most one expense, infinite deposits and NO transfers.*@@ -71,7 +67,7 @@ trait CreateJournalsTraitforeach ($array as $name) {if (strlen(trim($name)) > 0) {$tag = Tag::firstOrCreateEncrypted(['tag' => $name, 'user_id' => $journal->user_id]);- if (!is_null($tag)) {+ if (null !== $tag) {Log::debug(sprintf('Will try to connect tag #%d to journal #%d.', $tag->id, $journal->id));$tagRepository->connect($journal, $tag);}@@ -87,7 +83,7 @@ trait CreateJournalsTrait*/protected function storeBudgetWithTransaction(Transaction $transaction, int $budgetId){- if (intval($budgetId) > 0 && $transaction->transactionJournal->transactionType->type !== TransactionType::TRANSFER) {+ if (intval($budgetId) > 0 && TransactionType::TRANSFER !== $transaction->transactionJournal->transactionType->type) {/** @var \FireflyIII\Models\Budget $budget */$budget = Budget::find($budgetId);$transaction->budgets()->save($budget);@@ -123,7 +119,7 @@ trait CreateJournalsTrait// store transaction one way:$amount = bcmul(strval($transaction['amount']), '-1');- $foreignAmount = is_null($transaction['foreign_amount']) ? null : bcmul(strval($transaction['foreign_amount']), '-1');+ $foreignAmount = null === $transaction['foreign_amount'] ? null : bcmul(strval($transaction['foreign_amount']), '-1');$one = $this->storeTransaction(['journal' => $journal,@@ -143,7 +139,7 @@ trait CreateJournalsTrait// and the other way:$amount = strval($transaction['amount']);- $foreignAmount = is_null($transaction['foreign_amount']) ? null : strval($transaction['foreign_amount']);+ $foreignAmount = null === $transaction['foreign_amount'] ? null : strval($transaction['foreign_amount']);$two = $this->storeTransaction(['journal' => $journal,@@ -182,11 +178,10 @@ trait CreateJournalsTrait'identifier' => $data['identifier'],];-- if (is_null($data['foreign_currency_id'])) {+ if (null === $data['foreign_currency_id']) {unset($fields['foreign_currency_id']);}- if (is_null($data['foreign_amount'])) {+ if (null === $data['foreign_amount']) {unset($fields['foreign_amount']);}@@ -195,18 +190,17 @@ trait CreateJournalsTraitLog::debug(sprintf('Transaction stored with ID: %s', $transaction->id));- if (!is_null($data['category'])) {+ if (null !== $data['category']) {$transaction->categories()->save($data['category']);}- if (!is_null($data['budget'])) {+ if (null !== $data['budget']) {$transaction->categories()->save($data['budget']);}return $transaction;}-/*** @param TransactionJournal $journal* @param string $note@@ -215,16 +209,16 @@ trait CreateJournalsTrait*/protected function updateNote(TransactionJournal $journal, string $note): bool{- if (strlen($note) === 0) {+ if (0 === strlen($note)) {$dbNote = $journal->notes()->first();- if (!is_null($dbNote)) {+ if (null !== $dbNote) {$dbNote->delete();}return true;}$dbNote = $journal->notes()->first();- if (is_null($dbNote)) {+ if (null === $dbNote) {$dbNote = new Note();$dbNote->noteable()->associate($journal);}diff --git a/app/Repositories/Journal/JournalRepository.php b/app/Repositories/Journal/JournalRepository.phpindex 8c99fa16b9..2e03e96231 100644--- a/app/Repositories/Journal/JournalRepository.php+++ b/app/Repositories/Journal/JournalRepository.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Repositories\Journal;@@ -34,9 +33,7 @@ use Log;use Preferences;/**- * Class JournalRepository- *- * @package FireflyIII\Repositories\Journal+ * Class JournalRepository.*/class JournalRepository implements JournalRepositoryInterface{@@ -64,7 +61,7 @@ class JournalRepository implements JournalRepositoryInterface$messages->add('destination_account_expense', trans('firefly.invalid_convert_selection'));$messages->add('source_account_asset', trans('firefly.invalid_convert_selection'));- if ($source->id === $destination->id || is_null($source->id) || is_null($destination->id)) {+ if ($source->id === $destination->id || null === $source->id || null === $destination->id) {return $messages;}@@ -78,7 +75,7 @@ class JournalRepository implements JournalRepositoryInterface$journal->save();// if journal is a transfer now, remove budget:- if ($type->type === TransactionType::TRANSFER) {+ if (TransactionType::TRANSFER === $type->type) {$journal->budgets()->detach();}@@ -117,7 +114,7 @@ class JournalRepository implements JournalRepositoryInterfacepublic function find(int $journalId): TransactionJournal{$journal = $this->user->transactionJournals()->where('id', $journalId)->first();- if (is_null($journal)) {+ if (null === $journal) {return new TransactionJournal;}@@ -157,7 +154,7 @@ class JournalRepository implements JournalRepositoryInterface}/**- * Get users first transaction journal+ * Get users first transaction journal.** @return TransactionJournal*/@@ -165,7 +162,7 @@ class JournalRepository implements JournalRepositoryInterface{$entry = $this->user->transactionJournals()->orderBy('date', 'ASC')->first(['transaction_journals.*']);- if (is_null($entry)) {+ if (null === $entry) {return new TransactionJournal;}@@ -187,7 +184,7 @@ class JournalRepository implements JournalRepositoryInterface*/public function isTransfer(TransactionJournal $journal): bool{- return $journal->transactionType->type === TransactionType::TRANSFER;+ return TransactionType::TRANSFER === $journal->transactionType->type;}/**@@ -200,7 +197,7 @@ class JournalRepository implements JournalRepositoryInterfaceLog::debug(sprintf('Going to reconcile transaction #%d', $transaction->id));$opposing = $this->findOpposingTransaction($transaction);- if (is_null($opposing)) {+ if (null === $opposing) {Log::debug('Opposing transaction is NULL. Cannot reconcile.');return false;@@ -272,7 +269,7 @@ class JournalRepository implements JournalRepositoryInterface'account' => $accounts['source'],'amount' => bcmul($amount, '-1'),'transaction_currency_id' => $data['currency_id'],- 'foreign_amount' => is_null($data['foreign_amount']) ? null : bcmul(strval($data['foreign_amount']), '-1'),+ 'foreign_amount' => null === $data['foreign_amount'] ? null : bcmul(strval($data['foreign_amount']), '-1'),'foreign_currency_id' => $data['foreign_currency_id'],'description' => null,'category' => null,@@ -296,7 +293,6 @@ class JournalRepository implements JournalRepositoryInterface$this->storeTransaction($two);-// store tagsif (isset($data['tags']) && is_array($data['tags'])) {$this->saveTags($journal, $data['tags']);@@ -329,14 +325,13 @@ class JournalRepository implements JournalRepositoryInterface*/public function update(TransactionJournal $journal, array $data): TransactionJournal{-// update actual journal:$journal->description = $data['description'];$journal->date = $data['date'];$accounts = $this->storeAccounts($this->user, $journal->transactionType, $data);$data = $this->verifyNativeAmount($data, $accounts);$data['amount'] = strval($data['amount']);- $data['foreign_amount'] = is_null($data['foreign_amount']) ? null : strval($data['foreign_amount']);+ $data['foreign_amount'] = null === $data['foreign_amount'] ? null : strval($data['foreign_amount']);// unlink all categories, recreate them:$journal->categories()->detach();@@ -359,7 +354,7 @@ class JournalRepository implements JournalRepositoryInterface}// update note:- if (isset($data['notes']) && !is_null($data['notes'])) {+ if (isset($data['notes']) && null !== $data['notes']) {$this->updateNote($journal, strval($data['notes']));}@@ -401,11 +396,10 @@ class JournalRepository implements JournalRepositoryInterface$journal->budgets()->detach();// update note:- if (isset($data['notes']) && !is_null($data['notes'])) {+ if (isset($data['notes']) && null !== $data['notes']) {$this->updateNote($journal, strval($data['notes']));}-// update meta fields:$result = $journal->save();if ($result) {@@ -434,7 +428,7 @@ class JournalRepository implements JournalRepositoryInterfaceLog::debug(sprintf('Split journal update split transaction %d', $identifier));$transaction = $this->appendTransactionData($transaction, $data);$this->storeSplitTransaction($journal, $transaction, $identifier);- $identifier++;+ ++$identifier;}$journal->save();diff --git a/app/Repositories/Journal/JournalRepositoryInterface.php b/app/Repositories/Journal/JournalRepositoryInterface.phpindex d2c4edb1ea..34efa0a649 100644--- a/app/Repositories/Journal/JournalRepositoryInterface.php+++ b/app/Repositories/Journal/JournalRepositoryInterface.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Repositories\Journal;@@ -32,13 +31,10 @@ use Illuminate\Support\Collection;use Illuminate\Support\MessageBag;/**- * Interface JournalRepositoryInterface- *- * @package FireflyIII\Repositories\Journal+ * Interface JournalRepositoryInterface.*/interface JournalRepositoryInterface{-/*** @param TransactionJournal $journal* @param TransactionType $type@@ -66,7 +62,7 @@ interface JournalRepositoryInterfacepublic function delete(TransactionJournal $journal): bool;/**- * Find a specific journal+ * Find a specific journal.** @param int $journalId*@@ -89,7 +85,7 @@ interface JournalRepositoryInterfacepublic function findTransaction(int $transactionid): ?Transaction;/**- * Get users very first transaction journal+ * Get users very first transaction journal.** @return TransactionJournal*/diff --git a/app/Repositories/Journal/JournalTasker.php b/app/Repositories/Journal/JournalTasker.phpindex a0a3928d2a..ae7f22e7be 100644--- a/app/Repositories/Journal/JournalTasker.php+++ b/app/Repositories/Journal/JournalTasker.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Repositories\Journal;@@ -36,17 +35,13 @@ use Illuminate\Support\Collection;use Steam;/**- * Class JournalTasker- *- * @package FireflyIII\Repositories\Journal+ * Class JournalTasker.*/class JournalTasker implements JournalTaskerInterface{-/** @var User */private $user;-/*** @param TransactionJournal $journal*@@ -128,7 +123,6 @@ class JournalTasker implements JournalTaskerInterface'foreign_currencies.decimal_places as foreign_currency_dp','foreign_currencies.code as foreign_currency_code','foreign_currencies.symbol as foreign_currency_symbol',-]);@@ -156,14 +150,14 @@ class JournalTasker implements JournalTaskerInterface'source_account_after' => bcadd($sourceBalance, $entry->amount),'destination_id' => $entry->destination_id,'destination_amount' => bcmul($entry->amount, '-1'),- 'foreign_destination_amount' => is_null($entry->foreign_amount) ? null : bcmul($entry->foreign_amount, '-1'),+ 'foreign_destination_amount' => null === $entry->foreign_amount ? null : bcmul($entry->foreign_amount, '-1'),'destination_account_id' => $entry->destination_account_id,'destination_account_type' => $entry->destination_account_type,'destination_account_name' => Steam::decrypt(intval($entry->destination_account_encrypted), $entry->destination_account_name),'destination_account_before' => $destinationBalance,'destination_account_after' => bcadd($destinationBalance, bcmul($entry->amount, '-1')),- 'budget_id' => is_null($budget) ? 0 : $budget->id,- 'category' => is_null($category) ? '' : $category->name,+ 'budget_id' => null === $budget ? 0 : $budget->id,+ 'category' => null === $category ? '' : $category->name,'transaction_currency_id' => $entry->transaction_currency_id,'transaction_currency_code' => $entry->transaction_currency_code,'transaction_currency_symbol' => $entry->transaction_currency_symbol,@@ -173,15 +167,14 @@ class JournalTasker implements JournalTaskerInterface'foreign_currency_symbol' => $entry->foreign_currency_symbol,'foreign_currency_dp' => $entry->foreign_currency_dp,];- if ($entry->destination_account_type === AccountType::CASH) {+ if (AccountType::CASH === $entry->destination_account_type) {$transaction['destination_account_name'] = '';}- if ($entry->account_type === AccountType::CASH) {+ if (AccountType::CASH === $entry->account_type) {$transaction['source_account_name'] = '';}-$transactions[] = $transaction;}$cache->store($transactions);@@ -200,7 +193,7 @@ class JournalTasker implements JournalTaskerInterface/*** Collect the balance of an account before the given transaction has hit. This is tricky, because* the balance does not depend on the transaction itself but the journal it's part of. And of course- * the order of transactions within the journal. So the query is pretty complex:+ * the order of transactions within the journal. So the query is pretty complex:.** @param int $transactionId*diff --git a/app/Repositories/Journal/JournalTaskerInterface.php b/app/Repositories/Journal/JournalTaskerInterface.phpindex 98985477d8..37899de92f 100644--- a/app/Repositories/Journal/JournalTaskerInterface.php+++ b/app/Repositories/Journal/JournalTaskerInterface.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Repositories\Journal;@@ -28,9 +27,7 @@ use FireflyIII\User;use Illuminate\Support\Collection;/**- * Interface JournalTaskerInterface- *- * @package FireflyIII\Repositories\Journal+ * Interface JournalTaskerInterface.*/interface JournalTaskerInterface{diff --git a/app/Repositories/Journal/SupportJournalsTrait.php b/app/Repositories/Journal/SupportJournalsTrait.phpindex d825158223..a357a316bc 100644--- a/app/Repositories/Journal/SupportJournalsTrait.php+++ b/app/Repositories/Journal/SupportJournalsTrait.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Repositories\Journal;@@ -34,9 +33,7 @@ use FireflyIII\User;use Log;/**- * Trait SupportJournalsTrait- *- * @package FireflyIII\Repositories\Journal+ * Trait SupportJournalsTrait.*/trait SupportJournalsTrait{@@ -46,6 +43,7 @@ trait SupportJournalsTrait* @param array $data** @return array+ ** @throws FireflyException*/protected function storeAccounts(User $user, TransactionType $type, array $data): array@@ -73,17 +71,16 @@ trait SupportJournalsTraitthrow new FireflyException(sprintf('Did not recognise transaction type "%s".', $type->type));}- if (is_null($accounts['source'])) {+ if (null === $accounts['source']) {Log::error('"source"-account is null, so we cannot continue!', ['data' => $data]);throw new FireflyException('"source"-account is null, so we cannot continue!');}- if (is_null($accounts['destination'])) {+ if (null === $accounts['destination']) {Log::error('"destination"-account is null, so we cannot continue!', ['data' => $data]);throw new FireflyException('"destination"-account is null, so we cannot continue!');}-return $accounts;}@@ -93,7 +90,7 @@ trait SupportJournalsTrait*/protected function storeBudgetWithJournal(TransactionJournal $journal, int $budgetId){- if (intval($budgetId) > 0 && $journal->transactionType->type === TransactionType::WITHDRAWAL) {+ if (intval($budgetId) > 0 && TransactionType::WITHDRAWAL === $journal->transactionType->type) {/** @var \FireflyIII\Models\Budget $budget */$budget = Budget::find($budgetId);$journal->budgets()->save($budget);@@ -215,6 +212,7 @@ trait SupportJournalsTrait* @param array $accounts** @return array+ ** @throws FireflyException*/protected function verifyNativeAmount(array $data, array $accounts): array@@ -227,7 +225,7 @@ trait SupportJournalsTrait// which account to check for what the native currency is?$check = 'source';- if ($transactionType->type === TransactionType::DEPOSIT) {+ if (TransactionType::DEPOSIT === $transactionType->type) {$check = 'destination';}switch ($transactionType->type) {diff --git a/app/Repositories/Journal/UpdateJournalsTrait.php b/app/Repositories/Journal/UpdateJournalsTrait.phpindex 75aba8e0a0..0095d8bf83 100644--- a/app/Repositories/Journal/UpdateJournalsTrait.php+++ b/app/Repositories/Journal/UpdateJournalsTrait.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Repositories\Journal;@@ -34,15 +33,12 @@ use FireflyIII\Repositories\Tag\TagRepositoryInterface;use Log;/**- * Trait UpdateJournalsTrait- *- * @package FireflyIII\Repositories\Journal+ * Trait UpdateJournalsTrait.*/trait UpdateJournalsTrait{-/**- * When the user edits a split journal, each line is missing crucial data:+ * When the user edits a split journal, each line is missing crucial data:.** - Withdrawal lines are missing the source account ID* - Deposit lines are missing the destination account ID@@ -84,14 +80,14 @@ trait UpdateJournalsTraitprotected function updateDestinationTransaction(TransactionJournal $journal, Account $account, array $data){$set = $journal->transactions()->where('amount', '>', 0)->get();- if ($set->count() !== 1) {+ if (1 !== $set->count()) {throw new FireflyException(sprintf('Journal #%d has %d transactions with an amount more than zero.', $journal->id, $set->count()));}/** @var Transaction $transaction */$transaction = $set->first();$transaction->amount = app('steam')->positive($data['amount']);$transaction->transaction_currency_id = $data['currency_id'];- $transaction->foreign_amount = is_null($data['foreign_amount']) ? null : app('steam')->positive($data['foreign_amount']);+ $transaction->foreign_amount = null === $data['foreign_amount'] ? null : app('steam')->positive($data['foreign_amount']);$transaction->foreign_currency_id = $data['foreign_currency_id'];$transaction->account_id = $account->id;$transaction->save();@@ -108,14 +104,14 @@ trait UpdateJournalsTrait{// should be one:$set = $journal->transactions()->where('amount', '<', 0)->get();- if ($set->count() !== 1) {+ if (1 !== $set->count()) {throw new FireflyException(sprintf('Journal #%d has %d transactions with an amount more than zero.', $journal->id, $set->count()));}/** @var Transaction $transaction */$transaction = $set->first();$transaction->amount = bcmul(app('steam')->positive($data['amount']), '-1');$transaction->transaction_currency_id = $data['currency_id'];- $transaction->foreign_amount = is_null($data['foreign_amount']) ? null : bcmul(app('steam')->positive($data['foreign_amount']), '-1');+ $transaction->foreign_amount = null === $data['foreign_amount'] ? null : bcmul(app('steam')->positive($data['foreign_amount']), '-1');$transaction->foreign_currency_id = $data['foreign_currency_id'];$transaction->account_id = $account->id;$transaction->save();@@ -133,7 +129,6 @@ trait UpdateJournalsTrait/** @var TagRepositoryInterface $tagRepository */$tagRepository = app(TagRepositoryInterface::class);-// find or create all tags:$tags = [];$ids = [];@@ -150,7 +145,7 @@ trait UpdateJournalsTraitDB::table('tag_transaction_journal')->where('transaction_journal_id', $journal->id)->whereNotIn('tag_id', $ids)->delete();}// if count is zero, delete them all:- if (count($ids) === 0) {+ if (0 === count($ids)) {DB::table('tag_transaction_journal')->where('transaction_journal_id', $journal->id)->delete();}diff --git a/app/Repositories/LinkType/LinkTypeRepository.php b/app/Repositories/LinkType/LinkTypeRepository.phpindex 2f71487d7d..c600cc0f54 100644--- a/app/Repositories/LinkType/LinkTypeRepository.php+++ b/app/Repositories/LinkType/LinkTypeRepository.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Repositories\LinkType;@@ -30,9 +29,7 @@ use FireflyIII\User;use Illuminate\Support\Collection;/**- * Class LinkTypeRepository- *- * @package FireflyIII\Repositories\LinkType+ * Class LinkTypeRepository.*/class LinkTypeRepository implements LinkTypeRepositoryInterface{@@ -57,7 +54,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface*/public function destroy(LinkType $linkType, LinkType $moveTo): bool{- if (!is_null($moveTo->id)) {+ if (null !== $moveTo->id) {TransactionJournalLink::where('link_type_id', $linkType->id)->update(['link_type_id' => $moveTo->id]);}$linkType->delete();@@ -85,7 +82,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterfacepublic function find(int $id): LinkType{$linkType = LinkType::find($id);- if (is_null($linkType)) {+ if (null === $linkType) {return new LinkType;}@@ -105,7 +102,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface$count = TransactionJournalLink::whereDestinationId($one->id)->whereSourceId($two->id)->count();$opposingCount = TransactionJournalLink::whereDestinationId($two->id)->whereSourceId($one->id)->count();- return ($count + $opposingCount > 0);+ return $count + $opposingCount > 0;}/**diff --git a/app/Repositories/LinkType/LinkTypeRepositoryInterface.php b/app/Repositories/LinkType/LinkTypeRepositoryInterface.phpindex 5e4fe38e7e..b917cec351 100644--- a/app/Repositories/LinkType/LinkTypeRepositoryInterface.php+++ b/app/Repositories/LinkType/LinkTypeRepositoryInterface.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Repositories\LinkType;@@ -29,9 +28,7 @@ use FireflyIII\Models\TransactionJournalLink;use Illuminate\Support\Collection;/**- * Interface LinkTypeRepositoryInterface- *- * @package FireflyIII\Repositories\LinkType+ * Interface LinkTypeRepositoryInterface.*/interface LinkTypeRepositoryInterface{diff --git a/app/Repositories/PiggyBank/PiggyBankRepository.php b/app/Repositories/PiggyBank/PiggyBankRepository.phpindex a9e557f081..49f2852217 100644--- a/app/Repositories/PiggyBank/PiggyBankRepository.php+++ b/app/Repositories/PiggyBank/PiggyBankRepository.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Repositories\PiggyBank;@@ -34,13 +33,10 @@ use Illuminate\Support\Collection;use Log;/**- * Class PiggyBankRepository- *- * @package FireflyIII\Repositories\PiggyBank+ * Class PiggyBankRepository.*/class PiggyBankRepository implements PiggyBankRepositoryInterface{-/** @var User */private $user;@@ -142,6 +138,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface* @param PiggyBank $piggyBank** @return bool+ ** @throws \Exception*/public function destroy(PiggyBank $piggyBank): bool@@ -159,7 +156,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterfacepublic function find(int $piggyBankid): PiggyBank{$piggyBank = $this->user->piggyBanks()->where('piggy_banks.id', $piggyBankid)->first(['piggy_banks.*']);- if (!is_null($piggyBank)) {+ if (null !== $piggyBank) {return $piggyBank;}@@ -200,9 +197,8 @@ class PiggyBankRepository implements PiggyBankRepositoryInterfaceLog::debug(sprintf('Account #%d is the source, so will remove amount from piggy bank.', $piggyBank->account_id));}-// if the amount is positive, make sure it fits in piggy bank:- if (bccomp($amount, '0') === 1 && bccomp($room, $amount) === -1) {+ if (1 === bccomp($amount, '0') && bccomp($room, $amount) === -1) {// amount is positive and $room is smaller than $amountLog::debug(sprintf('Room in piggy bank for extra money is %f', $room));Log::debug(sprintf('There is NO room to add %f to piggy bank #%d ("%s")', $amount, $piggyBank->id, $piggyBank->name));@@ -212,7 +208,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface}// amount is negative and $currentamount is smaller than $amount- if (bccomp($amount, '0') === -1 && bccomp($compare, $amount) === 1) {+ if (bccomp($amount, '0') === -1 && 1 === bccomp($compare, $amount)) {Log::debug(sprintf('Max amount to remove is %f', $repetition->currentamount));Log::debug(sprintf('Cannot remove %f from piggy bank #%d ("%s")', $amount, $piggyBank->id, $piggyBank->name));Log::debug(sprintf('New amount is %f', $compare));@@ -269,7 +265,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterfacepublic function getRepetition(PiggyBank $piggyBank, Carbon $date): PiggyBankRepetition{$repetition = $piggyBank->piggyBankRepetitions()->relevantOnDate($date)->first();- if (is_null($repetition)) {+ if (null === $repetition) {return new PiggyBankRepetition;}@@ -313,7 +309,6 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface}/**- ** set id of piggy bank.** @param int $piggyBankId@@ -397,16 +392,16 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface*/private function updateNote(PiggyBank $piggyBank, string $note): bool{- if (strlen($note) === 0) {+ if (0 === strlen($note)) {$dbNote = $piggyBank->notes()->first();- if (!is_null($dbNote)) {+ if (null !== $dbNote) {$dbNote->delete();}return true;}$dbNote = $piggyBank->notes()->first();- if (is_null($dbNote)) {+ if (null === $dbNote) {$dbNote = new Note();$dbNote->noteable()->associate($piggyBank);}diff --git a/app/Repositories/PiggyBank/PiggyBankRepositoryInterface.php b/app/Repositories/PiggyBank/PiggyBankRepositoryInterface.phpindex 2c6b335908..1219552227 100644--- a/app/Repositories/PiggyBank/PiggyBankRepositoryInterface.php+++ b/app/Repositories/PiggyBank/PiggyBankRepositoryInterface.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Repositories\PiggyBank;@@ -32,9 +31,7 @@ use FireflyIII\User;use Illuminate\Support\Collection;/**- * Interface PiggyBankRepositoryInterface- *- * @package FireflyIII\Repositories\PiggyBank+ * Interface PiggyBankRepositoryInterface.*/interface PiggyBankRepositoryInterface{diff --git a/app/Repositories/Rule/RuleRepository.php b/app/Repositories/Rule/RuleRepository.phpindex cf15854ea3..8f58c366ce 100644--- a/app/Repositories/Rule/RuleRepository.php+++ b/app/Repositories/Rule/RuleRepository.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Repositories\Rule;@@ -31,9 +30,7 @@ use FireflyIII\Models\RuleTrigger;use FireflyIII\User;/**- * Class RuleRepository- *- * @package FireflyIII\Repositories\Rule+ * Class RuleRepository.*/class RuleRepository implements RuleRepositoryInterface{@@ -74,7 +71,7 @@ class RuleRepository implements RuleRepositoryInterfacepublic function find(int $ruleId): Rule{$rule = $this->user->rules()->find($ruleId);- if (is_null($rule)) {+ if (null === $rule) {return new Rule;}@@ -82,7 +79,7 @@ class RuleRepository implements RuleRepositoryInterface}/**- * FIxXME can return null+ * FIxXME can return null.** @return RuleGroup*/@@ -105,12 +102,13 @@ class RuleRepository implements RuleRepositoryInterface* @param Rule $rule** @return string+ ** @throws FireflyException*/public function getPrimaryTrigger(Rule $rule): string{$count = $rule->ruleTriggers()->count();- if ($count === 0) {+ if (0 === $count) {throw new FireflyException('Rules should have more than zero triggers, rule #' . $rule->id . ' has none!');}@@ -133,7 +131,6 @@ class RuleRepository implements RuleRepositoryInterface$other->save();}-$rule->order = ($rule->order + 1);$rule->save();$this->resetRulesInGroupOrder($rule->ruleGroup);@@ -176,10 +173,10 @@ class RuleRepository implements RuleRepositoryInterfaceforeach ($ids as $actionId) {/** @var RuleTrigger $trigger */$action = $rule->ruleActions()->find($actionId);- if (!is_null($action)) {+ if (null !== $action) {$action->order = $order;$action->save();- $order++;+ ++$order;}}@@ -198,10 +195,10 @@ class RuleRepository implements RuleRepositoryInterfaceforeach ($ids as $triggerId) {/** @var RuleTrigger $trigger */$trigger = $rule->ruleTriggers()->find($triggerId);- if (!is_null($trigger)) {+ if (null !== $trigger) {$trigger->order = $order;$trigger->save();- $order++;+ ++$order;}}@@ -226,7 +223,7 @@ class RuleRepository implements RuleRepositoryInterfaceforeach ($set as $entry) {$entry->order = $count;$entry->save();- $count++;+ ++$count;}return true;@@ -260,7 +257,7 @@ class RuleRepository implements RuleRepositoryInterface$rule->rule_group_id = $data['rule_group_id'];$rule->order = ($order + 1);$rule->active = 1;- $rule->stop_processing = intval($data['stop_processing']) === 1;+ $rule->stop_processing = 1 === intval($data['stop_processing']);$rule->title = $data['title'];$rule->description = strlen($data['description']) > 0 ? $data['description'] : null;@@ -289,10 +286,9 @@ class RuleRepository implements RuleRepositoryInterface$ruleAction->active = 1;$ruleAction->stop_processing = $values['stopProcessing'];$ruleAction->action_type = $values['action'];- $ruleAction->action_value = is_null($values['value']) ? '' : $values['value'];+ $ruleAction->action_value = null === $values['value'] ? '' : $values['value'];$ruleAction->save();-return $ruleAction;}@@ -310,7 +306,7 @@ class RuleRepository implements RuleRepositoryInterface$ruleTrigger->active = 1;$ruleTrigger->stop_processing = $values['stopProcessing'];$ruleTrigger->trigger_type = $values['action'];- $ruleTrigger->trigger_value = is_null($values['value']) ? '' : $values['value'];+ $ruleTrigger->trigger_value = null === $values['value'] ? '' : $values['value'];$ruleTrigger->save();return $ruleTrigger;@@ -344,7 +340,6 @@ class RuleRepository implements RuleRepositoryInterface// recreate actions:$this->storeActions($rule, $data);-return $rule;}@@ -405,7 +400,7 @@ class RuleRepository implements RuleRepositoryInterface];$this->storeTrigger($rule, $triggerValues);- $order++;+ ++$order;}return true;diff --git a/app/Repositories/Rule/RuleRepositoryInterface.php b/app/Repositories/Rule/RuleRepositoryInterface.phpindex a7fd8bacd7..57612767d5 100644--- a/app/Repositories/Rule/RuleRepositoryInterface.php+++ b/app/Repositories/Rule/RuleRepositoryInterface.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Repositories\Rule;@@ -30,9 +29,7 @@ use FireflyIII\Models\RuleTrigger;use FireflyIII\User;/**- * Interface RuleRepositoryInterface- *- * @package FireflyIII\Repositories\Rule+ * Interface RuleRepositoryInterface.*/interface RuleRepositoryInterface{@@ -55,7 +52,6 @@ interface RuleRepositoryInterface*/public function find(int $ruleId): Rule;-/*** @return RuleGroup*/diff --git a/app/Repositories/RuleGroup/RuleGroupRepository.php b/app/Repositories/RuleGroup/RuleGroupRepository.phpindex 09b74d84ae..4c45395466 100644--- a/app/Repositories/RuleGroup/RuleGroupRepository.php+++ b/app/Repositories/RuleGroup/RuleGroupRepository.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Repositories\RuleGroup;@@ -30,9 +29,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany;use Illuminate\Support\Collection;/**- * Class RuleGroupRepository- *- * @package FireflyIII\Repositories\RuleGroup+ * Class RuleGroupRepository.*/class RuleGroupRepository implements RuleGroupRepositoryInterface{@@ -57,7 +54,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface{/** @var Rule $rule */foreach ($ruleGroup->rules as $rule) {- if (is_null($moveTo)) {+ if (null === $moveTo) {$rule->delete();continue;}@@ -69,7 +66,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface$ruleGroup->delete();$this->resetRuleGroupOrder();- if (!is_null($moveTo)) {+ if (null !== $moveTo) {$this->resetRulesInGroupOrder($moveTo);}@@ -84,7 +81,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterfacepublic function find(int $ruleGroupId): RuleGroup{$group = $this->user->ruleGroups()->find($ruleGroupId);- if (is_null($group)) {+ if (null === $group) {return new RuleGroup;}@@ -234,10 +231,9 @@ class RuleGroupRepository implements RuleGroupRepositoryInterfaceforeach ($set as $entry) {$entry->order = $count;$entry->save();- $count++;+ ++$count;}-return true;}@@ -259,7 +255,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterfaceforeach ($set as $entry) {$entry->order = $count;$entry->save();- $count++;+ ++$count;}return true;@@ -289,8 +285,6 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface'description' => $data['description'],'order' => ($order + 1),'active' => 1,--]);$newRuleGroup->save();diff --git a/app/Repositories/RuleGroup/RuleGroupRepositoryInterface.php b/app/Repositories/RuleGroup/RuleGroupRepositoryInterface.phpindex a2ee5e45a5..ca9a142bc1 100644--- a/app/Repositories/RuleGroup/RuleGroupRepositoryInterface.php+++ b/app/Repositories/RuleGroup/RuleGroupRepositoryInterface.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Repositories\RuleGroup;@@ -28,16 +27,11 @@ use FireflyIII\User;use Illuminate\Support\Collection;/**- * Interface RuleGroupRepositoryInterface- *- * @package FireflyIII\Repositories\RuleGroup+ * Interface RuleGroupRepositoryInterface.*/interface RuleGroupRepositoryInterface{-/**- *- ** @return int*/public function count(): int;diff --git a/app/Repositories/Tag/TagRepository.php b/app/Repositories/Tag/TagRepository.phpindex 25e99d7773..e75bc5710f 100644--- a/app/Repositories/Tag/TagRepository.php+++ b/app/Repositories/Tag/TagRepository.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Repositories\Tag;@@ -35,18 +34,14 @@ use Illuminate\Support\Collection;use Log;/**- * Class TagRepository- *- * @package FireflyIII\Repositories\Tag+ * Class TagRepository.*/class TagRepository implements TagRepositoryInterface{-/** @var User */private $user;/**- ** @param TransactionJournal $journal* @param Tag $tag*@@ -54,9 +49,7 @@ class TagRepository implements TagRepositoryInterface*/public function connect(TransactionJournal $journal, Tag $tag): bool{- /*- * Already connected:- */+ // Already connected:if ($journal->tags()->find($tag->id)) {Log::info(sprintf('Tag #%d is already connected to journal #%d.', $tag->id, $journal->id));@@ -116,7 +109,7 @@ class TagRepository implements TagRepositoryInterfacepublic function find(int $tagId): Tag{$tag = $this->user->tags()->find($tagId);- if (is_null($tag)) {+ if (null === $tag) {$tag = new Tag;}@@ -131,7 +124,7 @@ class TagRepository implements TagRepositoryInterfacepublic function findByTag(string $tag): Tag{$tags = $this->user->tags()->get();- /** @var Tag $tag */+ // @var Tag $tagforeach ($tags as $databaseTag) {if ($databaseTag->tag === $tag) {return $databaseTag;@@ -149,7 +142,7 @@ class TagRepository implements TagRepositoryInterfacepublic function firstUseDate(Tag $tag): Carbon{$journal = $tag->transactionJournals()->orderBy('date', 'ASC')->first();- if (!is_null($journal)) {+ if (null !== $journal) {return $journal->date;}@@ -190,7 +183,7 @@ class TagRepository implements TagRepositoryInterfacepublic function lastUseDate(Tag $tag): Carbon{$journal = $tag->transactionJournals()->orderBy('date', 'DESC')->first();- if (!is_null($journal)) {+ if (null !== $journal) {return $journal->date;}@@ -265,7 +258,7 @@ class TagRepository implements TagRepositoryInterface/** @var JournalCollectorInterface $collector */$collector = app(JournalCollectorInterface::class);- if (!is_null($start) && !is_null($end)) {+ if (null !== $start && null !== $end) {$collector->setRange($start, $end);}@@ -291,7 +284,7 @@ class TagRepository implements TagRepositoryInterface/** @var JournalCollectorInterface $collector */$collector = app(JournalCollectorInterface::class);- if (!is_null($start) && !is_null($end)) {+ if (null !== $start && null !== $end) {$collector->setRange($start, $end);}@@ -308,7 +301,7 @@ class TagRepository implements TagRepositoryInterfaceforeach ($journals as $journal) {$amount = app('steam')->positive(strval($journal->transaction_amount));$type = $journal->transaction_type_type;- if ($type === TransactionType::WITHDRAWAL) {+ if (TransactionType::WITHDRAWAL === $type) {$amount = bcmul($amount, '-1');}$sums[$type] = bcadd($sums[$type], $amount);@@ -326,15 +319,11 @@ class TagRepository implements TagRepositoryInterface*/public function tagCloud(?int $year): array{- /*- * Some vars- */+ // Some vars$min = null;$max = '0';$return = [];- /*- * get tags with a certain amount (in this range):- */+ // get tags with a certain amount (in this range):$query = $this->user->tags()->leftJoin('tag_transaction_journal', 'tag_transaction_journal.tag_id', '=', 'tags.id')->leftJoin('transaction_journals', 'tag_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')@@ -343,10 +332,10 @@ class TagRepository implements TagRepositoryInterface->groupBy('tags.id');// add date range (or not):- if (is_null($year)) {+ if (null === $year) {$query->whereNull('tags.date');}- if (!is_null($year)) {+ if (null !== $year) {$start = $year . '-01-01';$end = $year . '-12-31';$query->where('tags.date', '>=', $start)->where('tags.date', '<=', $end);@@ -358,16 +347,14 @@ class TagRepository implements TagRepositoryInterface$tagsWithAmounts[$tag->id] = strval($tag->amount_sum);}- /*- * get all tags in period:- */+ // get all tags in period:$query = $this->user->tags();- if (!is_null($year)) {+ if (null !== $year) {$start = $year . '-01-01';$end = $year . '-12-31';$query->where('date', '>=', $start)->where('date', '<=', $end);}- if (is_null($year)) {+ if (null === $year) {$query->whereNull('date');}$tags = $query->orderBy('id', 'desc')->get();@@ -375,10 +362,10 @@ class TagRepository implements TagRepositoryInterface/** @var Tag $tag */foreach ($tags as $tag) {$amount = $tagsWithAmounts[$tag->id] ?? '0';- if (is_null($min)) {+ if (null === $min) {$min = $amount;}- $max = bccomp($amount, $max) === 1 ? $amount : $max;+ $max = 1 === bccomp($amount, $max) ? $amount : $max;$min = bccomp($amount, $min) === -1 ? $amount : $min;$temporary[] = [@@ -431,21 +418,20 @@ class TagRepository implements TagRepositoryInterface$amountDiff = $max - $min;// no difference? Every tag same range:- if ($amountDiff === 0.0) {+ if (0.0 === $amountDiff) {return $range[0];}$diff = $range[1] - $range[0];$step = 1;- if ($diff != 0) {+ if (0 != $diff) {$step = $amountDiff / $diff;}- if ($step == 0) {+ if (0 == $step) {$step = 1;}$extra = round($amount / $step);-return intval($range[0] + $extra);}}diff --git a/app/Repositories/Tag/TagRepositoryInterface.php b/app/Repositories/Tag/TagRepositoryInterface.phpindex 6e04a0a2df..814fb87036 100644--- a/app/Repositories/Tag/TagRepositoryInterface.php+++ b/app/Repositories/Tag/TagRepositoryInterface.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Repositories\Tag;@@ -30,13 +29,10 @@ use FireflyIII\User;use Illuminate\Support\Collection;/**- * Interface TagRepositoryInterface- *- * @package FireflyIII\Repositories\Tag+ * Interface TagRepositoryInterface.*/interface TagRepositoryInterface{-/*** This method will connect a journal with a tag.*diff --git a/app/Repositories/User/UserRepository.php b/app/Repositories/User/UserRepository.phpindex 88bb889c86..45c567ca2d 100644--- a/app/Repositories/User/UserRepository.php+++ b/app/Repositories/User/UserRepository.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Repositories\User;@@ -31,13 +30,10 @@ use Log;use Preferences;/**- * Class UserRepository- *- * @package FireflyIII\Repositories\User+ * Class UserRepository.*/class UserRepository implements UserRepositoryInterface{-/*** @return Collection*/@@ -153,7 +149,7 @@ class UserRepository implements UserRepositoryInterfacepublic function find(int $userId): User{$user = User::find($userId);- if (!is_null($user)) {+ if (null !== $user) {return $user;}@@ -183,14 +179,14 @@ class UserRepository implements UserRepositoryInterface// two factor:$is2faEnabled = Preferences::getForUser($user, 'twoFactorAuthEnabled', false)->data;- $has2faSecret = !is_null(Preferences::getForUser($user, 'twoFactorAuthSecret'));+ $has2faSecret = null !== Preferences::getForUser($user, 'twoFactorAuthSecret');$return['has_2fa'] = false;if ($is2faEnabled && $has2faSecret) {$return['has_2fa'] = true;}$return['is_admin'] = $user->hasRole('owner');- $return['blocked'] = intval($user->blocked) === 1;+ $return['blocked'] = 1 === intval($user->blocked);$return['blocked_code'] = $user->blocked_code;$return['accounts'] = $user->accounts()->count();$return['journals'] = $user->transactionJournals()->count();diff --git a/app/Repositories/User/UserRepositoryInterface.php b/app/Repositories/User/UserRepositoryInterface.phpindex 9bca371f10..8436eee569 100644--- a/app/Repositories/User/UserRepositoryInterface.php+++ b/app/Repositories/User/UserRepositoryInterface.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Repositories\User;@@ -27,13 +26,10 @@ use FireflyIII\User;use Illuminate\Support\Collection;/**- * Interface UserRepositoryInterface- *- * @package FireflyIII\Repositories\User+ * Interface UserRepositoryInterface.*/interface UserRepositoryInterface{-/*** Returns a collection of all users.*diff --git a/app/Services/Bunq/Id/BunqId.php b/app/Services/Bunq/Id/BunqId.phpindex 21609f5fa3..3ba845c54e 100644--- a/app/Services/Bunq/Id/BunqId.php+++ b/app/Services/Bunq/Id/BunqId.php@@ -19,15 +19,12 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Services\Bunq\Id;/**- * Class BunqId- *- * @package FireflyIII\Services\Bunq\Id+ * Class BunqId.*/class BunqId{diff --git a/app/Services/Bunq/Id/DeviceServerId.php b/app/Services/Bunq/Id/DeviceServerId.phpindex 88b91358b5..a074753b55 100644--- a/app/Services/Bunq/Id/DeviceServerId.php+++ b/app/Services/Bunq/Id/DeviceServerId.php@@ -19,15 +19,12 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Services\Bunq\Id;/**- * Class DeviceServerId- *- * @package Bunq\Id+ * Class DeviceServerId.*/class DeviceServerId extends BunqId{diff --git a/app/Services/Bunq/Id/DeviceSessionId.php b/app/Services/Bunq/Id/DeviceSessionId.phpindex c8443c4f2f..71ce07ebcc 100644--- a/app/Services/Bunq/Id/DeviceSessionId.php+++ b/app/Services/Bunq/Id/DeviceSessionId.php@@ -18,15 +18,12 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Services\Bunq\Id;/**- * Class DeviceSessionId- *- * @package Bunq\Id+ * Class DeviceSessionId.*/class DeviceSessionId extends BunqId{diff --git a/app/Services/Bunq/Id/InstallationId.php b/app/Services/Bunq/Id/InstallationId.phpindex 84abcb61f9..48a9d73170 100644--- a/app/Services/Bunq/Id/InstallationId.php+++ b/app/Services/Bunq/Id/InstallationId.php@@ -18,15 +18,12 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Services\Bunq\Id;/**- * Class InstallationId- *- * @package Bunq\Id+ * Class InstallationId.*/class InstallationId extends BunqId{diff --git a/app/Services/Bunq/Object/Alias.php b/app/Services/Bunq/Object/Alias.phpindex a625543de8..7819c6bd48 100644--- a/app/Services/Bunq/Object/Alias.php+++ b/app/Services/Bunq/Object/Alias.php@@ -18,15 +18,12 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Services\Bunq\Object;/**- * Class Alias- *- * @package FireflyIII\Services\Bunq\Object+ * Class Alias.*/class Alias extends BunqObject{diff --git a/app/Services/Bunq/Object/Amount.php b/app/Services/Bunq/Object/Amount.phpindex 854a5ca6ba..2504bffb26 100644--- a/app/Services/Bunq/Object/Amount.php+++ b/app/Services/Bunq/Object/Amount.php@@ -18,15 +18,12 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Services\Bunq\Object;/**- * Class Amount- *- * @package FireflyIII\Services\Bunq\Object+ * Class Amount.*/class Amount extends BunqObject{diff --git a/app/Services/Bunq/Object/Avatar.php b/app/Services/Bunq/Object/Avatar.phpindex 034e9c817c..0ac804bacd 100644--- a/app/Services/Bunq/Object/Avatar.php+++ b/app/Services/Bunq/Object/Avatar.php@@ -18,15 +18,12 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Services\Bunq\Object;/**- * Class Avatar- *- * @package FireflyIII\Services\Bunq\Object+ * Class Avatar.*/class Avatar extends BunqObject{diff --git a/app/Services/Bunq/Object/BunqObject.php b/app/Services/Bunq/Object/BunqObject.phpindex 050ae58046..a14df09963 100644--- a/app/Services/Bunq/Object/BunqObject.php+++ b/app/Services/Bunq/Object/BunqObject.php@@ -18,15 +18,12 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Services\Bunq\Object;/**- * Class BunqObject- *- * @package FireflyIII\Services\Bunq\Object+ * Class BunqObject.*/class BunqObject{diff --git a/app/Services/Bunq/Object/DeviceServer.php b/app/Services/Bunq/Object/DeviceServer.phpindex d1498dcb93..f884631c0a 100644--- a/app/Services/Bunq/Object/DeviceServer.php+++ b/app/Services/Bunq/Object/DeviceServer.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Services\Bunq\Object;@@ -28,17 +27,17 @@ use FireflyIII\Services\Bunq\Id\DeviceServerId;class DeviceServer extends BunqObject{- /** @var Carbon */+ /** @var Carbon */private $created;- /** @var string */+ /** @var string */private $description;- /** @var DeviceServerId */+ /** @var DeviceServerId */private $id;- /** @var string */+ /** @var string */private $ip;- /** @var string */+ /** @var string */private $status;- /** @var Carbon */+ /** @var Carbon */private $updated;public function __construct(array $data)diff --git a/app/Services/Bunq/Object/MonetaryAccountBank.php b/app/Services/Bunq/Object/MonetaryAccountBank.phpindex 1fe87a304b..d5b60d6652 100644--- a/app/Services/Bunq/Object/MonetaryAccountBank.php+++ b/app/Services/Bunq/Object/MonetaryAccountBank.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Services\Bunq\Object;@@ -26,35 +25,33 @@ namespace FireflyIII\Services\Bunq\Object;use Carbon\Carbon;/**- * Class MonetaryAccountBank- *- * @package FireflyIII\Services\Bunq\Object+ * Class MonetaryAccountBank.*/class MonetaryAccountBank extends BunqObject{/** @var array */private $aliases = [];- /** @var Avatar */+ /** @var Avatar */private $avatar;- /** @var Amount */+ /** @var Amount */private $balance;/** @var Carbon */private $created;/** @var string */private $currency = '';- /** @var Amount */+ /** @var Amount */private $dailyLimit;- /** @var Amount */+ /** @var Amount */private $dailySpent;/** @var string */private $description = '';/** @var int */private $id = 0;- /** @var MonetaryAccountProfile */+ /** @var MonetaryAccountProfile */private $monetaryAccountProfile;/** @var array */private $notificationFilters = [];- /** @var Amount */+ /** @var Amount */private $overdraftLimit;/** @var string */private $publicUuid = '';@@ -62,7 +59,7 @@ class MonetaryAccountBank extends BunqObjectprivate $reason = '';/** @var string */private $reasonDescription = '';- /** @var MonetaryAccountSetting */+ /** @var MonetaryAccountSetting */private $setting;/** @var string */private $status = '';diff --git a/app/Services/Bunq/Object/MonetaryAccountProfile.php b/app/Services/Bunq/Object/MonetaryAccountProfile.phpindex 8bcc47ec03..8a4f436f43 100644--- a/app/Services/Bunq/Object/MonetaryAccountProfile.php+++ b/app/Services/Bunq/Object/MonetaryAccountProfile.php@@ -18,21 +18,18 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Services\Bunq\Object;/**- * Class MonetaryAccountProfile- *- * @package FireflyIII\Services\Bunq\Object+ * Class MonetaryAccountProfile.*/class MonetaryAccountProfile extends BunqObject{/** @var string */private $profileActionRequired = '';- /** @var Amount */+ /** @var Amount */private $profileAmountRequired;private $profileDrain;private $profileFill;diff --git a/app/Services/Bunq/Object/MonetaryAccountSetting.php b/app/Services/Bunq/Object/MonetaryAccountSetting.phpindex d592e914da..58f44f80b0 100644--- a/app/Services/Bunq/Object/MonetaryAccountSetting.php+++ b/app/Services/Bunq/Object/MonetaryAccountSetting.php@@ -18,15 +18,12 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Services\Bunq\Object;/**- * Class MonetaryAccountSetting- *- * @package FireflyIII\Services\Bunq\Object+ * Class MonetaryAccountSetting.*/class MonetaryAccountSetting extends BunqObject{diff --git a/app/Services/Bunq/Object/NotificationFilter.php b/app/Services/Bunq/Object/NotificationFilter.phpindex baf65ed86c..aedc952109 100644--- a/app/Services/Bunq/Object/NotificationFilter.php+++ b/app/Services/Bunq/Object/NotificationFilter.php@@ -18,15 +18,12 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Services\Bunq\Object;/**- * Class NotificationFilter- *- * @package FireflyIII\Services\Bunq\Object+ * Class NotificationFilter.*/class NotificationFilter extends BunqObject{diff --git a/app/Services/Bunq/Object/ServerPublicKey.php b/app/Services/Bunq/Object/ServerPublicKey.phpindex bdea9e69a7..b70a6ac01e 100644--- a/app/Services/Bunq/Object/ServerPublicKey.php+++ b/app/Services/Bunq/Object/ServerPublicKey.php@@ -18,15 +18,12 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Services\Bunq\Object;/**- * Class ServerPublicKey- *- * @package Bunq\Object+ * Class ServerPublicKey.*/class ServerPublicKey extends BunqObject{diff --git a/app/Services/Bunq/Object/UserCompany.php b/app/Services/Bunq/Object/UserCompany.phpindex 54cfcdfc56..36f37ce4a4 100644--- a/app/Services/Bunq/Object/UserCompany.php+++ b/app/Services/Bunq/Object/UserCompany.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Services\Bunq\Object;@@ -26,9 +25,7 @@ namespace FireflyIII\Services\Bunq\Object;use Carbon\Carbon;/**- * Class UserCompany- *- * @package FireflyIII\Services\Bunq\Object+ * Class UserCompany.*/class UserCompany extends BunqObject{@@ -69,7 +66,7 @@ class UserCompany extends BunqObjectprivate $status = '';/** @var string */private $subStatus = '';- /** @var string */+ /** @var string */private $typeOfBusinessEntity = '';/** @var array */private $ubos = [];diff --git a/app/Services/Bunq/Object/UserLight.php b/app/Services/Bunq/Object/UserLight.phpindex b7c7ee4c34..060a257282 100644--- a/app/Services/Bunq/Object/UserLight.php+++ b/app/Services/Bunq/Object/UserLight.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Services\Bunq\Object;@@ -26,9 +25,7 @@ namespace FireflyIII\Services\Bunq\Object;use Carbon\Carbon;/**- * Class UserLight- *- * @package FireflyIII\Services\Bunq\Object+ * Class UserLight.*/class UserLight extends BunqObject{@@ -62,7 +59,7 @@ class UserLight extends BunqObject*/public function __construct(array $data){- if (count($data) === 0) {+ if (0 === count($data)) {return;}$this->id = intval($data['id']);diff --git a/app/Services/Bunq/Object/UserPerson.php b/app/Services/Bunq/Object/UserPerson.phpindex d66b2e97d6..223dfef779 100644--- a/app/Services/Bunq/Object/UserPerson.php+++ b/app/Services/Bunq/Object/UserPerson.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Services\Bunq\Object;@@ -26,9 +25,7 @@ namespace FireflyIII\Services\Bunq\Object;use Carbon\Carbon;/**- * Class UserPerson- *- * @package Bunq\Object+ * Class UserPerson.*/class UserPerson extends BunqObject{@@ -101,7 +98,7 @@ class UserPerson extends BunqObject*/public function __construct(array $data){- if (count($data) === 0) {+ if (0 === count($data)) {return;}$this->id = intval($data['id']);diff --git a/app/Services/Bunq/Request/BunqRequest.php b/app/Services/Bunq/Request/BunqRequest.phpindex 9ff87c3567..dcc4a23729 100644--- a/app/Services/Bunq/Request/BunqRequest.php+++ b/app/Services/Bunq/Request/BunqRequest.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Services\Bunq\Request;@@ -31,15 +30,13 @@ use Requests;use Requests_Exception;/**- * Class BunqRequest- *- * @package Bunq\Request+ * Class BunqRequest.*/abstract class BunqRequest{/** @var string */protected $secret = '';- /** @var ServerPublicKey */+ /** @var ServerPublicKey */protected $serverPublicKey;/** @var string */private $privateKey = '';@@ -111,14 +108,15 @@ abstract class BunqRequest* @param string $data** @return string+ ** @throws FireflyException*/protected function generateSignature(string $method, string $uri, array $headers, string $data): string{- if (strlen($this->privateKey) === 0) {+ if (0 === strlen($this->privateKey)) {throw new FireflyException('No private key present.');}- if (strtolower($method) === 'get' || strtolower($method) === 'delete') {+ if ('get' === strtolower($method) || 'delete' === strtolower($method)) {$data = '';}@@ -127,7 +125,7 @@ abstract class BunqRequest$headersToSign = ['Cache-Control', 'User-Agent'];ksort($headers);foreach ($headers as $name => $value) {- if (in_array($name, $headersToSign) || substr($name, 0, 7) === 'X-Bunq-') {+ if (in_array($name, $headersToSign) || 'X-Bunq-' === substr($name, 0, 7)) {$toSign .= sprintf("%s: %s\n", $name, $value);}}@@ -202,11 +200,12 @@ abstract class BunqRequest* @param array $headers** @return array+ ** @throws Exception*/protected function sendSignedBunqDelete(string $uri, array $headers): array{- if (strlen($this->server) === 0) {+ if (0 === strlen($this->server)) {throw new FireflyException('No bunq server defined');}@@ -216,7 +215,7 @@ abstract class BunqRequesttry {$response = Requests::delete($fullUri, $headers);} catch (Requests_Exception $e) {- return ['Error' => [0 => ['error_description' => $e->getMessage(), 'error_description_translated' => $e->getMessage()],]];+ return ['Error' => [0 => ['error_description' => $e->getMessage(), 'error_description_translated' => $e->getMessage()]]];}$body = $response->body;@@ -235,7 +234,6 @@ abstract class BunqRequestthrow new FireflyException(sprintf('Could not verify signature for request to "%s"', $uri));}-return $array;}@@ -245,11 +243,12 @@ abstract class BunqRequest* @param array $headers** @return array+ ** @throws Exception*/protected function sendSignedBunqGet(string $uri, array $data, array $headers): array{- if (strlen($this->server) === 0) {+ if (0 === strlen($this->server)) {throw new FireflyException('No bunq server defined');}@@ -260,7 +259,7 @@ abstract class BunqRequesttry {$response = Requests::get($fullUri, $headers);} catch (Requests_Exception $e) {- return ['Error' => [0 => ['error_description' => $e->getMessage(), 'error_description_translated' => $e->getMessage()],]];+ return ['Error' => [0 => ['error_description' => $e->getMessage(), 'error_description_translated' => $e->getMessage()]]];}$body = $response->body;@@ -287,6 +286,7 @@ abstract class BunqRequest* @param array $headers** @return array+ ** @throws Exception*/protected function sendSignedBunqPost(string $uri, array $data, array $headers): array@@ -298,7 +298,7 @@ abstract class BunqRequesttry {$response = Requests::post($fullUri, $headers, $body);} catch (Requests_Exception $e) {- return ['Error' => [0 => ['error_description' => $e->getMessage(), 'error_description_translated' => $e->getMessage()],]];+ return ['Error' => [0 => ['error_description' => $e->getMessage(), 'error_description_translated' => $e->getMessage()]]];}$body = $response->body;@@ -316,7 +316,6 @@ abstract class BunqRequestthrow new FireflyException(sprintf('Could not verify signature for request to "%s"', $uri));}-return $array;}@@ -332,7 +331,7 @@ abstract class BunqRequesttry {$response = Requests::delete($fullUri, $headers);} catch (Requests_Exception $e) {- return ['Error' => [0 => ['error_description' => $e->getMessage(), 'error_description_translated' => $e->getMessage()],]];+ return ['Error' => [0 => ['error_description' => $e->getMessage(), 'error_description_translated' => $e->getMessage()]]];}$body = $response->body;$array = json_decode($body, true);@@ -362,7 +361,7 @@ abstract class BunqRequesttry {$response = Requests::post($fullUri, $headers, $body);} catch (Requests_Exception $e) {- return ['Error' => [0 => ['error_description' => $e->getMessage(), 'error_description_translated' => $e->getMessage()],]];+ return ['Error' => [0 => ['error_description' => $e->getMessage(), 'error_description_translated' => $e->getMessage()]]];}$body = $response->body;$array = json_decode($body, true);@@ -375,7 +374,6 @@ abstract class BunqRequest$this->throwResponseError($array);}-return $array;}@@ -387,7 +385,7 @@ abstract class BunqRequestprivate function isErrorResponse(array $response): bool{$key = key($response);- if ($key === 'Error') {+ if ('Error' === $key) {return true;}@@ -431,6 +429,7 @@ abstract class BunqRequest* @param int $statusCode** @return bool+ ** @throws Exception*/private function verifyServerSignature(string $body, array $headers, int $statusCode): bool@@ -440,15 +439,14 @@ abstract class BunqRequest$verifyHeaders = [];// false when no public key is present- if (is_null($this->serverPublicKey)) {+ if (null === $this->serverPublicKey) {Log::error('No public key present in class, so return FALSE.');return false;}foreach ($headers as $header => $value) {-// skip non-bunq headers or signature- if (substr($header, 0, 7) !== 'x-bunq-' || $header === 'x-bunq-server-signature') {+ if ('x-bunq-' !== substr($header, 0, 7) || 'x-bunq-server-signature' === $header) {continue;}// need to have upper case variant of header:diff --git a/app/Services/Bunq/Request/DeleteDeviceSessionRequest.php b/app/Services/Bunq/Request/DeleteDeviceSessionRequest.phpindex fb23e334c5..750baef294 100644--- a/app/Services/Bunq/Request/DeleteDeviceSessionRequest.php+++ b/app/Services/Bunq/Request/DeleteDeviceSessionRequest.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Services\Bunq\Request;@@ -27,13 +26,11 @@ use FireflyIII\Services\Bunq\Token\SessionToken;use Log;/**- * Class DeleteDeviceSessionRequest- *- * @package FireflyIII\Services\Bunq\Request+ * Class DeleteDeviceSessionRequest.*/class DeleteDeviceSessionRequest extends BunqRequest{- /** @var SessionToken */+ /** @var SessionToken */private $sessionToken;/**diff --git a/app/Services/Bunq/Request/DeviceServerRequest.php b/app/Services/Bunq/Request/DeviceServerRequest.phpindex a2aa6f9d7d..a6d817bf7b 100644--- a/app/Services/Bunq/Request/DeviceServerRequest.php+++ b/app/Services/Bunq/Request/DeviceServerRequest.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Services\Bunq\Request;@@ -27,17 +26,15 @@ use FireflyIII\Services\Bunq\Id\DeviceServerId;use FireflyIII\Services\Bunq\Token\InstallationToken;/**- * Class DeviceServerRequest- *- * @package Bunq\Request+ * Class DeviceServerRequest.*/class DeviceServerRequest extends BunqRequest{/** @var string */private $description = '';- /** @var DeviceServerId */+ /** @var DeviceServerId */private $deviceServerId;- /** @var InstallationToken */+ /** @var InstallationToken */private $installationToken;/** @var array */private $permittedIps = [];diff --git a/app/Services/Bunq/Request/DeviceSessionRequest.php b/app/Services/Bunq/Request/DeviceSessionRequest.phpindex 36319e79be..603b795ac6 100644--- a/app/Services/Bunq/Request/DeviceSessionRequest.php+++ b/app/Services/Bunq/Request/DeviceSessionRequest.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Services\Bunq\Request;@@ -31,21 +30,19 @@ use FireflyIII\Services\Bunq\Token\SessionToken;use Log;/**- * Class DeviceSessionRequest- *- * @package FireflyIII\Services\Bunq\Request+ * Class DeviceSessionRequest.*/class DeviceSessionRequest extends BunqRequest{- /** @var DeviceSessionId */+ /** @var DeviceSessionId */private $deviceSessionId;- /** @var InstallationToken */+ /** @var InstallationToken */private $installationToken;- /** @var SessionToken */+ /** @var SessionToken */private $sessionToken;- /** @var UserCompany */+ /** @var UserCompany */private $userCompany;- /** @var UserPerson */+ /** @var UserPerson */private $userPerson;/**@@ -59,7 +56,6 @@ class DeviceSessionRequest extends BunqRequest$headers['X-Bunq-Client-Authentication'] = $this->installationToken->getToken();$response = $this->sendSignedBunqPost($uri, $data, $headers);-$this->deviceSessionId = $this->extractDeviceSessionId($response);$this->sessionToken = $this->extractSessionToken($response);$this->userPerson = $this->extractUserPerson($response);@@ -137,7 +133,6 @@ class DeviceSessionRequest extends BunqRequest$data = $this->getKeyFromResponse('UserCompany', $response);$userCompany = new UserCompany($data);-return $userCompany;}@@ -151,7 +146,6 @@ class DeviceSessionRequest extends BunqRequest$data = $this->getKeyFromResponse('UserPerson', $response);$userPerson = new UserPerson($data);-return $userPerson;}}diff --git a/app/Services/Bunq/Request/InstallationTokenRequest.php b/app/Services/Bunq/Request/InstallationTokenRequest.phpindex 45e6cb81d0..8678ebb0c3 100644--- a/app/Services/Bunq/Request/InstallationTokenRequest.php+++ b/app/Services/Bunq/Request/InstallationTokenRequest.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Services\Bunq\Request;@@ -29,15 +28,13 @@ use FireflyIII\Services\Bunq\Token\InstallationToken;use Log;/**- * Class InstallationTokenRequest- *- * @package FireflyIII\Services\Bunq\Request+ * Class InstallationTokenRequest.*/class InstallationTokenRequest extends BunqRequest{/** @var InstallationId */private $installationId;- /** @var InstallationToken */+ /** @var InstallationToken */private $installationToken;/** @var string */private $publicKey = '';@@ -48,7 +45,7 @@ class InstallationTokenRequest extends BunqRequestpublic function call(): void{$uri = '/v1/installation';- $data = ['client_public_key' => $this->publicKey,];+ $data = ['client_public_key' => $this->publicKey];$headers = $this->getDefaultHeaders();$response = $this->sendUnsignedBunqPost($uri, $data, $headers);Log::debug('Installation request response', $response);diff --git a/app/Services/Bunq/Request/ListDeviceServerRequest.php b/app/Services/Bunq/Request/ListDeviceServerRequest.phpindex 40957ea306..4c82e91c8e 100644--- a/app/Services/Bunq/Request/ListDeviceServerRequest.php+++ b/app/Services/Bunq/Request/ListDeviceServerRequest.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Services\Bunq\Request;@@ -28,15 +27,13 @@ use FireflyIII\Services\Bunq\Token\InstallationToken;use Illuminate\Support\Collection;/**- * Class ListDeviceServerRequest- *- * @package FireflyIII\Services\Bunq\Request+ * Class ListDeviceServerRequest.*/class ListDeviceServerRequest extends BunqRequest{/** @var Collection */private $devices;- /** @var InstallationToken */+ /** @var InstallationToken */private $installationToken;public function __construct()diff --git a/app/Services/Bunq/Request/ListMonetaryAccountRequest.php b/app/Services/Bunq/Request/ListMonetaryAccountRequest.phpindex 231ad1d8db..bfdf871f32 100644--- a/app/Services/Bunq/Request/ListMonetaryAccountRequest.php+++ b/app/Services/Bunq/Request/ListMonetaryAccountRequest.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Services\Bunq\Request;@@ -28,15 +27,13 @@ use FireflyIII\Services\Bunq\Token\SessionToken;use Illuminate\Support\Collection;/**- * Class ListMonetaryAccountRequest- *- * @package FireflyIII\Services\Bunq\Request+ * Class ListMonetaryAccountRequest.*/class ListMonetaryAccountRequest extends BunqRequest{- /** @var Collection */+ /** @var Collection */private $monetaryAccounts;- /** @var SessionToken */+ /** @var SessionToken */private $sessionToken;/** @var int */private $userId = 0;diff --git a/app/Services/Bunq/Request/ListUserRequest.php b/app/Services/Bunq/Request/ListUserRequest.phpindex 066f6ee785..8aa9bf2407 100644--- a/app/Services/Bunq/Request/ListUserRequest.php+++ b/app/Services/Bunq/Request/ListUserRequest.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Services\Bunq\Request;@@ -29,19 +28,17 @@ use FireflyIII\Services\Bunq\Object\UserPerson;use FireflyIII\Services\Bunq\Token\SessionToken;/**- * Class ListUserRequest- *- * @package FireflyIII\Services\Bunq\Request+ * Class ListUserRequest.*/class ListUserRequest extends BunqRequest{- /** @var SessionToken */+ /** @var SessionToken */private $sessionToken;- /** @var UserCompany */+ /** @var UserCompany */private $userCompany;- /** @var UserLight */+ /** @var UserLight */private $userLight;- /** @var UserPerson */+ /** @var UserPerson */private $userPerson;/**@@ -90,7 +87,6 @@ class ListUserRequest extends BunqRequestreturn $this->userPerson;}-/*** @param SessionToken $sessionToken*/diff --git a/app/Services/Bunq/Token/BunqToken.php b/app/Services/Bunq/Token/BunqToken.phpindex 7ea1b16ab7..e83537fc7a 100644--- a/app/Services/Bunq/Token/BunqToken.php+++ b/app/Services/Bunq/Token/BunqToken.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Services\Bunq\Token;@@ -26,19 +25,17 @@ namespace FireflyIII\Services\Bunq\Token;use Carbon\Carbon;/**- * Class BunqToken- *- * @package Bunq\Token+ * Class BunqToken.*/class BunqToken{- /** @var Carbon */+ /** @var Carbon */private $created;/** @var int */private $id = 0;/** @var string */private $token = '';- /** @var Carbon */+ /** @var Carbon */private $updated;/**diff --git a/app/Services/Bunq/Token/InstallationToken.php b/app/Services/Bunq/Token/InstallationToken.phpindex 1659da3598..4bf38c4d3c 100644--- a/app/Services/Bunq/Token/InstallationToken.php+++ b/app/Services/Bunq/Token/InstallationToken.php@@ -18,15 +18,12 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Services\Bunq\Token;/**- * Class InstallationToken- *- * @package FireflyIII\Services\Bunq\Token+ * Class InstallationToken.*/class InstallationToken extends BunqToken{diff --git a/app/Services/Bunq/Token/SessionToken.php b/app/Services/Bunq/Token/SessionToken.phpindex 1e9df7e787..129216906c 100644--- a/app/Services/Bunq/Token/SessionToken.php+++ b/app/Services/Bunq/Token/SessionToken.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace Bunq\Token;@@ -26,9 +25,7 @@ namespace Bunq\Token;namespace FireflyIII\Services\Bunq\Token;/**- * Class SessionToken- *- * @package FireflyIII\Services\Bunq\Token+ * Class SessionToken.*/class SessionToken extends BunqToken{diff --git a/app/Services/Currency/ExchangeRateInterface.php b/app/Services/Currency/ExchangeRateInterface.phpindex e783de5f72..5e9bdfd080 100644--- a/app/Services/Currency/ExchangeRateInterface.php+++ b/app/Services/Currency/ExchangeRateInterface.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Services\Currency;diff --git a/app/Services/Currency/FixerIO.php b/app/Services/Currency/FixerIO.phpindex b7748953ee..f51541cf6a 100644--- a/app/Services/Currency/FixerIO.php+++ b/app/Services/Currency/FixerIO.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Services\Currency;@@ -32,13 +31,11 @@ use Requests;use Requests_Exception;/**- * Class FixerIO- *- * @package FireflyIII\Services\Currency+ * Class FixerIO.*/class FixerIO implements ExchangeRateInterface{- /** @var User */+ /** @var User */protected $user;public function getRate(TransactionCurrency $fromCurrency, TransactionCurrency $toCurrency, Carbon $date): CurrencyExchangeRate@@ -57,14 +54,14 @@ class FixerIO implements ExchangeRateInterface// Requests_Exception$rate = 1.0;$content = null;- if ($statusCode !== 200) {+ if (200 !== $statusCode) {Log::error(sprintf('Something went wrong. Received error code %d and body "%s" from FixerIO.', $statusCode, $body));}// get rate from body:- if ($statusCode === 200) {+ if (200 === $statusCode) {$content = json_decode($body, true);}- if (!is_null($content)) {+ if (null !== $content) {$code = $toCurrency->code;$rate = isset($content['rates'][$code]) ? $content['rates'][$code] : '1';}diff --git a/app/Services/Password/PwndVerifier.php b/app/Services/Password/PwndVerifier.phpindex bf4734b0e3..61cf6947b9 100644--- a/app/Services/Password/PwndVerifier.php+++ b/app/Services/Password/PwndVerifier.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Services\Password;@@ -28,13 +27,10 @@ use Requests;use Requests_Exception;/**- * Class PwndVerifier- *- * @package FireflyIII\Services\Password+ * Class PwndVerifier.*/class PwndVerifier implements Verifier{-/*** Verify the given password against (some) service.*@@ -54,7 +50,7 @@ class PwndVerifier implements Verifierreturn true;}Log::debug(sprintf('Status code returned is %d', $result->status_code));- if ($result->status_code === 404) {+ if (404 === $result->status_code) {return true;}diff --git a/app/Services/Password/Verifier.php b/app/Services/Password/Verifier.phpindex db600e12ee..54b5f63eb7 100644--- a/app/Services/Password/Verifier.php+++ b/app/Services/Password/Verifier.php@@ -18,15 +18,12 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Services\Password;/**- * Interface Verifier- *- * @package FireflyIII\Services\Password+ * Interface Verifier.*/interface Verifier{diff --git a/app/Support/Amount.php b/app/Support/Amount.phpindex 844f0cd5e1..16b251fdec 100644--- a/app/Support/Amount.php+++ b/app/Support/Amount.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support;@@ -30,18 +29,15 @@ use Illuminate\Support\Collection;use Preferences as Prefs;/**- * Class Amount- *- * @package FireflyIII\Support+ * Class Amount.*/class Amount{-/*** bool $sepBySpace is $localeconv['n_sep_by_space']* int $signPosn = $localeconv['n_sign_posn']* string $sign = $localeconv['negative_sign']- * bool $csPrecedes = $localeconv['n_cs_precedes']+ * bool $csPrecedes = $localeconv['n_cs_precedes'].** @param bool $sepBySpace* @param int $signPosn@@ -74,7 +70,6 @@ class Amount// AD%v_B%sCE (amount before currency)// the _ is the optional space-// switch on how to display amount:switch ($signPosn) {default:@@ -140,7 +135,7 @@ class Amount$result = $formatted . $space . $format->symbol;}- if ($coloured === true) {+ if (true === $coloured) {if ($amount > 0) {return sprintf('<span class="text-success">%s</span>', $result);}@@ -206,6 +201,7 @@ class Amount/*** @return \FireflyIII\Models\TransactionCurrency+ ** @throws FireflyException*/public function getDefaultCurrency(): TransactionCurrency@@ -219,6 +215,7 @@ class Amount* @param User $user** @return \FireflyIII\Models\TransactionCurrency+ ** @throws FireflyException*/public function getDefaultCurrencyByUser(User $user): TransactionCurrency@@ -231,7 +228,7 @@ class Amount}$currencyPreference = Prefs::getForUser($user, 'currencyPreference', config('firefly.default_currency', 'EUR'));$currency = TransactionCurrency::where('code', $currencyPreference->data)->first();- if (is_null($currency)) {+ if (null === $currency) {throw new FireflyException(sprintf('No currency found with code "%s"', $currencyPreference->data));}$cache->store($currency);@@ -249,8 +246,8 @@ class Amount*/public function getJsConfig(array $config): array{- $negative = self::getAmountJsConfig($config['n_sep_by_space'] === 1, $config['n_sign_posn'], $config['negative_sign'], $config['n_cs_precedes'] === 1);- $positive = self::getAmountJsConfig($config['p_sep_by_space'] === 1, $config['p_sign_posn'], $config['positive_sign'], $config['p_cs_precedes'] === 1);+ $negative = self::getAmountJsConfig(1 === $config['n_sep_by_space'], $config['n_sign_posn'], $config['negative_sign'], 1 === $config['n_cs_precedes']);+ $positive = self::getAmountJsConfig(1 === $config['p_sep_by_space'], $config['p_sign_posn'], $config['positive_sign'], 1 === $config['p_cs_precedes']);return ['pos' => $positive,diff --git a/app/Support/Binder/AccountList.php b/app/Support/Binder/AccountList.phpindex 415ed494ed..d048a0f666 100644--- a/app/Support/Binder/AccountList.php+++ b/app/Support/Binder/AccountList.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support\Binder;@@ -28,13 +27,10 @@ use Illuminate\Support\Collection;use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;/**- * Class AccountList- *- * @package FireflyIII\Support\Binder+ * Class AccountList.*/class AccountList implements BinderInterface{-/*** @param $value* @param $routediff --git a/app/Support/Binder/BinderInterface.php b/app/Support/Binder/BinderInterface.phpindex 1754966a77..e5887a69da 100644--- a/app/Support/Binder/BinderInterface.php+++ b/app/Support/Binder/BinderInterface.php@@ -18,15 +18,12 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support\Binder;/**- * Interface BinderInterface- *- * @package FireflyIII\Support\Binder+ * Interface BinderInterface.*/interface BinderInterface{diff --git a/app/Support/Binder/BudgetList.php b/app/Support/Binder/BudgetList.phpindex 1d91fd3a80..279c0982d7 100644--- a/app/Support/Binder/BudgetList.php+++ b/app/Support/Binder/BudgetList.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support\Binder;@@ -28,13 +27,10 @@ use Illuminate\Support\Collection;use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;/**- * Class BudgetList- *- * @package FireflyIII\Support\Binder+ * Class BudgetList.*/class BudgetList implements BinderInterface{-/*** @param $value* @param $routediff --git a/app/Support/Binder/CategoryList.php b/app/Support/Binder/CategoryList.phpindex 3688972bd8..2469a5c524 100644--- a/app/Support/Binder/CategoryList.php+++ b/app/Support/Binder/CategoryList.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support\Binder;@@ -28,13 +27,10 @@ use Illuminate\Support\Collection;use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;/**- * Class CategoryList- *- * @package FireflyIII\Support\Binder+ * Class CategoryList.*/class CategoryList implements BinderInterface{-/*** @param $value* @param $routediff --git a/app/Support/Binder/CurrencyCode.php b/app/Support/Binder/CurrencyCode.phpindex 641ec4fd72..e2f810d432 100644--- a/app/Support/Binder/CurrencyCode.php+++ b/app/Support/Binder/CurrencyCode.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support\Binder;@@ -27,13 +26,10 @@ use FireflyIII\Models\TransactionCurrency;use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;/**- * Class CurrencyCode- *- * @package FireflyIII\Support\Binder+ * Class CurrencyCode.*/class CurrencyCode implements BinderInterface{-/*** @param $value* @param $route@@ -43,7 +39,7 @@ class CurrencyCode implements BinderInterfacepublic static function routeBinder($value, $route){$currency = TransactionCurrency::where('code', $value)->first();- if (!is_null($currency)) {+ if (null !== $currency) {return $currency;}throw new NotFoundHttpException;diff --git a/app/Support/Binder/Date.php b/app/Support/Binder/Date.phpindex 0499b1c5e1..d517fd1957 100644--- a/app/Support/Binder/Date.php+++ b/app/Support/Binder/Date.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support\Binder;@@ -30,14 +29,10 @@ use Log;use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;/**- * Class Date- *- * @package FireflyIII\Support\Binder+ * Class Date.*/class Date implements BinderInterface{--/*** @param $value* @param $route@@ -70,7 +65,6 @@ class Date implements BinderInterfacereturn $fiscalHelper->startOfFiscalYear(Carbon::now());case 'currentFiscalYearEnd':return $fiscalHelper->endOfFiscalYear(Carbon::now());-}}}diff --git a/app/Support/Binder/JournalList.php b/app/Support/Binder/JournalList.phpindex a5a605423f..cb8171b9cb 100644--- a/app/Support/Binder/JournalList.php+++ b/app/Support/Binder/JournalList.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support\Binder;@@ -28,13 +27,10 @@ use Illuminate\Support\Collection;use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;/**- * Class JournalList- *- * @package FireflyIII\Support\Binder+ * Class JournalList.*/class JournalList implements BinderInterface{-/*** @param $value* @param $route@@ -48,7 +44,7 @@ class JournalList implements BinderInterface/** @var \Illuminate\Support\Collection $object */$object = TransactionJournal::whereIn('transaction_journals.id', $ids)->where('transaction_journals.user_id', auth()->user()->id)- ->get(['transaction_journals.*',]);+ ->get(['transaction_journals.*']);if ($object->count() > 0) {return $object;diff --git a/app/Support/Binder/TagList.php b/app/Support/Binder/TagList.phpindex 1bd98fe722..de088a0ddf 100644--- a/app/Support/Binder/TagList.php+++ b/app/Support/Binder/TagList.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support\Binder;@@ -29,13 +28,10 @@ use Illuminate\Support\Collection;use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;/**- * Class TagList- *- * @package FireflyIII\Support\Binder+ * Class TagList.*/class TagList implements BinderInterface{-/*** @param $value* @param $routediff --git a/app/Support/Binder/UnfinishedJournal.php b/app/Support/Binder/UnfinishedJournal.phpindex 1cf152879e..56b9c42cf5 100644--- a/app/Support/Binder/UnfinishedJournal.php+++ b/app/Support/Binder/UnfinishedJournal.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support\Binder;@@ -27,14 +26,10 @@ use FireflyIII\Models\TransactionJournal;use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;/**- * Class Date- *- * @package FireflyIII\Support\Binder+ * Class Date.*/class UnfinishedJournal implements BinderInterface{--/*** @param $value* @param $routediff --git a/app/Support/CacheProperties.php b/app/Support/CacheProperties.phpindex 5dc23ccfb5..2cfd0e720c 100644--- a/app/Support/CacheProperties.php+++ b/app/Support/CacheProperties.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support;@@ -28,14 +27,11 @@ use Illuminate\Support\Collection;use Preferences as Prefs;/**- * Class CacheProperties- *- * @package FireflyIII\Support+ * Class CacheProperties.*/class CacheProperties{-- /** @var string */+ /** @var string */protected $hash = '';/** @var Collection */protected $properties;@@ -81,7 +77,7 @@ class CacheProperties*/public function has(): bool{- if (getenv('APP_ENV') === 'testing') {+ if ('testing' === getenv('APP_ENV')) {return false;}$this->hash();@@ -98,7 +94,6 @@ class CacheProperties}/**- * @return void*/private function hash(){diff --git a/app/Support/ChartColour.php b/app/Support/ChartColour.phpindex f53e5c412b..3f2eb21488 100644--- a/app/Support/ChartColour.php+++ b/app/Support/ChartColour.php@@ -18,15 +18,12 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support;/**- * Class ChartColour- *- * @package FireflyIII\Support+ * Class ChartColour.*/class ChartColour{diff --git a/app/Support/Domain.php b/app/Support/Domain.phpindex 03e093b638..c94e1e80b5 100644--- a/app/Support/Domain.php+++ b/app/Support/Domain.php@@ -18,15 +18,12 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support;/**- * Class Domain- *- * @package FireflyIII\Support+ * Class Domain.*/class Domain{diff --git a/app/Support/Events/BillScanner.php b/app/Support/Events/BillScanner.phpindex d58a048e72..21315f668a 100644--- a/app/Support/Events/BillScanner.php+++ b/app/Support/Events/BillScanner.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support\Events;@@ -27,9 +26,7 @@ use FireflyIII\Models\TransactionJournal;use FireflyIII\Repositories\Bill\BillRepositoryInterface;/**- * Class BillScanner- *- * @package FireflyIII\Support\Events+ * Class BillScanner.*/class BillScanner{diff --git a/app/Support/ExpandedForm.php b/app/Support/ExpandedForm.phpindex 764b8f1beb..0c3b5b5e1f 100644--- a/app/Support/ExpandedForm.php+++ b/app/Support/ExpandedForm.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support;@@ -28,19 +27,14 @@ use Carbon\Carbon;use Eloquent;use Illuminate\Support\Collection;use Illuminate\Support\MessageBag;-use Input;use RuntimeException;use Session;/**- * Class ExpandedForm- *- * @package FireflyIII\Support- *+ * Class ExpandedForm.*/class ExpandedForm{-/*** @param $name* @param null $value@@ -87,7 +81,7 @@ class ExpandedForm*/public function checkbox(string $name, $value = 1, $checked = null, $options = []): string{- $options['checked'] = $checked === true ? true : null;+ $options['checked'] = true === $checked ? true : null;$label = $this->label($name, $options);$options = $this->expandOptionArray($name, $label, $options);$classes = $this->getHolderClasses($name);@@ -173,7 +167,6 @@ class ExpandedForm}/**- ** Takes any collection and tries to make a sensible select list compatible array of it.** @param \Illuminate\Support\Collection $set@@ -190,7 +183,7 @@ class ExpandedForm$title = null;foreach ($fields as $field) {- if (isset($entry->$field) && is_null($title)) {+ if (isset($entry->$field) && null === $title) {$title = $entry->$field;}}@@ -216,7 +209,7 @@ class ExpandedForm$title = null;foreach ($fields as $field) {- if (isset($entry->$field) && is_null($title)) {+ if (isset($entry->$field) && null === $title) {$title = $entry->$field;}}@@ -287,11 +280,10 @@ class ExpandedFormunset($options['placeholder']);// make sure value is formatted nicely:- if (!is_null($value) && $value !== '') {+ if (null !== $value && '' !== $value) {$value = round($value, $selectedCurrency->decimal_places);}-$html = view('form.non-selectable-amount', compact('selectedCurrency', 'classes', 'name', 'label', 'value', 'options'))->render();return $html;@@ -316,12 +308,11 @@ class ExpandedFormunset($options['placeholder']);// make sure value is formatted nicely:- if (!is_null($value) && $value !== '') {+ if (null !== $value && '' !== $value) {$decimals = $selectedCurrency->decimal_places ?? 2;$value = round($value, $decimals);}-$html = view('form.non-selectable-amount', compact('selectedCurrency', 'classes', 'name', 'label', 'value', 'options'))->render();return $html;@@ -364,7 +355,7 @@ class ExpandedForm// don't care}- $previousValue = is_null($previousValue) ? 'store' : $previousValue;+ $previousValue = null === $previousValue ? 'store' : $previousValue;$html = view('form.options', compact('type', 'name', 'previousValue'))->render();return $html;@@ -508,10 +499,10 @@ class ExpandedForm{if (Session::has('preFilled')) {$preFilled = session('preFilled');- $value = isset($preFilled[$name]) && is_null($value) ? $preFilled[$name] : $value;+ $value = isset($preFilled[$name]) && null === $value ? $preFilled[$name] : $value;}try {- if (!is_null(request()->old($name))) {+ if (null !== request()->old($name)) {$value = request()->old($name);}} catch (RuntimeException $e) {@@ -521,7 +512,6 @@ class ExpandedForm$value = $value->format('Y-m-d');}-return $value;}@@ -532,14 +522,12 @@ class ExpandedForm*/protected function getHolderClasses(string $name): string{- /*- * Get errors from session:- */+ // Get errors from session:/** @var MessageBag $errors */$errors = session('errors');$classes = 'form-group';- if (!is_null($errors) && $errors->has($name)) {+ if (null !== $errors && $errors->has($name)) {$classes = 'form-group has-error has-feedback';}@@ -596,11 +584,10 @@ class ExpandedForm}// make sure value is formatted nicely:- if (!is_null($value) && $value !== '') {+ if (null !== $value && '' !== $value) {$value = round($value, $defaultCurrency->decimal_places);}-$html = view('form.' . $view, compact('defaultCurrency', 'currencies', 'classes', 'name', 'label', 'value', 'options'))->render();return $html;diff --git a/app/Support/Facades/Amount.php b/app/Support/Facades/Amount.phpindex ab7dcd3d4c..d60471705d 100644--- a/app/Support/Facades/Amount.php+++ b/app/Support/Facades/Amount.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support\Facades;@@ -26,9 +25,7 @@ namespace FireflyIII\Support\Facades;use Illuminate\Support\Facades\Facade;/**- * Class Amount- *- * @package FireflyIII\Support\Facades+ * Class Amount.*/class Amount extends Facade{diff --git a/app/Support/Facades/ExpandedForm.php b/app/Support/Facades/ExpandedForm.phpindex 9f71f90399..9334a4212c 100644--- a/app/Support/Facades/ExpandedForm.php+++ b/app/Support/Facades/ExpandedForm.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support\Facades;@@ -26,9 +25,7 @@ namespace FireflyIII\Support\Facades;use Illuminate\Support\Facades\Facade;/**- * Class Amount- *- * @package FireflyIII\Support\Facades+ * Class Amount.*/class ExpandedForm extends Facade{diff --git a/app/Support/Facades/FireflyConfig.php b/app/Support/Facades/FireflyConfig.phpindex 048e3e4b25..d8da789f1f 100644--- a/app/Support/Facades/FireflyConfig.php+++ b/app/Support/Facades/FireflyConfig.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support\Facades;@@ -26,9 +25,7 @@ namespace FireflyIII\Support\Facades;use Illuminate\Support\Facades\Facade;/**- * Class FireflyConfig- *- * @package FireflyIII\Support\Facades+ * Class FireflyConfig.*/class FireflyConfig extends Facade{diff --git a/app/Support/Facades/Navigation.php b/app/Support/Facades/Navigation.phpindex 95665752fb..cd5ef864f3 100644--- a/app/Support/Facades/Navigation.php+++ b/app/Support/Facades/Navigation.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support\Facades;@@ -26,9 +25,7 @@ namespace FireflyIII\Support\Facades;use Illuminate\Support\Facades\Facade;/**- * Class Navigation- *- * @package FireflyIII\Support\Facades+ * Class Navigation.*/class Navigation extends Facade{diff --git a/app/Support/Facades/Preferences.php b/app/Support/Facades/Preferences.phpindex d6a6373fb1..1cb13a12d6 100644--- a/app/Support/Facades/Preferences.php+++ b/app/Support/Facades/Preferences.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support\Facades;@@ -26,9 +25,7 @@ namespace FireflyIII\Support\Facades;use Illuminate\Support\Facades\Facade;/**- * Class Preferences- *- * @package FireflyIII\Support\Facades+ * Class Preferences.*/class Preferences extends Facade{diff --git a/app/Support/Facades/Steam.php b/app/Support/Facades/Steam.phpindex 015e910873..cc523bff9d 100644--- a/app/Support/Facades/Steam.php+++ b/app/Support/Facades/Steam.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support\Facades;@@ -26,9 +25,7 @@ namespace FireflyIII\Support\Facades;use Illuminate\Support\Facades\Facade;/**- * Class Steam- *- * @package FireflyIII\Support\Facades+ * Class Steam.*/class Steam extends Facade{diff --git a/app/Support/FireflyConfig.php b/app/Support/FireflyConfig.phpindex 367d4c7c06..6842300967 100644--- a/app/Support/FireflyConfig.php+++ b/app/Support/FireflyConfig.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support;@@ -28,9 +27,7 @@ use FireflyIII\Models\Configuration;use Log;/**- * Class FireflyConfig- *- * @package FireflyIII\Support+ * Class FireflyConfig.*/class FireflyConfig{@@ -38,6 +35,7 @@ class FireflyConfig* @param $name** @return bool+ ** @throws \Exception*/public function delete($name): bool@@ -72,7 +70,7 @@ class FireflyConfigreturn $config;}// no preference found and default is null:- if (is_null($default)) {+ if (null === $default) {return null;}@@ -100,7 +98,7 @@ class FireflyConfig{Log::debug('Set new value for ', ['name' => $name]);$config = Configuration::whereName($name)->first();- if (is_null($config)) {+ if (null === $config) {Log::debug('Does not exist yet ', ['name' => $name]);$item = new Configuration;$item->name = $name;diff --git a/app/Support/Import/Configuration/ConfigurationInterface.php b/app/Support/Import/Configuration/ConfigurationInterface.phpindex a5723a55ad..14a2ecb4ae 100644--- a/app/Support/Import/Configuration/ConfigurationInterface.php+++ b/app/Support/Import/Configuration/ConfigurationInterface.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support\Import\Configuration;@@ -26,9 +25,7 @@ namespace FireflyIII\Support\Import\Configuration;use FireflyIII\Models\ImportJob;/**- * Class ConfigurationInterface- *- * @package FireflyIII\Support\Import\Configuration+ * Class ConfigurationInterface.*/interface ConfigurationInterface{diff --git a/app/Support/Import/Configuration/Csv/Initial.php b/app/Support/Import/Configuration/Csv/Initial.phpindex c6f770e777..dff977be5c 100644--- a/app/Support/Import/Configuration/Csv/Initial.php+++ b/app/Support/Import/Configuration/Csv/Initial.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support\Import\Configuration\Csv;@@ -31,9 +30,7 @@ use FireflyIII\Support\Import\Configuration\ConfigurationInterface;use Log;/**- * Class CsvInitial- *- * @package FireflyIII\Support\Import\Configuration+ * Class CsvInitial.*/class Initial implements ConfigurationInterface{@@ -109,23 +106,22 @@ class Initial implements ConfigurationInterface$importId = $data['csv_import_account'] ?? 0;$account = $repository->find(intval($importId));- $hasHeaders = isset($data['has_headers']) && intval($data['has_headers']) === 1 ? true : false;+ $hasHeaders = isset($data['has_headers']) && 1 === intval($data['has_headers']) ? true : false;$config = $this->job->configuration;$config['initial-config-complete'] = true;$config['has-headers'] = $hasHeaders;$config['date-format'] = $data['date_format'];$config['delimiter'] = $data['csv_delimiter'];- $config['delimiter'] = $config['delimiter'] === 'tab' ? "\t" : $config['delimiter'];+ $config['delimiter'] = 'tab' === $config['delimiter'] ? "\t" : $config['delimiter'];Log::debug('Entered import account.', ['id' => $importId]);-- if (!is_null($account->id)) {+ if (null !== $account->id) {Log::debug('Found account.', ['id' => $account->id, 'name' => $account->name]);$config['import-account'] = $account->id;}- if (is_null($account->id)) {+ if (null === $account->id) {Log::error('Could not find anything for csv_import_account.', ['id' => $importId]);}diff --git a/app/Support/Import/Configuration/Csv/Map.php b/app/Support/Import/Configuration/Csv/Map.phpindex 612d782b4f..7aa35f62b0 100644--- a/app/Support/Import/Configuration/Csv/Map.php+++ b/app/Support/Import/Configuration/Csv/Map.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support\Import\Configuration\Csv;@@ -33,9 +32,7 @@ use League\Csv\Reader;use Log;/**- * Class Mapping- *- * @package FireflyIII\Support\Import\Configuration\Csv+ * Class Mapping.*/class Map implements ConfigurationInterface{@@ -43,13 +40,14 @@ class Map implements ConfigurationInterfaceprivate $configuration = [];/** @var array that holds each column to be mapped by the user */private $data = [];- /** @var ImportJob */+ /** @var ImportJob */private $job;/** @var array */private $validSpecifics = [];/*** @return array+ ** @throws FireflyException*/public function getData(): array@@ -79,10 +77,9 @@ class Map implements ConfigurationInterface}$value = $row[$index];if (strlen($value) > 0) {-// we can do some preprocessing here,// which is exclusively to fix the tags:- if (!is_null($this->data[$index]['preProcessMap']) && strlen($this->data[$index]['preProcessMap']) > 0) {+ if (null !== $this->data[$index]['preProcessMap'] && strlen($this->data[$index]['preProcessMap']) > 0) {/** @var PreProcessorInterface $preProcessor */$preProcessor = app($this->data[$index]['preProcessMap']);$result = $preProcessor->run($value);@@ -92,7 +89,6 @@ class Map implements ConfigurationInterfaceLog::debug($rowIndex . ':' . $index . 'Value after preprocessor', ['value-new' => $result]);Log::debug($rowIndex . ':' . $index . 'Value after joining', ['value-complete' => $this->data[$index]['values']]);-continue;}@@ -154,7 +150,7 @@ class Map implements ConfigurationInterface$config['column-mapping-config'][$index] = [];foreach ($data as $value => $mapId) {$mapId = intval($mapId);- if ($mapId !== 0) {+ if (0 !== $mapId) {$config['column-mapping-config'][$index][$value] = intval($mapId);}}@@ -192,15 +188,13 @@ class Map implements ConfigurationInterface$config = $this->job->configuration;/**- * @var int $index+ * @var int* @var bool $mustBeMapped*/foreach ($config['column-do-mapping'] as $index => $mustBeMapped) {$column = $this->validateColumnName($config['column-roles'][$index] ?? '_ignore');$shouldMap = $this->shouldMapColumn($column, $mustBeMapped);if ($shouldMap) {--// create configuration entry for this specific column and add column to $this->data array for later processing.$this->data[$index] = ['name' => $column,@@ -226,7 +220,7 @@ class Map implements ConfigurationInterface$hasPreProcess = config('csv.import_roles.' . $column . '.pre-process-map');$preProcessClass = config('csv.import_roles.' . $column . '.pre-process-mapper');- if (!is_null($hasPreProcess) && $hasPreProcess === true && !is_null($preProcessClass)) {+ if (null !== $hasPreProcess && true === $hasPreProcess && null !== $preProcessClass) {$name = sprintf('\\FireflyIII\\Import\\MapperPreProcess\\%s', $preProcessClass);}@@ -237,6 +231,7 @@ class Map implements ConfigurationInterface* @param array $row** @return array+ ** @throws FireflyException*/private function runSpecifics(array $row): array@@ -269,13 +264,14 @@ class Map implements ConfigurationInterface{$canBeMapped = config('csv.import_roles.' . $column . '.mappable');- return ($canBeMapped && $mustBeMapped);+ return $canBeMapped && $mustBeMapped;}/*** @param string $column** @return string+ ** @throws FireflyException*/private function validateColumnName(string $column): stringdiff --git a/app/Support/Import/Configuration/Csv/Roles.php b/app/Support/Import/Configuration/Csv/Roles.phpindex 265b98aeab..2f03e3f1a5 100644--- a/app/Support/Import/Configuration/Csv/Roles.php+++ b/app/Support/Import/Configuration/Csv/Roles.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support\Import\Configuration\Csv;@@ -30,14 +29,12 @@ use League\Csv\Reader;use Log;/**- * Class Roles- *- * @package FireflyIII\Support\Import\Configuration\Csv+ * Class Roles.*/class Roles implements ConfigurationInterface{private $data = [];- /** @var ImportJob */+ /** @var ImportJob */private $job;/** @var string */@@ -75,7 +72,7 @@ class Roles implements ConfigurationInterface$count = count($row);$this->data['total'] = $count > $this->data['total'] ? $count : $this->data['total'];$this->processRow($row);- $start++;+ ++$start;}$this->updateColumCount();@@ -118,7 +115,7 @@ class Roles implements ConfigurationInterfaceLog::debug('Now in storeConfiguration of Roles.');$config = $this->job->configuration;$count = $config['column-count'];- for ($i = 0; $i < $count; $i++) {+ for ($i = 0; $i < $count; ++$i) {$role = $data['role'][$i] ?? '_ignore';$mapping = isset($data['map'][$i]) && $data['map'][$i] === '1' ? true : false;$config['column-roles'][$i] = $role;@@ -126,7 +123,6 @@ class Roles implements ConfigurationInterfaceLog::debug(sprintf('Column %d has been given role %s', $i, $role));}-$this->job->configuration = $config;$this->job->save();@@ -134,7 +130,6 @@ class Roles implements ConfigurationInterface$this->setRolesComplete();$this->isMappingNecessary();-return true;}@@ -158,11 +153,11 @@ class Roles implements ConfigurationInterface{$config = $this->job->configuration;$count = $config['column-count'];- for ($i = 0; $i < $count; $i++) {+ for ($i = 0; $i < $count; ++$i) {$role = $config['column-roles'][$i] ?? '_ignore';$mapping = $config['column-do-mapping'][$i] ?? false;- if ($role === '_ignore' && $mapping === true) {+ if ('_ignore' === $role && true === $mapping) {$mapping = false;Log::debug(sprintf('Column %d has type %s so it cannot be mapped.', $i, $role));}@@ -183,14 +178,14 @@ class Roles implements ConfigurationInterface$config = $this->job->configuration;$count = $config['column-count'];$toBeMapped = 0;- for ($i = 0; $i < $count; $i++) {+ for ($i = 0; $i < $count; ++$i) {$mapping = $config['column-do-mapping'][$i] ?? false;- if ($mapping === true) {- $toBeMapped++;+ if (true === $mapping) {+ ++$toBeMapped;}}Log::debug(sprintf('Found %d columns that need mapping.', $toBeMapped));- if ($toBeMapped === 0) {+ if (0 === $toBeMapped) {// skip setting of map, because none need to be mapped:$config['column-mapping-complete'] = true;$this->job->configuration = $config;@@ -201,7 +196,7 @@ class Roles implements ConfigurationInterface}/**- * make unique example data+ * make unique example data.*/private function makeExamplesUnique(): bool{@@ -258,12 +253,12 @@ class Roles implements ConfigurationInterface$count = $config['column-count'];$assigned = 0;$hasAmount = false;- for ($i = 0; $i < $count; $i++) {+ for ($i = 0; $i < $count; ++$i) {$role = $config['column-roles'][$i] ?? '_ignore';- if ($role !== '_ignore') {- $assigned++;+ if ('_ignore' !== $role) {+ ++$assigned;}- if ($role === 'amount') {+ if ('amount' === $role) {$hasAmount = true;}}@@ -273,7 +268,7 @@ class Roles implements ConfigurationInterface$this->job->save();$this->warning = '';}- if ($assigned === 0 || !$hasAmount) {+ if (0 === $assigned || !$hasAmount) {$this->warning = strval(trans('csv.roles_warning'));}diff --git a/app/Support/Import/Information/BunqInformation.php b/app/Support/Import/Information/BunqInformation.phpindex 9570506a0d..3c76d63558 100644--- a/app/Support/Import/Information/BunqInformation.php+++ b/app/Support/Import/Information/BunqInformation.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support\Import\Information;@@ -38,14 +37,11 @@ use Log;use Preferences;/**- * Class BunqInformation- *- * @package FireflyIII\Support\Import\Information+ * Class BunqInformation.*/class BunqInformation implements InformationInterface{-- /** @var User */+ /** @var User */private $user;/**@@ -92,7 +88,7 @@ class BunqInformation implements InformationInterface];/** @var Alias $alias */foreach ($account->getAliases() as $alias) {- if ($alias->getType() === 'IBAN') {+ if ('IBAN' === $alias->getType()) {$current['number'] = $alias->getValue();}}@@ -161,6 +157,7 @@ class BunqInformation implements InformationInterface* @param SessionToken $sessionToken** @return int+ ** @throws FireflyException*/private function getUserInformation(SessionToken $sessionToken): intdiff --git a/app/Support/Import/Information/InformationInterface.php b/app/Support/Import/Information/InformationInterface.phpindex 068889f2fe..7de8e527d4 100644--- a/app/Support/Import/Information/InformationInterface.php+++ b/app/Support/Import/Information/InformationInterface.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support\Import\Information;@@ -26,13 +25,10 @@ namespace FireflyIII\Support\Import\Information;use FireflyIII\User;/**- * Interface InformationInterface- *- * @package FireflyIII\Support\Import\Information+ * Interface InformationInterface.*/interface InformationInterface{-/*** Returns a collection of accounts. Preferrably, these follow a uniform Firefly III format so they can be managed over banks.*diff --git a/app/Support/Import/Prerequisites/BunqPrerequisites.php b/app/Support/Import/Prerequisites/BunqPrerequisites.phpindex c9eae0595b..75614b3762 100644--- a/app/Support/Import/Prerequisites/BunqPrerequisites.php+++ b/app/Support/Import/Prerequisites/BunqPrerequisites.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support\Import\Prerequisites;@@ -41,12 +40,10 @@ use Requests_Exception;/*** This class contains all the routines necessary to connect to Bunq.- *- * @package FireflyIII\Support\Import\Prerequisites*/class BunqPrerequisites implements PrerequisitesInterface{- /** @var User */+ /** @var User */private $user;/**@@ -80,7 +77,7 @@ class BunqPrerequisites implements PrerequisitesInterface{$apiKey = Preferences::getForUser($this->user, 'bunq_api_key', false);- return ($apiKey->data === false || is_null($apiKey->data));+ return false === $apiKey->data || null === $apiKey->data;}/**@@ -156,6 +153,7 @@ class BunqPrerequisites implements PrerequisitesInterface* to try and detect the server ID for this firefly instance.** @return DeviceServerId+ ** @throws FireflyException*/private function getExistingDevice(): DeviceServerId@@ -187,7 +185,7 @@ class BunqPrerequisites implements PrerequisitesInterface{Log::debug('Get installation token.');$token = Preferences::getForUser($this->user, 'bunq_installation_token', null);- if (!is_null($token)) {+ if (null !== $token) {return $token->data;}Log::debug('Have no token, request one.');@@ -219,7 +217,7 @@ class BunqPrerequisites implements PrerequisitesInterface{Log::debug('get private key');$preference = Preferences::getForUser($this->user, 'bunq_private_key', null);- if (is_null($preference)) {+ if (null === $preference) {Log::debug('private key is null');// create key pair$this->createKeyPair();@@ -239,7 +237,7 @@ class BunqPrerequisites implements PrerequisitesInterface{Log::debug('get public key');$preference = Preferences::getForUser($this->user, 'bunq_public_key', null);- if (is_null($preference)) {+ if (null === $preference) {Log::debug('public key is null');// create key pair$this->createKeyPair();@@ -254,18 +252,19 @@ class BunqPrerequisites implements PrerequisitesInterface* Request users server remote IP. Let's assume this value will not change any time soon.** @return string+ ** @throws FireflyException*/private function getRemoteIp(): string{$preference = Preferences::getForUser($this->user, 'external_ip', null);- if (is_null($preference)) {+ if (null === $preference) {try {$response = Requests::get('https://api.ipify.org');} catch (Requests_Exception $e) {throw new FireflyException(sprintf('Could not retrieve external IP: %s', $e->getMessage()));}- if ($response->status_code !== 200) {+ if (200 !== $response->status_code) {throw new FireflyException(sprintf('Could not retrieve external IP: %d %s', $response->status_code, $response->body));}$serverIp = $response->body;@@ -299,7 +298,7 @@ class BunqPrerequisites implements PrerequisitesInterfaceLog::debug('Now in registerDevice');$deviceServerId = Preferences::getForUser($this->user, 'bunq_device_server_id', null);$serverIp = $this->getRemoteIp();- if (!is_null($deviceServerId)) {+ if (null !== $deviceServerId) {Log::debug('Have device server ID.');return $deviceServerId->data;@@ -323,7 +322,7 @@ class BunqPrerequisites implements PrerequisitesInterface} catch (FireflyException $e) {Log::error($e->getMessage());}- if (is_null($deviceServerId)) {+ if (null === $deviceServerId) {// try get the current from a list:$deviceServerId = $this->getExistingDevice();}diff --git a/app/Support/Import/Prerequisites/PrerequisitesInterface.php b/app/Support/Import/Prerequisites/PrerequisitesInterface.phpindex f6042869d4..e52fad7d61 100644--- a/app/Support/Import/Prerequisites/PrerequisitesInterface.php+++ b/app/Support/Import/Prerequisites/PrerequisitesInterface.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support\Import\Prerequisites;diff --git a/app/Support/Models/TransactionJournalTrait.php b/app/Support/Models/TransactionJournalTrait.phpindex ff039bea5a..928fa95e79 100644--- a/app/Support/Models/TransactionJournalTrait.php+++ b/app/Support/Models/TransactionJournalTrait.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support\Models;@@ -35,19 +34,18 @@ use Illuminate\Database\Eloquent\Relations\HasMany;use Illuminate\Support\Collection;/**- * Class TransactionJournalTrait+ * Class TransactionJournalTrait.** @property int $id* @property Carbon $date* @property string $transaction_type_type* @property TransactionType $transactionType- *- * @package FireflyIII\Support\Models*/trait TransactionJournalTrait{/*** @return string+ ** @throws FireflyException*/public function amount(): string@@ -100,7 +98,7 @@ trait TransactionJournalTraitpublic function budgetId(): int{$budget = $this->budgets()->first();- if (!is_null($budget)) {+ if (null !== $budget) {return $budget->id;}@@ -123,7 +121,7 @@ trait TransactionJournalTraitpublic function categoryAsString(): string{$category = $this->categories()->first();- if (!is_null($category)) {+ if (null !== $category) {return $category->name;}@@ -137,10 +135,10 @@ trait TransactionJournalTrait*/public function dateAsString(string $dateField = ''): string{- if ($dateField === '') {+ if ('' === $dateField) {return $this->date->format('Y-m-d');}- if (!is_null($this->$dateField) && $this->$dateField instanceof Carbon) {+ if (null !== $this->$dateField && $this->$dateField instanceof Carbon) {// make field NULL$carbon = clone $this->$dateField;$this->$dateField = null;@@ -153,7 +151,7 @@ trait TransactionJournalTraitreturn $carbon->format('Y-m-d');}$metaField = $this->getMeta($dateField);- if (!is_null($metaField)) {+ if (null !== $metaField) {$carbon = new Carbon($metaField);return $carbon->format('Y-m-d');@@ -205,7 +203,6 @@ trait TransactionJournalTrait}/**- ** @param string $name** @return string@@ -226,7 +223,7 @@ trait TransactionJournalTraitpublic function isJoined(Builder $query, string $table): bool{$joins = $query->getQuery()->joins;- if (is_null($joins)) {+ if (null === $joins) {return false;}foreach ($joins as $join) {@@ -239,19 +236,16 @@ trait TransactionJournalTrait}/**- ** @return bool*/abstract public function isOpeningBalance(): bool;/**- ** @return bool*/abstract public function isTransfer(): bool;/**- ** @return bool*/abstract public function isWithdrawal(): bool;@@ -284,7 +278,7 @@ trait TransactionJournalTrait/*** Save the model to the database.*- * @param array $options+ * @param array $options** @return bool*/diff --git a/app/Support/Navigation.php b/app/Support/Navigation.phpindex ae3ec494b0..402a48a666 100644--- a/app/Support/Navigation.php+++ b/app/Support/Navigation.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support;@@ -27,19 +26,17 @@ use Carbon\Carbon;use FireflyIII\Exceptions\FireflyException;/**- * Class Navigation- *- * @package FireflyIII\Support+ * Class Navigation.*/class Navigation{-/*** @param \Carbon\Carbon $theDate* @param $repeatFreq* @param $skip** @return \Carbon\Carbon+ ** @throws FireflyException*/public function addPeriod(Carbon $theDate, string $repeatFreq, int $skip): Carbon@@ -75,7 +72,7 @@ class Navigation// if period is 1M and diff in month is 2 and new DOM = 1, sub a day:$months = ['1M', 'month', 'monthly'];$difference = $date->month - $theDate->month;- if (in_array($repeatFreq, $months) && $difference === 2 && $date->day === 1) {+ if (in_array($repeatFreq, $months) && 2 === $difference && 1 === $date->day) {$date->subDay();}@@ -87,6 +84,7 @@ class Navigation* @param $repeatFreq** @return \Carbon\Carbon+ ** @throws FireflyException*/public function endOfPeriod(\Carbon\Carbon $end, string $repeatFreq): Carbon@@ -113,7 +111,7 @@ class Navigation// if the range is custom, the end of the period// is another X days (x is the difference between start)// and end added to $theCurrentEnd- if ($repeatFreq === 'custom') {+ if ('custom' === $repeatFreq) {/** @var Carbon $tStart */$tStart = session('start', Carbon::now()->startOfMonth());/** @var Carbon $tEnd */@@ -178,7 +176,7 @@ class Navigation$currentEnd->$function();}- if (!is_null($maxDate) && $currentEnd > $maxDate) {+ if (null !== $maxDate && $currentEnd > $maxDate) {return clone $maxDate;}@@ -227,6 +225,7 @@ class Navigation* @param $repeatFrequency** @return string+ ** @throws FireflyException*/public function periodShow(Carbon $theDate, string $repeatFrequency): string@@ -248,13 +247,12 @@ class Navigation'year' => trans('config.year'),'yearly' => trans('config.year'),'6M' => trans('config.half_year'),-];if (isset($formatMap[$repeatFrequency])) {return $date->formatLocalized(strval($formatMap[$repeatFrequency]));}- if ($repeatFrequency === '3M' || $repeatFrequency === 'quarter') {+ if ('3M' === $repeatFrequency || 'quarter' === $repeatFrequency) {$quarter = ceil($theDate->month / 3);return sprintf('Q%d %d', $quarter, $theDate->year);@@ -384,6 +382,7 @@ class Navigation* @param $repeatFreq** @return \Carbon\Carbon+ ** @throws FireflyException*/public function startOfPeriod(Carbon $theDate, string $repeatFreq): Carbon@@ -412,7 +411,7 @@ class Navigationreturn $date;}- if ($repeatFreq === 'half-year' || $repeatFreq === '6M') {+ if ('half-year' === $repeatFreq || '6M' === $repeatFreq) {$month = $date->month;$date->startOfYear();if ($month >= 7) {@@ -421,11 +420,10 @@ class Navigationreturn $date;}- if ($repeatFreq === 'custom') {+ if ('custom' === $repeatFreq) {return $date; // the date is already at the start.}-throw new FireflyException(sprintf('Cannot do startOfPeriod for $repeat_freq "%s"', $repeatFreq));}@@ -435,6 +433,7 @@ class Navigation* @param int $subtract** @return \Carbon\Carbon+ ** @throws FireflyException*/public function subtractPeriod(Carbon $theDate, string $repeatFreq, int $subtract = 1): Carbon@@ -476,7 +475,7 @@ class Navigation// a custom range requires the session start// and session end to calculate the difference in days.// this is then subtracted from $theDate (* $subtract).- if ($repeatFreq === 'custom') {+ if ('custom' === $repeatFreq) {/** @var Carbon $tStart */$tStart = session('start', Carbon::now()->startOfMonth());/** @var Carbon $tEnd */@@ -495,6 +494,7 @@ class Navigation* @param \Carbon\Carbon $start** @return \Carbon\Carbon+ ** @throws FireflyException*/public function updateEndDate(string $range, Carbon $start): Carbon@@ -515,7 +515,7 @@ class Navigationreturn $end;}- if ($range === '6M') {+ if ('6M' === $range) {if ($start->month >= 7) {$end->endOfYear();@@ -533,6 +533,7 @@ class Navigation* @param \Carbon\Carbon $start** @return \Carbon\Carbon+ ** @throws FireflyException*/public function updateStartDate(string $range, Carbon $start): Carbon@@ -551,7 +552,7 @@ class Navigationreturn $start;}- if ($range === '6M') {+ if ('6M' === $range) {if ($start->month >= 7) {$start->startOfYear()->addMonths(6);diff --git a/app/Support/Preferences.php b/app/Support/Preferences.phpindex 33a7becce5..0750c44394 100644--- a/app/Support/Preferences.php+++ b/app/Support/Preferences.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support;@@ -30,9 +29,7 @@ use Illuminate\Support\Collection;use Session;/**- * Class Preferences- *- * @package FireflyIII\Support+ * Class Preferences.*/class Preferences{@@ -53,6 +50,7 @@ class Preferences* @param $name** @return bool+ ** @throws \Exception*/public function delete(string $name): bool@@ -87,7 +85,7 @@ class Preferencespublic function get($name, $default = null){$user = auth()->user();- if (is_null($user)) {+ if (null === $user) {return $default;}@@ -119,7 +117,7 @@ class Preferences/*** @param \FireflyIII\User $user- * @param string $name+ * @param string $name* @param null|string $default** @return \FireflyIII\Models\Preference|null@@ -139,7 +137,7 @@ class Preferencesreturn $preference;}// no preference found and default is null:- if (is_null($default)) {+ if (null === $default) {// return NULLreturn null;}@@ -154,7 +152,7 @@ class Preferences{$lastActivity = microtime();$preference = $this->get('lastActivity', microtime());- if (!is_null($preference)) {+ if (null !== $preference) {$lastActivity = $preference->data;}@@ -173,15 +171,15 @@ class Preferences}/**- * @param $name- * @param $value+ * @param $name+ * @param $value** @return Preference*/public function set($name, $value): Preference{$user = auth()->user();- if (is_null($user)) {+ if (null === $user) {// make new preference, return it:$pref = new Preference;$pref->name = $name;@@ -206,7 +204,7 @@ class PreferencesCache::forget($fullName);$pref = Preference::where('user_id', $user->id)->where('name', $name)->first(['id', 'name', 'data']);- if (!is_null($pref)) {+ if (null !== $pref) {$pref->data = $value;$pref->save();diff --git a/app/Support/Search/Modifier.php b/app/Support/Search/Modifier.phpindex cf23cc9383..4d2271a729 100644--- a/app/Support/Search/Modifier.php+++ b/app/Support/Search/Modifier.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support\Search;@@ -56,6 +55,7 @@ class Modifier* @SuppressWarnings(PHPMD.CyclomaticComplexity)** @return bool+ ** @throws FireflyException*/public static function apply(array $modifier, Transaction $transaction): bool@@ -149,7 +149,7 @@ class Modifier*/public static function stringCompare(string $haystack, string $needle): bool{- $res = !(strpos(strtolower($haystack), strtolower($needle)) === false);+ $res = !(false === strpos(strtolower($haystack), strtolower($needle)));Log::debug(sprintf('"%s" is in "%s"? %s', $needle, $haystack, var_export($res, true)));return $res;@@ -164,11 +164,11 @@ class Modifierprivate static function budget(Transaction $transaction, string $search): bool{$journalBudget = '';- if (!is_null($transaction->transaction_journal_budget_name)) {+ if (null !== $transaction->transaction_journal_budget_name) {$journalBudget = Steam::decrypt(intval($transaction->transaction_journal_budget_encrypted), $transaction->transaction_journal_budget_name);}$transactionBudget = '';- if (!is_null($transaction->transaction_budget_name)) {+ if (null !== $transaction->transaction_budget_name) {$journalBudget = Steam::decrypt(intval($transaction->transaction_budget_encrypted), $transaction->transaction_budget_name);}@@ -184,11 +184,11 @@ class Modifierprivate static function category(Transaction $transaction, string $search): bool{$journalCategory = '';- if (!is_null($transaction->transaction_journal_category_name)) {+ if (null !== $transaction->transaction_journal_category_name) {$journalCategory = Steam::decrypt(intval($transaction->transaction_journal_category_encrypted), $transaction->transaction_journal_category_name);}$transactionCategory = '';- if (!is_null($transaction->transaction_category_name)) {+ if (null !== $transaction->transaction_category_name) {$journalCategory = Steam::decrypt(intval($transaction->transaction_category_encrypted), $transaction->transaction_category_name);}diff --git a/app/Support/Search/Search.php b/app/Support/Search/Search.phpindex 7b59960233..e5aa93b4cb 100644--- a/app/Support/Search/Search.php+++ b/app/Support/Search/Search.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support\Search;@@ -33,9 +32,7 @@ use Illuminate\Support\Collection;use Log;/**- * Class Search- *- * @package FireflyIII\Search+ * Class Search.*/class Search implements SearchInterface{@@ -43,13 +40,13 @@ class Search implements SearchInterfaceprivate $limit = 100;/** @var Collection */private $modifiers;- /** @var string */+ /** @var string */private $originalQuery = '';/** @var User */private $user;/** @var array */private $validModifiers = [];- /** @var array */+ /** @var array */private $words = [];/**@@ -67,7 +64,7 @@ class Search implements SearchInterfacepublic function getWordsAsString(): string{$string = join(' ', $this->words);- if (strlen($string) === 0) {+ if (0 === strlen($string)) {return is_string($this->originalQuery) ? $this->originalQuery : '';}@@ -150,7 +147,7 @@ class Search implements SearchInterfaceLog::debug(sprintf('Total count is now %d', $result->count()));// Update counters- $page++;+ ++$page;$processed += count($set);Log::debug(sprintf('Page is now %d, processed is %d', $page, $processed));@@ -235,7 +232,6 @@ class Search implements SearchInterface}}-return $collector;}@@ -245,12 +241,12 @@ class Search implements SearchInterfaceprivate function extractModifier(string $string){$parts = explode(':', $string);- if (count($parts) === 2 && strlen(trim(strval($parts[0]))) > 0 && strlen(trim(strval($parts[1])))) {+ if (2 === count($parts) && strlen(trim(strval($parts[0]))) > 0 && strlen(trim(strval($parts[1])))) {$type = trim(strval($parts[0]));$value = trim(strval($parts[1]));if (in_array($type, $this->validModifiers)) {// filter for valid type- $this->modifiers->push(['type' => $type, 'value' => $value,]);+ $this->modifiers->push(['type' => $type, 'value' => $value]);}}}@@ -259,6 +255,7 @@ class Search implements SearchInterface* @param Transaction $transaction** @return bool+ ** @throws FireflyException*/private function matchModifiers(Transaction $transaction): bool@@ -278,7 +275,7 @@ class Search implements SearchInterface// then a for-each and a switch for every possible other thingie.foreach ($this->modifiers as $modifier) {$res = Modifier::apply($modifier, $transaction);- if ($res === false) {+ if (false === $res) {return $res;}}@@ -294,11 +291,11 @@ class Search implements SearchInterface*/private function strposArray(string $haystack, array $needle){- if (strlen($haystack) === 0) {+ if (0 === strlen($haystack)) {return false;}foreach ($needle as $what) {- if (stripos($haystack, $what) !== false) {+ if (false !== stripos($haystack, $what)) {return true;}}diff --git a/app/Support/Search/SearchInterface.php b/app/Support/Search/SearchInterface.phpindex d87d07dbe7..f24c26cfc3 100644--- a/app/Support/Search/SearchInterface.php+++ b/app/Support/Search/SearchInterface.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support\Search;@@ -27,9 +26,7 @@ use FireflyIII\User;use Illuminate\Support\Collection;/**- * Interface SearchInterface- *- * @package FireflyIII\Support\Search+ * Interface SearchInterface.*/interface SearchInterface{@@ -48,7 +45,6 @@ interface SearchInterface*/public function parseQuery(string $query);-/*** @return Collection*/diff --git a/app/Support/SingleCacheProperties.php b/app/Support/SingleCacheProperties.phpindex 9e2b3324ad..f0b88d108d 100644--- a/app/Support/SingleCacheProperties.php+++ b/app/Support/SingleCacheProperties.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support;@@ -26,9 +25,7 @@ namespace FireflyIII\Support;use Illuminate\Support\Collection;/**- * Class CacheProperties- *- * @package FireflyIII\Support+ * Class CacheProperties.*/class SingleCacheProperties extends CacheProperties{diff --git a/app/Support/Steam.php b/app/Support/Steam.phpindex a7b56c774d..70a95bdb01 100644--- a/app/Support/Steam.php+++ b/app/Support/Steam.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support;@@ -32,15 +31,11 @@ use Illuminate\Contracts\Encryption\DecryptException;use Illuminate\Support\Collection;/**- * Class Steam- *- * @package FireflyIII\Support+ * Class Steam.*/class Steam{-/**- ** @param \FireflyIII\Models\Account $account* @param \Carbon\Carbon $date*@@ -48,7 +43,6 @@ class Steam*/public function balance(Account $account, Carbon $date): string{-// abuse chart properties:$cache = new CacheProperties;$cache->addProperty($account->id);@@ -59,7 +53,7 @@ class Steam}$currencyId = intval($account->getMeta('currency_id'));// use system default currency:- if ($currencyId === 0) {+ if (0 === $currencyId) {$currency = app('amount')->getDefaultCurrency();$currencyId = $currency->id;}@@ -81,7 +75,7 @@ class Steam->sum('transactions.foreign_amount'));$balance = bcadd($nativeBalance, $foreignBalance);- $virtual = is_null($account->virtual_balance) ? '0' : strval($account->virtual_balance);+ $virtual = null === $account->virtual_balance ? '0' : strval($account->virtual_balance);$balance = bcadd($balance, $virtual);$cache->store($balance);@@ -89,7 +83,6 @@ class Steam}/**- ** @param \FireflyIII\Models\Account $account* @param \Carbon\Carbon $date*@@ -97,7 +90,6 @@ class Steam*/public function balanceIgnoreVirtual(Account $account, Carbon $date): string{-// abuse chart properties:$cache = new CacheProperties;$cache->addProperty($account->id);@@ -132,7 +124,7 @@ class Steam}/**- * Gets the balance for the given account during the whole range, using this format:+ * Gets the balance for the given account during the whole range, using this format:.** [yyyy-mm-dd] => 123,2*@@ -187,10 +179,10 @@ class Steam/** @var Transaction $entry */foreach ($set as $entry) {// normal amount and foreign amount- $modified = is_null($entry->modified) ? '0' : strval($entry->modified);- $foreignModified = is_null($entry->modified_foreign) ? '0' : strval($entry->modified_foreign);+ $modified = null === $entry->modified ? '0' : strval($entry->modified);+ $foreignModified = null === $entry->modified_foreign ? '0' : strval($entry->modified_foreign);$amount = '0';- if ($currencyId === $entry->transaction_currency_id || $currencyId === 0) {+ if ($currencyId === $entry->transaction_currency_id || 0 === $currencyId) {// use normal amount:$amount = $modified;}@@ -250,7 +242,7 @@ class Steam*/public function decrypt(int $isEncrypted, string $value){- if ($isEncrypted === 1) {+ if (1 === $isEncrypted) {return Crypt::decrypt($value);}@@ -285,7 +277,7 @@ class Steam*/public function negative(string $amount): string{- if (bccomp($amount, '0') === 1) {+ if (1 === bccomp($amount, '0')) {$amount = bcmul($amount, '-1');}@@ -313,21 +305,21 @@ class Steam{$string = strtolower($string);- if (!(stripos($string, 'k') === false)) {+ if (!(false === stripos($string, 'k'))) {// has a K in it, remove the K and multiply by 1024.$bytes = bcmul(rtrim($string, 'kK'), '1024');return intval($bytes);}- if (!(stripos($string, 'm') === false)) {+ if (!(false === stripos($string, 'm'))) {// has a M in it, remove the M and multiply by 1048576.$bytes = bcmul(rtrim($string, 'mM'), '1048576');return intval($bytes);}- if (!(stripos($string, 'g') === false)) {+ if (!(false === stripos($string, 'g'))) {// has a G in it, remove the G and multiply by (1024)^3.$bytes = bcmul(rtrim($string, 'gG'), '1073741824');diff --git a/app/Support/Twig/AmountFormat.php b/app/Support/Twig/AmountFormat.phpindex cd2c528e3c..98ff3509b7 100644--- a/app/Support/Twig/AmountFormat.php+++ b/app/Support/Twig/AmountFormat.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support\Twig;@@ -31,13 +30,11 @@ use Twig_SimpleFunction;/*** Contains all amount formatting routines.- *- * @package FireflyIII\Support\Twig*/class AmountFormat extends Twig_Extension{/**- * {@inheritDoc}+ * {@inheritdoc}*/public function getFilters(): array{@@ -48,7 +45,7 @@ class AmountFormat extends Twig_Extension}/**- * {@inheritDoc}+ * {@inheritdoc}*/public function getFunctions(): array{@@ -74,7 +71,6 @@ class AmountFormat extends Twig_Extension}/**- ** @return Twig_SimpleFilter*/protected function formatAmount(): Twig_SimpleFilter@@ -102,7 +98,7 @@ class AmountFormat extends Twig_Extensionfunction (AccountModel $account, string $amount, bool $coloured = true): string {$currencyId = intval($account->getMeta('currency_id'));- if ($currencyId !== 0) {+ if (0 !== $currencyId) {$currency = TransactionCurrency::find($currencyId);return app('amount')->formatAnything($currency, $amount, $coloured);@@ -175,7 +171,6 @@ class AmountFormat extends Twig_Extensionreturn new Twig_SimpleFunction('formatDestinationAfter',function (array $transaction): string {-// build fake currency for main amount.$format = new TransactionCurrency;$format->decimal_places = $transaction['transaction_currency_dp'];@@ -183,7 +178,7 @@ class AmountFormat extends Twig_Extension$string = app('amount')->formatAnything($format, $transaction['destination_account_after'], true);// also append foreign amount for clarity:- if (!is_null($transaction['foreign_destination_amount'])) {+ if (null !== $transaction['foreign_destination_amount']) {// build fake currency for foreign amount$format = new TransactionCurrency;$format->decimal_places = $transaction['foreign_currency_dp'];@@ -191,7 +186,6 @@ class AmountFormat extends Twig_Extension$string .= ' (' . app('amount')->formatAnything($format, $transaction['foreign_destination_amount'], true) . ')';}-return $string;},['is_safe' => ['html']]@@ -206,7 +200,6 @@ class AmountFormat extends Twig_Extensionreturn new Twig_SimpleFunction('formatDestinationBefore',function (array $transaction): string {-// build fake currency for main amount.$format = new TransactionCurrency;$format->decimal_places = $transaction['transaction_currency_dp'];@@ -226,7 +219,6 @@ class AmountFormat extends Twig_Extensionreturn new Twig_SimpleFunction('formatSourceAfter',function (array $transaction): string {-// build fake currency for main amount.$format = new TransactionCurrency;$format->decimal_places = $transaction['transaction_currency_dp'];@@ -234,7 +226,7 @@ class AmountFormat extends Twig_Extension$string = app('amount')->formatAnything($format, $transaction['source_account_after'], true);// also append foreign amount for clarity:- if (!is_null($transaction['foreign_source_amount'])) {+ if (null !== $transaction['foreign_source_amount']) {// build fake currency for foreign amount$format = new TransactionCurrency;$format->decimal_places = $transaction['foreign_currency_dp'];@@ -242,7 +234,6 @@ class AmountFormat extends Twig_Extension$string .= ' (' . app('amount')->formatAnything($format, $transaction['foreign_source_amount'], true) . ')';}-return $string;},['is_safe' => ['html']]@@ -257,7 +248,6 @@ class AmountFormat extends Twig_Extensionreturn new Twig_SimpleFunction('formatSourceBefore',function (array $transaction): string {-// build fake currency for main amount.$format = new TransactionCurrency;$format->decimal_places = $transaction['transaction_currency_dp'];diff --git a/app/Support/Twig/Extension/Transaction.php b/app/Support/Twig/Extension/Transaction.phpindex b9d9816859..bb2e9d6365 100644--- a/app/Support/Twig/Extension/Transaction.php+++ b/app/Support/Twig/Extension/Transaction.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support\Twig\Extension;@@ -33,13 +32,10 @@ use Lang;use Twig_Extension;/**- * Class Transaction- *- * @package FireflyIII\Support\Twig\Extension+ * Class Transaction.*/class Transaction extends Twig_Extension{-/*** Can show the amount of a transaction, if that transaction has been collected by the journal collector.*@@ -61,16 +57,16 @@ class Transaction extends Twig_Extension$format = '%s';$coloured = true;- if ($transaction->transaction_type_type === TransactionType::DEPOSIT) {+ if (TransactionType::DEPOSIT === $transaction->transaction_type_type) {$amount = bcmul($amount, '-1');}- if ($transaction->transaction_type_type === TransactionType::TRANSFER) {+ if (TransactionType::TRANSFER === $transaction->transaction_type_type) {$amount = app('steam')->positive($amount);$coloured = false;$format = '<span class="text-info">%s</span>';}- if ($transaction->transaction_type_type === TransactionType::OPENING_BALANCE) {+ if (TransactionType::OPENING_BALANCE === $transaction->transaction_type_type) {$amount = strval($transaction->transaction_amount);}@@ -79,15 +75,13 @@ class Transaction extends Twig_Extension$currency->decimal_places = $transaction->transaction_currency_dp;$str = sprintf($format, app('amount')->formatAnything($currency, $amount, $coloured));-- if (!is_null($transaction->transaction_foreign_amount)) {+ if (null !== $transaction->transaction_foreign_amount) {$amount = bcmul(app('steam')->positive(strval($transaction->transaction_foreign_amount)), '-1');- if ($transaction->transaction_type_type === TransactionType::DEPOSIT) {+ if (TransactionType::DEPOSIT === $transaction->transaction_type_type) {$amount = bcmul($amount, '-1');}-- if ($transaction->transaction_type_type === TransactionType::TRANSFER) {+ if (TransactionType::TRANSFER === $transaction->transaction_type_type) {$amount = app('steam')->positive($amount);$coloured = false;$format = '<span class="text-info">%s</span>';@@ -120,7 +114,7 @@ class Transaction extends Twig_Extension}// first display amount:- $amount = $transaction['journal_type'] === TransactionType::WITHDRAWAL ? $transaction['source_amount']+ $amount = TransactionType::WITHDRAWAL === $transaction['journal_type'] ? $transaction['source_amount']: $transaction['destination_amount'];$fakeCurrency = new TransactionCurrency;$fakeCurrency->decimal_places = $transaction['transaction_currency_dp'];@@ -128,8 +122,8 @@ class Transaction extends Twig_Extension$string = app('amount')->formatAnything($fakeCurrency, $amount, true);// then display (if present) the foreign amount:- if (!is_null($transaction['foreign_source_amount'])) {- $amount = $transaction['journal_type'] === TransactionType::WITHDRAWAL ? $transaction['foreign_source_amount']+ if (null !== $transaction['foreign_source_amount']) {+ $amount = TransactionType::WITHDRAWAL === $transaction['journal_type'] ? $transaction['foreign_source_amount']: $transaction['foreign_destination_amount'];$fakeCurrency = new TransactionCurrency;$fakeCurrency->decimal_places = $transaction['foreign_currency_dp'];@@ -176,7 +170,7 @@ class Transaction extends Twig_Extension// see if the transaction has a budget:$budgets = $transaction->budgets()->get();- if ($budgets->count() === 0) {+ if (0 === $budgets->count()) {$budgets = $transaction->transactionJournal()->first()->budgets()->get();}if ($budgets->count() > 0) {@@ -231,7 +225,7 @@ class Transaction extends Twig_Extension// see if the transaction has a category:$categories = $transaction->categories()->get();- if ($categories->count() === 0) {+ if (0 === $categories->count()) {$categories = $transaction->transactionJournal()->first()->categories()->get();}if ($categories->count() > 0) {@@ -296,14 +290,14 @@ class Transaction extends Twig_Extension$type = $transaction->account_type;// name is present in object, use that one:- if (bccomp($transaction->transaction_amount, '0') === -1 && !is_null($transaction->opposing_account_id)) {+ if (bccomp($transaction->transaction_amount, '0') === -1 && null !== $transaction->opposing_account_id) {$name = $transaction->opposing_account_name;$transactionId = intval($transaction->opposing_account_id);$type = $transaction->opposing_account_type;}// Find the opposing account and use that one:- if (bccomp($transaction->transaction_amount, '0') === -1 && is_null($transaction->opposing_account_id)) {+ if (bccomp($transaction->transaction_amount, '0') === -1 && null === $transaction->opposing_account_id) {// if the amount is negative, find the opposing account and use that one:$journalId = $transaction->journal_id;/** @var TransactionModel $other */@@ -320,7 +314,7 @@ class Transaction extends Twig_Extension$type = $other->type;}- if ($type === AccountType::CASH) {+ if (AccountType::CASH === $type) {$txt = '<span class="text-success">(' . trans('firefly.cash') . ')</span>';$cache->store($txt);@@ -418,7 +412,7 @@ class Transaction extends Twig_Extensionreturn $cache->get();}$icon = '';- if (intval($transaction->reconciled) === 1) {+ if (1 === intval($transaction->reconciled)) {$icon = '<i class="fa fa-check"></i>';}@@ -477,13 +471,13 @@ class Transaction extends Twig_Extension$type = $transaction->account_type;// name is present in object, use that one:- if (bccomp($transaction->transaction_amount, '0') === 1 && !is_null($transaction->opposing_account_id)) {+ if (1 === bccomp($transaction->transaction_amount, '0') && null !== $transaction->opposing_account_id) {$name = $transaction->opposing_account_name;$transactionId = intval($transaction->opposing_account_id);$type = $transaction->opposing_account_type;}// Find the opposing account and use that one:- if (bccomp($transaction->transaction_amount, '0') === 1 && is_null($transaction->opposing_account_id)) {+ if (1 === bccomp($transaction->transaction_amount, '0') && null === $transaction->opposing_account_id) {$journalId = $transaction->journal_id;/** @var TransactionModel $other */$other = TransactionModel::where('transaction_journal_id', $journalId)->where('transactions.id', '!=', $transaction->id)@@ -499,7 +493,7 @@ class Transaction extends Twig_Extension$type = $other->type;}- if ($type === AccountType::CASH) {+ if (AccountType::CASH === $type) {$txt = '<span class="text-success">(' . trans('firefly.cash') . ')</span>';$cache->store($txt);diff --git a/app/Support/Twig/Extension/TransactionJournal.php b/app/Support/Twig/Extension/TransactionJournal.phpindex 5e429db205..5f96804ff9 100644--- a/app/Support/Twig/Extension/TransactionJournal.php+++ b/app/Support/Twig/Extension/TransactionJournal.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support\Twig\Extension;@@ -31,7 +30,6 @@ use Twig_Extension;class TransactionJournal extends Twig_Extension{-/*** @param JournalModel $journal*@@ -63,7 +61,7 @@ class TransactionJournal extends Twig_Extension}$totals[$currencyId]['amount'] = bcadd($transaction->amount, $totals[$currencyId]['amount']);- if (!is_null($transaction->foreign_currency_id)) {+ if (null !== $transaction->foreign_currency_id) {$foreignId = $transaction->foreign_currency_id;$foreign = $transaction->foreignCurrency;if (!isset($totals[$foreignId])) {@@ -77,7 +75,7 @@ class TransactionJournal extends Twig_Extension}$array = [];foreach ($totals as $total) {- if ($type === TransactionType::WITHDRAWAL) {+ if (TransactionType::WITHDRAWAL === $type) {$total['amount'] = bcmul($total['amount'], '-1');}$array[] = app('amount')->formatAnything($total['currency'], $total['amount']);diff --git a/app/Support/Twig/General.php b/app/Support/Twig/General.phpindex 9b8d524a0b..98c37aa162 100644--- a/app/Support/Twig/General.php+++ b/app/Support/Twig/General.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support\Twig;@@ -33,15 +32,10 @@ use Twig_SimpleFilter;use Twig_SimpleFunction;/**- *- * Class TwigSupport- *- * @package FireflyIII\Support+ * Class TwigSupport.*/class General extends Twig_Extension{--/*** @return array*/@@ -51,12 +45,11 @@ class General extends Twig_Extension$this->balance(),$this->formatFilesize(),$this->mimeIcon(),-];}/**- * {@inheritDoc}+ * {@inheritdoc}*/public function getFunctions(): array{@@ -70,12 +63,11 @@ class General extends Twig_Extension$this->steamPositive(),$this->activeRoutePartial(),$this->activeRoutePartialWhat(),-];}/**- * {@inheritDoc}+ * {@inheritdoc}*/public function getName(): string{@@ -96,7 +88,7 @@ class General extends Twig_Extension$args = func_get_args();$route = $args[0]; // name of the route.$name = Route::getCurrentRoute()->getName() ?? '';- if (!(strpos($name, $route) === false)) {+ if (!(false === strpos($name, $route))) {return 'active';}@@ -121,7 +113,7 @@ class General extends Twig_Extension$what = $args[2]; // name of the route.$activeWhat = $context['what'] ?? false;- if ($what === $activeWhat && !(strpos(Route::getCurrentRoute()->getName(), $route) === false)) {+ if ($what === $activeWhat && !(false === strpos(Route::getCurrentRoute()->getName(), $route))) {return 'active';}@@ -162,7 +154,7 @@ class General extends Twig_Extensionreturn new Twig_SimpleFilter('balance',function (?Account $account): string {- if (is_null($account)) {+ if (null === $account) {return 'NULL';}$date = session('end', Carbon::now()->endOfMonth());@@ -193,7 +185,6 @@ class General extends Twig_Extensionreturn new Twig_SimpleFilter('filesize',function (int $size): string {-// less than one GB, more than one MBif ($size < (1024 * 1024 * 2014) && $size >= (1024 * 1024)) {return round($size / (1024 * 1024), 2) . ' MB';@@ -209,7 +200,6 @@ class General extends Twig_Extension);}-/*** @return Twig_SimpleFunction*/diff --git a/app/Support/Twig/Journal.php b/app/Support/Twig/Journal.phpindex 808bf2199d..1f32719ab3 100644--- a/app/Support/Twig/Journal.php+++ b/app/Support/Twig/Journal.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support\Twig;@@ -34,14 +33,10 @@ use Twig_SimpleFilter;use Twig_SimpleFunction;/**- * Class Journal- *- * @package FireflyIII\Support\Twig+ * Class Journal.*/class Journal extends Twig_Extension{--/*** @return Twig_SimpleFunction*/@@ -62,7 +57,7 @@ class Journal extends Twig_Extension$array = [];/** @var Account $entry */foreach ($list as $entry) {- if ($entry->accountType->type === AccountType::CASH) {+ if (AccountType::CASH === $entry->accountType->type) {$array[] = '<span class="text-success">(cash)</span>';continue;}@@ -134,7 +129,7 @@ class Journal extends Twig_Extension$array = [];/** @var Account $entry */foreach ($list as $entry) {- if ($entry->accountType->type === AccountType::CASH) {+ if (AccountType::CASH === $entry->accountType->type) {$array[] = '<span class="text-success">(cash)</span>';continue;}@@ -165,7 +160,6 @@ class Journal extends Twig_Extensionreturn $cache->get(); // @codeCoverageIgnore}-$budgets = [];// get all budgets:foreach ($journal->budgets as $budget) {@@ -205,7 +199,7 @@ class Journal extends Twig_Extensionforeach ($journal->categories as $category) {$categories[] = sprintf('<a title="%1$s" href="%2$s">%1$s</a>', e($category->name), route('categories.show', $category->id));}- if (count($categories) === 0) {+ if (0 === count($categories)) {$set = Category::distinct()->leftJoin('category_transaction', 'categories.id', '=', 'category_transaction.category_id')->leftJoin('transactions', 'category_transaction.transaction_id', '=', 'transactions.id')->leftJoin('transaction_journals', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')diff --git a/app/Support/Twig/Loader/TransactionJournalLoader.php b/app/Support/Twig/Loader/TransactionJournalLoader.phpindex 6e92978c14..f0a3de2895 100644--- a/app/Support/Twig/Loader/TransactionJournalLoader.php+++ b/app/Support/Twig/Loader/TransactionJournalLoader.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support\Twig\Loader;@@ -27,13 +26,10 @@ use FireflyIII\Support\Twig\Extension\TransactionJournal;use Twig_RuntimeLoaderInterface;/**- * Class TransactionJournalLoader- *- * @package FireflyIII\Support\Twig\Extension+ * Class TransactionJournalLoader.*/class TransactionJournalLoader implements Twig_RuntimeLoaderInterface{-/*** Creates the runtime implementation of a Twig element (filter/function/test).*diff --git a/app/Support/Twig/Loader/TransactionLoader.php b/app/Support/Twig/Loader/TransactionLoader.phpindex 4c4b8e9892..a32ee03d43 100644--- a/app/Support/Twig/Loader/TransactionLoader.php+++ b/app/Support/Twig/Loader/TransactionLoader.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support\Twig\Loader;@@ -27,13 +26,10 @@ use FireflyIII\Support\Twig\Extension\Transaction;use Twig_RuntimeLoaderInterface;/**- * Class TransactionLoader- *- * @package FireflyIII\Support\Twig\Extension+ * Class TransactionLoader.*/class TransactionLoader implements Twig_RuntimeLoaderInterface{-/*** Creates the runtime implementation of a Twig element (filter/function/test).*diff --git a/app/Support/Twig/PiggyBank.php b/app/Support/Twig/PiggyBank.phpindex a56a67e2be..05d91a04be 100644--- a/app/Support/Twig/PiggyBank.php+++ b/app/Support/Twig/PiggyBank.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support\Twig;@@ -28,14 +27,10 @@ use Twig_Extension;use Twig_SimpleFunction;/**- *- * Class PiggyBank- *- * @package FireflyIII\Support\Twig+ * Class PiggyBank.*/class PiggyBank extends Twig_Extension{-/****/diff --git a/app/Support/Twig/Rule.php b/app/Support/Twig/Rule.phpindex 8b89b48226..9a9350de10 100644--- a/app/Support/Twig/Rule.php+++ b/app/Support/Twig/Rule.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support\Twig;@@ -28,13 +27,10 @@ use Twig_Extension;use Twig_SimpleFunction;/**- * Class Rule- *- * @package FireflyIII\Support\Twig+ * Class Rule.*/class Rule extends Twig_Extension{-/*** @return Twig_SimpleFunction*/@@ -84,7 +80,7 @@ class Rule extends Twig_Extension$ruleTriggers = array_keys(Config::get('firefly.rule-triggers'));$possibleTriggers = [];foreach ($ruleTriggers as $key) {- if ($key !== 'user_action') {+ if ('user_action' !== $key) {$possibleTriggers[$key] = trans('firefly.rule_trigger_' . $key . '_choice');}}@@ -93,7 +89,6 @@ class Rule extends Twig_Extensionreturn $possibleTriggers;}-);}diff --git a/app/Support/Twig/Transaction.php b/app/Support/Twig/Transaction.phpindex fa1f8a76ba..c9095e78cd 100644--- a/app/Support/Twig/Transaction.php+++ b/app/Support/Twig/Transaction.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support\Twig;@@ -28,9 +27,7 @@ use Twig_Extension;use Twig_SimpleFilter;/**- * Class Transaction- *- * @package FireflyIII\Support\Twig+ * Class Transaction.*/class Transaction extends Twig_Extension{diff --git a/app/Support/Twig/Translation.php b/app/Support/Twig/Translation.phpindex 3939dd8f3d..fd4ffe1852 100644--- a/app/Support/Twig/Translation.php+++ b/app/Support/Twig/Translation.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Support\Twig;@@ -28,14 +27,10 @@ use Twig_SimpleFilter;use Twig_SimpleFunction;/**- *- * Class Budget- *- * @package FireflyIII\Support\Twig+ * Class Budget.*/class Translation extends Twig_Extension{-/*** @return array*/@@ -54,20 +49,18 @@ class Translation extends Twig_Extensionreturn $filters;}-/**- * {@inheritDoc}+ * {@inheritdoc}*/public function getFunctions(): array{return [$this->journalLinkTranslation(),-];}/**- * {@inheritDoc}+ * {@inheritdoc}*/public function getName(): string{diff --git a/app/TransactionRules/Actions/ActionInterface.php b/app/TransactionRules/Actions/ActionInterface.phpindex 4df180fd8e..82a84f0c41 100644--- a/app/TransactionRules/Actions/ActionInterface.php+++ b/app/TransactionRules/Actions/ActionInterface.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Actions;@@ -27,9 +26,7 @@ use FireflyIII\Models\RuleAction;use FireflyIII\Models\TransactionJournal;/**- * Interface ActionInterface- *- * @package FireflyIII\TransactionRules\Action+ * Interface ActionInterface.*/interface ActionInterface{diff --git a/app/TransactionRules/Actions/AddTag.php b/app/TransactionRules/Actions/AddTag.phpindex a1f667a459..6b7109adf5 100644--- a/app/TransactionRules/Actions/AddTag.php+++ b/app/TransactionRules/Actions/AddTag.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Actions;@@ -29,13 +28,10 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class AddTag- *- * @package FireflyIII\TransactionRules\Actions+ * Class AddTag.*/class AddTag implements ActionInterface{-/** @var RuleAction */private $action;@@ -56,12 +52,11 @@ class AddTag implements ActionInterface*/public function act(TransactionJournal $journal): bool{-// journal has this tag maybe?$tag = Tag::firstOrCreateEncrypted(['tag' => $this->action->action_value, 'user_id' => $journal->user->id]);$count = $journal->tags()->where('tag_id', $tag->id)->count();- if ($count === 0) {+ if (0 === $count) {$journal->tags()->save($tag);Log::debug(sprintf('RuleAction AddTag. Added tag #%d ("%s") to journal %d.', $tag->id, $tag->tag, $journal->id));diff --git a/app/TransactionRules/Actions/AppendDescription.php b/app/TransactionRules/Actions/AppendDescription.phpindex 12e9d5339f..58b7298f41 100644--- a/app/TransactionRules/Actions/AppendDescription.php+++ b/app/TransactionRules/Actions/AppendDescription.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Actions;@@ -28,15 +27,12 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class AppendDescription- *- * @package FireflyIII\TransactionRules\Actions+ * Class AppendDescription.*/class AppendDescription implements ActionInterface{private $action;-/*** TriggerInterface constructor.*diff --git a/app/TransactionRules/Actions/AppendNotes.php b/app/TransactionRules/Actions/AppendNotes.phpindex ef57c62fbf..4af78bbe30 100644--- a/app/TransactionRules/Actions/AppendNotes.php+++ b/app/TransactionRules/Actions/AppendNotes.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Actions;@@ -29,15 +28,12 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class AppendNotes- *- * @package FireflyIII\TransactionRules\Actions+ * Class AppendNotes.*/class AppendNotes implements ActionInterface{private $action;-/*** TriggerInterface constructor.*@@ -56,7 +52,7 @@ class AppendNotes implements ActionInterfacepublic function act(TransactionJournal $journal): bool{$dbNote = $journal->notes()->first();- if (is_null($dbNote)) {+ if (null === $dbNote) {$dbNote = new Note;$dbNote->noteable()->associate($journal);}diff --git a/app/TransactionRules/Actions/ClearBudget.php b/app/TransactionRules/Actions/ClearBudget.phpindex b666bc9cd1..bf78f5070c 100644--- a/app/TransactionRules/Actions/ClearBudget.php+++ b/app/TransactionRules/Actions/ClearBudget.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Actions;@@ -28,15 +27,12 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class ClearBudget- *- * @package FireflyIII\TransactionRules\Action+ * Class ClearBudget.*/class ClearBudget implements ActionInterface{private $action;-/*** TriggerInterface constructor.*diff --git a/app/TransactionRules/Actions/ClearCategory.php b/app/TransactionRules/Actions/ClearCategory.phpindex fee2a49a1a..c4f5f8dc81 100644--- a/app/TransactionRules/Actions/ClearCategory.php+++ b/app/TransactionRules/Actions/ClearCategory.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Actions;@@ -28,15 +27,12 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class ClearCategory- *- * @package FireflyIII\TransactionRules\Action+ * Class ClearCategory.*/class ClearCategory implements ActionInterface{private $action;-/*** TriggerInterface constructor.*diff --git a/app/TransactionRules/Actions/ClearNotes.php b/app/TransactionRules/Actions/ClearNotes.phpindex f02b3662bc..dd84d16519 100644--- a/app/TransactionRules/Actions/ClearNotes.php+++ b/app/TransactionRules/Actions/ClearNotes.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Actions;@@ -29,15 +28,12 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class ClearNotes- *- * @package FireflyIII\TransactionRules\Actions+ * Class ClearNotes.*/class ClearNotes implements ActionInterface{private $action;-/*** TriggerInterface constructor.*diff --git a/app/TransactionRules/Actions/PrependDescription.php b/app/TransactionRules/Actions/PrependDescription.phpindex 0a1b1c3e49..fa60c30c3f 100644--- a/app/TransactionRules/Actions/PrependDescription.php+++ b/app/TransactionRules/Actions/PrependDescription.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Actions;@@ -28,15 +27,12 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class AppendDescription- *- * @package FireflyIII\TransactionRules\Actions+ * Class AppendDescription.*/class PrependDescription implements ActionInterface{private $action;-/*** TriggerInterface constructor.*@@ -58,7 +54,6 @@ class PrependDescription implements ActionInterface$journal->description = $this->action->action_value . $journal->description;$journal->save();-return true;}}diff --git a/app/TransactionRules/Actions/PrependNotes.php b/app/TransactionRules/Actions/PrependNotes.phpindex 2273b59076..21b20592c8 100644--- a/app/TransactionRules/Actions/PrependNotes.php+++ b/app/TransactionRules/Actions/PrependNotes.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Actions;@@ -29,15 +28,12 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class PrependNotes- *- * @package FireflyIII\TransactionRules\Actions+ * Class PrependNotes.*/class PrependNotes implements ActionInterface{private $action;-/*** TriggerInterface constructor.*@@ -56,7 +52,7 @@ class PrependNotes implements ActionInterfacepublic function act(TransactionJournal $journal): bool{$dbNote = $journal->notes()->first();- if (is_null($dbNote)) {+ if (null === $dbNote) {$dbNote = new Note;$dbNote->noteable()->associate($journal);}diff --git a/app/TransactionRules/Actions/RemoveAllTags.php b/app/TransactionRules/Actions/RemoveAllTags.phpindex caebb9e389..d6efb992e0 100644--- a/app/TransactionRules/Actions/RemoveAllTags.php+++ b/app/TransactionRules/Actions/RemoveAllTags.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Actions;@@ -28,15 +27,12 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class RemoveAllTags- *- * @package FireflyIII\TransactionRules\Actions+ * Class RemoveAllTags.*/class RemoveAllTags implements ActionInterface{private $action;-/*** TriggerInterface constructor.*diff --git a/app/TransactionRules/Actions/RemoveTag.php b/app/TransactionRules/Actions/RemoveTag.phpindex c6b178f255..1ddd98d7a0 100644--- a/app/TransactionRules/Actions/RemoveTag.php+++ b/app/TransactionRules/Actions/RemoveTag.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Actions;@@ -29,15 +28,12 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class RemoveTag- *- * @package FireflyIII\TransactionRules\Actions+ * Class RemoveTag.*/class RemoveTag implements ActionInterface{private $action;-/*** TriggerInterface constructor.*@@ -64,7 +60,7 @@ class RemoveTag implements ActionInterface})->first();- if (!is_null($tag)) {+ if (null !== $tag) {Log::debug(sprintf('RuleAction RemoveTag removed tag #%d ("%s") from journal #%d.', $tag->id, $tag->tag, $journal->id));$journal->tags()->detach([$tag->id]);diff --git a/app/TransactionRules/Actions/SetBudget.php b/app/TransactionRules/Actions/SetBudget.phpindex 932cca045c..c9efbb6422 100644--- a/app/TransactionRules/Actions/SetBudget.php+++ b/app/TransactionRules/Actions/SetBudget.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Actions;@@ -31,15 +30,12 @@ use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;use Log;/**- * Class SetBudget- *- * @package FireflyIII\TransactionRules\Action+ * Class SetBudget.*/class SetBudget implements ActionInterface{private $action;-/*** TriggerInterface constructor.*@@ -67,13 +63,13 @@ class SetBudget implements ActionInterfacereturn $current->name === $search;})->first();- if (is_null($budget)) {+ if (null === $budget) {Log::debug(sprintf('RuleAction SetBudget could not set budget of journal #%d to "%s" because no such budget exists.', $journal->id, $search));return true;}- if ($journal->transactionType->type !== TransactionType::WITHDRAWAL) {+ if (TransactionType::WITHDRAWAL !== $journal->transactionType->type) {Log::debug(sprintf('RuleAction SetBudget could not set budget of journal #%d to "%s" because journal is a %s.',@@ -90,7 +86,6 @@ class SetBudget implements ActionInterface$journal->budgets()->sync([$budget->id]);-return true;}}diff --git a/app/TransactionRules/Actions/SetCategory.php b/app/TransactionRules/Actions/SetCategory.phpindex ca540ccdc5..daa3b611dd 100644--- a/app/TransactionRules/Actions/SetCategory.php+++ b/app/TransactionRules/Actions/SetCategory.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Actions;@@ -29,15 +28,12 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class SetCategory- *- * @package FireflyIII\TransactionRules\Action+ * Class SetCategory.*/class SetCategory implements ActionInterface{private $action;-/*** TriggerInterface constructor.*diff --git a/app/TransactionRules/Actions/SetDescription.php b/app/TransactionRules/Actions/SetDescription.phpindex f0a29cc896..4face0a53c 100644--- a/app/TransactionRules/Actions/SetDescription.php+++ b/app/TransactionRules/Actions/SetDescription.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Actions;@@ -28,15 +27,12 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class SetDescription- *- * @package FireflyIII\TransactionRules\Actions+ * Class SetDescription.*/class SetDescription implements ActionInterface{private $action;-/*** TriggerInterface constructor.*diff --git a/app/TransactionRules/Actions/SetDestinationAccount.php b/app/TransactionRules/Actions/SetDestinationAccount.phpindex 58b7eb7f8b..75ab0bc67c 100644--- a/app/TransactionRules/Actions/SetDestinationAccount.php+++ b/app/TransactionRules/Actions/SetDestinationAccount.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Actions;@@ -32,24 +31,21 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface;use Log;/**- * Class SetDestinationAccount- *- * @package FireflyIII\TransactionRules\Action+ * Class SetDestinationAccount.*/class SetDestinationAccount implements ActionInterface{private $action;- /** @var TransactionJournal */+ /** @var TransactionJournal */private $journal;- /** @var Account */+ /** @var Account */private $newDestinationAccount;/** @var AccountRepositoryInterface */private $repository;-/*** TriggerInterface constructor.*@@ -81,7 +77,7 @@ class SetDestinationAccount implements ActionInterface$type = $journal->transactionType->type;// if this is a deposit or a transfer, the destination account must be an asset account or a default account, and it MUST exist:- if (($type === TransactionType::DEPOSIT || $type === TransactionType::TRANSFER) && !$this->findAssetAccount()) {+ if ((TransactionType::DEPOSIT === $type || TransactionType::TRANSFER === $type) && !$this->findAssetAccount()) {Log::error(sprintf('Cannot change destination account of journal #%d because no asset account with name "%s" exists.',@@ -94,7 +90,7 @@ class SetDestinationAccount implements ActionInterface}// if this is a withdrawal, the new destination account must be a expense account and may be created:- if ($type === TransactionType::WITHDRAWAL) {+ if (TransactionType::WITHDRAWAL === $type) {$this->findExpenseAccount();}@@ -117,7 +113,7 @@ class SetDestinationAccount implements ActionInterface{$account = $this->repository->findByName($this->action->action_value, [AccountType::DEFAULT, AccountType::ASSET]);- if (is_null($account->id)) {+ if (null === $account->id) {Log::debug(sprintf('There is NO asset account called "%s".', $this->action->action_value));return false;@@ -134,7 +130,7 @@ class SetDestinationAccount implements ActionInterfaceprivate function findExpenseAccount(){$account = $this->repository->findByName($this->action->action_value, [AccountType::EXPENSE]);- if (is_null($account->id)) {+ if (null === $account->id) {// create new revenue account with this name:$data = ['name' => $this->action->action_value,diff --git a/app/TransactionRules/Actions/SetNotes.php b/app/TransactionRules/Actions/SetNotes.phpindex 6bed507707..3b548a9f08 100644--- a/app/TransactionRules/Actions/SetNotes.php+++ b/app/TransactionRules/Actions/SetNotes.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Actions;@@ -29,15 +28,12 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class SetNotes- *- * @package FireflyIII\TransactionRules\Actions+ * Class SetNotes.*/class SetNotes implements ActionInterface{private $action;-/*** TriggerInterface constructor.*@@ -56,7 +52,7 @@ class SetNotes implements ActionInterfacepublic function act(TransactionJournal $journal): bool{$dbNote = $journal->notes()->first();- if (is_null($dbNote)) {+ if (null === $dbNote) {$dbNote = new Note;$dbNote->noteable()->associate($journal);}diff --git a/app/TransactionRules/Actions/SetSourceAccount.php b/app/TransactionRules/Actions/SetSourceAccount.phpindex f45461f698..733c4ba546 100644--- a/app/TransactionRules/Actions/SetSourceAccount.php+++ b/app/TransactionRules/Actions/SetSourceAccount.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Actions;@@ -32,24 +31,21 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface;use Log;/**- * Class SetSourceAccount- *- * @package FireflyIII\TransactionRules\Action+ * Class SetSourceAccount.*/class SetSourceAccount implements ActionInterface{private $action;- /** @var TransactionJournal */+ /** @var TransactionJournal */private $journal;- /** @var Account */+ /** @var Account */private $newSourceAccount;/** @var AccountRepositoryInterface */private $repository;-/*** TriggerInterface constructor.*@@ -80,7 +76,7 @@ class SetSourceAccount implements ActionInterface// journal type:$type = $journal->transactionType->type;// if this is a transfer or a withdrawal, the new source account must be an asset account or a default account, and it MUST exist:- if (($type === TransactionType::WITHDRAWAL || $type === TransactionType::TRANSFER) && !$this->findAssetAccount()) {+ if ((TransactionType::WITHDRAWAL === $type || TransactionType::TRANSFER === $type) && !$this->findAssetAccount()) {Log::error(sprintf('Cannot change source account of journal #%d because no asset account with name "%s" exists.',@@ -93,7 +89,7 @@ class SetSourceAccount implements ActionInterface}// if this is a deposit, the new source account must be a revenue account and may be created:- if ($type === TransactionType::DEPOSIT) {+ if (TransactionType::DEPOSIT === $type) {$this->findRevenueAccount();}@@ -116,7 +112,7 @@ class SetSourceAccount implements ActionInterface{$account = $this->repository->findByName($this->action->action_value, [AccountType::DEFAULT, AccountType::ASSET]);- if (is_null($account->id)) {+ if (null === $account->id) {Log::debug(sprintf('There is NO asset account called "%s".', $this->action->action_value));return false;@@ -133,7 +129,7 @@ class SetSourceAccount implements ActionInterfaceprivate function findRevenueAccount(){$account = $this->repository->findByName($this->action->action_value, [AccountType::REVENUE]);- if (is_null($account->id)) {+ if (null === $account->id) {// create new revenue account with this name:$data = ['name' => $this->action->action_value,diff --git a/app/TransactionRules/Factory/ActionFactory.php b/app/TransactionRules/Factory/ActionFactory.phpindex 9d0fe14e52..f45cae70ed 100644--- a/app/TransactionRules/Factory/ActionFactory.php+++ b/app/TransactionRules/Factory/ActionFactory.php@@ -1,7 +1,7 @@<?php/*** ActionFactory.php- * Copyright (C) 2016 Robert Horlings+ * Copyright (C) 2016 Robert Horlings.** This file is part of Firefly III.*@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Factory;@@ -32,8 +31,6 @@ use Log;/*** @codeCoverageIgnore* Class ActionFactory- *- * @package FireflyIII\TransactionRules\Factory*/class ActionFactory{@@ -65,6 +62,7 @@ class ActionFactory* @param string $actionType** @return string+ ** @throws FireflyException*/public static function getActionClass(string $actionType): string@@ -84,13 +82,13 @@ class ActionFactory}/**- * Returns a map with actiontypes, mapped to the class representing that type+ * Returns a map with actiontypes, mapped to the class representing that type.** @return array*/protected static function getActionTypes(): array{- if (count(self::$actionTypes) === 0) {+ if (0 === count(self::$actionTypes)) {self::$actionTypes = Domain::getRuleActions();}diff --git a/app/TransactionRules/Factory/TriggerFactory.php b/app/TransactionRules/Factory/TriggerFactory.phpindex 3f7bf3fc28..83fc417097 100644--- a/app/TransactionRules/Factory/TriggerFactory.php+++ b/app/TransactionRules/Factory/TriggerFactory.php@@ -1,7 +1,7 @@<?php/*** TriggerFactory.php- * Copyright (C) 2016 Robert Horlings+ * Copyright (C) 2016 Robert Horlings.** This file is part of Firefly III.*@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Factory;@@ -33,8 +32,6 @@ use Log;/*** @codeCoverageIgnore* Interface TriggerInterface- *- * @package FireflyIII\TransactionRules\Triggers*/class TriggerFactory{@@ -78,7 +75,9 @@ class TriggerFactory* @param bool $stopProcessing** @see TriggerFactory::getTrigger+ ** @return AbstractTrigger+ ** @throws FireflyException*/public static function makeTriggerFromStrings(string $triggerType, string $triggerValue, bool $stopProcessing)@@ -98,7 +97,7 @@ class TriggerFactory*/protected static function getTriggerTypes(): array{- if (count(self::$triggerTypes) === 0) {+ if (0 === count(self::$triggerTypes)) {self::$triggerTypes = Domain::getRuleTriggers();}@@ -113,6 +112,7 @@ class TriggerFactory* @param string $triggerType** @return TriggerInterface|string+ ** @throws FireflyException*/private static function getTriggerClass(string $triggerType): stringdiff --git a/app/TransactionRules/Processor.php b/app/TransactionRules/Processor.phpindex e0156162cc..a880c88910 100644--- a/app/TransactionRules/Processor.php+++ b/app/TransactionRules/Processor.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules;@@ -36,26 +35,23 @@ use Illuminate\Support\Collection;use Log;/**- * Class Processor- *- * @package FireflyIII\TransactionRules+ * Class Processor.*/final class Processor{- /** @var Collection */+ /** @var Collection */public $actions;- /** @var TransactionJournal */+ /** @var TransactionJournal */public $journal;- /** @var Rule */+ /** @var Rule */public $rule;/** @var Collection */public $triggers;/** @var int */- protected $foundTriggers = 0;+ private $foundTriggers = 0;/*** Processor constructor.- **/private function __construct(){@@ -68,7 +64,6 @@ final class Processor* and actions found in the given Rule.** @param Rule $rule- ** @param bool $includeActions** @return Processor@@ -128,7 +123,7 @@ final class Processor{$self = new self;foreach ($triggers as $entry) {- $entry['value'] = is_null($entry['value']) ? '' : $entry['value'];+ $entry['value'] = null === $entry['value'] ? '' : $entry['value'];$trigger = TriggerFactory::makeTriggerFromStrings($entry['type'], $entry['value'], $entry['stopProcessing']);$self->triggers->push($trigger);}@@ -153,7 +148,6 @@ final class Processor}/**- ** @return \FireflyIII\Models\Rule*/public function getRule(): Rule@@ -185,7 +179,7 @@ final class ProcessorLog::debug('Has more than zero actions.');$this->actions();}- if ($this->actions->count() === 0) {+ if (0 === $this->actions->count()) {Log::info('Rule has no actions!');}@@ -227,7 +221,7 @@ final class Processorprivate function actions(){/**- * @var int $index+ * @var int* @var RuleAction $action*/foreach ($this->actions as $action) {@@ -246,7 +240,7 @@ final class Processor/*** Method to check whether the current transaction would be triggered- * by the given list of triggers+ * by the given list of triggers.** @return bool*/@@ -258,12 +252,12 @@ final class ProcessorLog::debug(sprintf('Found triggers starts at %d', $foundTriggers));/** @var AbstractTrigger $trigger */foreach ($this->triggers as $trigger) {- $foundTriggers++;+ ++$foundTriggers;Log::debug(sprintf('Now checking trigger %s with value %s', get_class($trigger), $trigger->getTriggerValue()));/** @var AbstractTrigger $trigger */if ($trigger->triggered($this->journal)) {Log::debug('Is a match!');- $hitTriggers++;+ ++$hitTriggers;}if ($trigger->stopProcessing) {Log::debug('Stop processing this trigger and break.');diff --git a/app/TransactionRules/TransactionMatcher.php b/app/TransactionRules/TransactionMatcher.phpindex 510d4cca84..73639adf5b 100644--- a/app/TransactionRules/TransactionMatcher.php+++ b/app/TransactionRules/TransactionMatcher.php@@ -1,7 +1,7 @@<?php/*** TransactionMatcher.php- * Copyright (C) 2016 Robert Horlings+ * Copyright (C) 2016 Robert Horlings.** This file is part of Firefly III.*@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules;@@ -33,9 +32,7 @@ use Log;/*** Class TransactionMatcher is used to find a list of- * transaction matching a set of triggers- *- * @package FireflyIII\TransactionRules+ * transaction matching a set of triggers.*/class TransactionMatcher{@@ -43,9 +40,9 @@ class TransactionMatcherprivate $limit = 10;/** @var int Maximum number of transaction to search in (for performance reasons) * */private $range = 200;- /** @var Rule */+ /** @var Rule */private $rule;- /** @var JournalTaskerInterface */+ /** @var JournalTaskerInterface */private $tasker;/** @var array */private $transactionTypes = [TransactionType::DEPOSIT, TransactionType::WITHDRAWAL, TransactionType::TRANSFER];@@ -68,11 +65,10 @@ class TransactionMatcher* triggers onto each transaction journal until enough matches are found ($limit).** @return Collection- **/public function findTransactionsByRule(){- if (count($this->rule->ruleTriggers) === 0) {+ if (0 === count($this->rule->ruleTriggers)) {return new Collection;}@@ -93,11 +89,10 @@ class TransactionMatcher* triggers onto each transaction journal until enough matches are found ($limit).** @return Collection- **/public function findTransactionsByTriggers(): Collection{- if (count($this->triggers) === 0) {+ if (0 === count($this->triggers)) {return new Collection;}@@ -125,7 +120,7 @@ class TransactionMatcher** @return TransactionMatcher*/- public function setLimit(int $limit): TransactionMatcher+ public function setLimit(int $limit): self{$this->limit = $limit;@@ -145,7 +140,7 @@ class TransactionMatcher** @return TransactionMatcher*/- public function setRange(int $range): TransactionMatcher+ public function setRange(int $range): self{$this->range = $range;@@ -165,7 +160,7 @@ class TransactionMatcher** @return TransactionMatcher*/- public function setTriggers(array $triggers): TransactionMatcher+ public function setTriggers(array $triggers): self{$this->triggers = $triggers;@@ -221,7 +216,7 @@ class TransactionMatcherLog::debug(sprintf('Total count is now %d', $result->count()));// Update counters- $page++;+ ++$page;$processed += count($set);Log::debug(sprintf('Page is now %d, processed is %d', $page, $processed));diff --git a/app/TransactionRules/Triggers/AbstractTrigger.php b/app/TransactionRules/Triggers/AbstractTrigger.phpindex e1fd0dc6cb..d6e9b73b30 100644--- a/app/TransactionRules/Triggers/AbstractTrigger.php+++ b/app/TransactionRules/Triggers/AbstractTrigger.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Triggers;@@ -30,20 +29,18 @@ use FireflyIII\Models\TransactionJournal;* This class will be magical!** Class AbstractTrigger- *- * @package FireflyIII\TransactionRules\Triggers*/class AbstractTrigger{- /** @var bool */+ /** @var bool */public $stopProcessing;- /** @var string */+ /** @var string */protected $checkValue;- /** @var TransactionJournal */+ /** @var TransactionJournal */protected $journal;/** @var RuleTrigger */protected $trigger;- /** @var string */+ /** @var string */protected $triggerValue;/**@@ -106,6 +103,7 @@ class AbstractTrigger/*** @codeCoverageIgnore+ ** @return RuleTrigger*/public function getTrigger(): RuleTrigger@@ -115,6 +113,7 @@ class AbstractTrigger/*** @codeCoverageIgnore+ ** @return string*/public function getTriggerValue(): stringdiff --git a/app/TransactionRules/Triggers/AmountExactly.php b/app/TransactionRules/Triggers/AmountExactly.phpindex c6e6262e6e..fdc6c68391 100644--- a/app/TransactionRules/Triggers/AmountExactly.php+++ b/app/TransactionRules/Triggers/AmountExactly.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Triggers;@@ -27,13 +26,10 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class AmountExactly- *- * @package FireflyIII\TransactionRules\Triggers+ * Class AmountExactly.*/final class AmountExactly extends AbstractTrigger implements TriggerInterface{-/*** A trigger is said to "match anything", or match any given transaction,* when the trigger value is very vague or has no restrictions. Easy examples@@ -52,7 +48,7 @@ final class AmountExactly extends AbstractTrigger implements TriggerInterface*/public static function willMatchEverything($value = null){- if (!is_null($value)) {+ if (null !== $value) {return false;}Log::error(sprintf('Cannot use %s with a null value.', self::class));@@ -70,7 +66,7 @@ final class AmountExactly extends AbstractTrigger implements TriggerInterface$amount = $journal->destination_amount ?? $journal->amountPositive();$compare = $this->triggerValue;$result = bccomp($amount, $compare);- if ($result === 0) {+ if (0 === $result) {Log::debug(sprintf('RuleTrigger AmountExactly for journal #%d: %d matches %d exactly, so return true', $journal->id, $amount, $compare));return true;diff --git a/app/TransactionRules/Triggers/AmountLess.php b/app/TransactionRules/Triggers/AmountLess.phpindex c635859f09..40a3626297 100644--- a/app/TransactionRules/Triggers/AmountLess.php+++ b/app/TransactionRules/Triggers/AmountLess.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Triggers;@@ -27,13 +26,10 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class AmountLess- *- * @package FireflyIII\TransactionRules\Triggers+ * Class AmountLess.*/final class AmountLess extends AbstractTrigger implements TriggerInterface{-/*** A trigger is said to "match anything", or match any given transaction,* when the trigger value is very vague or has no restrictions. Easy examples@@ -52,7 +48,7 @@ final class AmountLess extends AbstractTrigger implements TriggerInterface*/public static function willMatchEverything($value = null){- if (!is_null($value)) {+ if (null !== $value) {return false;}Log::error(sprintf('Cannot use %s with a null value.', self::class));diff --git a/app/TransactionRules/Triggers/AmountMore.php b/app/TransactionRules/Triggers/AmountMore.phpindex 619bd9e5c5..aa3c1591ea 100644--- a/app/TransactionRules/Triggers/AmountMore.php+++ b/app/TransactionRules/Triggers/AmountMore.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Triggers;@@ -27,13 +26,10 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class AmountMore- *- * @package FireflyIII\TransactionRules\Triggers+ * Class AmountMore.*/final class AmountMore extends AbstractTrigger implements TriggerInterface{-/*** A trigger is said to "match anything", or match any given transaction,* when the trigger value is very vague or has no restrictions. Easy examples@@ -52,9 +48,9 @@ final class AmountMore extends AbstractTrigger implements TriggerInterface*/public static function willMatchEverything($value = null){- if (!is_null($value)) {- $res = bccomp('0', strval($value)) === 0;- if ($res === true) {+ if (null !== $value) {+ $res = 0 === bccomp('0', strval($value));+ if (true === $res) {Log::error(sprintf('Cannot use %s with a value equal to 0.', self::class));}@@ -76,7 +72,7 @@ final class AmountMore extends AbstractTrigger implements TriggerInterface$amount = $journal->destination_amount ?? $journal->amountPositive();$compare = $this->triggerValue;$result = bccomp($amount, $compare);- if ($result === 1) {+ if (1 === $result) {Log::debug(sprintf('RuleTrigger AmountMore for journal #%d: %d is more than %d, so return true', $journal->id, $amount, $compare));return true;diff --git a/app/TransactionRules/Triggers/BudgetIs.php b/app/TransactionRules/Triggers/BudgetIs.phpindex cc234e6636..b465c76e4c 100644--- a/app/TransactionRules/Triggers/BudgetIs.php+++ b/app/TransactionRules/Triggers/BudgetIs.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Triggers;@@ -28,13 +27,10 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class BudgetIs- *- * @package FireflyIII\TransactionRules\Triggers+ * Class BudgetIs.*/final class BudgetIs extends AbstractTrigger implements TriggerInterface{-/*** A trigger is said to "match anything", or match any given transaction,* when the trigger value is very vague or has no restrictions. Easy examples@@ -53,7 +49,7 @@ final class BudgetIs extends AbstractTrigger implements TriggerInterface*/public static function willMatchEverything($value = null){- if (!is_null($value)) {+ if (null !== $value) {return false;}Log::error(sprintf('Cannot use %s with a null value.', self::class));@@ -69,7 +65,7 @@ final class BudgetIs extends AbstractTrigger implements TriggerInterfacepublic function triggered(TransactionJournal $journal): bool{$budget = $journal->budgets()->first();- if (!is_null($budget)) {+ if (null !== $budget) {$name = strtolower($budget->name);// match on journal:if ($name === strtolower($this->triggerValue)) {@@ -79,12 +75,12 @@ final class BudgetIs extends AbstractTrigger implements TriggerInterface}}- if (is_null($budget)) {+ if (null === $budget) {// perhaps transactions have this budget?/** @var Transaction $transaction */foreach ($journal->transactions as $transaction) {$budget = $transaction->budgets()->first();- if (!is_null($budget)) {+ if (null !== $budget) {$name = strtolower($budget->name);if ($name === strtolower($this->triggerValue)) {Log::debug(diff --git a/app/TransactionRules/Triggers/CategoryIs.php b/app/TransactionRules/Triggers/CategoryIs.phpindex 6b406031d6..969ba4d062 100644--- a/app/TransactionRules/Triggers/CategoryIs.php+++ b/app/TransactionRules/Triggers/CategoryIs.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Triggers;@@ -28,13 +27,10 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class CategoryIs- *- * @package FireflyIII\TransactionRules\Triggers+ * Class CategoryIs.*/final class CategoryIs extends AbstractTrigger implements TriggerInterface{-/*** A trigger is said to "match anything", or match any given transaction,* when the trigger value is very vague or has no restrictions. Easy examples@@ -53,7 +49,7 @@ final class CategoryIs extends AbstractTrigger implements TriggerInterface*/public static function willMatchEverything($value = null){- if (!is_null($value)) {+ if (null !== $value) {return false;}Log::error(sprintf('Cannot use %s with a null value.', self::class));@@ -69,7 +65,7 @@ final class CategoryIs extends AbstractTrigger implements TriggerInterfacepublic function triggered(TransactionJournal $journal): bool{$category = $journal->categories()->first();- if (!is_null($category)) {+ if (null !== $category) {$name = strtolower($category->name);// match on journal:if ($name === strtolower($this->triggerValue)) {@@ -79,12 +75,12 @@ final class CategoryIs extends AbstractTrigger implements TriggerInterface}}- if (is_null($category)) {+ if (null === $category) {// perhaps transactions have this category?/** @var Transaction $transaction */foreach ($journal->transactions as $transaction) {$category = $transaction->categories()->first();- if (!is_null($category)) {+ if (null !== $category) {$name = strtolower($category->name);if ($name === strtolower($this->triggerValue)) {Log::debug(diff --git a/app/TransactionRules/Triggers/DescriptionContains.php b/app/TransactionRules/Triggers/DescriptionContains.phpindex a81f10f2a2..f583f99bde 100644--- a/app/TransactionRules/Triggers/DescriptionContains.php+++ b/app/TransactionRules/Triggers/DescriptionContains.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Triggers;@@ -27,13 +26,10 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class DescriptionContains- *- * @package FireflyIII\TransactionRules\Triggers+ * Class DescriptionContains.*/final class DescriptionContains extends AbstractTrigger implements TriggerInterface{-/*** A trigger is said to "match anything", or match any given transaction,* when the trigger value is very vague or has no restrictions. Easy examples@@ -52,9 +48,9 @@ final class DescriptionContains extends AbstractTrigger implements TriggerInterf*/public static function willMatchEverything($value = null){- if (!is_null($value)) {- $res = strval($value) === '';- if ($res === true) {+ if (null !== $value) {+ $res = '' === strval($value);+ if (true === $res) {Log::error(sprintf('Cannot use %s with "" as a value.', self::class));}@@ -76,7 +72,7 @@ final class DescriptionContains extends AbstractTrigger implements TriggerInterf$search = strtolower($this->triggerValue);$source = strtolower($journal->description ?? '');$strpos = stripos($source, $search);- if (!($strpos === false)) {+ if (!(false === $strpos)) {Log::debug(sprintf('RuleTrigger DescriptionContains for journal #%d: "%s" contains "%s", return true.', $journal->id, $source, $search));return true;diff --git a/app/TransactionRules/Triggers/DescriptionEnds.php b/app/TransactionRules/Triggers/DescriptionEnds.phpindex 1877eb8099..f6a6c5f48c 100644--- a/app/TransactionRules/Triggers/DescriptionEnds.php+++ b/app/TransactionRules/Triggers/DescriptionEnds.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Triggers;@@ -27,13 +26,10 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class DescriptionEnds- *- * @package FireflyIII\TransactionRules\Triggers+ * Class DescriptionEnds.*/final class DescriptionEnds extends AbstractTrigger implements TriggerInterface{-/*** A trigger is said to "match anything", or match any given transaction,* when the trigger value is very vague or has no restrictions. Easy examples@@ -52,9 +48,9 @@ final class DescriptionEnds extends AbstractTrigger implements TriggerInterface*/public static function willMatchEverything($value = null){- if (!is_null($value)) {- $res = strval($value) === '';- if ($res === true) {+ if (null !== $value) {+ $res = '' === strval($value);+ if (true === $res) {Log::error(sprintf('Cannot use %s with "" as a value.', self::class));}diff --git a/app/TransactionRules/Triggers/DescriptionIs.php b/app/TransactionRules/Triggers/DescriptionIs.phpindex bcfeb803d6..77e310a30e 100644--- a/app/TransactionRules/Triggers/DescriptionIs.php+++ b/app/TransactionRules/Triggers/DescriptionIs.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Triggers;@@ -27,13 +26,10 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class DescriptionIs- *- * @package FireflyIII\TransactionRules\Triggers+ * Class DescriptionIs.*/final class DescriptionIs extends AbstractTrigger implements TriggerInterface{-/*** A trigger is said to "match anything", or match any given transaction,* when the trigger value is very vague or has no restrictions. Easy examples@@ -52,7 +48,7 @@ final class DescriptionIs extends AbstractTrigger implements TriggerInterface*/public static function willMatchEverything($value = null){- if (!is_null($value)) {+ if (null !== $value) {return false;}diff --git a/app/TransactionRules/Triggers/DescriptionStarts.php b/app/TransactionRules/Triggers/DescriptionStarts.phpindex 9d48ffcc2f..c3e123b88b 100644--- a/app/TransactionRules/Triggers/DescriptionStarts.php+++ b/app/TransactionRules/Triggers/DescriptionStarts.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Triggers;@@ -27,13 +26,10 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class DescriptionStarts- *- * @package FireflyIII\TransactionRules\Triggers+ * Class DescriptionStarts.*/final class DescriptionStarts extends AbstractTrigger implements TriggerInterface{-/*** A trigger is said to "match anything", or match any given transaction,* when the trigger value is very vague or has no restrictions. Easy examples@@ -52,9 +48,9 @@ final class DescriptionStarts extends AbstractTrigger implements TriggerInterfac*/public static function willMatchEverything($value = null){- if (!is_null($value)) {- $res = strval($value) === '';- if ($res === true) {+ if (null !== $value) {+ $res = '' === strval($value);+ if (true === $res) {Log::error(sprintf('Cannot use %s with "" as a value.', self::class));}diff --git a/app/TransactionRules/Triggers/FromAccountContains.php b/app/TransactionRules/Triggers/FromAccountContains.phpindex ae26f69a31..38c1f5535c 100644--- a/app/TransactionRules/Triggers/FromAccountContains.php+++ b/app/TransactionRules/Triggers/FromAccountContains.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Triggers;@@ -28,13 +27,10 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class FromAccountContains- *- * @package FireflyIII\TransactionRules\Triggers+ * Class FromAccountContains.*/final class FromAccountContains extends AbstractTrigger implements TriggerInterface{-/*** A trigger is said to "match anything", or match any given transaction,* when the trigger value is very vague or has no restrictions. Easy examples@@ -53,9 +49,9 @@ final class FromAccountContains extends AbstractTrigger implements TriggerInterf*/public static function willMatchEverything($value = null){- if (!is_null($value)) {- $res = strval($value) === '';- if ($res === true) {+ if (null !== $value) {+ $res = '' === strval($value);+ if (true === $res) {Log::error(sprintf('Cannot use %s with "" as a value.', self::class));}@@ -83,7 +79,7 @@ final class FromAccountContains extends AbstractTrigger implements TriggerInterf$search = strtolower($this->triggerValue);$strpos = strpos($fromAccountName, $search);- if (!($strpos === false)) {+ if (!(false === $strpos)) {Log::debug(sprintf('RuleTrigger FromAccountContains for journal #%d: "%s" contains "%s", return true.', $journal->id, $fromAccountName, $search));return true;diff --git a/app/TransactionRules/Triggers/FromAccountEnds.php b/app/TransactionRules/Triggers/FromAccountEnds.phpindex 1a469a310e..4a01a543a1 100644--- a/app/TransactionRules/Triggers/FromAccountEnds.php+++ b/app/TransactionRules/Triggers/FromAccountEnds.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Triggers;@@ -28,13 +27,10 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class FromAccountEnds- *- * @package FireflyIII\TransactionRules\Triggers+ * Class FromAccountEnds.*/final class FromAccountEnds extends AbstractTrigger implements TriggerInterface{-/*** A trigger is said to "match anything", or match any given transaction,* when the trigger value is very vague or has no restrictions. Easy examples@@ -53,9 +49,9 @@ final class FromAccountEnds extends AbstractTrigger implements TriggerInterface*/public static function willMatchEverything($value = null){- if (!is_null($value)) {- $res = strval($value) === '';- if ($res === true) {+ if (null !== $value) {+ $res = '' === strval($value);+ if (true === $res) {Log::error(sprintf('Cannot use %s with "" as a value.', self::class));}@@ -92,7 +88,6 @@ final class FromAccountEnds extends AbstractTrigger implements TriggerInterfacereturn false;}-$part = substr($name, $searchLength * -1);if ($part === $search) {diff --git a/app/TransactionRules/Triggers/FromAccountIs.php b/app/TransactionRules/Triggers/FromAccountIs.phpindex 53787e0910..6764ad94b0 100644--- a/app/TransactionRules/Triggers/FromAccountIs.php+++ b/app/TransactionRules/Triggers/FromAccountIs.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Triggers;@@ -28,13 +27,10 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class FromAccountIs- *- * @package FireflyIII\TransactionRules\Triggers+ * Class FromAccountIs.*/final class FromAccountIs extends AbstractTrigger implements TriggerInterface{-/*** A trigger is said to "match anything", or match any given transaction,* when the trigger value is very vague or has no restrictions. Easy examples@@ -53,9 +49,9 @@ final class FromAccountIs extends AbstractTrigger implements TriggerInterface*/public static function willMatchEverything($value = null){- if (!is_null($value)) {- $res = strval($value) === '';- if ($res === true) {+ if (null !== $value) {+ $res = '' === strval($value);+ if (true === $res) {Log::error(sprintf('Cannot use %s with "" as a value.', self::class));}diff --git a/app/TransactionRules/Triggers/FromAccountStarts.php b/app/TransactionRules/Triggers/FromAccountStarts.phpindex 637c3d34d3..f75bc9717c 100644--- a/app/TransactionRules/Triggers/FromAccountStarts.php+++ b/app/TransactionRules/Triggers/FromAccountStarts.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Triggers;@@ -28,13 +27,10 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class FromAccountStarts- *- * @package FireflyIII\TransactionRules\Triggers+ * Class FromAccountStarts.*/final class FromAccountStarts extends AbstractTrigger implements TriggerInterface{-/*** A trigger is said to "match anything", or match any given transaction,* when the trigger value is very vague or has no restrictions. Easy examples@@ -53,9 +49,9 @@ final class FromAccountStarts extends AbstractTrigger implements TriggerInterfac*/public static function willMatchEverything($value = null){- if (!is_null($value)) {- $res = strval($value) === '';- if ($res === true) {+ if (null !== $value) {+ $res = '' === strval($value);+ if (true === $res) {Log::error(sprintf('Cannot use %s with "" as a value.', self::class));}diff --git a/app/TransactionRules/Triggers/HasAnyBudget.php b/app/TransactionRules/Triggers/HasAnyBudget.phpindex 3d1628e461..c039dc006a 100644--- a/app/TransactionRules/Triggers/HasAnyBudget.php+++ b/app/TransactionRules/Triggers/HasAnyBudget.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Triggers;@@ -28,13 +27,10 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class HasAnyBudget- *- * @package FireflyIII\TransactionRules\Triggers+ * Class HasAnyBudget.*/final class HasAnyBudget extends AbstractTrigger implements TriggerInterface{-/*** A trigger is said to "match anything", or match any given transaction,* when the trigger value is very vague or has no restrictions. Easy examplesdiff --git a/app/TransactionRules/Triggers/HasAnyCategory.php b/app/TransactionRules/Triggers/HasAnyCategory.phpindex aad3509b8a..50d72ce62e 100644--- a/app/TransactionRules/Triggers/HasAnyCategory.php+++ b/app/TransactionRules/Triggers/HasAnyCategory.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Triggers;@@ -28,13 +27,10 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class HasAnyCategory- *- * @package FireflyIII\TransactionRules\Triggers+ * Class HasAnyCategory.*/final class HasAnyCategory extends AbstractTrigger implements TriggerInterface{-/*** A trigger is said to "match anything", or match any given transaction,* when the trigger value is very vague or has no restrictions. Easy examplesdiff --git a/app/TransactionRules/Triggers/HasAnyTag.php b/app/TransactionRules/Triggers/HasAnyTag.phpindex 0d83e06adf..abac39866f 100644--- a/app/TransactionRules/Triggers/HasAnyTag.php+++ b/app/TransactionRules/Triggers/HasAnyTag.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Triggers;@@ -27,13 +26,10 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class HasAnyTag- *- * @package FireflyIII\TransactionRules\Triggers+ * Class HasAnyTag.*/final class HasAnyTag extends AbstractTrigger implements TriggerInterface{-/*** A trigger is said to "match anything", or match any given transaction,* when the trigger value is very vague or has no restrictions. Easy examplesdiff --git a/app/TransactionRules/Triggers/HasAttachment.php b/app/TransactionRules/Triggers/HasAttachment.phpindex 54528c65fb..2e7eaad91b 100644--- a/app/TransactionRules/Triggers/HasAttachment.php+++ b/app/TransactionRules/Triggers/HasAttachment.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Triggers;@@ -28,7 +27,6 @@ use Log;class HasAttachment extends AbstractTrigger implements TriggerInterface{-/*** A trigger is said to "match anything", or match any given transaction,* when the trigger value is very vague or has no restrictions. Easy examplesdiff --git a/app/TransactionRules/Triggers/HasNoBudget.php b/app/TransactionRules/Triggers/HasNoBudget.phpindex db3a6d66f9..6834fd24c8 100644--- a/app/TransactionRules/Triggers/HasNoBudget.php+++ b/app/TransactionRules/Triggers/HasNoBudget.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Triggers;@@ -28,13 +27,10 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class HasNoBudget- *- * @package FireflyIII\TransactionRules\Triggers+ * Class HasNoBudget.*/final class HasNoBudget extends AbstractTrigger implements TriggerInterface{-/*** A trigger is said to "match anything", or match any given transaction,* when the trigger value is very vague or has no restrictions. Easy examples@@ -70,7 +66,7 @@ final class HasNoBudget extends AbstractTrigger implements TriggerInterfaceforeach ($journal->transactions()->get() as $transaction) {$count += $transaction->budgets()->count();}- if ($count === 0) {+ if (0 === $count) {Log::debug(sprintf('RuleTrigger HasNoBudget for journal #%d: count is %d, return true.', $journal->id, $count));return true;diff --git a/app/TransactionRules/Triggers/HasNoCategory.php b/app/TransactionRules/Triggers/HasNoCategory.phpindex 76ac645a0b..b12072d005 100644--- a/app/TransactionRules/Triggers/HasNoCategory.php+++ b/app/TransactionRules/Triggers/HasNoCategory.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Triggers;@@ -28,13 +27,10 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class HasNoCategory- *- * @package FireflyIII\TransactionRules\Triggers+ * Class HasNoCategory.*/final class HasNoCategory extends AbstractTrigger implements TriggerInterface{-/*** A trigger is said to "match anything", or match any given transaction,* when the trigger value is very vague or has no restrictions. Easy examples@@ -71,7 +67,7 @@ final class HasNoCategory extends AbstractTrigger implements TriggerInterface$count += $transaction->categories()->count();}- if ($count === 0) {+ if (0 === $count) {Log::debug(sprintf('RuleTrigger HasNoCategory for journal #%d: count is %d, return true.', $journal->id, $count));return true;diff --git a/app/TransactionRules/Triggers/HasNoTag.php b/app/TransactionRules/Triggers/HasNoTag.phpindex 04dc7542f7..b547171450 100644--- a/app/TransactionRules/Triggers/HasNoTag.php+++ b/app/TransactionRules/Triggers/HasNoTag.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Triggers;@@ -27,13 +26,10 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class HasNoTag- *- * @package FireflyIII\TransactionRules\Triggers+ * Class HasNoTag.*/final class HasNoTag extends AbstractTrigger implements TriggerInterface{-/*** A trigger is said to "match anything", or match any given transaction,* when the trigger value is very vague or has no restrictions. Easy examples@@ -63,7 +59,7 @@ final class HasNoTag extends AbstractTrigger implements TriggerInterfacepublic function triggered(TransactionJournal $journal): bool{$count = $journal->tags()->count();- if ($count === 0) {+ if (0 === $count) {Log::debug(sprintf('RuleTrigger HasNoTag for journal #%d: count is %d, return true.', $journal->id, $count));return true;diff --git a/app/TransactionRules/Triggers/NotesAny.php b/app/TransactionRules/Triggers/NotesAny.phpindex e342a98962..fb63301ad7 100644--- a/app/TransactionRules/Triggers/NotesAny.php+++ b/app/TransactionRules/Triggers/NotesAny.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Triggers;@@ -28,13 +27,10 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class NotesAny- *- * @package FireflyIII\TransactionRules\Triggers+ * Class NotesAny.*/final class NotesAny extends AbstractTrigger implements TriggerInterface{-/*** A trigger is said to "match anything", or match any given transaction,* when the trigger value is very vague or has no restrictions. Easy examples@@ -66,7 +62,7 @@ final class NotesAny extends AbstractTrigger implements TriggerInterface/** @var Note $note */$note = $journal->notes()->first();$text = '';- if (!is_null($note)) {+ if (null !== $note) {$text = $note->text;}diff --git a/app/TransactionRules/Triggers/NotesAre.php b/app/TransactionRules/Triggers/NotesAre.phpindex ef7362649d..34a7fef5f6 100644--- a/app/TransactionRules/Triggers/NotesAre.php+++ b/app/TransactionRules/Triggers/NotesAre.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Triggers;@@ -28,13 +27,10 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class NotesAre- *- * @package FireflyIII\TransactionRules\Triggers+ * Class NotesAre.*/final class NotesAre extends AbstractTrigger implements TriggerInterface{-/*** A trigger is said to "match anything", or match any given transaction,* when the trigger value is very vague or has no restrictions. Easy examples@@ -53,7 +49,7 @@ final class NotesAre extends AbstractTrigger implements TriggerInterface*/public static function willMatchEverything($value = null){- if (!is_null($value)) {+ if (null !== $value) {return false;}@@ -72,7 +68,7 @@ final class NotesAre extends AbstractTrigger implements TriggerInterface/** @var Note $note */$note = $journal->notes()->first();$text = '';- if (!is_null($note)) {+ if (null !== $note) {$text = strtolower($note->text);}$search = strtolower($this->triggerValue);diff --git a/app/TransactionRules/Triggers/NotesContain.php b/app/TransactionRules/Triggers/NotesContain.phpindex 6b1d04521a..10f3c35d44 100644--- a/app/TransactionRules/Triggers/NotesContain.php+++ b/app/TransactionRules/Triggers/NotesContain.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Triggers;@@ -28,13 +27,10 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class NotesContain- *- * @package FireflyIII\TransactionRules\Triggers+ * Class NotesContain.*/final class NotesContain extends AbstractTrigger implements TriggerInterface{-/*** A trigger is said to "match anything", or match any given transaction,* when the trigger value is very vague or has no restrictions. Easy examples@@ -53,9 +49,9 @@ final class NotesContain extends AbstractTrigger implements TriggerInterface*/public static function willMatchEverything($value = null){- if (!is_null($value)) {- $res = strval($value) === '';- if ($res === true) {+ if (null !== $value) {+ $res = '' === strval($value);+ if (true === $res) {Log::error(sprintf('Cannot use %s with "" as a value.', self::class));}@@ -76,7 +72,7 @@ final class NotesContain extends AbstractTrigger implements TriggerInterface{$search = trim(strtolower($this->triggerValue));- if (strlen($search) === 0) {+ if (0 === strlen($search)) {Log::debug(sprintf('RuleTrigger NotesContain for journal #%d: "%s" is empty, return false.', $journal->id, $search));return false;@@ -85,13 +81,12 @@ final class NotesContain extends AbstractTrigger implements TriggerInterface/** @var Note $note */$note = $journal->notes()->first();$text = '';- if (!is_null($note)) {+ if (null !== $note) {$text = strtolower($note->text);}-$strpos = strpos($text, $search);- if (!($strpos === false)) {+ if (!(false === $strpos)) {Log::debug(sprintf('RuleTrigger NotesContain for journal #%d: "%s" contains "%s", return true.', $journal->id, $text, $search));return true;diff --git a/app/TransactionRules/Triggers/NotesEmpty.php b/app/TransactionRules/Triggers/NotesEmpty.phpindex 5c52cca0b1..dc1bedff4f 100644--- a/app/TransactionRules/Triggers/NotesEmpty.php+++ b/app/TransactionRules/Triggers/NotesEmpty.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Triggers;@@ -28,13 +27,10 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class NotesEmpty- *- * @package FireflyIII\TransactionRules\Triggers+ * Class NotesEmpty.*/final class NotesEmpty extends AbstractTrigger implements TriggerInterface{-/*** A trigger is said to "match anything", or match any given transaction,* when the trigger value is very vague or has no restrictions. Easy examples@@ -66,11 +62,11 @@ final class NotesEmpty extends AbstractTrigger implements TriggerInterface/** @var Note $note */$note = $journal->notes()->first();$text = '';- if (!is_null($note)) {+ if (null !== $note) {$text = $note->text;}- if (strlen($text) === 0) {+ if (0 === strlen($text)) {Log::debug(sprintf('RuleTrigger NotesEmpty for journal #%d: strlen is 0, return true.', $journal->id));return true;diff --git a/app/TransactionRules/Triggers/NotesEnd.php b/app/TransactionRules/Triggers/NotesEnd.phpindex f4c1546281..8c36fcb659 100644--- a/app/TransactionRules/Triggers/NotesEnd.php+++ b/app/TransactionRules/Triggers/NotesEnd.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Triggers;@@ -28,13 +27,10 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class NotesEnd- *- * @package FireflyIII\TransactionRules\Triggers+ * Class NotesEnd.*/final class NotesEnd extends AbstractTrigger implements TriggerInterface{-/*** A trigger is said to "match anything", or match any given transaction,* when the trigger value is very vague or has no restrictions. Easy examples@@ -53,9 +49,9 @@ final class NotesEnd extends AbstractTrigger implements TriggerInterface*/public static function willMatchEverything($value = null){- if (!is_null($value)) {- $res = strval($value) === '';- if ($res === true) {+ if (null !== $value) {+ $res = '' === strval($value);+ if (true === $res) {Log::error(sprintf('Cannot use %s with "" as a value.', self::class));}@@ -77,7 +73,7 @@ final class NotesEnd extends AbstractTrigger implements TriggerInterface/** @var Note $note */$note = $journal->notes()->first();$text = '';- if (!is_null($note)) {+ if (null !== $note) {$text = strtolower($note->text);}$notesLength = strlen($text);diff --git a/app/TransactionRules/Triggers/NotesStart.php b/app/TransactionRules/Triggers/NotesStart.phpindex 64385a6f7e..eedea6f71e 100644--- a/app/TransactionRules/Triggers/NotesStart.php+++ b/app/TransactionRules/Triggers/NotesStart.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Triggers;@@ -28,13 +27,10 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class NotesStart- *- * @package FireflyIII\TransactionRules\Triggers+ * Class NotesStart.*/final class NotesStart extends AbstractTrigger implements TriggerInterface{-/*** A trigger is said to "match anything", or match any given transaction,* when the trigger value is very vague or has no restrictions. Easy examples@@ -53,9 +49,9 @@ final class NotesStart extends AbstractTrigger implements TriggerInterface*/public static function willMatchEverything($value = null){- if (!is_null($value)) {- $res = strval($value) === '';- if ($res === true) {+ if (null !== $value) {+ $res = '' === strval($value);+ if (true === $res) {Log::error(sprintf('Cannot use %s with "" as a value.', self::class));}@@ -77,7 +73,7 @@ final class NotesStart extends AbstractTrigger implements TriggerInterface/** @var Note $note */$note = $journal->notes()->first();$text = '';- if (!is_null($note)) {+ if (null !== $note) {$text = strtolower($note->text);}$search = strtolower($this->triggerValue);diff --git a/app/TransactionRules/Triggers/TagIs.php b/app/TransactionRules/Triggers/TagIs.phpindex 7c7b7b02c9..3f4fcb19f1 100644--- a/app/TransactionRules/Triggers/TagIs.php+++ b/app/TransactionRules/Triggers/TagIs.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Triggers;@@ -28,13 +27,10 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class TagIs- *- * @package FireflyIII\TransactionRules\Triggers+ * Class TagIs.*/final class TagIs extends AbstractTrigger implements TriggerInterface{-/*** A trigger is said to "match anything", or match any given transaction,* when the trigger value is very vague or has no restrictions. Easy examples@@ -53,7 +49,7 @@ final class TagIs extends AbstractTrigger implements TriggerInterface*/public static function willMatchEverything($value = null){- if (!is_null($value)) {+ if (null !== $value) {return false;}Log::error(sprintf('Cannot use %s with a null value.', self::class));diff --git a/app/TransactionRules/Triggers/ToAccountContains.php b/app/TransactionRules/Triggers/ToAccountContains.phpindex 729e1454b9..cd4141c826 100644--- a/app/TransactionRules/Triggers/ToAccountContains.php+++ b/app/TransactionRules/Triggers/ToAccountContains.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Triggers;@@ -28,13 +27,10 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class ToAccountContains- *- * @package FireflyIII\TransactionRules\Triggers+ * Class ToAccountContains.*/final class ToAccountContains extends AbstractTrigger implements TriggerInterface{-/*** A trigger is said to "match anything", or match any given transaction,* when the trigger value is very vague or has no restrictions. Easy examples@@ -53,9 +49,9 @@ final class ToAccountContains extends AbstractTrigger implements TriggerInterfac*/public static function willMatchEverything($value = null){- if (!is_null($value)) {- $res = strval($value) === '';- if ($res === true) {+ if (null !== $value) {+ $res = '' === strval($value);+ if (true === $res) {Log::error(sprintf('Cannot use %s with "" as a value.', self::class));}@@ -83,7 +79,7 @@ final class ToAccountContains extends AbstractTrigger implements TriggerInterfac$search = strtolower($this->triggerValue);$strpos = strpos($toAccountName, $search);- if (!($strpos === false)) {+ if (!(false === $strpos)) {Log::debug(sprintf('RuleTrigger ToAccountContains for journal #%d: "%s" contains "%s", return true.', $journal->id, $toAccountName, $search));return true;diff --git a/app/TransactionRules/Triggers/ToAccountEnds.php b/app/TransactionRules/Triggers/ToAccountEnds.phpindex 01a8936171..ba2a4f0d30 100644--- a/app/TransactionRules/Triggers/ToAccountEnds.php+++ b/app/TransactionRules/Triggers/ToAccountEnds.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Triggers;@@ -28,13 +27,10 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class ToAccountEnds- *- * @package FireflyIII\TransactionRules\Triggers+ * Class ToAccountEnds.*/final class ToAccountEnds extends AbstractTrigger implements TriggerInterface{-/*** A trigger is said to "match anything", or match any given transaction,* when the trigger value is very vague or has no restrictions. Easy examples@@ -53,9 +49,9 @@ final class ToAccountEnds extends AbstractTrigger implements TriggerInterface*/public static function willMatchEverything($value = null){- if (!is_null($value)) {- $res = strval($value) === '';- if ($res === true) {+ if (null !== $value) {+ $res = '' === strval($value);+ if (true === $res) {Log::error(sprintf('Cannot use %s with "" as a value.', self::class));}@@ -92,7 +88,6 @@ final class ToAccountEnds extends AbstractTrigger implements TriggerInterfacereturn false;}-$part = substr($toAccountName, $searchLength * -1);if ($part === $search) {diff --git a/app/TransactionRules/Triggers/ToAccountIs.php b/app/TransactionRules/Triggers/ToAccountIs.phpindex 457c421da6..50a20375c0 100644--- a/app/TransactionRules/Triggers/ToAccountIs.php+++ b/app/TransactionRules/Triggers/ToAccountIs.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Triggers;@@ -28,13 +27,10 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class ToAccountIs- *- * @package FireflyIII\TransactionRules\Triggers+ * Class ToAccountIs.*/final class ToAccountIs extends AbstractTrigger implements TriggerInterface{-/*** A trigger is said to "match anything", or match any given transaction,* when the trigger value is very vague or has no restrictions. Easy examples@@ -53,9 +49,9 @@ final class ToAccountIs extends AbstractTrigger implements TriggerInterface*/public static function willMatchEverything($value = null){- if (!is_null($value)) {- $res = strval($value) === '';- if ($res === true) {+ if (null !== $value) {+ $res = '' === strval($value);+ if (true === $res) {Log::error(sprintf('Cannot use %s with "" as a value.', self::class));}diff --git a/app/TransactionRules/Triggers/ToAccountStarts.php b/app/TransactionRules/Triggers/ToAccountStarts.phpindex 84f52c24d1..3c47e2cdae 100644--- a/app/TransactionRules/Triggers/ToAccountStarts.php+++ b/app/TransactionRules/Triggers/ToAccountStarts.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Triggers;@@ -28,13 +27,10 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class ToAccountStarts- *- * @package FireflyIII\TransactionRules\Triggers+ * Class ToAccountStarts.*/final class ToAccountStarts extends AbstractTrigger implements TriggerInterface{-/*** A trigger is said to "match anything", or match any given transaction,* when the trigger value is very vague or has no restrictions. Easy examples@@ -53,9 +49,9 @@ final class ToAccountStarts extends AbstractTrigger implements TriggerInterface*/public static function willMatchEverything($value = null){- if (!is_null($value)) {- $res = strval($value) === '';- if ($res === true) {+ if (null !== $value) {+ $res = '' === strval($value);+ if (true === $res) {Log::error(sprintf('Cannot use %s with "" as a value.', self::class));}@@ -90,7 +86,6 @@ final class ToAccountStarts extends AbstractTrigger implements TriggerInterface}Log::debug(sprintf('RuleTrigger ToAccountStarts for journal #%d: "%s" does not start with "%s", return false.', $journal->id, $toAccountName, $search));-return false;}}diff --git a/app/TransactionRules/Triggers/TransactionType.php b/app/TransactionRules/Triggers/TransactionType.phpindex e2ddf1b564..3e29c00c4d 100644--- a/app/TransactionRules/Triggers/TransactionType.php+++ b/app/TransactionRules/Triggers/TransactionType.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Triggers;@@ -27,13 +26,10 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class TransactionType- *- * @package FireflyIII\TransactionRules\Triggers+ * Class TransactionType.*/final class TransactionType extends AbstractTrigger implements TriggerInterface{-/*** A trigger is said to "match anything", or match any given transaction,* when the trigger value is very vague or has no restrictions. Easy examples@@ -52,7 +48,7 @@ final class TransactionType extends AbstractTrigger implements TriggerInterface*/public static function willMatchEverything($value = null){- if (!is_null($value)) {+ if (null !== $value) {return false;}Log::error(sprintf('Cannot use %s with a null value.', self::class));@@ -67,7 +63,7 @@ final class TransactionType extends AbstractTrigger implements TriggerInterface*/public function triggered(TransactionJournal $journal): bool{- $type = !is_null($journal->transaction_type_type) ? $journal->transaction_type_type : strtolower($journal->transactionType->type);+ $type = null !== $journal->transaction_type_type ? $journal->transaction_type_type : strtolower($journal->transactionType->type);$search = strtolower($this->triggerValue);if ($type === $search) {diff --git a/app/TransactionRules/Triggers/TriggerInterface.php b/app/TransactionRules/Triggers/TriggerInterface.phpindex 611498f7fc..7b3efa89b1 100644--- a/app/TransactionRules/Triggers/TriggerInterface.php+++ b/app/TransactionRules/Triggers/TriggerInterface.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Triggers;@@ -26,13 +25,10 @@ namespace FireflyIII\TransactionRules\Triggers;use FireflyIII\Models\TransactionJournal;/**- * Interface TriggerInterface- *- * @package FireflyIII\TransactionRules\Triggers+ * Interface TriggerInterface.*/interface TriggerInterface{-/*** A trigger is said to "match anything", or match any given transaction,* when the trigger value is very vague or has no restrictions. Easy examplesdiff --git a/app/TransactionRules/Triggers/UserAction.php b/app/TransactionRules/Triggers/UserAction.phpindex 6a3bacca20..eb0a99076e 100644--- a/app/TransactionRules/Triggers/UserAction.php+++ b/app/TransactionRules/Triggers/UserAction.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\TransactionRules\Triggers;@@ -27,13 +26,10 @@ use FireflyIII\Models\TransactionJournal;use Log;/**- * Class UserAction- *- * @package FireflyIII\TransactionRules\Triggers+ * Class UserAction.*/final class UserAction extends AbstractTrigger implements TriggerInterface{-/*** A trigger is said to "match anything", or match any given transaction,* when the trigger value is very vague or has no restrictions. Easy examplesdiff --git a/app/User.php b/app/User.phpindex 92699f32ff..d301d96331 100644--- a/app/User.php+++ b/app/User.php@@ -18,10 +18,8 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);-namespace FireflyIII;use FireflyIII\Events\RequestedNewPassword;@@ -34,9 +32,7 @@ use Illuminate\Notifications\Notifiable;use Request;/**- * Class User- *- * @package FireflyIII+ * Class User.*/class User extends Authenticatable{@@ -227,9 +223,7 @@ class User extends Authenticatable/*** Send the password reset notification.*- * @param string $token- *- * @return void+ * @param string $token*/public function sendPasswordResetNotification($token){diff --git a/app/Validation/FireflyValidator.php b/app/Validation/FireflyValidator.phpindex 70290446bc..95b14b987b 100644--- a/app/Validation/FireflyValidator.php+++ b/app/Validation/FireflyValidator.php@@ -18,7 +18,6 @@* You should have received a copy of the GNU General Public License* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.*/-declare(strict_types=1);namespace FireflyIII\Validation;@@ -42,20 +41,16 @@ use Illuminate\Contracts\Translation\Translator;use Illuminate\Validation\Validator;/**- * Class FireflyValidator- *- * @package FireflyIII\Validation+ * Class FireflyValidator.*/class FireflyValidator extends Validator{-/*** @param Translator $translator* @param array $data* @param array $rules* @param array $messages* @param array $customAttributes- **/public function __construct(Translator $translator, array $data, array $rules, array $messages = [], array $customAttributes = []){@@ -64,15 +59,15 @@ class FireflyValidator extends Validator/*** @SuppressWarnings(PHPMD.UnusedFormalParameter)+ ** @param $attribute* @param $value** @return bool- **/public function validate2faCode($attribute, $value): bool{- if (!is_string($value) || is_null($value) || strlen($value) <> 6) {+ if (!is_string($value) || null === $value || 6 != strlen($value)) {return false;}@@ -83,6 +78,7 @@ class FireflyValidator extends Validator/*** @SuppressWarnings(PHPMD.UnusedFormalParameter)+ ** @param $attribute* @param $value* @param $parameters@@ -93,11 +89,11 @@ class FireflyValidator extends Validator{$field = $parameters[1] ?? 'id';- if (intval($value) === 0) {+ if (0 === intval($value)) {return true;}$count = DB::table($parameters[0])->where('user_id', auth()->user()->id)->where($field, $value)->count();- if ($count === 1) {+ if (1 === $count) {return true;}@@ -106,20 +102,20 @@ class FireflyValidator extends Validator/*** @SuppressWarnings(PHPMD.UnusedFormalParameter)+ ** @param $attribute* @param $value** @return bool- **/public function validateBic($attribute, $value): bool{$regex = '/^[a-z]{6}[0-9a-z]{2}([0-9a-z]{3})?\z/i';$result = preg_match($regex, $value);- if ($result === false) {+ if (false === $result) {return false;}- if ($result === 0) {+ if (0 === $result) {return false;}@@ -128,15 +124,15 @@ class FireflyValidator extends Validator/*** @SuppressWarnings(PHPMD.UnusedFormalParameter)+ ** @param $attribute* @param $value*- ** @return bool*/public function validateIban($attribute, $value): bool{- if (!is_string($value) || is_null($value) || strlen($value) < 6) {+ if (!is_string($value) || null === $value || strlen($value) < 6) {return false;}@@ -144,7 +140,7 @@ class FireflyValidator extends Validator$search = [' ', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];$replace = ['', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31',- '32', '33', '34', '35'];+ '32', '33', '34', '35',];// take$first = substr($value, 0, 4);@@ -153,7 +149,7 @@ class FireflyValidator extends Validator$iban = str_replace($search, $replace, $iban);$checksum = bcmod($iban, '97');- return (intval($checksum) === 1);+ return 1 === intval($checksum);}/**@@ -173,6 +169,7 @@ class FireflyValidator extends Validator/*** @SuppressWarnings(PHPMD.UnusedFormalParameter)+ ** @param $attribute* @param $value* @param $parameters@@ -183,11 +180,11 @@ class FireflyValidator extends Validator{$field = $parameters[1] ?? 'id';- if (intval($value) === 0) {+ if (0 === intval($value)) {return true;}$count = DB::table($parameters[0])->where($field, $value)->count();- if ($count === 1) {+ if (1 === $count) {return true;}@@ -225,10 +222,9 @@ class FireflyValidator extends Validator})->count();- return ($count === 1);+ return 1 === $count;case 'invalid':return false;-}}@@ -256,13 +252,13 @@ class FireflyValidator extends Validatorswitch ($name) {case 'amount_less':$result = is_numeric($value);- if ($result === false) {+ if (false === $result) {return false;}break;case 'transaction_type':$count = TransactionType::where('type', $value)->count();- if (!($count === 1)) {+ if (!(1 === $count)) {return false;}break;@@ -293,7 +289,7 @@ class FireflyValidator extends Validator{$verify = false;if (isset($this->data['verify_password'])) {- $verify = intval($this->data['verify_password']) === 1;+ $verify = 1 === intval($this->data['verify_password']);}if ($verify) {/** @var Verifier $service */@@ -307,11 +303,11 @@ class FireflyValidator extends Validator/*** @SuppressWarnings(PHPMD.UnusedFormalParameter)+ ** @param $attribute* @param $value* @param $parameters*- ** @return bool*/public function validateUniqueAccountForUser($attribute, $value, $parameters): bool@@ -332,12 +328,12 @@ class FireflyValidator extends Validatorreturn $this->validateByAccountId($value);}-return false;}/*** @SuppressWarnings(PHPMD.UnusedFormalParameter)+ ** @param $attribute* @param $value* @param $parameters@@ -380,7 +376,6 @@ class FireflyValidator extends Validator* @param $value* @param $parameters*- ** @return bool*/public function validateUniqueObjectForUser($attribute, $value, $parameters): bool@@ -408,6 +403,7 @@ class FireflyValidator extends Validator/*** @SuppressWarnings(PHPMD.UnusedFormalParameter)+ ** @param $attribute* @param $value* @param $parameters@@ -419,7 +415,7 @@ class FireflyValidator extends Validator$exclude = $parameters[0] ?? null;$query = DB::table('piggy_banks')->whereNull('piggy_banks.deleted_at')->leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id')->where('accounts.user_id', auth()->user()->id);- if (!is_null($exclude)) {+ if (null !== $exclude) {$query->where('piggy_banks.id', '!=', $exclude);}$set = $query->get(['piggy_banks.*']);@@ -484,7 +480,6 @@ class FireflyValidator extends Validator$type = AccountType::find($this->data['account_type_id'])->first();$value = $this->tryDecrypt($this->data['name']);-$set = $user->accounts()->where('account_type_id', $type->id)->get();/** @var Account $entry */foreach ($set as $entry) {@@ -500,7 +495,6 @@ class FireflyValidator extends Validator* @param $value** @return bool- **/private function validateByAccountId($value): bool{