diff --git a/app/Import/Converter/Amount.php b/app/Import/Converter/Amount.php index ee13f8c565..d75346d78b 100644 --- a/app/Import/Converter/Amount.php +++ b/app/Import/Converter/Amount.php @@ -114,7 +114,7 @@ class Amount implements ConverterInterface $str = preg_replace('/[^\-\(\)\.\,0-9 ]/', '', $value); $len = strlen($str); if ('(' === $str[0] && ')' === $str[$len - 1]) { - $str = '-' . substr($str, 1, ($len - 2)); + $str = '-' . substr($str, 1, $len - 2); } Log::debug(sprintf('Stripped "%s" away to "%s"', $value, $str)); diff --git a/app/Import/FileProcessor/CsvProcessor.php b/app/Import/FileProcessor/CsvProcessor.php index 6201a96f23..b4b8b31858 100644 --- a/app/Import/FileProcessor/CsvProcessor.php +++ b/app/Import/FileProcessor/CsvProcessor.php @@ -281,9 +281,8 @@ class CsvProcessor implements FileProcessorInterface if (false === $json) { throw new FireflyException(sprintf('Error while encoding JSON for CSV row: %s', $this->getJsonError($jsonError))); // @codeCoverageIgnore } - $hash = hash('sha256', $json); - return $hash; + return hash('sha256', $json); } /** @@ -340,11 +339,8 @@ class CsvProcessor implements FileProcessorInterface { $hash = $this->getRowHash($array); $count = $this->repository->countByHash($hash); - if ($count > 0) { - return true; - } - return false; + return $count > 0; } /** diff --git a/app/Import/Logging/CommandHandler.php b/app/Import/Logging/CommandHandler.php index eb1d9c1b7a..f52fe8a71b 100644 --- a/app/Import/Logging/CommandHandler.php +++ b/app/Import/Logging/CommandHandler.php @@ -54,7 +54,7 @@ class CommandHandler extends AbstractProcessingHandler */ protected function write(array $record) { - $this->command->line((string)trim($record['formatted'])); + $this->command->line(trim($record['formatted'])); } /** diff --git a/app/Import/Mapper/AssetAccountIbans.php b/app/Import/Mapper/AssetAccountIbans.php index cfbdf46437..20f60ba9cf 100644 --- a/app/Import/Mapper/AssetAccountIbans.php +++ b/app/Import/Mapper/AssetAccountIbans.php @@ -53,6 +53,7 @@ class AssetAccountIbans implements MapperInterface $list[$accountId] = $account->name; } } + /** @noinspection AdditionOperationOnArraysInspection */ $list = $topList + $list; asort($list); $list = [0 => trans('import.map_do_not_map')] + $list; diff --git a/app/Import/Object/ImportJournal.php b/app/Import/Object/ImportJournal.php index b0e48154d8..1b8d04bfd9 100644 --- a/app/Import/Object/ImportJournal.php +++ b/app/Import/Object/ImportJournal.php @@ -183,7 +183,7 @@ class ImportJournal $converter = app($class); Log::debug(sprintf('Now launching converter %s', $class)); if ($converter->convert($modifier['value']) === -1) { - $this->convertedAmount = Steam::negative($amount); + $amount = Steam::negative($amount); } Log::debug(sprintf('Foreign amount after conversion is %s', $amount)); } @@ -478,7 +478,5 @@ class ImportJournal $preProcessor = app(sprintf('\FireflyIII\Import\MapperPreProcess\%s', $preProcessorClass)); $tags = $preProcessor->run($array['value']); $this->tags = array_merge($this->tags, $tags); - - return; } } diff --git a/app/Import/Routine/BunqRoutine.php b/app/Import/Routine/BunqRoutine.php index 50fefe2e88..e4feb97f1d 100644 --- a/app/Import/Routine/BunqRoutine.php +++ b/app/Import/Routine/BunqRoutine.php @@ -226,8 +226,6 @@ class BunqRoutine implements RoutineInterface $config['stage'] = 'registered'; $this->setConfig($config); $this->addStep(); - - return; } /** @@ -319,6 +317,8 @@ class BunqRoutine implements RoutineInterface * @param string $expectedType * * @return Account + * @throws \FireflyIII\Exceptions\FireflyException + * @throws FireflyException */ private function convertToAccount(LabelMonetaryAccount $party, string $expectedType): Account { diff --git a/app/Import/Routine/FileRoutine.php b/app/Import/Routine/FileRoutine.php index 33f12dd0f5..b4c58bc856 100644 --- a/app/Import/Routine/FileRoutine.php +++ b/app/Import/Routine/FileRoutine.php @@ -266,8 +266,6 @@ class FileRoutine implements RoutineInterface private function setExtendedStatus(array $extended): void { $this->repository->setExtendedStatus($this->job, $extended); - - return; } /** diff --git a/app/Import/Routine/SpectreRoutine.php b/app/Import/Routine/SpectreRoutine.php index 347031b924..9f035fc4ea 100644 --- a/app/Import/Routine/SpectreRoutine.php +++ b/app/Import/Routine/SpectreRoutine.php @@ -343,8 +343,6 @@ class SpectreRoutine implements RoutineInterface $this->setConfig($config); $this->setStatus('configuring'); $this->addStep(); - - return; } /** @@ -468,7 +466,7 @@ class SpectreRoutine implements RoutineInterface // various meta fields: $importJournal->setValue(['role' => 'category-name', 'value' => $transaction->getCategory()]); $importJournal->setValue(['role' => 'note', 'value' => $notes]); - $importJournal->setValue(['role' => 'tags-comma', 'value' => join(',', $tags)]); + $importJournal->setValue(['role' => 'tags-comma', 'value' => implode(',', $tags)]); $collection->push($importJournal); } } @@ -521,7 +519,6 @@ class SpectreRoutine implements RoutineInterface $this->setStatus('finished'); $this->addStep(); - return; } /** @@ -538,7 +535,7 @@ class SpectreRoutine implements RoutineInterface /** @var array $accountArray */ foreach ($accounts as $accountArray) { $account = new Account($accountArray); - $importId = intval($config['accounts-mapped'][$account->getid()] ?? 0); + $importId = intval($config['accounts-mapped'][$account->getId()] ?? 0); $doImport = 0 !== $importId ? true : false; if (!$doImport) { Log::debug(sprintf('Will NOT import from Spectre account #%d ("%s")', $account->getId(), $account->getName())); @@ -571,7 +568,6 @@ class SpectreRoutine implements RoutineInterface { $this->repository->setConfiguration($this->job, $config); - return; } /** @@ -583,7 +579,6 @@ class SpectreRoutine implements RoutineInterface { $this->repository->setExtendedStatus($this->job, $extended); - return; } /** diff --git a/app/Import/Storage/ImportStorage.php b/app/Import/Storage/ImportStorage.php index b67cddfc32..9b56038718 100644 --- a/app/Import/Storage/ImportStorage.php +++ b/app/Import/Storage/ImportStorage.php @@ -182,7 +182,7 @@ class ImportStorage */ protected function storeImportJournal(int $index, ImportJournal $importJournal): bool { - Log::debug(sprintf('Going to store object #%d/%d with description "%s"', ($index + 1), $this->total, $importJournal->getDescription())); + Log::debug(sprintf('Going to store object #%d/%d with description "%s"', $index + 1, $this->total, $importJournal->getDescription())); $assetAccount = $importJournal->asset->getAccount(); $amount = $importJournal->getAmount(); $foreignAmount = $importJournal->getForeignAmount(); @@ -370,7 +370,7 @@ class ImportStorage } if ($names === $transfer['names']) { ++$hits; - Log::debug(sprintf('Involved accounts, "%s" equals "%s", hits = %d', join(',', $names), join(',', $transfer['names']), $hits)); + Log::debug(sprintf('Involved accounts, "%s" equals "%s", hits = %d', implode(',', $names), implode(',', $transfer['names']), $hits)); } if (0 === bccomp($amount, $transfer['amount'])) { ++$hits; diff --git a/app/Import/Storage/ImportSupport.php b/app/Import/Storage/ImportSupport.php index 8bbd0a454f..a1bf25557b 100644 --- a/app/Import/Storage/ImportSupport.php +++ b/app/Import/Storage/ImportSupport.php @@ -62,6 +62,7 @@ trait ImportSupport * @param TransactionJournal $journal * * @return bool + * @throws \FireflyIII\Exceptions\FireflyException */ protected function applyRules(TransactionJournal $journal): bool { @@ -279,6 +280,7 @@ trait ImportSupport * is not already present. * * @return array + * @throws \InvalidArgumentException */ private function getTransfers(): array { diff --git a/app/Jobs/ExecuteRuleGroupOnExistingTransactions.php b/app/Jobs/ExecuteRuleGroupOnExistingTransactions.php index a1d896184c..5a4495e84b 100644 --- a/app/Jobs/ExecuteRuleGroupOnExistingTransactions.php +++ b/app/Jobs/ExecuteRuleGroupOnExistingTransactions.php @@ -126,6 +126,8 @@ class ExecuteRuleGroupOnExistingTransactions extends Job implements ShouldQueue /** * Execute the job. + * + * @throws \FireflyIII\Exceptions\FireflyException */ public function handle() { @@ -168,6 +170,7 @@ class ExecuteRuleGroupOnExistingTransactions extends Job implements ShouldQueue * Collects a list of rule processors, one for each rule within the rule group. * * @return array + * @throws \FireflyIII\Exceptions\FireflyException */ protected function collectProcessors() { diff --git a/app/Models/Account.php b/app/Models/Account.php index 9d3d4e2bf9..cf1e6131ba 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -116,6 +116,7 @@ class Account extends Model * @param string $value * * @return Account + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ public static function routeBinder(string $value): Account { @@ -210,6 +211,7 @@ class Account extends Model * @param $value * * @return string + * @throws \Illuminate\Contracts\Encryption\DecryptException */ public function getNameAttribute($value): ?string { @@ -274,9 +276,12 @@ class Account extends Model /** * @codeCoverageIgnore * @deprecated + * * @param EloquentBuilder $query * @param string $name * @param string $value + * + * @throws \InvalidArgumentException */ public function scopeHasMetaValue(EloquentBuilder $query, $name, $value) { @@ -296,6 +301,7 @@ class Account extends Model * @param $value * * @codeCoverageIgnore + * @throws \Illuminate\Contracts\Encryption\EncryptException */ public function setIbanAttribute($value) { @@ -306,6 +312,7 @@ class Account extends Model * @codeCoverageIgnore * * @param $value + * @throws \Illuminate\Contracts\Encryption\EncryptException */ public function setNameAttribute($value) { diff --git a/app/Models/AccountType.php b/app/Models/AccountType.php index 9b34d0382e..09402789c7 100644 --- a/app/Models/AccountType.php +++ b/app/Models/AccountType.php @@ -33,43 +33,43 @@ class AccountType extends Model /** * */ - const DEFAULT = 'Default account'; + public const DEFAULT = 'Default account'; /** * */ - const CASH = 'Cash account'; + public const CASH = 'Cash account'; /** * */ - const ASSET = 'Asset account'; + public const ASSET = 'Asset account'; /** * */ - const EXPENSE = 'Expense account'; + public const EXPENSE = 'Expense account'; /** * */ - const REVENUE = 'Revenue account'; + public const REVENUE = 'Revenue account'; /** * */ - const INITIAL_BALANCE = 'Initial balance account'; + public const INITIAL_BALANCE = 'Initial balance account'; /** * */ - const BENEFICIARY = 'Beneficiary account'; + public const BENEFICIARY = 'Beneficiary account'; /** * */ - const IMPORT = 'Import account'; + public const IMPORT = 'Import account'; /** * */ - const RECONCILIATION = 'Reconciliation account'; + public const RECONCILIATION = 'Reconciliation account'; /** * */ - const LOAN = 'Loan'; + public const LOAN = 'Loan'; /** * The attributes that should be casted to native types. * diff --git a/app/Models/Attachment.php b/app/Models/Attachment.php index 32699744a2..9ef2343d09 100644 --- a/app/Models/Attachment.php +++ b/app/Models/Attachment.php @@ -55,6 +55,7 @@ class Attachment extends Model * @param string $value * * @return Attachment + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ public static function routeBinder(string $value): Attachment { @@ -96,6 +97,7 @@ class Attachment extends Model * * @codeCoverageIgnore * @return null|string + * @throws \Illuminate\Contracts\Encryption\DecryptException */ public function getDescriptionAttribute($value) { @@ -111,6 +113,7 @@ class Attachment extends Model * * @codeCoverageIgnore * @return null|string + * @throws \Illuminate\Contracts\Encryption\DecryptException */ public function getFilenameAttribute($value) { @@ -126,6 +129,7 @@ class Attachment extends Model * * @codeCoverageIgnore * @return null|string + * @throws \Illuminate\Contracts\Encryption\DecryptException */ public function getMimeAttribute($value) { @@ -141,6 +145,7 @@ class Attachment extends Model * * @codeCoverageIgnore * @return null|string + * @throws \Illuminate\Contracts\Encryption\DecryptException */ public function getTitleAttribute($value) { @@ -164,6 +169,8 @@ class Attachment extends Model * @codeCoverageIgnore * * @param string $value + * + * @throws \Illuminate\Contracts\Encryption\EncryptException */ public function setDescriptionAttribute(string $value) { @@ -174,6 +181,7 @@ class Attachment extends Model * @codeCoverageIgnore * * @param string $value + * @throws \Illuminate\Contracts\Encryption\EncryptException */ public function setFilenameAttribute(string $value) { @@ -184,6 +192,7 @@ class Attachment extends Model * @codeCoverageIgnore * * @param string $value + * @throws \Illuminate\Contracts\Encryption\EncryptException */ public function setMimeAttribute(string $value) { @@ -194,6 +203,7 @@ class Attachment extends Model * @codeCoverageIgnore * * @param string $value + * @throws \Illuminate\Contracts\Encryption\EncryptException */ public function setTitleAttribute(string $value) { diff --git a/app/Models/Bill.php b/app/Models/Bill.php index ec09d0fcc7..823f39b426 100644 --- a/app/Models/Bill.php +++ b/app/Models/Bill.php @@ -72,6 +72,7 @@ class Bill extends Model * @param string $value * * @return Bill + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ public static function routeBinder(string $value): Bill { @@ -100,6 +101,7 @@ class Bill extends Model * @param $value * * @return string + * @throws \Illuminate\Contracts\Encryption\DecryptException */ public function getMatchAttribute($value) { @@ -116,6 +118,7 @@ class Bill extends Model * @param $value * * @return string + * @throws \Illuminate\Contracts\Encryption\DecryptException */ public function getNameAttribute($value) { @@ -159,6 +162,7 @@ class Bill extends Model * @param $value * * @codeCoverageIgnore + * @throws \Illuminate\Contracts\Encryption\EncryptException */ public function setMatchAttribute($value) { @@ -171,6 +175,7 @@ class Bill extends Model * @param $value * * @codeCoverageIgnore + * @throws \Illuminate\Contracts\Encryption\EncryptException */ public function setNameAttribute($value) { diff --git a/app/Models/Budget.php b/app/Models/Budget.php index ba013701ea..7d4a833322 100644 --- a/app/Models/Budget.php +++ b/app/Models/Budget.php @@ -87,6 +87,7 @@ class Budget extends Model * @param string $value * * @return Budget + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ public static function routeBinder(string $value): Budget { @@ -115,6 +116,7 @@ class Budget extends Model * @param $value * * @return string + * @throws \Illuminate\Contracts\Encryption\DecryptException */ public function getNameAttribute($value) { @@ -129,6 +131,8 @@ class Budget extends Model * @codeCoverageIgnore * * @param $value + * + * @throws \Illuminate\Contracts\Encryption\EncryptException */ public function setNameAttribute($value) { diff --git a/app/Models/BudgetLimit.php b/app/Models/BudgetLimit.php index 741e2706c3..8063df7936 100644 --- a/app/Models/BudgetLimit.php +++ b/app/Models/BudgetLimit.php @@ -48,6 +48,7 @@ class BudgetLimit extends Model * @param string $value * * @return mixed + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ public static function routeBinder(string $value): BudgetLimit { diff --git a/app/Models/Category.php b/app/Models/Category.php index 38f6e3712d..f946d8bcdb 100644 --- a/app/Models/Category.php +++ b/app/Models/Category.php @@ -86,6 +86,7 @@ class Category extends Model * @param string $value * * @return Category + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ public static function routeBinder(string $value): Category { @@ -105,6 +106,7 @@ class Category extends Model * @param $value * * @return string + * @throws \Illuminate\Contracts\Encryption\DecryptException */ public function getNameAttribute($value) { @@ -119,6 +121,8 @@ class Category extends Model * @codeCoverageIgnore * * @param $value + * + * @throws \Illuminate\Contracts\Encryption\EncryptException */ public function setNameAttribute($value) { diff --git a/app/Models/ImportJob.php b/app/Models/ImportJob.php index 779d759d85..70315a5c6b 100644 --- a/app/Models/ImportJob.php +++ b/app/Models/ImportJob.php @@ -179,6 +179,7 @@ class ImportJob extends Model /** * @return string * + * @throws \Illuminate\Contracts\Encryption\DecryptException * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ public function uploadFileContents(): string diff --git a/app/Models/PiggyBank.php b/app/Models/PiggyBank.php index b0195287cf..af6461ca30 100644 --- a/app/Models/PiggyBank.php +++ b/app/Models/PiggyBank.php @@ -64,6 +64,7 @@ class PiggyBank extends Model * @param string $value * * @return PiggyBank + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ public static function routeBinder(string $value): PiggyBank { @@ -116,6 +117,7 @@ class PiggyBank extends Model * @param $value * * @return string + * @throws \Illuminate\Contracts\Encryption\DecryptException */ public function getNameAttribute($value) { @@ -202,6 +204,8 @@ class PiggyBank extends Model * @codeCoverageIgnore * * @param $value + * + * @throws \Illuminate\Contracts\Encryption\EncryptException */ public function setNameAttribute($value) { diff --git a/app/Models/Preference.php b/app/Models/Preference.php index 22db5a66dd..757e25ae42 100644 --- a/app/Models/Preference.php +++ b/app/Models/Preference.php @@ -84,6 +84,8 @@ class Preference extends Model * @codeCoverageIgnore * * @param $value + * + * @throws \Illuminate\Contracts\Encryption\EncryptException */ public function setDataAttribute($value) { diff --git a/app/Models/Rule.php b/app/Models/Rule.php index a59525674f..a7be9798ac 100644 --- a/app/Models/Rule.php +++ b/app/Models/Rule.php @@ -52,6 +52,7 @@ class Rule extends Model * @param string $value * * @return Rule + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ public static function routeBinder(string $value): Rule { diff --git a/app/Models/RuleGroup.php b/app/Models/RuleGroup.php index c57ebc4ad8..0345afb535 100644 --- a/app/Models/RuleGroup.php +++ b/app/Models/RuleGroup.php @@ -55,6 +55,7 @@ class RuleGroup extends Model * @param string $value * * @return RuleGroup + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ public static function routeBinder(string $value): RuleGroup { diff --git a/app/Models/Tag.php b/app/Models/Tag.php index be5c7819d8..8ff2aefe35 100644 --- a/app/Models/Tag.php +++ b/app/Models/Tag.php @@ -90,6 +90,7 @@ class Tag extends Model * @param string $value * * @return Tag + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ public static function routeBinder(string $value): Tag { @@ -109,6 +110,7 @@ class Tag extends Model * @param $value * * @return string + * @throws \Illuminate\Contracts\Encryption\DecryptException */ public function getDescriptionAttribute($value) { @@ -125,6 +127,7 @@ class Tag extends Model * @param $value * * @return string + * @throws \Illuminate\Contracts\Encryption\DecryptException */ public function getTagAttribute($value) { @@ -139,6 +142,8 @@ class Tag extends Model * @codeCoverageIgnore * * @param $value + * + * @throws \Illuminate\Contracts\Encryption\EncryptException */ public function setDescriptionAttribute($value) { @@ -149,6 +154,7 @@ class Tag extends Model * @codeCoverageIgnore * * @param $value + * @throws \Illuminate\Contracts\Encryption\EncryptException */ public function setTagAttribute($value) { diff --git a/app/Models/Transaction.php b/app/Models/Transaction.php index 027300de00..6e4a004b6b 100644 --- a/app/Models/Transaction.php +++ b/app/Models/Transaction.php @@ -137,6 +137,7 @@ class Transaction extends Model * @param string $value * * @return Transaction + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ public static function routeBinder(string $value): Transaction { diff --git a/app/Models/TransactionCurrency.php b/app/Models/TransactionCurrency.php index 304b45487f..ec3dc40db4 100644 --- a/app/Models/TransactionCurrency.php +++ b/app/Models/TransactionCurrency.php @@ -57,6 +57,7 @@ class TransactionCurrency extends Model * @param string $value * * @return TransactionCurrency + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ public static function routeBinder(string $value): TransactionCurrency { diff --git a/app/Models/TransactionJournal.php b/app/Models/TransactionJournal.php index 14960e29b3..5842d765c4 100644 --- a/app/Models/TransactionJournal.php +++ b/app/Models/TransactionJournal.php @@ -88,6 +88,7 @@ class TransactionJournal extends Model * @param string $value * * @return TransactionJournal + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ public static function routeBinder(string $value): TransactionJournal { @@ -169,6 +170,7 @@ class TransactionJournal extends Model * @param $value * * @return string + * @throws \Illuminate\Contracts\Encryption\DecryptException */ public function getDescriptionAttribute($value) { @@ -344,6 +346,8 @@ class TransactionJournal extends Model * @codeCoverageIgnore * * @param $value + * + * @throws \Illuminate\Contracts\Encryption\EncryptException */ public function setDescriptionAttribute($value) { diff --git a/app/Models/TransactionJournalLink.php b/app/Models/TransactionJournalLink.php index 8d216cc8ae..0675b5ce07 100644 --- a/app/Models/TransactionJournalLink.php +++ b/app/Models/TransactionJournalLink.php @@ -108,6 +108,8 @@ class TransactionJournalLink extends Model * @codeCoverageIgnore * * @param $value + * + * @throws \Illuminate\Contracts\Encryption\EncryptException */ public function setCommentAttribute($value): void { diff --git a/app/Models/TransactionType.php b/app/Models/TransactionType.php index 1ad60435b3..fa1abdf690 100644 --- a/app/Models/TransactionType.php +++ b/app/Models/TransactionType.php @@ -36,23 +36,23 @@ class TransactionType extends Model /** * */ - const WITHDRAWAL = 'Withdrawal'; + public const WITHDRAWAL = 'Withdrawal'; /** * */ - const DEPOSIT = 'Deposit'; + public const DEPOSIT = 'Deposit'; /** * */ - const TRANSFER = 'Transfer'; + public const TRANSFER = 'Transfer'; /** * */ - const OPENING_BALANCE = 'Opening balance'; + public const OPENING_BALANCE = 'Opening balance'; /** * */ - const RECONCILIATION = 'Reconciliation'; + public const RECONCILIATION = 'Reconciliation'; /** * The attributes that should be casted to native types. * @@ -71,6 +71,7 @@ class TransactionType extends Model * @param string $type * * @return Model|null|static + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ public static function routeBinder(string $type): TransactionType { diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php index f837262b3b..ca37c54489 100644 --- a/app/Repositories/Account/AccountRepository.php +++ b/app/Repositories/Account/AccountRepository.php @@ -235,6 +235,7 @@ class AccountRepository implements AccountRepositoryInterface /** * Returns the date of the very first transaction in this account. + * TODO refactor to nullable. * * @param Account $account * @@ -242,12 +243,13 @@ class AccountRepository implements AccountRepositoryInterface */ public function oldestJournalDate(Account $account): Carbon { + $result = new Carbon; $journal = $this->oldestJournal($account); - if (null === $journal->id) { - return new Carbon; + if (null !== $journal->id) { + $result = $journal->date; } - return $journal->date; + return $result; } /** @@ -262,6 +264,8 @@ class AccountRepository implements AccountRepositoryInterface * @param array $data * * @return Account + * @throws \FireflyIII\Exceptions\FireflyException + * @throws \FireflyIII\Exceptions\FireflyException */ public function store(array $data): Account { @@ -278,6 +282,8 @@ class AccountRepository implements AccountRepositoryInterface * @param array $data * * @return Account + * @throws \FireflyIII\Exceptions\FireflyException + * @throws \FireflyIII\Exceptions\FireflyException */ public function update(Account $account, array $data): Account { diff --git a/app/Repositories/Attachment/AttachmentRepository.php b/app/Repositories/Attachment/AttachmentRepository.php index 1726188161..48da0f6ee9 100644 --- a/app/Repositories/Attachment/AttachmentRepository.php +++ b/app/Repositories/Attachment/AttachmentRepository.php @@ -133,6 +133,7 @@ class AttachmentRepository implements AttachmentRepositoryInterface * * @return string * + * @throws \Illuminate\Contracts\Encryption\DecryptException * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ public function getContent(Attachment $attachment): string diff --git a/app/Repositories/Bill/BillRepository.php b/app/Repositories/Bill/BillRepository.php index 9df1cae343..11055dcafe 100644 --- a/app/Repositories/Bill/BillRepository.php +++ b/app/Repositories/Bill/BillRepository.php @@ -136,6 +136,7 @@ class BillRepository implements BillRepositoryInterface * @param Collection $accounts * * @return Collection + * @throws \InvalidArgumentException */ public function getBillsForAccounts(Collection $accounts): Collection { @@ -221,7 +222,6 @@ class BillRepository implements BillRepositoryInterface * @param Carbon $end * * @return string - * @throws \FireflyIII\Exceptions\FireflyException */ public function getBillsUnpaidInRange(Carbon $start, Carbon $end): string { @@ -276,6 +276,7 @@ class BillRepository implements BillRepositoryInterface * @param int $size * * @return LengthAwarePaginator + * @throws \InvalidArgumentException */ public function getPaginator(int $size): LengthAwarePaginator { diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.php index e49758c5e2..7df0701e48 100644 --- a/app/Repositories/Budget/BudgetRepository.php +++ b/app/Repositories/Budget/BudgetRepository.php @@ -252,6 +252,7 @@ class BudgetRepository implements BudgetRepositoryInterface * @param Budget $budget * * @return Carbon + * @throws \InvalidArgumentException */ public function firstUseDate(Budget $budget): Carbon { @@ -362,7 +363,7 @@ class BudgetRepository implements BudgetRepositoryInterface */ public function getBudgetLimits(Budget $budget, Carbon $start, Carbon $end): Collection { - $set = $budget->budgetLimits() + $set = $budget->budgetlimits() ->where( function (Builder $q5) use ($start, $end) { $q5->where( diff --git a/app/Repositories/ImportJob/ImportJobRepository.php b/app/Repositories/ImportJob/ImportJobRepository.php index fc63e67c99..a034fc64bf 100644 --- a/app/Repositories/ImportJob/ImportJobRepository.php +++ b/app/Repositories/ImportJob/ImportJobRepository.php @@ -210,6 +210,8 @@ class ImportJobRepository implements ImportJobRepositoryInterface * @param UploadedFile $file * * @return bool + * @throws \RuntimeException + * @throws \LogicException */ public function processConfiguration(ImportJob $job, UploadedFile $file): bool { @@ -247,6 +249,9 @@ class ImportJobRepository implements ImportJobRepositoryInterface * * @return bool * + * @throws \RuntimeException + * @throws \LogicException + * @throws \Illuminate\Contracts\Encryption\EncryptException * @throws \Illuminate\Contracts\Filesystem\FileNotFoundException */ public function processFile(ImportJob $job, ?UploadedFile $file): bool diff --git a/app/Repositories/Rule/RuleRepository.php b/app/Repositories/Rule/RuleRepository.php index 3d92220a51..50fa719748 100644 --- a/app/Repositories/Rule/RuleRepository.php +++ b/app/Repositories/Rule/RuleRepository.php @@ -129,13 +129,13 @@ class RuleRepository implements RuleRepositoryInterface $order = $rule->order; // find the rule with order+1 and give it order-1 - $other = $rule->ruleGroup->rules()->where('order', ($order + 1))->first(); + $other = $rule->ruleGroup->rules()->where('order', $order + 1)->first(); if ($other) { - $other->order = $other->order - 1; + --$other->order; $other->save(); } - $rule->order = ($rule->order + 1); + ++$rule->order; $rule->save(); $this->resetRulesInGroupOrder($rule->ruleGroup); @@ -152,13 +152,13 @@ class RuleRepository implements RuleRepositoryInterface $order = $rule->order; // find the rule with order-1 and give it order+1 - $other = $rule->ruleGroup->rules()->where('order', ($order - 1))->first(); + $other = $rule->ruleGroup->rules()->where('order', $order - 1)->first(); if ($other) { - $other->order = ($other->order + 1); + ++$other->order; $other->save(); } - $rule->order = ($rule->order - 1); + --$rule->order; $rule->save(); $this->resetRulesInGroupOrder($rule->ruleGroup); diff --git a/app/Repositories/RuleGroup/RuleGroupRepository.php b/app/Repositories/RuleGroup/RuleGroupRepository.php index f271e7d893..9d1268d19f 100644 --- a/app/Repositories/RuleGroup/RuleGroupRepository.php +++ b/app/Repositories/RuleGroup/RuleGroupRepository.php @@ -185,13 +185,13 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface $order = $ruleGroup->order; // find the rule with order+1 and give it order-1 - $other = $this->user->ruleGroups()->where('order', ($order + 1))->first(); + $other = $this->user->ruleGroups()->where('order', $order + 1)->first(); if ($other) { - $other->order = ($other->order - 1); + --$other->order; $other->save(); } - $ruleGroup->order = ($ruleGroup->order + 1); + ++$ruleGroup->order; $ruleGroup->save(); $this->resetRuleGroupOrder(); @@ -208,13 +208,13 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface $order = $ruleGroup->order; // find the rule with order-1 and give it order+1 - $other = $this->user->ruleGroups()->where('order', ($order - 1))->first(); + $other = $this->user->ruleGroups()->where('order', $order - 1)->first(); if ($other) { - $other->order = ($other->order + 1); + ++$other->order; $other->save(); } - $ruleGroup->order = ($ruleGroup->order - 1); + --$ruleGroup->order; $ruleGroup->save(); $this->resetRuleGroupOrder(); @@ -286,7 +286,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface 'user_id' => $this->user->id, 'title' => $data['title'], 'description' => $data['description'], - 'order' => ($order + 1), + 'order' => $order + 1, 'active' => 1, ] ); diff --git a/app/Services/Bunq/Object/DeviceServer.php b/app/Services/Bunq/Object/DeviceServer.php index 33fb1a9f94..64bf9dced0 100644 --- a/app/Services/Bunq/Object/DeviceServer.php +++ b/app/Services/Bunq/Object/DeviceServer.php @@ -47,6 +47,8 @@ class DeviceServer extends BunqObject * DeviceServer constructor. * * @param array $data + * + * @throws \InvalidArgumentException */ public function __construct(array $data) { diff --git a/app/Services/Bunq/Object/MonetaryAccountBank.php b/app/Services/Bunq/Object/MonetaryAccountBank.php index cdca32f84e..2d0fddef6b 100644 --- a/app/Services/Bunq/Object/MonetaryAccountBank.php +++ b/app/Services/Bunq/Object/MonetaryAccountBank.php @@ -74,6 +74,8 @@ class MonetaryAccountBank extends BunqObject * MonetaryAccountBank constructor. * * @param array $data + * + * @throws \InvalidArgumentException */ public function __construct(array $data) { diff --git a/app/Services/Bunq/Object/Payment.php b/app/Services/Bunq/Object/Payment.php index b64ba2ce92..a5e1763ed2 100644 --- a/app/Services/Bunq/Object/Payment.php +++ b/app/Services/Bunq/Object/Payment.php @@ -60,6 +60,8 @@ class Payment extends BunqObject * Payment constructor. * * @param array $data + * + * @throws \InvalidArgumentException */ public function __construct(array $data) { diff --git a/app/Services/Bunq/Object/UserCompany.php b/app/Services/Bunq/Object/UserCompany.php index 196445743d..fee6c445be 100644 --- a/app/Services/Bunq/Object/UserCompany.php +++ b/app/Services/Bunq/Object/UserCompany.php @@ -94,6 +94,8 @@ class UserCompany extends BunqObject * UserCompany constructor. * * @param array $data + * + * @throws \InvalidArgumentException */ public function __construct(array $data) { diff --git a/app/Services/Bunq/Object/UserLight.php b/app/Services/Bunq/Object/UserLight.php index a889ff04f4..e6ff84b504 100644 --- a/app/Services/Bunq/Object/UserLight.php +++ b/app/Services/Bunq/Object/UserLight.php @@ -56,6 +56,8 @@ class UserLight extends BunqObject * UserLight constructor. * * @param array $data + * + * @throws \InvalidArgumentException */ public function __construct(array $data) { diff --git a/app/Services/Bunq/Object/UserPerson.php b/app/Services/Bunq/Object/UserPerson.php index ee3085c09c..265c31429e 100644 --- a/app/Services/Bunq/Object/UserPerson.php +++ b/app/Services/Bunq/Object/UserPerson.php @@ -116,6 +116,8 @@ class UserPerson extends BunqObject * UserPerson constructor. * * @param array $data + * + * @throws \InvalidArgumentException */ public function __construct(array $data) { diff --git a/app/Services/Bunq/Request/BunqRequest.php b/app/Services/Bunq/Request/BunqRequest.php index 47b3842bbe..ca132487de 100644 --- a/app/Services/Bunq/Request/BunqRequest.php +++ b/app/Services/Bunq/Request/BunqRequest.php @@ -178,7 +178,7 @@ abstract class BunqRequest $userAgent = sprintf('FireflyIII v%s', config('firefly.version')); return [ - 'X-Bunq-Client-Request-Id' => uniqid('FFIII'), + 'X-Bunq-Client-Request-Id' => uniqid('FFIII', true), 'Cache-Control' => 'no-cache', 'User-Agent' => $userAgent, 'X-Bunq-Language' => 'en_US', diff --git a/app/Services/Bunq/Token/BunqToken.php b/app/Services/Bunq/Token/BunqToken.php index d1f9d83f5a..7b4ee2efe9 100644 --- a/app/Services/Bunq/Token/BunqToken.php +++ b/app/Services/Bunq/Token/BunqToken.php @@ -95,6 +95,8 @@ class BunqToken /** * @param array $response + * + * @throws \InvalidArgumentException */ protected function makeTokenFromResponse(array $response): void { diff --git a/app/Services/Internal/Support/AccountServiceTrait.php b/app/Services/Internal/Support/AccountServiceTrait.php index 9e92951945..3f06ad1f14 100644 --- a/app/Services/Internal/Support/AccountServiceTrait.php +++ b/app/Services/Internal/Support/AccountServiceTrait.php @@ -218,7 +218,7 @@ trait AccountServiceTrait */ public function storeOpposingAccount(User $user, string $name): Account { - $name = $name . ' initial balance'; + $name .= ' initial balance'; Log::debug('Going to create an opening balance opposing account.'); /** @var AccountFactory $factory */ $factory = app(AccountFactory::class); diff --git a/app/Services/Internal/Update/TransactionUpdateService.php b/app/Services/Internal/Update/TransactionUpdateService.php index 8578bd1675..6a31e71d06 100644 --- a/app/Services/Internal/Update/TransactionUpdateService.php +++ b/app/Services/Internal/Update/TransactionUpdateService.php @@ -154,8 +154,8 @@ class TransactionUpdateService */ public function updateCategory(Transaction $transaction, string $category): Transaction { - $category = $this->findCategory(0, $category); - $this->setCategory($transaction, $category); + $found = $this->findCategory(0, $category); + $this->setCategory($transaction, $found); return $transaction; } diff --git a/app/Services/Password/PwndVerifier.php b/app/Services/Password/PwndVerifier.php index b79a157327..b3ba550255 100644 --- a/app/Services/Password/PwndVerifier.php +++ b/app/Services/Password/PwndVerifier.php @@ -50,10 +50,7 @@ class PwndVerifier implements Verifier return true; } Log::debug(sprintf('Status code returned is %d', $result->status_code)); - if (404 === $result->status_code) { - return true; - } - return false; + return 404 === $result->status_code; } } diff --git a/app/Services/Spectre/Request/ListLoginsRequest.php b/app/Services/Spectre/Request/ListLoginsRequest.php index 04c3d92853..14b9761a6b 100644 --- a/app/Services/Spectre/Request/ListLoginsRequest.php +++ b/app/Services/Spectre/Request/ListLoginsRequest.php @@ -40,6 +40,8 @@ class ListLoginsRequest extends SpectreRequest /** * + * @throws \FireflyIII\Services\Spectre\Exception\SpectreException + * @throws \FireflyIII\Exceptions\FireflyException */ public function call(): void { diff --git a/app/Services/Spectre/Request/SpectreRequest.php b/app/Services/Spectre/Request/SpectreRequest.php index 6dd6b61d19..772bb52c39 100644 --- a/app/Services/Spectre/Request/SpectreRequest.php +++ b/app/Services/Spectre/Request/SpectreRequest.php @@ -55,6 +55,8 @@ abstract class SpectreRequest * * @param User $user * + * @throws \Psr\Container\NotFoundExceptionInterface + * @throws \Psr\Container\ContainerExceptionInterface * @throws \Illuminate\Container\EntryNotFoundException */ public function __construct(User $user) @@ -180,7 +182,6 @@ abstract class SpectreRequest * @return array * * @throws FireflyException - * @throws SpectreException */ protected function sendSignedSpectreGet(string $uri, array $data): array { @@ -224,7 +225,6 @@ abstract class SpectreRequest * @return array * * @throws FireflyException - * @throws SpectreException */ protected function sendSignedSpectrePost(string $uri, array $data): array { diff --git a/app/Support/Amount.php b/app/Support/Amount.php index a9d066e557..5feec11237 100644 --- a/app/Support/Amount.php +++ b/app/Support/Amount.php @@ -166,19 +166,18 @@ class Amount $cache->addProperty('getCurrencyCode'); if ($cache->has()) { return $cache->get(); // @codeCoverageIgnore - } else { - $currencyPreference = Prefs::get('currencyPreference', config('firefly.default_currency', 'EUR')); - - $currency = TransactionCurrency::where('code', $currencyPreference->data)->first(); - if ($currency) { - $cache->store($currency->code); - - return $currency->code; - } - $cache->store(config('firefly.default_currency', 'EUR')); - - return strval(config('firefly.default_currency', 'EUR')); } + $currencyPreference = Prefs::get('currencyPreference', config('firefly.default_currency', 'EUR')); + + $currency = TransactionCurrency::where('code', $currencyPreference->data)->first(); + if ($currency) { + $cache->store($currency->code); + + return $currency->code; + } + $cache->store(config('firefly.default_currency', 'EUR')); + + return (string)config('firefly.default_currency', 'EUR'); } /** diff --git a/app/Support/Binder/AccountList.php b/app/Support/Binder/AccountList.php index e667ac9a9e..2cf2052cad 100644 --- a/app/Support/Binder/AccountList.php +++ b/app/Support/Binder/AccountList.php @@ -39,6 +39,7 @@ class AccountList implements BinderInterface * @param Route $route * * @return Collection + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ public static function routeBinder(string $value, Route $route): Collection { diff --git a/app/Support/Binder/BudgetList.php b/app/Support/Binder/BudgetList.php index f02cd32765..26ba5a927f 100644 --- a/app/Support/Binder/BudgetList.php +++ b/app/Support/Binder/BudgetList.php @@ -37,6 +37,7 @@ class BudgetList implements BinderInterface * @param Route $route * * @return Collection + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ public static function routeBinder(string $value, Route $route): Collection { diff --git a/app/Support/Binder/CategoryList.php b/app/Support/Binder/CategoryList.php index 3ce93ce553..11a88681c2 100644 --- a/app/Support/Binder/CategoryList.php +++ b/app/Support/Binder/CategoryList.php @@ -37,6 +37,7 @@ class CategoryList implements BinderInterface * @param Route $route * * @return Collection + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ public static function routeBinder(string $value, Route $route): Collection { diff --git a/app/Support/Binder/CurrencyCode.php b/app/Support/Binder/CurrencyCode.php index e142ee83a6..1240a4cc8a 100644 --- a/app/Support/Binder/CurrencyCode.php +++ b/app/Support/Binder/CurrencyCode.php @@ -36,6 +36,7 @@ class CurrencyCode implements BinderInterface * @param Route $route * * @return TransactionCurrency + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ public static function routeBinder(string $value, Route $route): TransactionCurrency { diff --git a/app/Support/Binder/Date.php b/app/Support/Binder/Date.php index 5b04cfbd54..39ee1a704f 100644 --- a/app/Support/Binder/Date.php +++ b/app/Support/Binder/Date.php @@ -39,6 +39,7 @@ class Date implements BinderInterface * @param Route $route * * @return Carbon + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ public static function routeBinder(string $value, Route $route): Carbon { diff --git a/app/Support/Binder/JournalList.php b/app/Support/Binder/JournalList.php index ee556f9907..df130fd200 100644 --- a/app/Support/Binder/JournalList.php +++ b/app/Support/Binder/JournalList.php @@ -36,6 +36,7 @@ class JournalList implements BinderInterface * @param Route $route * * @return mixed + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ public static function routeBinder(string $value, Route $route): Collection { diff --git a/app/Support/Binder/TagList.php b/app/Support/Binder/TagList.php index 880a535c11..0db60e1041 100644 --- a/app/Support/Binder/TagList.php +++ b/app/Support/Binder/TagList.php @@ -39,6 +39,7 @@ class TagList implements BinderInterface * @param Route $route * * @return Collection + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ public static function routeBinder(string $value, Route $route): Collection { diff --git a/app/Support/Binder/UnfinishedJournal.php b/app/Support/Binder/UnfinishedJournal.php index 92d03ac75f..f14fdf526f 100644 --- a/app/Support/Binder/UnfinishedJournal.php +++ b/app/Support/Binder/UnfinishedJournal.php @@ -36,6 +36,7 @@ class UnfinishedJournal implements BinderInterface * @param Route $route * * @return TransactionJournal + * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ public static function routeBinder(string $value, Route $route): TransactionJournal { diff --git a/app/Support/ChartColour.php b/app/Support/ChartColour.php index ace9884d81..5f0ab48904 100644 --- a/app/Support/ChartColour.php +++ b/app/Support/ChartColour.php @@ -58,7 +58,7 @@ class ChartColour */ public static function getColour(int $index): string { - $index = $index % count(self::$colours); + $index %= count(self::$colours); $row = self::$colours[$index]; return sprintf('rgba(%d, %d, %d, 0.7)', $row[0], $row[1], $row[2]); diff --git a/app/Support/ExpandedForm.php b/app/Support/ExpandedForm.php index 560fe16bad..5f4210e65c 100644 --- a/app/Support/ExpandedForm.php +++ b/app/Support/ExpandedForm.php @@ -354,8 +354,7 @@ class ExpandedForm $value = $this->fillFieldValue($name, $value); $options['step'] = 'any'; $selectedCurrency = isset($options['currency']) ? $options['currency'] : Amt::getDefaultCurrency(); - unset($options['currency']); - unset($options['placeholder']); + unset($options['currency'], $options['placeholder']); // make sure value is formatted nicely: if (null !== $value && '' !== $value) { @@ -384,8 +383,7 @@ class ExpandedForm $value = $this->fillFieldValue($name, $value); $options['step'] = 'any'; $selectedCurrency = isset($options['currency']) ? $options['currency'] : Amt::getDefaultCurrency(); - unset($options['currency']); - unset($options['placeholder']); + unset($options['currency'], $options['placeholder']); // make sure value is formatted nicely: if (null !== $value && '' !== $value) { @@ -479,8 +477,7 @@ class ExpandedForm $options = $this->expandOptionArray($name, $label, $options); $classes = $this->getHolderClasses($name); $selected = $this->fillFieldValue($name, $selected); - unset($options['autocomplete']); - unset($options['placeholder']); + unset($options['autocomplete'], $options['placeholder']); $html = view('form.select', compact('classes', 'name', 'label', 'selected', 'options', 'list'))->render(); return $html; @@ -666,8 +663,7 @@ class ExpandedForm $options['step'] = 'any'; $defaultCurrency = isset($options['currency']) ? $options['currency'] : Amt::getDefaultCurrency(); $currencies = app('amount')->getAllCurrencies(); - unset($options['currency']); - unset($options['placeholder']); + unset($options['currency'], $options['placeholder']); // perhaps the currency has been sent to us in the field $amount_currency_id_$name (amount_currency_id_amount) $preFilled = session('preFilled'); diff --git a/app/Support/Navigation.php b/app/Support/Navigation.php index f543a706f7..8390252ad5 100644 --- a/app/Support/Navigation.php +++ b/app/Support/Navigation.php @@ -65,7 +65,7 @@ class Navigation throw new FireflyException(sprintf('Cannot do addPeriod for $repeat_freq "%s"', $repeatFreq)); } if (isset($modifierMap[$repeatFreq])) { - $add = $add * $modifierMap[$repeatFreq]; + $add *= $modifierMap[$repeatFreq]; } $function = $functionMap[$repeatFreq]; $date->$function($add); @@ -99,7 +99,7 @@ class Navigation */ $perMonthEnd = clone $end; $perMonthStart = clone $end; - $perMonthStart->startOfyear()->subYear(); + $perMonthStart->startOfYear()->subYear(); $perMonthStart = $start->lt($perMonthStart) ? $perMonthStart : $start; // loop first set: @@ -537,7 +537,7 @@ class Navigation return $date; } if (isset($modifierMap[$repeatFreq])) { - $subtract = $subtract * $modifierMap[$repeatFreq]; + $subtract *= $modifierMap[$repeatFreq]; $date->subMonths($subtract); Log::debug(sprintf('%s is in modifier map with value %d, execute subMonths with argument %d', $repeatFreq, $modifierMap[$repeatFreq], $subtract)); Log::debug(sprintf('subtractPeriod: resulting date is %s', $date->format('Y-m-d'))); diff --git a/app/Support/Steam.php b/app/Support/Steam.php index 1c5301c9ef..ffdd0c6be4 100644 --- a/app/Support/Steam.php +++ b/app/Support/Steam.php @@ -242,6 +242,7 @@ class Steam * @param $value * * @return string + * @throws \Illuminate\Contracts\Encryption\DecryptException */ public function decrypt(int $isEncrypted, string $value) { diff --git a/app/Support/Twig/AmountFormat.php b/app/Support/Twig/AmountFormat.php index 6c1afc897e..9d78bd8dfe 100644 --- a/app/Support/Twig/AmountFormat.php +++ b/app/Support/Twig/AmountFormat.php @@ -56,16 +56,6 @@ class AmountFormat extends Twig_Extension ]; } - /** - * Returns the name of the extension. - * - * @return string The extension name - */ - public function getName(): string - { - return 'FireflyIII\Support\Twig\AmountFormat'; - } - /** * @return Twig_SimpleFilter */ diff --git a/app/Support/Twig/General.php b/app/Support/Twig/General.php index 6f22a9c7f5..eb53c2311d 100644 --- a/app/Support/Twig/General.php +++ b/app/Support/Twig/General.php @@ -67,14 +67,6 @@ class General extends Twig_Extension ]; } - /** - * {@inheritdoc} - */ - public function getName(): string - { - return 'FireflyIII\Support\Twig\General'; - } - /** * Will return "active" when a part of the route matches the argument. * ie. "accounts" will match "accounts.index". diff --git a/app/Support/Twig/Journal.php b/app/Support/Twig/Journal.php index 7bb8d7dea0..d37e071a45 100644 --- a/app/Support/Twig/Journal.php +++ b/app/Support/Twig/Journal.php @@ -102,16 +102,6 @@ class Journal extends Twig_Extension return $functions; } - /** - * Returns the name of the extension. - * - * @return string The extension name - */ - public function getName(): string - { - return 'FireflyIII\Support\Twig\Journals'; - } - /** * @return Twig_SimpleFunction */ diff --git a/app/Support/Twig/PiggyBank.php b/app/Support/Twig/PiggyBank.php index 9d5d3abc8c..4b5f7dd711 100644 --- a/app/Support/Twig/PiggyBank.php +++ b/app/Support/Twig/PiggyBank.php @@ -55,13 +55,4 @@ class PiggyBank extends Twig_Extension return $functions; } - /** - * Returns the name of the extension. - * - * @return string The extension name - */ - public function getName(): string - { - return 'FireflyIII\Support\Twig\PiggyBank'; - } } diff --git a/app/Support/Twig/Rule.php b/app/Support/Twig/Rule.php index dc115318f8..bb6830bc92 100644 --- a/app/Support/Twig/Rule.php +++ b/app/Support/Twig/Rule.php @@ -103,14 +103,4 @@ class Rule extends Twig_Extension $this->allActionTriggers(), ]; } - - /** - * Returns the name of the extension. - * - * @return string The extension name - */ - public function getName(): string - { - return 'FireflyIII\Support\Twig\Rule'; - } } diff --git a/app/Support/Twig/Transaction.php b/app/Support/Twig/Transaction.php index ec20cf3c04..ffe6b046fd 100644 --- a/app/Support/Twig/Transaction.php +++ b/app/Support/Twig/Transaction.php @@ -52,14 +52,4 @@ class Transaction extends Twig_Extension return $filters; } - - /** - * Returns the name of the extension. - * - * @return string The extension name - */ - public function getName(): string - { - return 'transaction'; - } } diff --git a/app/Support/Twig/Translation.php b/app/Support/Twig/Translation.php index d910ff054e..74198da564 100644 --- a/app/Support/Twig/Translation.php +++ b/app/Support/Twig/Translation.php @@ -41,7 +41,7 @@ class Translation extends Twig_Extension $filters[] = new Twig_SimpleFilter( '_', function ($name) { - return strval(trans(sprintf('firefly.%s', $name))); + return (string)trans(sprintf('firefly.%s', $name)); }, ['is_safe' => ['html']] ); @@ -59,13 +59,6 @@ class Translation extends Twig_Extension ]; } - /** - * {@inheritdoc} - */ - public function getName(): string - { - return 'FireflyIII\Support\Twig\Translation'; - } /** * @return Twig_SimpleFunction diff --git a/app/TransactionRules/Actions/AppendDescription.php b/app/TransactionRules/Actions/AppendDescription.php index 16b9054b62..887620a62a 100644 --- a/app/TransactionRules/Actions/AppendDescription.php +++ b/app/TransactionRules/Actions/AppendDescription.php @@ -54,7 +54,7 @@ class AppendDescription implements ActionInterface public function act(TransactionJournal $journal): bool { Log::debug(sprintf('RuleAction AppendDescription appended "%s" to "%s".', $this->action->action_value, $journal->description)); - $journal->description = $journal->description . $this->action->action_value; + $journal->description .= $this->action->action_value; $journal->save(); return true; diff --git a/app/TransactionRules/Actions/AppendNotes.php b/app/TransactionRules/Actions/AppendNotes.php index 9c779760d8..b1ff09df5c 100644 --- a/app/TransactionRules/Actions/AppendNotes.php +++ b/app/TransactionRules/Actions/AppendNotes.php @@ -61,7 +61,7 @@ class AppendNotes implements ActionInterface } $notes = $dbNote->text; Log::debug(sprintf('RuleAction AppendNotes appended "%s" to "%s".', $this->action->action_value, $notes)); - $notes = $notes . $this->action->action_value; + $notes .= $this->action->action_value; $dbNote->text = $notes; $dbNote->save(); $journal->save(); diff --git a/app/TransactionRules/TransactionMatcher.php b/app/TransactionRules/TransactionMatcher.php index d08ac27ad6..3ad8033ec5 100644 --- a/app/TransactionRules/TransactionMatcher.php +++ b/app/TransactionRules/TransactionMatcher.php @@ -184,6 +184,7 @@ class TransactionMatcher * @param Processor $processor * * @return Collection + * @throws \FireflyIII\Exceptions\FireflyException */ private function runProcessor(Processor $processor): Collection { diff --git a/app/TransactionRules/Triggers/NotesContain.php b/app/TransactionRules/Triggers/NotesContain.php index cb6b324455..e17babae41 100644 --- a/app/TransactionRules/Triggers/NotesContain.php +++ b/app/TransactionRules/Triggers/NotesContain.php @@ -72,7 +72,7 @@ final class NotesContain extends AbstractTrigger implements TriggerInterface */ public function triggered(TransactionJournal $journal): bool { - $search = trim(strtolower($this->triggerValue)); + $search = strtolower(trim($this->triggerValue)); if (0 === strlen($search)) { Log::debug(sprintf('RuleTrigger NotesContain for journal #%d: "%s" is empty, return false.', $journal->id, $search)); diff --git a/app/Transformers/AccountTransformer.php b/app/Transformers/AccountTransformer.php index 64ad4b7f0b..6f64a76e39 100644 --- a/app/Transformers/AccountTransformer.php +++ b/app/Transformers/AccountTransformer.php @@ -41,6 +41,7 @@ use Symfony\Component\HttpFoundation\ParameterBag; */ class AccountTransformer extends TransformerAbstract { + /** @noinspection ClassOverridesFieldOfSuperClassInspection */ /** * List of resources possible to include. * @@ -180,7 +181,7 @@ class AccountTransformer extends TransformerAbstract if ($type === AccountType::ASSET) { /** @var AccountRepositoryInterface $repository */ $repository = app(AccountRepositoryInterface::class); - $repository->setuser($account->user); + $repository->setUser($account->user); $amount = $repository->getOpeningBalanceAmount($account); $openingBalance = is_null($amount) ? null : round($amount, $decimalPlaces); $openingBalanceDate = $repository->getOpeningBalanceDate($account); diff --git a/app/Validation/FireflyValidator.php b/app/Validation/FireflyValidator.php index c004d77fde..061857c346 100644 --- a/app/Validation/FireflyValidator.php +++ b/app/Validation/FireflyValidator.php @@ -93,11 +93,8 @@ class FireflyValidator extends Validator return true; } $count = DB::table($parameters[0])->where('user_id', auth()->user()->id)->where($field, $value)->count(); - if (1 === $count) { - return true; - } - return false; + return 1 === $count; } /** @@ -234,11 +231,8 @@ class FireflyValidator extends Validator return true; } $count = DB::table($parameters[0])->where($field, $value)->count(); - if (1 === $count) { - return true; - } - return false; + return 1 === $count; } /** @@ -323,7 +317,7 @@ class FireflyValidator extends Validator /** @var TriggerInterface $class */ $class = $classes[$name]; - return !($class::willMatchEverything($value)); + return !$class::willMatchEverything($value); } return false; diff --git a/resources/lang/de_DE/firefly.php b/resources/lang/de_DE/firefly.php index e9ef9b03ae..6dec49ad86 100644 --- a/resources/lang/de_DE/firefly.php +++ b/resources/lang/de_DE/firefly.php @@ -455,8 +455,7 @@ return [ 'preferences_security' => 'Sicherheit', 'preferences_layout' => 'Anordnung', 'pref_home_show_deposits' => 'Einnahmen auf dem Startbildschirm anzeigen', - 'pref_home_show_deposits_info' => 'Der Startbildschirm zeigt schon Ihre Ausgabenkonten an. -Sollen zusätzlich Ihre Girokonten angezeigt werden?', + 'pref_home_show_deposits_info' => 'Der Startbildschirm zeigt schon Ihre Ausgabenkonten an. Sollen zusätzlich Ihre Girokonten angezeigt werden?', 'pref_home_do_show_deposits' => 'Ja, zeige sie an', 'successful_count' => 'davon :count erfolgreich', 'list_page_size_title' => 'Einträge pro Seite',