diff --git a/app/Api/V1/Requests/TransactionRequest.php b/app/Api/V1/Requests/TransactionRequest.php index 9d94981a85..979502d98a 100644 --- a/app/Api/V1/Requests/TransactionRequest.php +++ b/app/Api/V1/Requests/TransactionRequest.php @@ -435,11 +435,15 @@ class TransactionRequest extends Request $destinationAccount = $this->assetAccountExists($validator, $destinationId, $destinationName, $idField, $nameField); break; default: - throw new FireflyException(sprintf('The validator cannot handle transaction type "%s" in validateAccountInformation().', $data['type'])); + // @codeCoverageIgnoreStart + throw new FireflyException( + sprintf('The validator cannot handle transaction type "%s" in validateAccountInformation().', $data['type']) + ); + // @codeCoverageIgnoreEnd } // add some errors in case of same account submitted: - if (!is_null($sourceAccount) && !is_null($destinationAccount) && $sourceAccount->id === $destinationAccount->id) { + if (null !== $sourceAccount && null !== $destinationAccount && $sourceAccount->id === $destinationAccount->id) { $validator->errors()->add($idField, trans('validation.source_equals_destination')); } } @@ -463,7 +467,7 @@ class TransactionRequest extends Request // the journal may exist in the request: /** @var Transaction $transaction */ $transaction = $this->route()->parameter('transaction'); - if (is_null($transaction)) { + if (null === $transaction) { return; } $data['type'] = strtolower($transaction->transactionJournal->transactionType->type); diff --git a/app/Console/Commands/EncryptFile.php b/app/Console/Commands/EncryptFile.php index 5a712b0c56..b94cd1d981 100644 --- a/app/Console/Commands/EncryptFile.php +++ b/app/Console/Commands/EncryptFile.php @@ -54,6 +54,8 @@ class EncryptFile extends Command /** * Execute the console command. + * + * @throws \Illuminate\Contracts\Encryption\EncryptException */ public function handle() { diff --git a/app/Export/ExpandedProcessor.php b/app/Export/ExpandedProcessor.php index e90f135d5b..7f56bb91cd 100644 --- a/app/Export/ExpandedProcessor.php +++ b/app/Export/ExpandedProcessor.php @@ -124,7 +124,7 @@ class ExpandedProcessor implements ProcessorInterface $currencyId = $ibans[$accountId]['currency_id'] ?? 0; $opposingCurrencyId = $ibans[$opposingId]['currency_id'] ?? 0; $transaction->notes = $notes[$journalId] ?? ''; - $transaction->tags = join(',', $tags[$journalId] ?? []); + $transaction->tags = implode(',', $tags[$journalId] ?? []); $transaction->account_number = $ibans[$accountId]['accountNumber'] ?? ''; $transaction->account_bic = $ibans[$accountId]['BIC'] ?? ''; $transaction->account_currency_code = $currencies[$currencyId] ?? ''; @@ -331,6 +331,7 @@ class ExpandedProcessor implements ProcessorInterface * @param array $array * * @return array + * @throws \Illuminate\Contracts\Encryption\DecryptException */ private function getTags(array $array): array { diff --git a/app/Factory/AccountFactory.php b/app/Factory/AccountFactory.php index 13ddf7a626..53e2f98afe 100644 --- a/app/Factory/AccountFactory.php +++ b/app/Factory/AccountFactory.php @@ -75,7 +75,7 @@ class AccountFactory } $newAccount = Account::create($databaseData); - $this->updateMetadata($newAccount, $data); + $this->updateMetaData($newAccount, $data); if ($this->validIBData($data) && $type->type === AccountType::ASSET) { $this->updateIB($newAccount, $data); @@ -117,6 +117,8 @@ class AccountFactory * @param string $accountType * * @return Account + * @throws \FireflyIII\Exceptions\FireflyException + * @throws \FireflyIII\Exceptions\FireflyException */ public function findOrCreate(string $accountName, string $accountType): Account { diff --git a/app/Handlers/Events/VersionCheckEventHandler.php b/app/Handlers/Events/VersionCheckEventHandler.php index 8b6b097c0e..eb082de4a7 100644 --- a/app/Handlers/Events/VersionCheckEventHandler.php +++ b/app/Handlers/Events/VersionCheckEventHandler.php @@ -109,8 +109,6 @@ class VersionCheckEventHandler // flash info session()->flash('info', $string); } - - return; } } diff --git a/app/Helpers/Attachments/AttachmentHelper.php b/app/Helpers/Attachments/AttachmentHelper.php index cdc3df2c85..6ade273a6a 100644 --- a/app/Helpers/Attachments/AttachmentHelper.php +++ b/app/Helpers/Attachments/AttachmentHelper.php @@ -155,6 +155,7 @@ class AttachmentHelper implements AttachmentHelperInterface * @param Model $model * * @return Attachment + * @throws \Illuminate\Contracts\Encryption\EncryptException */ protected function processFile(UploadedFile $file, Model $model): Attachment { @@ -206,7 +207,7 @@ class AttachmentHelper implements AttachmentHelperInterface Log::debug('Now in validMime()'); $mime = e($file->getMimeType()); $name = e($file->getClientOriginalName()); - Log::debug(sprintf('Name is %, and mime is %s', $name, $mime)); + Log::debug(sprintf('Name is %s, and mime is %s', $name, $mime)); Log::debug('Valid mimes are', $this->allowedMimes); if (!in_array($mime, $this->allowedMimes)) { diff --git a/app/Helpers/Collection/BalanceLine.php b/app/Helpers/Collection/BalanceLine.php index 9bbacd7be6..c1de6d9211 100644 --- a/app/Helpers/Collection/BalanceLine.php +++ b/app/Helpers/Collection/BalanceLine.php @@ -35,15 +35,15 @@ class BalanceLine /** * */ - const ROLE_DEFAULTROLE = 1; + public const ROLE_DEFAULTROLE = 1; /** * */ - const ROLE_TAGROLE = 2; + public const ROLE_TAGROLE = 2; /** * */ - const ROLE_DIFFROLE = 3; + public const ROLE_DIFFROLE = 3; /** @var Collection */ protected $balanceEntries; diff --git a/app/Helpers/Collector/JournalCollector.php b/app/Helpers/Collector/JournalCollector.php index 032cc8d708..5463421094 100644 --- a/app/Helpers/Collector/JournalCollector.php +++ b/app/Helpers/Collector/JournalCollector.php @@ -834,6 +834,7 @@ class JournalCollector implements JournalCollectorInterface /** * + * @throws \InvalidArgumentException */ private function joinOpposingTables() { diff --git a/app/Helpers/Help/Help.php b/app/Helpers/Help/Help.php index fb5cc1f4c9..db7d34fef9 100644 --- a/app/Helpers/Help/Help.php +++ b/app/Helpers/Help/Help.php @@ -37,7 +37,7 @@ class Help implements HelpInterface /** * */ - const CACHEKEY = 'help_%s_%s'; + public const CACHEKEY = 'help_%s_%s'; /** @var string */ protected $userAgent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36'; diff --git a/app/Helpers/Report/PopupReport.php b/app/Helpers/Report/PopupReport.php index e55db58a4e..188e21ec70 100644 --- a/app/Helpers/Report/PopupReport.php +++ b/app/Helpers/Report/PopupReport.php @@ -57,11 +57,8 @@ class PopupReport implements PopupReportInterface return $journals->filter( function (Transaction $transaction) { $tags = $transaction->transactionJournal->tags()->where('tagMode', 'balancingAct')->count(); - if (0 === $tags) { - return true; - } - return false; + return 0 === $tags; } ); } diff --git a/app/Helpers/Report/ReportHelper.php b/app/Helpers/Report/ReportHelper.php index 210e4683d4..5359c309a2 100644 --- a/app/Helpers/Report/ReportHelper.php +++ b/app/Helpers/Report/ReportHelper.php @@ -119,6 +119,7 @@ class ReportHelper implements ReportHelperInterface * @param Carbon $date * * @return array + * @throws \InvalidArgumentException */ public function listOfMonths(Carbon $date): array { diff --git a/app/Http/Controllers/Account/ReconcileController.php b/app/Http/Controllers/Account/ReconcileController.php index 46aa0460a0..4ac431f472 100644 --- a/app/Http/Controllers/Account/ReconcileController.php +++ b/app/Http/Controllers/Account/ReconcileController.php @@ -96,7 +96,7 @@ class ReconcileController extends Controller $preFilled = [ 'date' => $this->repository->getJournalDate($journal, null), 'category' => $this->repository->getJournalCategoryName($journal), - 'tags' => join(',', $journal->tags->pluck('tag')->toArray()), + 'tags' => implode(',', $journal->tags->pluck('tag')->toArray()), 'amount' => $pTransaction->amount, ]; @@ -319,7 +319,7 @@ class ReconcileController extends Controller 'category_name' => null, ], ], - 'notes' => join(', ', $data['transactions']), + 'notes' => implode(', ', $data['transactions']), ]; $journal = $repository->store($journalData); diff --git a/app/Http/Controllers/Admin/LinkController.php b/app/Http/Controllers/Admin/LinkController.php index 0955f00521..aa2078da42 100644 --- a/app/Http/Controllers/Admin/LinkController.php +++ b/app/Http/Controllers/Admin/LinkController.php @@ -76,6 +76,7 @@ class LinkController extends Controller * @param LinkType $linkType * * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View + * @throws \RuntimeException */ public function delete(Request $request, LinkTypeRepositoryInterface $repository, LinkType $linkType) { @@ -108,6 +109,7 @@ class LinkController extends Controller * @param LinkType $linkType * * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector + * @throws \RuntimeException */ public function destroy(Request $request, LinkTypeRepositoryInterface $repository, LinkType $linkType) { @@ -126,6 +128,7 @@ class LinkController extends Controller * @param LinkType $linkType * * @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View + * @throws \RuntimeException */ public function edit(Request $request, LinkType $linkType) { @@ -184,6 +187,7 @@ class LinkController extends Controller * @param LinkTypeRepositoryInterface $repository * * @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector + * @throws \RuntimeException */ public function store(LinkTypeFormRequest $request, LinkTypeRepositoryInterface $repository) { @@ -212,6 +216,7 @@ class LinkController extends Controller * @param LinkType $linkType * * @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector + * @throws \RuntimeException */ public function update(LinkTypeFormRequest $request, LinkTypeRepositoryInterface $repository, LinkType $linkType) { diff --git a/app/Http/Controllers/Admin/UpdateController.php b/app/Http/Controllers/Admin/UpdateController.php index 9777f9a5bf..423de9cb6b 100644 --- a/app/Http/Controllers/Admin/UpdateController.php +++ b/app/Http/Controllers/Admin/UpdateController.php @@ -61,6 +61,8 @@ class UpdateController extends Controller /** * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View + * @throws \Psr\Container\NotFoundExceptionInterface + * @throws \Psr\Container\ContainerExceptionInterface * @throws \Illuminate\Container\EntryNotFoundException */ public function index() diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 8b76348ea1..1c621d6866 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -65,6 +65,7 @@ class LoginController extends Controller * * @return \Illuminate\Http\Response|\Symfony\Component\HttpFoundation\Response * + * @throws \RuntimeException * @throws \Illuminate\Validation\ValidationException */ public function login(Request $request) @@ -102,6 +103,7 @@ class LoginController extends Controller * @param CookieJar $cookieJar * * @return $this|\Illuminate\Http\RedirectResponse + * @throws \RuntimeException */ public function logout(Request $request, CookieJar $cookieJar) { @@ -119,6 +121,7 @@ class LoginController extends Controller * @param Request $request * * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View + * @throws \RuntimeException */ public function showLoginForm(Request $request) { diff --git a/app/Http/Controllers/Auth/TwoFactorController.php b/app/Http/Controllers/Auth/TwoFactorController.php index d6b984b756..b54e9fdf8a 100644 --- a/app/Http/Controllers/Auth/TwoFactorController.php +++ b/app/Http/Controllers/Auth/TwoFactorController.php @@ -40,6 +40,7 @@ class TwoFactorController extends Controller * * @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View * + * @throws \RuntimeException * @throws FireflyException * * @SuppressWarnings(PHPMD.CyclomaticComplexity) @@ -91,6 +92,7 @@ class TwoFactorController extends Controller * * @return mixed * @SuppressWarnings(PHPMD.UnusedFormalParameter) // it's unused but the class does some validation. + * @throws \RuntimeException */ public function postIndex(TokenFormRequest $request, CookieJar $cookieJar) { diff --git a/app/Http/Controllers/Import/ConfigurationController.php b/app/Http/Controllers/Import/ConfigurationController.php index 8450c26aab..3c3df4f9c5 100644 --- a/app/Http/Controllers/Import/ConfigurationController.php +++ b/app/Http/Controllers/Import/ConfigurationController.php @@ -97,6 +97,7 @@ class ConfigurationController extends Controller * * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector * + * @throws \RuntimeException * @throws FireflyException */ public function post(Request $request, ImportJob $job) diff --git a/app/Http/Controllers/Import/IndexController.php b/app/Http/Controllers/Import/IndexController.php index 4d898d3f0d..6216cc0045 100644 --- a/app/Http/Controllers/Import/IndexController.php +++ b/app/Http/Controllers/Import/IndexController.php @@ -71,7 +71,7 @@ class IndexController extends Controller */ public function create(string $bank) { - if (true === !(config(sprintf('import.enabled.%s', $bank)))) { + if (true === !config(sprintf('import.enabled.%s', $bank))) { throw new FireflyException(sprintf('Cannot import from "%s" at this time.', $bank)); // @codeCoverageIgnore } diff --git a/app/Http/Controllers/Import/PrerequisitesController.php b/app/Http/Controllers/Import/PrerequisitesController.php index a7326f04bf..81065bb670 100644 --- a/app/Http/Controllers/Import/PrerequisitesController.php +++ b/app/Http/Controllers/Import/PrerequisitesController.php @@ -66,7 +66,7 @@ class PrerequisitesController extends Controller */ public function index(string $bank) { - if (true === !(config(sprintf('import.enabled.%s', $bank)))) { + if (true === !config(sprintf('import.enabled.%s', $bank))) { throw new FireflyException(sprintf('Cannot import from "%s" at this time.', $bank)); // @codeCoverageIgnore } $class = strval(config(sprintf('import.prerequisites.%s', $bank))); @@ -103,13 +103,14 @@ class PrerequisitesController extends Controller * * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector * + * @throws \RuntimeException * @throws FireflyException */ public function post(Request $request, string $bank) { Log::debug(sprintf('Now in postPrerequisites for %s', $bank)); - if (true === !(config(sprintf('import.enabled.%s', $bank)))) { + if (true === !config(sprintf('import.enabled.%s', $bank))) { throw new FireflyException(sprintf('Cannot import from "%s" at this time.', $bank)); // @codeCoverageIgnore } diff --git a/app/Http/Controllers/Json/BoxController.php b/app/Http/Controllers/Json/BoxController.php index 01ad80dabf..b084a12a00 100644 --- a/app/Http/Controllers/Json/BoxController.php +++ b/app/Http/Controllers/Json/BoxController.php @@ -244,6 +244,15 @@ class BoxController extends Controller if ($currencyId !== 0) { $accountCurrency = $currencyRepos->findNull($currencyId); } + + // if the account is a credit card, subtract the virtual balance from the balance, + // to better reflect that this is not money that is actually "yours". + $role = (string)$repository->getMetaValue($account, 'accountRole'); + $virtualBalance = (string)$account->virtual_balance; + if ($role === 'ccAsset' && $virtualBalance !== '' && (float)$virtualBalance > 0) { + $balance = bcsub($balance, $virtualBalance); + } + if (!isset($netWorth[$accountCurrency->id])) { $netWorth[$accountCurrency->id]['currency'] = $accountCurrency; $netWorth[$accountCurrency->id]['sum'] = '0'; diff --git a/app/Http/Controllers/System/InstallController.php b/app/Http/Controllers/System/InstallController.php index 0e7864d422..cd9bb698f0 100644 --- a/app/Http/Controllers/System/InstallController.php +++ b/app/Http/Controllers/System/InstallController.php @@ -35,6 +35,7 @@ use phpseclib\Crypt\RSA; */ class InstallController extends Controller { + /** @noinspection MagicMethodsValidityInspection */ /** * InstallController constructor. */ @@ -66,7 +67,7 @@ class InstallController extends Controller Passport::keyPath('oauth-private.key'), ]; - if ((file_exists($publicKey) || file_exists($privateKey))) { + if (file_exists($publicKey) || file_exists($privateKey)) { return response()->json(['OK']); } diff --git a/app/Http/Middleware/AuthenticateTwoFactor.php b/app/Http/Middleware/AuthenticateTwoFactor.php index 97ed9bd749..e78a155a0a 100644 --- a/app/Http/Middleware/AuthenticateTwoFactor.php +++ b/app/Http/Middleware/AuthenticateTwoFactor.php @@ -56,6 +56,8 @@ class AuthenticateTwoFactor * @param array ...$guards * * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|mixed + * @throws \Psr\Container\NotFoundExceptionInterface + * @throws \Psr\Container\ContainerExceptionInterface * @throws \Illuminate\Container\EntryNotFoundException */ public function handle($request, Closure $next, ...$guards) diff --git a/app/Http/Middleware/Binder.php b/app/Http/Middleware/Binder.php index 7b018ac80a..3e58b67dee 100644 --- a/app/Http/Middleware/Binder.php +++ b/app/Http/Middleware/Binder.php @@ -63,6 +63,7 @@ class Binder * * @return mixed * + * @throws \LogicException */ public function handle($request, Closure $next, ...$guards) { diff --git a/app/Http/Middleware/IsDemoUser.php b/app/Http/Middleware/IsDemoUser.php index f03d64a97b..bd9e708bd5 100644 --- a/app/Http/Middleware/IsDemoUser.php +++ b/app/Http/Middleware/IsDemoUser.php @@ -39,6 +39,7 @@ class IsDemoUser * @param \Closure $next * * @return mixed + * @throws \RuntimeException */ public function handle(Request $request, Closure $next) { diff --git a/app/Http/Requests/AccountFormRequest.php b/app/Http/Requests/AccountFormRequest.php index ec67e26a6c..e380bcd243 100644 --- a/app/Http/Requests/AccountFormRequest.php +++ b/app/Http/Requests/AccountFormRequest.php @@ -68,9 +68,9 @@ class AccountFormRequest extends Request */ public function rules() { - $accountRoles = join(',', config('firefly.accountRoles')); - $types = join(',', array_keys(config('firefly.subTitlesByIdentifier'))); - $ccPaymentTypes = join(',', array_keys(config('firefly.ccTypes'))); + $accountRoles = implode(',', config('firefly.accountRoles')); + $types = implode(',', array_keys(config('firefly.subTitlesByIdentifier'))); + $ccPaymentTypes = implode(',', array_keys(config('firefly.ccTypes'))); $rules = [ 'name' => 'required|min:1|uniqueAccountForUser', 'openingBalance' => 'numeric|required_with:openingBalanceDate|nullable', diff --git a/app/Http/Requests/ExportFormRequest.php b/app/Http/Requests/ExportFormRequest.php index 3d60ac7696..7a3057987d 100644 --- a/app/Http/Requests/ExportFormRequest.php +++ b/app/Http/Requests/ExportFormRequest.php @@ -40,13 +40,14 @@ class ExportFormRequest extends Request /** * @return array + * @throws \InvalidArgumentException */ public function rules() { $sessionFirst = clone session('first'); $first = $sessionFirst->subDay()->format('Y-m-d'); $today = Carbon::create()->addDay()->format('Y-m-d'); - $formats = join(',', array_keys(config('firefly.export_formats'))); + $formats = implode(',', array_keys(config('firefly.export_formats'))); // fixed diff --git a/app/Http/Requests/JournalLinkRequest.php b/app/Http/Requests/JournalLinkRequest.php index 725f71e40c..3e12a28686 100644 --- a/app/Http/Requests/JournalLinkRequest.php +++ b/app/Http/Requests/JournalLinkRequest.php @@ -46,7 +46,7 @@ class JournalLinkRequest extends Request $return = []; $linkType = $this->get('link_type'); $parts = explode('_', $linkType); - $return['link_type_id'] = intval($parts[0]); + $return['link_type_id'] = (int)$parts[0]; $return['transaction_journal_id'] = $this->integer('link_journal_id'); $return['notes'] = strlen($this->string('notes')) > 0 ? $this->string('notes') : ''; $return['direction'] = $parts[1]; @@ -70,7 +70,7 @@ class JournalLinkRequest extends Request $combinations[] = sprintf('%d_inward', $type->id); $combinations[] = sprintf('%d_outward', $type->id); } - $string = join(',', $combinations); + $string = implode(',', $combinations); // fixed return [ diff --git a/app/Http/Requests/ReportFormRequest.php b/app/Http/Requests/ReportFormRequest.php index 1808b793bc..4c2632a54e 100644 --- a/app/Http/Requests/ReportFormRequest.php +++ b/app/Http/Requests/ReportFormRequest.php @@ -30,6 +30,7 @@ use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; use FireflyIII\Repositories\Category\CategoryRepositoryInterface; use FireflyIII\Repositories\Tag\TagRepositoryInterface; use Illuminate\Support\Collection; +use Log; /** * Class CategoryFormRequest. @@ -124,6 +125,7 @@ class ReportFormRequest extends Request $date = new Carbon($parts[1]); // @codeCoverageIgnoreStart } catch (Exception $e) { + Log::error(sprintf('"%s" is not a valid date range.', $range)); throw new FireflyException(sprintf('"%s" is not a valid date range.', $range)); // @codeCoverageIgnoreEnd } @@ -170,6 +172,7 @@ class ReportFormRequest extends Request $date = new Carbon($parts[0]); // @codeCoverageIgnoreStart } catch (Exception $e) { + Log::error(sprintf('"%s" is not a valid date range.', $range)); throw new FireflyException(sprintf('"%s" is not a valid date range.', $range)); // @codeCoverageIgnoreEnd } diff --git a/app/Http/Requests/RuleFormRequest.php b/app/Http/Requests/RuleFormRequest.php index 110639df3e..0890a543e4 100644 --- a/app/Http/Requests/RuleFormRequest.php +++ b/app/Http/Requests/RuleFormRequest.php @@ -70,7 +70,7 @@ class RuleFormRequest extends Request $validActions = array_keys(config('firefly.rule-actions')); // some actions require text: - $contextActions = join(',', config('firefly.rule-actions-text')); + $contextActions = implode(',', config('firefly.rule-actions-text')); $titleRule = 'required|between:1,100|uniqueObjectForUser:rules,title'; if (null !== $repository->find(intval($this->get('id')))->id) { @@ -82,9 +82,9 @@ class RuleFormRequest extends Request 'stop_processing' => 'boolean', 'rule_group_id' => 'required|belongsToUser:rule_groups', 'trigger' => 'required|in:store-journal,update-journal', - 'rule-trigger.*' => 'required|in:' . join(',', $validTriggers), + 'rule-trigger.*' => 'required|in:' . implode(',', $validTriggers), 'rule-trigger-value.*' => 'required|min:1|ruleTriggerValue', - 'rule-action.*' => 'required|in:' . join(',', $validActions), + 'rule-action.*' => 'required|in:' . implode(',', $validActions), ]; // since Laravel does not support this stuff yet, here's a trick. for ($i = 0; $i < 10; ++$i) { diff --git a/app/Http/Requests/SelectTransactionsRequest.php b/app/Http/Requests/SelectTransactionsRequest.php index 249613892a..082e4dd746 100644 --- a/app/Http/Requests/SelectTransactionsRequest.php +++ b/app/Http/Requests/SelectTransactionsRequest.php @@ -41,6 +41,7 @@ class SelectTransactionsRequest extends Request /** * @return array + * @throws \InvalidArgumentException */ public function rules() { diff --git a/app/Http/Requests/SplitJournalFormRequest.php b/app/Http/Requests/SplitJournalFormRequest.php index 8001c5e80a..14aa681378 100644 --- a/app/Http/Requests/SplitJournalFormRequest.php +++ b/app/Http/Requests/SplitJournalFormRequest.php @@ -154,11 +154,9 @@ class SplitJournalFormRequest extends Request $transactions = $data['transactions'] ?? []; /** @var array $array */ foreach ($transactions as $array) { - if ($array['destination_id'] !== null && $array['source_id'] !== null) { - if ($array['destination_id'] === $array['source_id']) { - $validator->errors()->add('journal_source_account_id', trans('validation.source_equals_destination')); - $validator->errors()->add('journal_destination_account_id', trans('validation.source_equals_destination')); - } + if ($array['destination_id'] !== null && $array['source_id'] !== null && $array['destination_id'] === $array['source_id']) { + $validator->errors()->add('journal_source_account_id', trans('validation.source_equals_destination')); + $validator->errors()->add('journal_destination_account_id', trans('validation.source_equals_destination')); } } diff --git a/app/Http/Requests/TestRuleFormRequest.php b/app/Http/Requests/TestRuleFormRequest.php index 4064306cbd..c0f90fcd98 100644 --- a/app/Http/Requests/TestRuleFormRequest.php +++ b/app/Http/Requests/TestRuleFormRequest.php @@ -45,7 +45,7 @@ class TestRuleFormRequest extends Request // fixed $validTriggers = array_keys(config('firefly.rule-triggers')); $rules = [ - 'rule-trigger.*' => 'required|min:1|in:' . join(',', $validTriggers), + 'rule-trigger.*' => 'required|min:1|in:' . implode(',', $validTriggers), 'rule-trigger-value.*' => 'required|min:1|ruleTriggerValue', ]; diff --git a/app/Http/Requests/TokenFormRequest.php b/app/Http/Requests/TokenFormRequest.php index cc3aeb4c33..fd247f593e 100644 --- a/app/Http/Requests/TokenFormRequest.php +++ b/app/Http/Requests/TokenFormRequest.php @@ -43,10 +43,8 @@ class TokenFormRequest extends Request public function rules() { // fixed - $rules = [ + return [ 'code' => 'required|2faCode', ]; - - return $rules; } } diff --git a/security.txt b/security.txt new file mode 100644 index 0000000000..78f431c07d --- /dev/null +++ b/security.txt @@ -0,0 +1,4 @@ +Contact: mailto:thegrumpydictator@gmail.com +Encryption: https://keybase.io/jc5/pgp_keys.asc?fingerprint=90f546f13b81b67a1baa5dddc16961e655e74b5e +Acknowledgements: https://github.com/firefly-iii/firefly-iii +Signature: https://firefly-iii.org/.well-known/security.txt.sig