diff --git a/app/Repositories/TransactionGroup/TransactionGroupRepository.php b/app/Repositories/TransactionGroup/TransactionGroupRepository.php index 10e609204a..1eea5c9b20 100644 --- a/app/Repositories/TransactionGroup/TransactionGroupRepository.php +++ b/app/Repositories/TransactionGroup/TransactionGroupRepository.php @@ -65,7 +65,6 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface $journal = $this->user->transactionJournals()->find($journalId); return $journal->attachments()->count(); - } /** @@ -73,7 +72,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface */ public function destroy(TransactionGroup $group): void { - $service = new TransactionGroupDestroyService; + $service = new TransactionGroupDestroyService(); $service->destroy($group); } @@ -181,7 +180,6 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface $current['notes'] = $repository->getNoteText($attachment); $current['journal_title'] = $attachment->attachable->description; // @phpstan-ignore-line $result[$journalId][] = $current; - } return $result; @@ -198,8 +196,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface { $return = []; $journals = $group->transactionJournals->pluck('id')->toArray(); - $set = TransactionJournalLink - ::where( + $set = TransactionJournalLink::where( static function (Builder $q) use ($journals) { $q->whereIn('source_id', $journals); $q->orWhereIn('destination_id', $journals); @@ -262,7 +259,6 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface } if (TransactionType::WITHDRAWAL !== $type) { $return = app('amount')->formatAnything($currency, $amount); - } return $return; @@ -319,8 +315,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface */ public function getMetaDateFields(int $journalId, array $fields): NullArrayObject { - $query = DB - ::table('journal_meta') + $query = DB::table('journal_meta') ->where('transaction_journal_id', $journalId) ->whereIn('name', $fields) ->whereNull('deleted_at') @@ -344,8 +339,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface */ public function getMetaFields(int $journalId, array $fields): NullArrayObject { - $query = DB - ::table('journal_meta') + $query = DB::table('journal_meta') ->where('transaction_journal_id', $journalId) ->whereIn('name', $fields) ->whereNull('deleted_at') @@ -369,8 +363,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface public function getNoteText(int $journalId): ?string { /** @var Note|null $note */ - $note = Note - ::where('noteable_id', $journalId) + $note = Note::where('noteable_id', $journalId) ->where('noteable_type', TransactionJournal::class) ->first(); if (null === $note) { @@ -394,8 +387,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface $return = []; $journals = $group->transactionJournals->pluck('id')->toArray(); $currency = app('amount')->getDefaultCurrencyByUser($this->user); - $data = PiggyBankEvent - ::whereIn('transaction_journal_id', $journals) + $data = PiggyBankEvent::whereIn('transaction_journal_id', $journals) ->with('piggyBank', 'piggyBank.account') ->get(['piggy_bank_events.*']); /** @var PiggyBankEvent $row */ @@ -404,8 +396,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface continue; } // get currency preference. - $currencyPreference = AccountMeta - ::where('account_id', $row->piggyBank->account_id) + $currencyPreference = AccountMeta::where('account_id', $row->piggyBank->account_id) ->where('name', 'currency_id') ->first(); if (null !== $currencyPreference) { @@ -448,8 +439,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface */ public function getTags(int $journalId): array { - $result = DB - ::table('tag_transaction_journal') + $result = DB::table('tag_transaction_journal') ->leftJoin('tags', 'tag_transaction_journal.tag_id', '=', 'tags.id') ->where('tag_transaction_journal.transaction_journal_id', $journalId) ->orderBy('tags.tag', 'ASC') diff --git a/app/Repositories/TransactionGroup/TransactionGroupRepositoryInterface.php b/app/Repositories/TransactionGroup/TransactionGroupRepositoryInterface.php index fed0bca69c..9d3900071f 100644 --- a/app/Repositories/TransactionGroup/TransactionGroupRepositoryInterface.php +++ b/app/Repositories/TransactionGroup/TransactionGroupRepositoryInterface.php @@ -176,5 +176,4 @@ interface TransactionGroupRepositoryInterface * @return TransactionGroup */ public function update(TransactionGroup $transactionGroup, array $data): TransactionGroup; - } diff --git a/app/Repositories/TransactionType/TransactionTypeRepository.php b/app/Repositories/TransactionType/TransactionTypeRepository.php index 68db902f6f..62e8071169 100644 --- a/app/Repositories/TransactionType/TransactionTypeRepository.php +++ b/app/Repositories/TransactionType/TransactionTypeRepository.php @@ -32,7 +32,6 @@ use Log; */ class TransactionTypeRepository implements TransactionTypeRepositoryInterface { - /** * @param TransactionType|null $type * @param string|null $typeString diff --git a/app/Repositories/User/UserRepository.php b/app/Repositories/User/UserRepository.php index 3770c1b550..baa06ead7e 100644 --- a/app/Repositories/User/UserRepository.php +++ b/app/Repositories/User/UserRepository.php @@ -274,7 +274,7 @@ class UserRepository implements UserRepositoryInterface { $now = Carbon::now(); $now->addDays(2); - $invitee = new InvitedUser; + $invitee = new InvitedUser(); $invitee->user()->associate($user); $invitee->invite_code = Str::random(64); $invitee->email = $email; @@ -353,7 +353,6 @@ class UserRepository implements UserRepositoryInterface $user->blocked = false; $user->blocked_code = ''; $user->save(); - } /** diff --git a/app/Repositories/User/UserRepositoryInterface.php b/app/Repositories/User/UserRepositoryInterface.php index cf5a22d59d..040ca46f7c 100644 --- a/app/Repositories/User/UserRepositoryInterface.php +++ b/app/Repositories/User/UserRepositoryInterface.php @@ -32,7 +32,6 @@ use Illuminate\Support\Collection; */ interface UserRepositoryInterface { - /** * Returns a collection of all users. * diff --git a/app/Repositories/Webhook/WebhookRepositoryInterface.php b/app/Repositories/Webhook/WebhookRepositoryInterface.php index 3fe28ca2e7..5ed9281c35 100644 --- a/app/Repositories/Webhook/WebhookRepositoryInterface.php +++ b/app/Repositories/Webhook/WebhookRepositoryInterface.php @@ -98,5 +98,4 @@ interface WebhookRepositoryInterface * @return Webhook */ public function update(Webhook $webhook, array $data): Webhook; - } diff --git a/app/Rules/BelongsUser.php b/app/Rules/BelongsUser.php index e8050c4d27..bbf924795f 100644 --- a/app/Rules/BelongsUser.php +++ b/app/Rules/BelongsUser.php @@ -154,7 +154,6 @@ class BelongsUser implements Rule if (PiggyBank::class === $class) { $objects = PiggyBank::leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id') ->where('accounts.user_id', '=', auth()->user()->id)->get(['piggy_banks.*']); - } if (PiggyBank::class !== $class) { $objects = $class::where('user_id', '=', auth()->user()->id)->get(); diff --git a/app/Rules/IsBoolean.php b/app/Rules/IsBoolean.php index cf8331948f..f4e034829b 100644 --- a/app/Rules/IsBoolean.php +++ b/app/Rules/IsBoolean.php @@ -61,7 +61,7 @@ class IsBoolean implements Rule if (is_int($value) && 1 === $value) { return true; } - if (is_string($value) && in_array($value, ['0', '1', 'true', 'false', 'on', 'off', 'yes', 'no', 'y', 'n'])) { + if (is_string($value) && in_array($value, ['0', '1', 'true', 'false', 'on', 'off', 'yes', 'no', 'y', 'n'], true)) { return true; } diff --git a/app/Rules/IsDateOrTime.php b/app/Rules/IsDateOrTime.php index cd888864b5..63c5a63139 100644 --- a/app/Rules/IsDateOrTime.php +++ b/app/Rules/IsDateOrTime.php @@ -35,7 +35,6 @@ use Log; */ class IsDateOrTime implements Rule { - /** * Get the validation error message. * diff --git a/app/Rules/UniqueAccountNumber.php b/app/Rules/UniqueAccountNumber.php index 94a2354a43..32b5e80474 100644 --- a/app/Rules/UniqueAccountNumber.php +++ b/app/Rules/UniqueAccountNumber.php @@ -101,7 +101,10 @@ class UniqueAccountNumber implements Rule Log::debug( sprintf( 'account number "%s" is in use with %d account(s) of type "%s", which is too much for expected type "%s"', - $value, $count, $type, $this->expectedType + $value, + $count, + $type, + $this->expectedType ) ); @@ -147,8 +150,7 @@ class UniqueAccountNumber implements Rule */ private function countHits(string $type, string $accountNumber): int { - $query = AccountMeta - ::leftJoin('accounts', 'accounts.id', '=', 'account_meta.account_id') + $query = AccountMeta::leftJoin('accounts', 'accounts.id', '=', 'account_meta.account_id') ->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id') ->where('accounts.user_id', auth()->user()->id) ->where('account_types.type', $type) diff --git a/app/Rules/UniqueIban.php b/app/Rules/UniqueIban.php index ae94b4f528..6b807e04b9 100644 --- a/app/Rules/UniqueIban.php +++ b/app/Rules/UniqueIban.php @@ -98,7 +98,10 @@ class UniqueIban implements Rule Log::debug( sprintf( 'IBAN "%s" is in use with %d account(s) of type "%s", which is too much for expected type "%s"', - $value, $count, $type, $this->expectedType + $value, + $count, + $type, + $this->expectedType ) ); diff --git a/app/Rules/ValidRecurrenceRepetitionType.php b/app/Rules/ValidRecurrenceRepetitionType.php index bbe95af3b2..f8c1d0188f 100644 --- a/app/Rules/ValidRecurrenceRepetitionType.php +++ b/app/Rules/ValidRecurrenceRepetitionType.php @@ -32,7 +32,6 @@ use Illuminate\Contracts\Validation\Rule; */ class ValidRecurrenceRepetitionType implements Rule { - /** * Get the validation error message. * @@ -60,7 +59,7 @@ class ValidRecurrenceRepetitionType implements Rule } //monthly,17 //ndom,3,7 - if (in_array(substr($value, 0, 6), ['yearly', 'weekly'])) { + if (in_array(substr($value, 0, 6), ['yearly', 'weekly'], true)) { return true; } if (str_starts_with($value, 'monthly')) { diff --git a/app/Rules/ValidRecurrenceRepetitionValue.php b/app/Rules/ValidRecurrenceRepetitionValue.php index f9a4f8b50f..f9fd59b45f 100644 --- a/app/Rules/ValidRecurrenceRepetitionValue.php +++ b/app/Rules/ValidRecurrenceRepetitionValue.php @@ -35,7 +35,6 @@ use Log; */ class ValidRecurrenceRepetitionValue implements Rule { - /** * Get the validation error message. * diff --git a/app/Services/FireflyIIIOrg/Update/UpdateRequest.php b/app/Services/FireflyIIIOrg/Update/UpdateRequest.php index 285541c19e..9dd876f513 100644 --- a/app/Services/FireflyIIIOrg/Update/UpdateRequest.php +++ b/app/Services/FireflyIIIOrg/Update/UpdateRequest.php @@ -36,7 +36,6 @@ use Log; */ class UpdateRequest implements UpdateRequestInterface { - /** * @param string $channel * @@ -83,7 +82,7 @@ class UpdateRequest implements UpdateRequestInterface $url = config('firefly.update_endpoint'); Log::debug(sprintf('Going to call %s', $url)); try { - $client = new Client; + $client = new Client(); $options = [ 'headers' => [ 'User-Agent' => sprintf('FireflyIII/%s/%s', config('firefly.version'), $channel), @@ -110,7 +109,6 @@ class UpdateRequest implements UpdateRequestInterface $body = (string) $res->getBody(); try { $json = json_decode($body, true, 512, JSON_THROW_ON_ERROR); - } catch (JsonException $e) { Log::error('Body is not valid JSON'); Log::error($body); diff --git a/app/Services/FireflyIIIOrg/Update/UpdateRequestInterface.php b/app/Services/FireflyIIIOrg/Update/UpdateRequestInterface.php index 779fc05b46..de0e8f294b 100644 --- a/app/Services/FireflyIIIOrg/Update/UpdateRequestInterface.php +++ b/app/Services/FireflyIIIOrg/Update/UpdateRequestInterface.php @@ -35,5 +35,4 @@ interface UpdateRequestInterface * @return array */ public function getUpdateInformation(string $channel): array; - } diff --git a/app/Services/Internal/Destroy/AccountDestroyService.php b/app/Services/Internal/Destroy/AccountDestroyService.php index ee5aafe5b0..85f733529e 100644 --- a/app/Services/Internal/Destroy/AccountDestroyService.php +++ b/app/Services/Internal/Destroy/AccountDestroyService.php @@ -91,8 +91,7 @@ class AccountDestroyService Log::debug(sprintf('Found opening balance journal with ID #%d', $journalId)); // get transactions with this journal (should be just one): - $transactions = Transaction - ::where('transaction_journal_id', $journalId) + $transactions = Transaction::where('transaction_journal_id', $journalId) ->where('account_id', '!=', $account->id) ->get(); /** @var Transaction $transaction */ @@ -159,7 +158,6 @@ class AccountDestroyService */ private function destroyJournals(Account $account): void { - /** @var JournalDestroyService $service */ $service = app(JournalDestroyService::class); @@ -181,8 +179,7 @@ class AccountDestroyService */ private function destroyRecurrences(Account $account): void { - $recurrences = RecurrenceTransaction:: - where( + $recurrences = RecurrenceTransaction::where( static function (Builder $q) use ($account) { $q->where('source_id', $account->id); $q->orWhere('destination_id', $account->id); @@ -195,5 +192,4 @@ class AccountDestroyService $destroyService->destroyById((int) $recurrenceId); } } - } diff --git a/app/Services/Internal/Destroy/BillDestroyService.php b/app/Services/Internal/Destroy/BillDestroyService.php index bc97716159..6f2f7df2ba 100644 --- a/app/Services/Internal/Destroy/BillDestroyService.php +++ b/app/Services/Internal/Destroy/BillDestroyService.php @@ -43,5 +43,4 @@ class BillDestroyService // @ignoreException } } - } diff --git a/app/Services/Internal/Destroy/BudgetDestroyService.php b/app/Services/Internal/Destroy/BudgetDestroyService.php index e7b1deb515..307ea0a7ef 100644 --- a/app/Services/Internal/Destroy/BudgetDestroyService.php +++ b/app/Services/Internal/Destroy/BudgetDestroyService.php @@ -39,7 +39,6 @@ class BudgetDestroyService */ public function destroy(Budget $budget): void { - try { $budget->delete(); } catch (Exception $e) { // @phpstan-ignore-line diff --git a/app/Services/Internal/Destroy/CurrencyDestroyService.php b/app/Services/Internal/Destroy/CurrencyDestroyService.php index a655c82919..0cb278d5ea 100644 --- a/app/Services/Internal/Destroy/CurrencyDestroyService.php +++ b/app/Services/Internal/Destroy/CurrencyDestroyService.php @@ -38,12 +38,10 @@ class CurrencyDestroyService */ public function destroy(TransactionCurrency $currency): void { - try { $currency->delete(); } catch (Exception $e) { // @phpstan-ignore-line // @ignoreException } } - } diff --git a/app/Services/Internal/Destroy/JournalDestroyService.php b/app/Services/Internal/Destroy/JournalDestroyService.php index 841f39a89b..36d32873ef 100644 --- a/app/Services/Internal/Destroy/JournalDestroyService.php +++ b/app/Services/Internal/Destroy/JournalDestroyService.php @@ -95,11 +95,8 @@ class JournalDestroyService $group->delete(); } } - } catch (Exception $e) { // @phpstan-ignore-line // @ignoreException } - } - } diff --git a/app/Services/Internal/Destroy/RecurrenceDestroyService.php b/app/Services/Internal/Destroy/RecurrenceDestroyService.php index 5a4ac788c5..c86b10d249 100644 --- a/app/Services/Internal/Destroy/RecurrenceDestroyService.php +++ b/app/Services/Internal/Destroy/RecurrenceDestroyService.php @@ -45,7 +45,6 @@ class RecurrenceDestroyService return; } $this->destroy($recurrence); - } /** @@ -82,5 +81,4 @@ class RecurrenceDestroyService // @ignoreException } } - } diff --git a/app/Services/Internal/Destroy/TransactionGroupDestroyService.php b/app/Services/Internal/Destroy/TransactionGroupDestroyService.php index c5e79feaa4..efc2806178 100644 --- a/app/Services/Internal/Destroy/TransactionGroupDestroyService.php +++ b/app/Services/Internal/Destroy/TransactionGroupDestroyService.php @@ -33,7 +33,6 @@ use FireflyIII\Models\TransactionGroup; */ class TransactionGroupDestroyService { - /** * @param TransactionGroup $transactionGroup */ @@ -50,5 +49,4 @@ class TransactionGroupDestroyService // @ignoreException } } - } diff --git a/app/Services/Internal/Support/AccountServiceTrait.php b/app/Services/Internal/Support/AccountServiceTrait.php index 0b8dc83bbc..3809d579b6 100644 --- a/app/Services/Internal/Support/AccountServiceTrait.php +++ b/app/Services/Internal/Support/AccountServiceTrait.php @@ -118,8 +118,8 @@ trait AccountServiceTrait // remove currency_id if necessary. $type = $account->accountType->type; $list = config('firefly.valid_currency_account_types'); - if(!in_array($type, $list, true)) { - $pos = array_search('currency_id', $fields); + if (!in_array($type, $list, true)) { + $pos = array_search('currency_id', $fields, true); if ($pos !== false) { unset($fields[$pos]); } @@ -147,7 +147,6 @@ trait AccountServiceTrait // if the field is set but NULL, skip it. // if the field is set but "", update it. if (array_key_exists($field, $data) && null !== $data[$field]) { - // convert boolean value: if (is_bool($data[$field]) && false === $data[$field]) { $data[$field] = 0; @@ -184,7 +183,7 @@ trait AccountServiceTrait } $dbNote = $account->notes()->first(); if (null === $dbNote) { - $dbNote = new Note; + $dbNote = new Note(); $dbNote->noteable()->associate($account); } $dbNote->text = trim($note); diff --git a/app/Services/Internal/Support/BillServiceTrait.php b/app/Services/Internal/Support/BillServiceTrait.php index c992e0b4e7..9aba82b7a0 100644 --- a/app/Services/Internal/Support/BillServiceTrait.php +++ b/app/Services/Internal/Support/BillServiceTrait.php @@ -36,7 +36,6 @@ use Log; */ trait BillServiceTrait { - /** * @param Bill $bill * @param string $oldName @@ -90,5 +89,4 @@ trait BillServiceTrait return true; } - } diff --git a/app/Services/Internal/Support/CreditRecalculateService.php b/app/Services/Internal/Support/CreditRecalculateService.php index e67346304d..71e739f01d 100644 --- a/app/Services/Internal/Support/CreditRecalculateService.php +++ b/app/Services/Internal/Support/CreditRecalculateService.php @@ -22,10 +22,8 @@ declare(strict_types=1); - namespace FireflyIII\Services\Internal\Support; - use FireflyIII\Exceptions\FireflyException; use FireflyIII\Factory\AccountMetaFactory; use FireflyIII\Models\Account; @@ -110,11 +108,11 @@ class CreditRecalculateService // destination or source must be liability. $valid = config('firefly.valid_liabilities'); - if (in_array($destination->accountType->type, $valid)) { + if (in_array($destination->accountType->type, $valid, true)) { Log::debug(sprintf('Dest account type is "%s", include it.', $destination->accountType->type)); $this->work[] = $destination; } - if (in_array($source->accountType->type, $valid)) { + if (in_array($source->accountType->type, $valid, true)) { Log::debug(sprintf('Src account type is "%s", include it.', $source->accountType->type)); $this->work[] = $source; } @@ -170,7 +168,7 @@ class CreditRecalculateService private function processAccount(): void { $valid = config('firefly.valid_liabilities'); - if (in_array($this->account->accountType->type, $valid)) { + if (in_array($this->account->accountType->type, $valid, true)) { Log::debug(sprintf('Account type is "%s", include it.', $this->account->accountType->type)); $this->work[] = $this->account; } @@ -290,6 +288,4 @@ class CreditRecalculateService { $this->group = $group; } - - } diff --git a/app/Services/Internal/Support/JournalServiceTrait.php b/app/Services/Internal/Support/JournalServiceTrait.php index f52d5be1b8..0fa4a89b3a 100644 --- a/app/Services/Internal/Support/JournalServiceTrait.php +++ b/app/Services/Internal/Support/JournalServiceTrait.php @@ -206,13 +206,13 @@ trait JournalServiceTrait Log::debug( sprintf( 'Was given %s account #%d ("%s") so will simply return that.', - $account->accountType->type, $account->id, $account->name - + $account->accountType->type, + $account->id, + $account->name ) ); } if (null === $account) { - // final attempt, create it. if (AccountType::ASSET === $preferredType) { throw new FireflyException(sprintf('TransactionFactory: Cannot create asset account with these values: %s', json_encode($data))); @@ -258,7 +258,6 @@ trait JournalServiceTrait $metaFactory = app(AccountMetaFactory::class); $metaFactory->create(['account_id' => $account->id, 'name' => 'account_number', 'data' => $data['number']]); } - } return $account; @@ -385,7 +384,7 @@ trait JournalServiceTrait $note = $journal->notes()->first(); if ('' !== $notes) { if (null === $note) { - $note = new Note; + $note = new Note(); $note->noteable()->associate($journal); } $note->text = $notes; diff --git a/app/Services/Internal/Support/LocationServiceTrait.php b/app/Services/Internal/Support/LocationServiceTrait.php index 74b4e6cdf0..c2e1766e68 100644 --- a/app/Services/Internal/Support/LocationServiceTrait.php +++ b/app/Services/Internal/Support/LocationServiceTrait.php @@ -42,7 +42,7 @@ trait LocationServiceTrait { $data['store_location'] = $data['store_location'] ?? false; if ($data['store_location']) { - $location = new Location; + $location = new Location(); $location->latitude = $data['latitude'] ?? config('firefly.default_location.latitude'); $location->longitude = $data['longitude'] ?? config('firefly.default_location.longitude'); $location->zoom_level = $data['zoom_level'] ?? config('firefly.default_location.zoom_level'); @@ -54,5 +54,4 @@ trait LocationServiceTrait return null; } - } diff --git a/app/Services/Internal/Support/RecurringTransactionTrait.php b/app/Services/Internal/Support/RecurringTransactionTrait.php index 4eb3cb9c93..9ca2fc2154 100644 --- a/app/Services/Internal/Support/RecurringTransactionTrait.php +++ b/app/Services/Internal/Support/RecurringTransactionTrait.php @@ -97,7 +97,6 @@ trait RecurringTransactionTrait 'weekend' => $array['weekend'] ?? 1, ] ); - } } @@ -181,7 +180,6 @@ trait RecurringTransactionTrait if (array_key_exists('tags', $array) && is_array($array['tags'])) { $this->updateTags($transaction, $array['tags']); } - } } @@ -226,11 +224,9 @@ trait RecurringTransactionTrait if (!in_array($expectedType, $cannotCreate, true)) { try { $result = $factory->findOrCreate($accountName, $expectedType); - } catch (FireflyException $e) { Log::error($e->getMessage()); } - } } @@ -252,7 +248,7 @@ trait RecurringTransactionTrait $meta = $transaction->recurrenceTransactionMeta()->where('name', 'budget_id')->first(); if (null === $meta) { - $meta = new RecurrenceTransactionMeta; + $meta = new RecurrenceTransactionMeta(); $meta->rt_id = $transaction->id; $meta->name = 'budget_id'; } @@ -275,7 +271,7 @@ trait RecurringTransactionTrait $meta = $transaction->recurrenceTransactionMeta()->where('name', 'bill_id')->first(); if (null === $meta) { - $meta = new RecurrenceTransactionMeta; + $meta = new RecurrenceTransactionMeta(); $meta->rt_id = $transaction->id; $meta->name = 'bill_id'; } @@ -304,7 +300,7 @@ trait RecurringTransactionTrait $meta = $transaction->recurrenceTransactionMeta()->where('name', 'category_id')->first(); if (null === $meta) { - $meta = new RecurrenceTransactionMeta; + $meta = new RecurrenceTransactionMeta(); $meta->rt_id = $transaction->id; $meta->name = 'category_id'; } diff --git a/app/Services/Internal/Update/AccountUpdateService.php b/app/Services/Internal/Update/AccountUpdateService.php index 77f3ef7c38..09df1a6b78 100644 --- a/app/Services/Internal/Update/AccountUpdateService.php +++ b/app/Services/Internal/Update/AccountUpdateService.php @@ -270,7 +270,7 @@ class AccountUpdateService if (!(null === $data['latitude'] && null === $data['longitude'] && null === $data['zoom_level'])) { $location = $this->accountRepository->getLocation($account); if (null === $location) { - $location = new Location; + $location = new Location(); $location->locatable()->associate($account); } diff --git a/app/Services/Internal/Update/BillUpdateService.php b/app/Services/Internal/Update/BillUpdateService.php index 500538cc44..eae4a4ad13 100644 --- a/app/Services/Internal/Update/BillUpdateService.php +++ b/app/Services/Internal/Update/BillUpdateService.php @@ -40,7 +40,8 @@ use Log; */ class BillUpdateService { - use BillServiceTrait, CreatesObjectGroups; + use BillServiceTrait; + use CreatesObjectGroups; protected User $user; @@ -203,7 +204,6 @@ class BillUpdateService $bill->order = $newOrder; $bill->save(); } - } /** @@ -239,7 +239,6 @@ class BillUpdateService } $this->updateRules($rules, $ruleTriggerKey, $oldData[$field], $newData[$field]); } - } /** diff --git a/app/Services/Internal/Update/CategoryUpdateService.php b/app/Services/Internal/Update/CategoryUpdateService.php index 95128dba5c..d7ce1936f5 100644 --- a/app/Services/Internal/Update/CategoryUpdateService.php +++ b/app/Services/Internal/Update/CategoryUpdateService.php @@ -130,8 +130,7 @@ class CategoryUpdateService */ private function updateRecurrences(string $oldName, string $newName): void { - RecurrenceTransactionMeta - ::leftJoin('recurrences_transactions', 'rt_meta.rt_id', '=', 'recurrences_transactions.id') + RecurrenceTransactionMeta::leftJoin('recurrences_transactions', 'rt_meta.rt_id', '=', 'recurrences_transactions.id') ->leftJoin('recurrences', 'recurrences.id', '=', 'recurrences_transactions.recurrence_id') ->where('recurrences.user_id', $this->user->id) ->where('rt_meta.name', 'category_name') @@ -165,11 +164,10 @@ class CategoryUpdateService } $dbNote = $category->notes()->first(); if (null === $dbNote) { - $dbNote = new Note; + $dbNote = new Note(); $dbNote->noteable()->associate($category); } $dbNote->text = trim($note); $dbNote->save(); } - } diff --git a/app/Services/Internal/Update/CurrencyUpdateService.php b/app/Services/Internal/Update/CurrencyUpdateService.php index 4c6219d97c..07e678d810 100644 --- a/app/Services/Internal/Update/CurrencyUpdateService.php +++ b/app/Services/Internal/Update/CurrencyUpdateService.php @@ -64,5 +64,4 @@ class CurrencyUpdateService return $currency; } - } diff --git a/app/Services/Internal/Update/GroupCloneService.php b/app/Services/Internal/Update/GroupCloneService.php index 1b5746e51f..66001d78ea 100644 --- a/app/Services/Internal/Update/GroupCloneService.php +++ b/app/Services/Internal/Update/GroupCloneService.php @@ -108,7 +108,7 @@ class GroupCloneService // clone linked piggy banks /** @var PiggyBankEvent $event */ $event = $journal->piggyBankEvents()->first(); - if(null !== $event) { + if (null !== $event) { $piggyBank = $event->piggyBank; $factory = app(PiggyBankEventFactory::class); $factory->create($newJournal, $piggyBank); @@ -136,11 +136,11 @@ class GroupCloneService { $newNote = $note->replicate(); $newNote->text .= sprintf( - "\n\n%s", trans('firefly.clones_journal_x', ['description' => $newJournal->description, 'id' => $oldGroupId]) + "\n\n%s", + trans('firefly.clones_journal_x', ['description' => $newJournal->description, 'id' => $oldGroupId]) ); $newNote->noteable_id = $newJournal->id; $newNote->save(); - } /** diff --git a/app/Services/Internal/Update/GroupUpdateService.php b/app/Services/Internal/Update/GroupUpdateService.php index 9a7e1151d2..2d2345e6ab 100644 --- a/app/Services/Internal/Update/GroupUpdateService.php +++ b/app/Services/Internal/Update/GroupUpdateService.php @@ -227,5 +227,4 @@ class GroupUpdateService return $collection->first(); } - } diff --git a/app/Services/Internal/Update/JournalUpdateService.php b/app/Services/Internal/Update/JournalUpdateService.php index 2938ad17b9..8b28b2b562 100644 --- a/app/Services/Internal/Update/JournalUpdateService.php +++ b/app/Services/Internal/Update/JournalUpdateService.php @@ -456,7 +456,9 @@ class JournalUpdateService Log::debug( sprintf( 'Trying to change journal #%d from a %s to a %s.', - $this->transactionJournal->id, $this->transactionJournal->transactionType->type, $type + $this->transactionJournal->id, + $this->transactionJournal->transactionType->type, + $type ) ); @@ -483,10 +485,10 @@ class JournalUpdateService { $type = $this->transactionJournal->transactionType->type; if (( - array_key_exists('bill_id', $this->data) - || array_key_exists('bill_name', $this->data) - ) - && TransactionType::WITHDRAWAL === $type + array_key_exists('bill_id', $this->data) + || array_key_exists('bill_name', $this->data) + ) + && TransactionType::WITHDRAWAL === $type ) { $billId = (int) ($this->data['bill_id'] ?? 0); $billName = (string) ($this->data['bill_name'] ?? ''); diff --git a/app/Services/Internal/Update/RecurrenceUpdateService.php b/app/Services/Internal/Update/RecurrenceUpdateService.php index b4cd593f95..55518862c4 100644 --- a/app/Services/Internal/Update/RecurrenceUpdateService.php +++ b/app/Services/Internal/Update/RecurrenceUpdateService.php @@ -42,7 +42,8 @@ use Log; */ class RecurrenceUpdateService { - use TransactionTypeTrait, RecurringTransactionTrait; + use TransactionTypeTrait; + use RecurringTransactionTrait; private User $user; diff --git a/app/Services/Webhook/StandardWebhookSender.php b/app/Services/Webhook/StandardWebhookSender.php index 94e7f7b78f..6b1bc1dae3 100644 --- a/app/Services/Webhook/StandardWebhookSender.php +++ b/app/Services/Webhook/StandardWebhookSender.php @@ -63,7 +63,7 @@ class StandardWebhookSender implements WebhookSenderInterface Log::error('Did not send message because of a Firefly III Exception.'); Log::error($e->getMessage()); Log::error($e->getTraceAsString()); - $attempt = new WebhookAttempt; + $attempt = new WebhookAttempt(); $attempt->webhookMessage()->associate($this->message); $attempt->status_code = 0; $attempt->logs = sprintf('Exception: %s', $e->getMessage()); @@ -83,7 +83,7 @@ class StandardWebhookSender implements WebhookSenderInterface Log::error('Did not send message because of a JSON error.'); Log::error($e->getMessage()); Log::error($e->getTraceAsString()); - $attempt = new WebhookAttempt; + $attempt = new WebhookAttempt(); $attempt->webhookMessage()->associate($this->message); $attempt->status_code = 0; $attempt->logs = sprintf('Json error: %s', $e->getMessage()); @@ -105,7 +105,7 @@ class StandardWebhookSender implements WebhookSenderInterface 'timeout' => 10, ], ]; - $client = new Client; + $client = new Client(); try { $res = $client->request('POST', $this->message->webhook->url, $options); $this->message->sent = true; @@ -119,7 +119,7 @@ class StandardWebhookSender implements WebhookSenderInterface $this->message->sent = false; $this->message->save(); - $attempt = new WebhookAttempt; + $attempt = new WebhookAttempt(); $attempt->webhookMessage()->associate($this->message); $attempt->status_code = $e->hasResponse() ? $e->getResponse()->getStatusCode() : 0; $attempt->logs = $logs; diff --git a/app/Support/Amount.php b/app/Support/Amount.php index a6e16091ed..8eb6416e64 100644 --- a/app/Support/Amount.php +++ b/app/Support/Amount.php @@ -117,7 +117,7 @@ class Amount */ public function getCurrencyCode(): string { - $cache = new CacheProperties; + $cache = new CacheProperties(); $cache->addProperty('getCurrencyCode'); if ($cache->has()) { return $cache->get(); @@ -155,7 +155,7 @@ class Amount */ public function getDefaultCurrencyByUser(User $user): TransactionCurrency { - $cache = new CacheProperties; + $cache = new CacheProperties(); $cache->addProperty('getDefaultCurrency'); $cache->addProperty($user->id); if ($cache->has()) { diff --git a/app/Support/Authentication/RemoteUserGuard.php b/app/Support/Authentication/RemoteUserGuard.php index c77435c832..2044856b99 100644 --- a/app/Support/Authentication/RemoteUserGuard.php +++ b/app/Support/Authentication/RemoteUserGuard.php @@ -38,8 +38,8 @@ use Log; class RemoteUserGuard implements Guard { protected Application $application; - protected $provider; - protected $user; + protected $provider; + protected $user; /** * Create a new authentication guard. diff --git a/app/Support/Authentication/RemoteUserProvider.php b/app/Support/Authentication/RemoteUserProvider.php index c67555b5a9..835fd0a500 100644 --- a/app/Support/Authentication/RemoteUserProvider.php +++ b/app/Support/Authentication/RemoteUserProvider.php @@ -37,7 +37,6 @@ use Str; */ class RemoteUserProvider implements UserProvider { - /** * @inheritDoc */ @@ -65,7 +64,7 @@ class RemoteUserProvider implements UserProvider ] ); // if this is the first user, give them admin as well. - if(1 === User::count()) { + if (1 === User::count()) { $roleObject = Role::where('name', 'owner')->first(); $user->roles()->attach($roleObject); } diff --git a/app/Support/Binder/AccountList.php b/app/Support/Binder/AccountList.php index b6f09d676b..2034ba5f2d 100644 --- a/app/Support/Binder/AccountList.php +++ b/app/Support/Binder/AccountList.php @@ -33,7 +33,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; */ class AccountList implements BinderInterface { - /** * @param string $value * @param Route $route @@ -45,7 +44,7 @@ class AccountList implements BinderInterface public static function routeBinder(string $value, Route $route): Collection { if (auth()->check()) { - $collection = new Collection; + $collection = new Collection(); if ('allAssetAccounts' === $value) { /** @var Collection $collection */ $collection = auth()->user()->accounts() @@ -70,6 +69,6 @@ class AccountList implements BinderInterface } } Log::error(sprintf('Trying to show account list (%s), but user is not logged in or list is empty.', $route->uri)); - throw new NotFoundHttpException; + throw new NotFoundHttpException(); } } diff --git a/app/Support/Binder/BudgetList.php b/app/Support/Binder/BudgetList.php index d07b1feee6..97b240fcd1 100644 --- a/app/Support/Binder/BudgetList.php +++ b/app/Support/Binder/BudgetList.php @@ -44,7 +44,6 @@ class BudgetList implements BinderInterface public static function routeBinder(string $value, Route $route): Collection { if (auth()->check()) { - if ('allBudgets' === $value) { return auth()->user()->budgets()->where('active', true) ->orderBy('order', 'ASC') @@ -57,7 +56,7 @@ class BudgetList implements BinderInterface if (empty($list)) { Log::warning('Budget list count is zero, return 404.'); - throw new NotFoundHttpException; + throw new NotFoundHttpException(); } @@ -69,15 +68,14 @@ class BudgetList implements BinderInterface // add empty budget if applicable. if (in_array(0, $list, true)) { - $collection->push(new Budget); + $collection->push(new Budget()); } if ($collection->count() > 0) { - return $collection; } } Log::warning('BudgetList fallback to 404.'); - throw new NotFoundHttpException; + throw new NotFoundHttpException(); } } diff --git a/app/Support/Binder/CLIToken.php b/app/Support/Binder/CLIToken.php index 7877c20280..7825e0cd5a 100644 --- a/app/Support/Binder/CLIToken.php +++ b/app/Support/Binder/CLIToken.php @@ -34,7 +34,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; */ class CLIToken implements BinderInterface { - /** * @param string $value * @param Route $route @@ -62,6 +61,6 @@ class CLIToken implements BinderInterface } } Log::error(sprintf('Recognized no users by access token "%s"', $value)); - throw new NotFoundHttpException; + throw new NotFoundHttpException(); } } diff --git a/app/Support/Binder/CategoryList.php b/app/Support/Binder/CategoryList.php index 56c2f0ce34..65b3f7024e 100644 --- a/app/Support/Binder/CategoryList.php +++ b/app/Support/Binder/CategoryList.php @@ -51,7 +51,7 @@ class CategoryList implements BinderInterface $list = array_unique(array_map('\intval', explode(',', $value))); if (empty($list)) { - throw new NotFoundHttpException; + throw new NotFoundHttpException(); } /** @var Collection $collection */ @@ -61,13 +61,13 @@ class CategoryList implements BinderInterface // add empty category if applicable. if (in_array(0, $list, true)) { - $collection->push(new Category); + $collection->push(new Category()); } if ($collection->count() > 0) { return $collection; } } - throw new NotFoundHttpException; + throw new NotFoundHttpException(); } } diff --git a/app/Support/Binder/CurrencyCode.php b/app/Support/Binder/CurrencyCode.php index 50ecd16b34..a790308322 100644 --- a/app/Support/Binder/CurrencyCode.php +++ b/app/Support/Binder/CurrencyCode.php @@ -46,6 +46,6 @@ class CurrencyCode implements BinderInterface return $currency; } } - throw new NotFoundHttpException; + throw new NotFoundHttpException(); } } diff --git a/app/Support/Binder/Date.php b/app/Support/Binder/Date.php index d458b343f5..ed021b72f3 100644 --- a/app/Support/Binder/Date.php +++ b/app/Support/Binder/Date.php @@ -73,7 +73,7 @@ class Date implements BinderInterface $result = new Carbon($value); } catch (Exception $e) { // @phpstan-ignore-line Log::error(sprintf('Could not parse date "%s" for user #%d: %s', $value, auth()->user()->id, $e->getMessage())); - throw new NotFoundHttpException; + throw new NotFoundHttpException(); } return $result; diff --git a/app/Support/Binder/DynamicConfigKey.php b/app/Support/Binder/DynamicConfigKey.php index a9a6bc0730..e3fb1c608d 100644 --- a/app/Support/Binder/DynamicConfigKey.php +++ b/app/Support/Binder/DynamicConfigKey.php @@ -31,7 +31,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; */ class DynamicConfigKey { - public static array $accepted = [ 'configuration.is_demo_site', @@ -52,7 +51,6 @@ class DynamicConfigKey if (in_array($value, self::$accepted, true)) { return $value; } - throw new NotFoundHttpException; + throw new NotFoundHttpException(); } - } diff --git a/app/Support/Binder/EitherConfigKey.php b/app/Support/Binder/EitherConfigKey.php index 476ac8613e..f41db15cbf 100644 --- a/app/Support/Binder/EitherConfigKey.php +++ b/app/Support/Binder/EitherConfigKey.php @@ -68,6 +68,6 @@ class EitherConfigKey if (in_array($value, self::$static, true) || in_array($value, DynamicConfigKey::$accepted, true)) { return $value; } - throw new NotFoundHttpException; + throw new NotFoundHttpException(); } } diff --git a/app/Support/Binder/JournalList.php b/app/Support/Binder/JournalList.php index cda7cc3c17..916c66f4f2 100644 --- a/app/Support/Binder/JournalList.php +++ b/app/Support/Binder/JournalList.php @@ -53,12 +53,12 @@ class JournalList implements BinderInterface $collector->setJournalIds($list); $result = $collector->getExtractedJournals(); if (empty($result)) { - throw new NotFoundHttpException; + throw new NotFoundHttpException(); } return $result; } - throw new NotFoundHttpException; + throw new NotFoundHttpException(); } /** @@ -70,7 +70,7 @@ class JournalList implements BinderInterface { $list = array_unique(array_map('\intval', explode(',', $value))); if (empty($list)) { - throw new NotFoundHttpException; + throw new NotFoundHttpException(); } return $list; diff --git a/app/Support/Binder/TagList.php b/app/Support/Binder/TagList.php index daa29e434e..6dc0514ac0 100644 --- a/app/Support/Binder/TagList.php +++ b/app/Support/Binder/TagList.php @@ -44,7 +44,6 @@ class TagList implements BinderInterface public static function routeBinder(string $value, Route $route): Collection { if (auth()->check()) { - if ('allTags' === $value) { return auth()->user()->tags() ->orderBy('tag', 'ASC') @@ -55,7 +54,7 @@ class TagList implements BinderInterface if (empty($list)) { Log::error('Tag list is empty.'); - throw new NotFoundHttpException; + throw new NotFoundHttpException(); } @@ -82,6 +81,6 @@ class TagList implements BinderInterface } } Log::error('TagList: user is not logged in.'); - throw new NotFoundHttpException; + throw new NotFoundHttpException(); } } diff --git a/app/Support/Binder/TagOrId.php b/app/Support/Binder/TagOrId.php index 42e33edd0e..72ab7fb31a 100644 --- a/app/Support/Binder/TagOrId.php +++ b/app/Support/Binder/TagOrId.php @@ -54,9 +54,9 @@ class TagOrId implements BinderInterface return $result; } Log::error('TagOrId: tag not found.'); - throw new NotFoundHttpException; + throw new NotFoundHttpException(); } Log::error('TagOrId: user is not logged in.'); - throw new NotFoundHttpException; + throw new NotFoundHttpException(); } } diff --git a/app/Support/CacheProperties.php b/app/Support/CacheProperties.php index 37a1db4cb3..865a786bb2 100644 --- a/app/Support/CacheProperties.php +++ b/app/Support/CacheProperties.php @@ -41,7 +41,7 @@ class CacheProperties */ public function __construct() { - $this->properties = new Collection; + $this->properties = new Collection(); if (auth()->check()) { $this->addProperty(auth()->user()->id); $this->addProperty(app('preferences')->lastActivity()); diff --git a/app/Support/Chart/Category/FrontpageChartGenerator.php b/app/Support/Chart/Category/FrontpageChartGenerator.php index d12cf4c633..0a1d86d042 100644 --- a/app/Support/Chart/Category/FrontpageChartGenerator.php +++ b/app/Support/Chart/Category/FrontpageChartGenerator.php @@ -64,7 +64,6 @@ class FrontpageChartGenerator $this->accountRepos = app(AccountRepositoryInterface::class); $this->opsRepos = app(OperationsRepositoryInterface::class); $this->noCatRepos = app(NoCategoryRepositoryInterface::class); - } /** @@ -200,10 +199,8 @@ class FrontpageChartGenerator $category = $array['name']; $amount = $array['sum_float'] < 0 ? $array['sum_float'] * -1 : $array['sum_float']; $currencyData[$key]['entries'][$category] = $amount; - } return $currencyData; } - } diff --git a/app/Support/Chart/Category/WholePeriodChartGenerator.php b/app/Support/Chart/Category/WholePeriodChartGenerator.php index c82a39cc5d..f8d8077ee0 100644 --- a/app/Support/Chart/Category/WholePeriodChartGenerator.php +++ b/app/Support/Chart/Category/WholePeriodChartGenerator.php @@ -124,7 +124,6 @@ class WholePeriodChartGenerator */ protected function calculateStep(Carbon $start, Carbon $end): string { - $step = '1D'; $months = $start->diffInMonths($end); if ($months > 3) { @@ -165,5 +164,4 @@ class WholePeriodChartGenerator return $return; } - } diff --git a/app/Support/Cronjobs/AbstractCronjob.php b/app/Support/Cronjobs/AbstractCronjob.php index 1625a45726..c13183a527 100644 --- a/app/Support/Cronjobs/AbstractCronjob.php +++ b/app/Support/Cronjobs/AbstractCronjob.php @@ -74,5 +74,4 @@ abstract class AbstractCronjob { $this->force = $force; } - } diff --git a/app/Support/Cronjobs/AutoBudgetCronjob.php b/app/Support/Cronjobs/AutoBudgetCronjob.php index 615d5b5789..9a55188916 100644 --- a/app/Support/Cronjobs/AutoBudgetCronjob.php +++ b/app/Support/Cronjobs/AutoBudgetCronjob.php @@ -34,7 +34,6 @@ use Log; */ class AutoBudgetCronjob extends AbstractCronjob { - /** * @inheritDoc */ diff --git a/app/Support/Cronjobs/ExchangeRatesCronjob.php b/app/Support/Cronjobs/ExchangeRatesCronjob.php index 5d76db6354..379d2483de 100644 --- a/app/Support/Cronjobs/ExchangeRatesCronjob.php +++ b/app/Support/Cronjobs/ExchangeRatesCronjob.php @@ -34,7 +34,6 @@ use Log; */ class ExchangeRatesCronjob extends AbstractCronjob { - /** * @inheritDoc */ diff --git a/app/Support/ExpandedForm.php b/app/Support/ExpandedForm.php index 8a90790dda..9f7150f7ce 100644 --- a/app/Support/ExpandedForm.php +++ b/app/Support/ExpandedForm.php @@ -340,7 +340,6 @@ class ExpandedForm */ public function password(string $name, array $options = null): string { - $label = $this->label($name, $options); $options = $this->expandOptionArray($name, $label, $options); $classes = $this->getHolderClasses($name); diff --git a/app/Support/Export/ExportDataGenerator.php b/app/Support/Export/ExportDataGenerator.php index ce8a05ea40..30eccb0a20 100644 --- a/app/Support/Export/ExportDataGenerator.php +++ b/app/Support/Export/ExportDataGenerator.php @@ -82,7 +82,7 @@ class ExportDataGenerator public function __construct() { - $this->accounts = new Collection; + $this->accounts = new Collection(); $this->start = today(config('app.timezone')); $this->start->subYear(); $this->end = today(config('app.timezone')); @@ -310,7 +310,6 @@ class ExportDataGenerator } return $string; - } /** @@ -737,7 +736,6 @@ class ExportDataGenerator $metaData['recurrence_total'], $metaData['recurrence_count'], ]; - } //load the CSV document from a string @@ -883,5 +881,4 @@ class ExportDataGenerator { $this->user = $user; } - } diff --git a/app/Support/FireflyConfig.php b/app/Support/FireflyConfig.php index c7aeeadac0..de1de44014 100644 --- a/app/Support/FireflyConfig.php +++ b/app/Support/FireflyConfig.php @@ -35,7 +35,6 @@ use Illuminate\Database\QueryException; */ class FireflyConfig { - /** * @param string $name */ @@ -97,7 +96,7 @@ class FireflyConfig try { $config = Configuration::whereName($name)->whereNull('deleted_at')->first(); } catch (QueryException|Exception $e) { // @phpstan-ignore-line - $item = new Configuration; + $item = new Configuration(); $item->name = $name; $item->data = $value; @@ -105,7 +104,7 @@ class FireflyConfig } if (null === $config) { - $item = new Configuration; + $item = new Configuration(); $item->name = $name; $item->data = $value; $item->save(); @@ -128,10 +127,8 @@ class FireflyConfig */ public function getFresh(string $name, $default = null): ?Configuration { - $config = Configuration::where('name', $name)->first(['id', 'name', 'data']); if ($config) { - return $config; } // no preference found and default is null: diff --git a/app/Support/Form/CurrencyForm.php b/app/Support/Form/CurrencyForm.php index ec64b7441e..8151f9da3d 100644 --- a/app/Support/Form/CurrencyForm.php +++ b/app/Support/Form/CurrencyForm.php @@ -224,5 +224,4 @@ class CurrencyForm return $this->select($name, $array, $value, $options); } - } diff --git a/app/Support/Http/Api/ConvertsExchangeRates.php b/app/Support/Http/Api/ConvertsExchangeRates.php index 04cf202023..a3cd240fa1 100644 --- a/app/Support/Http/Api/ConvertsExchangeRates.php +++ b/app/Support/Http/Api/ConvertsExchangeRates.php @@ -87,7 +87,6 @@ trait ConvertsExchangeRates $entry['native_decimal_places'] = $native->decimal_places; } $return[] = $entry; - } return $return; } @@ -267,5 +266,4 @@ trait ConvertsExchangeRates { $this->enabled = true; } - } diff --git a/app/Support/Http/Controllers/AugumentData.php b/app/Support/Http/Controllers/AugumentData.php index 8cf762f790..954cc77a65 100644 --- a/app/Support/Http/Controllers/AugumentData.php +++ b/app/Support/Http/Controllers/AugumentData.php @@ -59,7 +59,7 @@ trait AugumentData $combined = []; /** @var Account $expenseAccount */ foreach ($accounts as $expenseAccount) { - $collection = new Collection; + $collection = new Collection(); $collection->push($expenseAccount); $revenue = $repository->findByName($expenseAccount->name, [AccountType::REVENUE]); @@ -200,7 +200,7 @@ trait AugumentData /** @var BudgetLimitRepositoryInterface $blRepository */ $blRepository = app(BudgetLimitRepositoryInterface::class); // properties for cache - $cache = new CacheProperties; + $cache = new CacheProperties(); $cache->addProperty($start); $cache->addProperty($end); $cache->addProperty($budget->id); @@ -240,7 +240,6 @@ trait AugumentData */ protected function groupByName(array $array): array // filter + group data { - // group by opposing account name. $grouped = []; /** @var array $journal */ diff --git a/app/Support/Http/Controllers/ChartGeneration.php b/app/Support/Http/Controllers/ChartGeneration.php index c97e777fe3..7ccdbe8a73 100644 --- a/app/Support/Http/Controllers/ChartGeneration.php +++ b/app/Support/Http/Controllers/ChartGeneration.php @@ -52,7 +52,6 @@ trait ChartGeneration */ protected function accountBalanceChart(Collection $accounts, Carbon $start, Carbon $end): array // chart helper method. { - // chart properties for cache: $cache = new CacheProperties(); $cache->addProperty($start); diff --git a/app/Support/Http/Controllers/CreateStuff.php b/app/Support/Http/Controllers/CreateStuff.php index 4ec6aec618..690d652915 100644 --- a/app/Support/Http/Controllers/CreateStuff.php +++ b/app/Support/Http/Controllers/CreateStuff.php @@ -39,7 +39,6 @@ use phpseclib3\Crypt\RSA; */ trait CreateStuff { - /** * Creates an asset account. * @@ -61,7 +60,7 @@ trait CreateStuff 'active' => true, 'account_role' => 'defaultAsset', 'opening_balance' => $request->input('bank_balance'), - 'opening_balance_date' => new Carbon, + 'opening_balance_date' => new Carbon(), 'currency_id' => $currency->id, ]; @@ -120,7 +119,7 @@ trait CreateStuff if (class_exists(LegacyRSA::class)) { // PHP 7 Log::info('Will run PHP7 code.'); - $keys = (new LegacyRSA)->createKey(4096); + $keys = (new LegacyRSA())->createKey(4096); } if (!class_exists(LegacyRSA::class)) { @@ -158,7 +157,7 @@ trait CreateStuff 'active' => true, 'account_role' => 'savingAsset', 'opening_balance' => $request->input('savings_balance'), - 'opening_balance_date' => new Carbon, + 'opening_balance_date' => new Carbon(), 'currency_id' => $currency->id, ]; $repository->store($savingsAccount); @@ -182,5 +181,4 @@ trait CreateStuff ] ); } - } diff --git a/app/Support/Http/Controllers/CronRunner.php b/app/Support/Http/Controllers/CronRunner.php index 89e93ef55d..58ca2826d9 100644 --- a/app/Support/Http/Controllers/CronRunner.php +++ b/app/Support/Http/Controllers/CronRunner.php @@ -93,8 +93,5 @@ trait CronRunner 'job_errored' => $recurring->jobErrored, 'message' => $recurring->message, ]; - } - - } diff --git a/app/Support/Http/Controllers/DateCalculation.php b/app/Support/Http/Controllers/DateCalculation.php index 05d2b44421..9c92f971ac 100644 --- a/app/Support/Http/Controllers/DateCalculation.php +++ b/app/Support/Http/Controllers/DateCalculation.php @@ -84,7 +84,6 @@ trait DateCalculation */ protected function calculateStep(Carbon $start, Carbon $end): string { - $step = '1D'; $months = $start->diffInMonths($end); if ($months > 3) { @@ -167,5 +166,4 @@ trait DateCalculation return $loop; } - } diff --git a/app/Support/Http/Controllers/GetConfigurationData.php b/app/Support/Http/Controllers/GetConfigurationData.php index 8ee87faca6..b465743356 100644 --- a/app/Support/Http/Controllers/GetConfigurationData.php +++ b/app/Support/Http/Controllers/GetConfigurationData.php @@ -140,26 +140,26 @@ trait GetConfigurationData // last seven days: $seven = Carbon::now()->subDays(7); $index = (string) trans('firefly.last_seven_days'); - $ranges[$index] = [$seven, new Carbon]; + $ranges[$index] = [$seven, new Carbon()]; // last 30 days: $thirty = Carbon::now()->subDays(30); $index = (string) trans('firefly.last_thirty_days'); - $ranges[$index] = [$thirty, new Carbon]; + $ranges[$index] = [$thirty, new Carbon()]; // month to date: $monthBegin = Carbon::now()->startOfMonth(); $index = (string) trans('firefly.month_to_date'); - $ranges[$index] = [$monthBegin, new Carbon]; + $ranges[$index] = [$monthBegin, new Carbon()]; // year to date: $yearBegin = Carbon::now()->startOfYear(); $index = (string) trans('firefly.year_to_date'); - $ranges[$index] = [$yearBegin, new Carbon]; + $ranges[$index] = [$yearBegin, new Carbon()]; // everything $index = (string) trans('firefly.everything'); - $ranges[$index] = [$first, new Carbon]; + $ranges[$index] = [$first, new Carbon()]; return [ 'title' => $title, diff --git a/app/Support/Http/Controllers/ModelInformation.php b/app/Support/Http/Controllers/ModelInformation.php index b8073fa88b..6183de164c 100644 --- a/app/Support/Http/Controllers/ModelInformation.php +++ b/app/Support/Http/Controllers/ModelInformation.php @@ -119,7 +119,6 @@ trait ModelInformation $triggers = []; foreach ($operators as $key => $operator) { if ('user_action' !== $key && false === $operator['alias']) { - $triggers[$key] = (string) trans(sprintf('firefly.rule_trigger_%s_choice', $key)); } } @@ -146,7 +145,6 @@ trait ModelInformation ] )->render(); } catch (Throwable $e) { // @phpstan-ignore-line - Log::debug(sprintf('Throwable was thrown in getTriggersForBill(): %s', $e->getMessage())); Log::debug($e->getTraceAsString()); $string = ''; @@ -171,7 +169,6 @@ trait ModelInformation $triggers = []; foreach ($operators as $key => $operator) { if ('user_action' !== $key && false === $operator['alias']) { - $triggers[$key] = (string) trans(sprintf('firefly.rule_trigger_%s_choice', $key)); } } @@ -262,7 +259,6 @@ trait ModelInformation ] )->render(); } catch (Throwable $e) { // @phpstan-ignore-line - Log::debug(sprintf('Throwable was thrown in getTriggersForJournal(): %s', $e->getMessage())); Log::debug($e->getTraceAsString()); $string = ''; diff --git a/app/Support/Http/Controllers/PeriodOverview.php b/app/Support/Http/Controllers/PeriodOverview.php index aa43d4ffcc..f851d0b59c 100644 --- a/app/Support/Http/Controllers/PeriodOverview.php +++ b/app/Support/Http/Controllers/PeriodOverview.php @@ -88,7 +88,7 @@ trait PeriodOverview [$start, $end] = $end < $start ? [$end, $start] : [$start, $end]; // properties for cache - $cache = new CacheProperties; + $cache = new CacheProperties(); $cache->addProperty($start); $cache->addProperty($end); $cache->addProperty('account-show-period-entries'); @@ -252,12 +252,10 @@ trait PeriodOverview 'currency_symbol' => $journal['foreign_currency_symbol'], 'currency_decimal_places' => $journal['foreign_currency_decimal_places'], ]; - } $return[$foreignCurrencyId]['count']++; $return[$foreignCurrencyId]['amount'] = bcadd($return[$foreignCurrencyId]['amount'], $journal['foreign_amount']); } - } return $return; @@ -361,7 +359,7 @@ trait PeriodOverview [$start, $end] = $end < $start ? [$end, $start] : [$start, $end]; - $cache = new CacheProperties; + $cache = new CacheProperties(); $cache->addProperty($start); $cache->addProperty($end); $cache->addProperty('no-budget-period-entries'); @@ -415,7 +413,7 @@ trait PeriodOverview Log::debug(sprintf('Now in getNoCategoryPeriodOverview(%s)', $theDate->format('Y-m-d'))); $range = app('preferences')->get('viewRange', '1M')->data; $first = $this->journalRepos->firstNull(); - $start = null === $first ? new Carbon : $first->date; + $start = null === $first ? new Carbon() : $first->date; $end = $theDate ?? today(config('app.timezone')); Log::debug(sprintf('Start for getNoCategoryPeriodOverview() is %s', $start->format('Y-m-d'))); @@ -484,12 +482,11 @@ trait PeriodOverview */ protected function getTagPeriodOverview(Tag $tag, Carbon $start, Carbon $end): array // period overview for tags. { - $range = app('preferences')->get('viewRange', '1M')->data; [$start, $end] = $end < $start ? [$end, $start] : [$start, $end]; // properties for cache - $cache = new CacheProperties; + $cache = new CacheProperties(); $cache->addProperty($start); $cache->addProperty($end); $cache->addProperty('tag-period-entries'); @@ -565,7 +562,7 @@ trait PeriodOverview [$start, $end] = $end < $start ? [$end, $start] : [$start, $end]; // properties for cache - $cache = new CacheProperties; + $cache = new CacheProperties(); $cache->addProperty($start); $cache->addProperty($end); $cache->addProperty('transactions-period-entries'); diff --git a/app/Support/Http/Controllers/RenderPartialViews.php b/app/Support/Http/Controllers/RenderPartialViews.php index 4a2f06f087..48ce1f8f3c 100644 --- a/app/Support/Http/Controllers/RenderPartialViews.php +++ b/app/Support/Http/Controllers/RenderPartialViews.php @@ -44,7 +44,6 @@ use Throwable; */ trait RenderPartialViews { - /** * View for transactions in a budget for an account. * @@ -114,7 +113,7 @@ trait RenderPartialViews $budget = $budgetRepository->find((int) $attributes['budgetId']); if (null === $budget) { - $budget = new Budget; + $budget = new Budget(); } $journals = $popupHelper->byBudget($budget, $attributes); @@ -276,7 +275,6 @@ trait RenderPartialViews 'count' => $count, ] )->render(); - } catch (Throwable $e) { // @phpstan-ignore-line Log::debug(sprintf('Throwable was thrown in getCurrentActions(): %s', $e->getMessage())); Log::error($e->getTraceAsString()); @@ -303,7 +301,6 @@ trait RenderPartialViews $triggers = []; foreach ($operators as $key => $operator) { if ('user_action' !== $key && false === $operator['alias']) { - $triggers[$key] = (string) trans(sprintf('firefly.rule_trigger_%s_choice', $key)); } } @@ -318,7 +315,7 @@ trait RenderPartialViews $count = ($index + 1); try { $rootOperator = OperatorQuerySearch::getRootOperator($entry->trigger_type); - if(str_starts_with($rootOperator, '-')) { + if (str_starts_with($rootOperator, '-')) { $rootOperator = substr($rootOperator, 1); } $renderedEntries[] = view( @@ -332,7 +329,6 @@ trait RenderPartialViews 'triggers' => $triggers, ] )->render(); - } catch (Throwable $e) { // @phpstan-ignore-line Log::debug(sprintf('Throwable was thrown in getCurrentTriggers(): %s', $e->getMessage())); Log::error($e->getTraceAsString()); @@ -384,7 +380,6 @@ trait RenderPartialViews */ protected function noReportOptions(): string // render a view { - try { $result = view('reports.options.no-options')->render(); } catch (Throwable $e) { // @phpstan-ignore-line diff --git a/app/Support/Http/Controllers/RequestInformation.php b/app/Support/Http/Controllers/RequestInformation.php index 13c5f972f7..d4ecb83252 100644 --- a/app/Support/Http/Controllers/RequestInformation.php +++ b/app/Support/Http/Controllers/RequestInformation.php @@ -228,5 +228,4 @@ trait RequestInformation ] ); } - } diff --git a/app/Support/Http/Controllers/RuleManagement.php b/app/Support/Http/Controllers/RuleManagement.php index 6c6aa585d2..b77cdad3d9 100644 --- a/app/Support/Http/Controllers/RuleManagement.php +++ b/app/Support/Http/Controllers/RuleManagement.php @@ -35,7 +35,6 @@ use Throwable; */ trait RuleManagement { - /** * @param Request $request * @@ -83,7 +82,6 @@ trait RuleManagement $triggers = []; foreach ($operators as $key => $operator) { if ('user_action' !== $key && false === $operator['alias']) { - $triggers[$key] = (string) trans(sprintf('firefly.rule_trigger_%s_choice', $key)); } } @@ -130,7 +128,6 @@ trait RuleManagement $triggers = []; foreach ($operators as $key => $operator) { if ('user_action' !== $key && false === $operator['alias']) { - $triggers[$key] = (string) trans(sprintf('firefly.rule_trigger_%s_choice', $key)); } } diff --git a/app/Support/Http/Controllers/TransactionCalculation.php b/app/Support/Http/Controllers/TransactionCalculation.php index 533434a967..c17c26a7a5 100644 --- a/app/Support/Http/Controllers/TransactionCalculation.php +++ b/app/Support/Http/Controllers/TransactionCalculation.php @@ -183,5 +183,4 @@ trait TransactionCalculation return $collector->getExtractedJournals(); } - } diff --git a/app/Support/Http/Controllers/UserNavigation.php b/app/Support/Http/Controllers/UserNavigation.php index 7368e1d4a7..328501a1e1 100644 --- a/app/Support/Http/Controllers/UserNavigation.php +++ b/app/Support/Http/Controllers/UserNavigation.php @@ -39,7 +39,6 @@ use Log; */ trait UserNavigation { - /** * Functionality:. * diff --git a/app/Support/Logging/AuditLogger.php b/app/Support/Logging/AuditLogger.php index 01eecf70e4..73a805ace2 100644 --- a/app/Support/Logging/AuditLogger.php +++ b/app/Support/Logging/AuditLogger.php @@ -44,13 +44,12 @@ class AuditLogger */ public function __invoke(Logger $logger) { - $processor = new AuditProcessor; + $processor = new AuditProcessor(); /** @var AbstractProcessingHandler $handler */ foreach ($logger->getHandlers() as $handler) { $formatter = new LineFormatter("[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n"); $handler->setFormatter($formatter); $handler->pushProcessor($processor); } - } } diff --git a/app/Support/Logging/AuditProcessor.php b/app/Support/Logging/AuditProcessor.php index b3651b6357..a233be4118 100644 --- a/app/Support/Logging/AuditProcessor.php +++ b/app/Support/Logging/AuditProcessor.php @@ -39,13 +39,13 @@ class AuditProcessor public function __invoke(array $record): array { if (auth()->check()) { - $record['message'] = sprintf( 'AUDIT: %s (%s (%s) -> %s:%s)', $record['message'], app('request')->ip(), auth()->user()->email, - request()->method(), request()->url() + request()->method(), + request()->url() ); return $record; @@ -55,7 +55,8 @@ class AuditProcessor 'AUDIT: %s (%s -> %s:%s)', $record['message'], app('request')->ip(), - request()->method(), request()->url() + request()->method(), + request()->url() ); return $record; diff --git a/app/Support/Navigation.php b/app/Support/Navigation.php index a9fda5a1cd..3c33e11f64 100644 --- a/app/Support/Navigation.php +++ b/app/Support/Navigation.php @@ -207,7 +207,6 @@ class Navigation Log::error(sprintf('Cannot do startOfPeriod for $repeat_freq "%s"', $repeatFreq)); return $theDate; - } /** @@ -426,7 +425,6 @@ class Navigation Log::error(sprintf('No date formats for frequency "%s"!', $repeatFrequency)); return $date->format('Y-m-d'); - } /** @@ -585,12 +583,12 @@ class Navigation switch ($repeatFreq) { default: break; - case 'last7'; - $date->subDays(7); - return $date; - case 'last30'; - $date->subDays(30); - return $date; + case 'last7': + $date->subDays(7); + return $date; + case 'last30': + $date->subDays(30); + return $date; case 'last90': $date->subDays(90); return $date; @@ -658,8 +656,8 @@ class Navigation switch ($range) { default: break; - case 'last7'; - case 'last30'; + case 'last7': + case 'last30': case 'last90': case 'last365': case 'YTD': @@ -715,12 +713,12 @@ class Navigation switch ($range) { default: break; - case 'last7'; - $start->subDays(7); - return $start; - case 'last30'; - $start->subDays(30); - return $start; + case 'last7': + $start->subDays(7); + return $start; + case 'last30': + $start->subDays(30); + return $start; case 'last90': $start->subDays(90); return $start; diff --git a/app/Support/ParseDateString.php b/app/Support/ParseDateString.php index 5d06033896..fe2ef36bcb 100644 --- a/app/Support/ParseDateString.php +++ b/app/Support/ParseDateString.php @@ -95,7 +95,6 @@ class ParseDateString // if + or -: if (str_starts_with($date, '+') || str_starts_with($date, '-')) { - return $this->parseRelativeDate($date); } if ('xxxx-xx-xx' === strtolower($date)) { @@ -204,7 +203,6 @@ class ParseDateString Log::debug(sprintf('Will now do %s(%d) on %s', $func, $number, $today->format('Y-m-d'))); $today->$func($number); Log::debug(sprintf('Resulting date is %s', $today->format('Y-m-d'))); - } return $today; @@ -464,5 +462,4 @@ class ParseDateString 'month' => $parts[1], ]; } - } diff --git a/app/Support/Preferences.php b/app/Support/Preferences.php index a7bc86789f..336a547791 100644 --- a/app/Support/Preferences.php +++ b/app/Support/Preferences.php @@ -45,7 +45,7 @@ class Preferences { $user = auth()->user(); if (null === $user) { - return new Collection; + return new Collection(); } return Preference::where('user_id', $user->id)->get(); @@ -139,7 +139,7 @@ class Preferences /** @var User|null $user */ $user = auth()->user(); if (null === $user) { - $preference = new Preference; + $preference = new Preference(); $preference->data = $default; return $preference; @@ -183,7 +183,6 @@ class Preferences } if (null !== $preference) { - return $preference; } // no preference found and default is null: @@ -217,13 +216,13 @@ class Preferences throw new FireflyException(sprintf('Could not delete preference: %s', $e->getMessage()), 0, $e); } - return new Preference; + return new Preference(); } if (null === $value) { - return new Preference; + return new Preference(); } if (null === $pref) { - $pref = new Preference; + $pref = new Preference(); $pref->user_id = $user->id; $pref->name = $name; } @@ -269,7 +268,7 @@ class Preferences /** @var User|null $user */ $user = auth()->user(); if (null === $user) { - $preference = new Preference; + $preference = new Preference(); $preference->data = $default; return $preference; @@ -299,7 +298,7 @@ class Preferences $user = auth()->user(); if (null === $user) { // make new preference, return it: - $pref = new Preference; + $pref = new Preference(); $pref->name = $name; $pref->data = $value; diff --git a/app/Support/Report/Budget/BudgetReportGenerator.php b/app/Support/Report/Budget/BudgetReportGenerator.php index 31f376b78e..bc40dab0d4 100644 --- a/app/Support/Report/Budget/BudgetReportGenerator.php +++ b/app/Support/Report/Budget/BudgetReportGenerator.php @@ -69,7 +69,6 @@ class BudgetReportGenerator */ public function accountPerBudget(): void { - $spent = $this->opsRepository->listExpenses($this->start, $this->end, $this->accounts, $this->budgets); $this->report = []; /** @var Account $account */ @@ -87,7 +86,6 @@ class BudgetReportGenerator foreach ($spent as $currency) { $this->processExpenses($currency); } - } /** @@ -251,7 +249,6 @@ class BudgetReportGenerator $noBudget = $this->nbRepository->sumExpenses($this->start, $this->end, $this->accounts); foreach ($noBudget as $noBudgetEntry) { - // currency information: $nbCurrencyId = (int) ($noBudgetEntry['currency_id'] ?? $this->currency->id); $nbCurrencyCode = $noBudgetEntry['currency_code'] ?? $this->currency->code; diff --git a/app/Support/Report/Category/CategoryReportGenerator.php b/app/Support/Report/Category/CategoryReportGenerator.php index efd064d6b3..564a160935 100644 --- a/app/Support/Report/Category/CategoryReportGenerator.php +++ b/app/Support/Report/Category/CategoryReportGenerator.php @@ -210,5 +210,4 @@ class CategoryReportGenerator $this->noCatRepository->setUser($user); $this->opsRepository->setUser($user); } - } diff --git a/app/Support/Repositories/Recurring/CalculateRangeOccurrences.php b/app/Support/Repositories/Recurring/CalculateRangeOccurrences.php index d5160b32ef..680f1af0d3 100644 --- a/app/Support/Repositories/Recurring/CalculateRangeOccurrences.php +++ b/app/Support/Repositories/Recurring/CalculateRangeOccurrences.php @@ -32,7 +32,6 @@ use Illuminate\Support\Facades\Log; */ trait CalculateRangeOccurrences { - /** * Get the number of daily occurrences for a recurring transaction until date $end is reached. Will skip every $skipMod-1 occurrences. * @@ -185,7 +184,6 @@ trait CalculateRangeOccurrences $return = []; if ($start > $date) { $date->addYear(); - } // is $date between $start and $end? @@ -201,6 +199,5 @@ trait CalculateRangeOccurrences } return $return; - } } diff --git a/app/Support/Repositories/Recurring/CalculateXOccurrences.php b/app/Support/Repositories/Recurring/CalculateXOccurrences.php index 166fa78fcc..4cd955fbd3 100644 --- a/app/Support/Repositories/Recurring/CalculateXOccurrences.php +++ b/app/Support/Repositories/Recurring/CalculateXOccurrences.php @@ -31,7 +31,6 @@ use Carbon\Carbon; */ trait CalculateXOccurrences { - /** * Calculates the number of daily occurrences for a recurring transaction, starting at the date, until $count is reached. It will skip * over $skipMod -1 recurrences. @@ -210,6 +209,5 @@ trait CalculateXOccurrences } return $return; - } } diff --git a/app/Support/Repositories/Recurring/CalculateXOccurrencesSince.php b/app/Support/Repositories/Recurring/CalculateXOccurrencesSince.php index b46a5dfebc..5a12ce7a0f 100644 --- a/app/Support/Repositories/Recurring/CalculateXOccurrencesSince.php +++ b/app/Support/Repositories/Recurring/CalculateXOccurrencesSince.php @@ -32,7 +32,6 @@ use Log; */ trait CalculateXOccurrencesSince { - /** * Calculates the number of daily occurrences for a recurring transaction, starting at the date, until $count is reached. It will skip * over $skipMod -1 recurrences. @@ -234,6 +233,5 @@ trait CalculateXOccurrencesSince } return $return; - } } diff --git a/app/Support/Repositories/Recurring/FiltersWeekends.php b/app/Support/Repositories/Recurring/FiltersWeekends.php index 04afa7dd81..8d2f04fa78 100644 --- a/app/Support/Repositories/Recurring/FiltersWeekends.php +++ b/app/Support/Repositories/Recurring/FiltersWeekends.php @@ -34,7 +34,6 @@ use Illuminate\Support\Facades\Log; */ trait FiltersWeekends { - /** * Filters out all weekend entries, if necessary. * diff --git a/app/Support/Request/AppendsLocationData.php b/app/Support/Request/AppendsLocationData.php index 7958cacdac..77a3e8e081 100644 --- a/app/Support/Request/AppendsLocationData.php +++ b/app/Support/Request/AppendsLocationData.php @@ -240,13 +240,12 @@ trait AppendsLocationData $zoomLevelKey = $this->getLocationKey($prefix, 'zoom_level'); return ( - null === $this->get($longitudeKey) - && null === $this->get($latitudeKey) - && null === $this->get($zoomLevelKey)) - && ('PUT' === $this->method() - || ('POST' === $this->method() && $this->routeIs('*.update')) + null === $this->get($longitudeKey) + && null === $this->get($latitudeKey) + && null === $this->get($zoomLevelKey)) + && ( + 'PUT' === $this->method() + || ('POST' === $this->method() && $this->routeIs('*.update')) ); - } - } diff --git a/app/Support/Request/ConvertAPIDataTypes.php b/app/Support/Request/ConvertAPIDataTypes.php index 3c6acabc22..837e906847 100644 --- a/app/Support/Request/ConvertAPIDataTypes.php +++ b/app/Support/Request/ConvertAPIDataTypes.php @@ -28,5 +28,4 @@ namespace FireflyIII\Support\Request; */ trait ConvertAPIDataTypes { - } diff --git a/app/Support/Request/ConvertsDataTypes.php b/app/Support/Request/ConvertsDataTypes.php index 7ee7f4f2ce..f98d172c10 100644 --- a/app/Support/Request/ConvertsDataTypes.php +++ b/app/Support/Request/ConvertsDataTypes.php @@ -314,5 +314,4 @@ trait ConvertsDataTypes return (int) $value; } - } diff --git a/app/Support/Request/GetRecurrenceData.php b/app/Support/Request/GetRecurrenceData.php index 38602e28f2..3fa48d8aaa 100644 --- a/app/Support/Request/GetRecurrenceData.php +++ b/app/Support/Request/GetRecurrenceData.php @@ -86,5 +86,4 @@ trait GetRecurrenceData return $return; } - } diff --git a/app/Support/Request/GetRuleConfiguration.php b/app/Support/Request/GetRuleConfiguration.php index 9c7e8ef1fb..776d966ea6 100644 --- a/app/Support/Request/GetRuleConfiguration.php +++ b/app/Support/Request/GetRuleConfiguration.php @@ -28,7 +28,6 @@ namespace FireflyIII\Support\Request; */ trait GetRuleConfiguration { - /** * @return array */ diff --git a/app/Support/Search/AccountSearch.php b/app/Support/Search/AccountSearch.php index 9ace498a2b..a6decf6392 100644 --- a/app/Support/Search/AccountSearch.php +++ b/app/Support/Search/AccountSearch.php @@ -59,7 +59,6 @@ class AccountSearch implements GenericSearchInterface */ public function search(): Collection { - $searchQuery = $this->user->accounts() ->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id') ->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id') @@ -140,5 +139,4 @@ class AccountSearch implements GenericSearchInterface { $this->user = $user; } - } diff --git a/app/Support/Search/GenericSearchInterface.php b/app/Support/Search/GenericSearchInterface.php index 60b4539da7..e7bb9005c3 100644 --- a/app/Support/Search/GenericSearchInterface.php +++ b/app/Support/Search/GenericSearchInterface.php @@ -35,5 +35,4 @@ interface GenericSearchInterface * @return Collection */ public function search(): Collection; - } diff --git a/app/Support/Search/OperatorQuerySearch.php b/app/Support/Search/OperatorQuerySearch.php index 5bd9f08386..813c7e4e27 100644 --- a/app/Support/Search/OperatorQuerySearch.php +++ b/app/Support/Search/OperatorQuerySearch.php @@ -88,7 +88,7 @@ class OperatorQuerySearch implements SearchInterface public function __construct() { Log::debug('Constructed OperatorQuerySearch'); - $this->operators = new Collection; + $this->operators = new Collection(); $this->page = 1; $this->words = []; $this->prohibitedWords = []; @@ -241,7 +241,6 @@ class OperatorQuerySearch implements SearchInterface ]; } } - } /** @@ -267,13 +266,13 @@ class OperatorQuerySearch implements SearchInterface default: Log::error(sprintf('No such operator: %s', $operator)); throw new FireflyException(sprintf('Unsupported search operator: "%s"', $operator)); - // some search operators are ignored, basically: + // some search operators are ignored, basically: case 'user_action': Log::info(sprintf('Ignore search operator "%s"', $operator)); return false; // - // all account related searches: + // all account related searches: // case 'account_is': $this->searchAccount($value, 3, 4); @@ -475,7 +474,7 @@ class OperatorQuerySearch implements SearchInterface break; case 'account_id': $parts = explode(',', $value); - $collection = new Collection; + $collection = new Collection(); foreach ($parts as $accountId) { $account = $this->accountRepository->find((int) $accountId); if (null !== $account) { @@ -491,7 +490,7 @@ class OperatorQuerySearch implements SearchInterface break; case '-account_id': $parts = explode(',', $value); - $collection = new Collection; + $collection = new Collection(); foreach ($parts as $accountId) { $account = $this->accountRepository->find((int) $accountId); if (null !== $account) { @@ -506,7 +505,7 @@ class OperatorQuerySearch implements SearchInterface } break; // - // cash account + // cash account // case 'source_is_cash': $account = $this->getCashAccount(); @@ -533,7 +532,7 @@ class OperatorQuerySearch implements SearchInterface $this->collector->excludeAccounts(new Collection([$account])); break; // - // description + // description // case 'description_starts': $this->collector->descriptionStarts([$value]); @@ -562,7 +561,7 @@ class OperatorQuerySearch implements SearchInterface $this->collector->descriptionIsNot($value); break; // - // currency + // currency // case 'currency_is': $currency = $this->findCurrency($value); @@ -601,7 +600,7 @@ class OperatorQuerySearch implements SearchInterface } break; // - // attachments + // attachments // case 'has_attachments': case '-has_no_attachments': @@ -614,7 +613,7 @@ class OperatorQuerySearch implements SearchInterface $this->collector->hasNoAttachments(); break; // - // categories + // categories case '-has_any_category': case 'has_no_category': $this->collector->withoutCategory(); @@ -693,7 +692,7 @@ class OperatorQuerySearch implements SearchInterface } break; // - // budgets + // budgets // case '-has_any_budget': case 'has_no_budget': @@ -774,7 +773,7 @@ class OperatorQuerySearch implements SearchInterface } break; // - // bill + // bill // case '-has_any_bill': case 'has_no_bill': @@ -853,7 +852,7 @@ class OperatorQuerySearch implements SearchInterface } break; // - // tags + // tags // case '-has_any_tag': case 'has_no_tag': @@ -883,7 +882,7 @@ class OperatorQuerySearch implements SearchInterface } break; // - // notes + // notes // case 'notes_contains': $this->collector->notesContain($value); @@ -924,7 +923,7 @@ class OperatorQuerySearch implements SearchInterface $this->collector->isNotReconciled(); break; // - // amount + // amount // case 'amount_is': // strip comma's, make dots. @@ -997,7 +996,7 @@ class OperatorQuerySearch implements SearchInterface $this->collector->foreignAmountMore($amount); break; // - // transaction type + // transaction type // case 'transaction_type': $this->collector->setTypes([ucfirst($value)]); @@ -1008,7 +1007,7 @@ class OperatorQuerySearch implements SearchInterface Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $value)); break; // - // dates + // dates // case '-date_on': case 'date_on': @@ -1160,7 +1159,7 @@ class OperatorQuerySearch implements SearchInterface $this->setObjectDateAfterParams('updated_at', $range); return false; // - // external URL + // external URL // case '-any_external_url': case 'no_external_url': @@ -1197,7 +1196,7 @@ class OperatorQuerySearch implements SearchInterface break; // - // other fields + // other fields // case 'external_id_is': $this->collector->setExternalId($value); @@ -1310,7 +1309,6 @@ class OperatorQuerySearch implements SearchInterface case '-exists': $this->collector->findNothing(); break; - } return true; } @@ -1550,7 +1548,7 @@ class OperatorQuerySearch implements SearchInterface */ private function parseDateRange(string $value): array { - $parser = new ParseDateString; + $parser = new ParseDateString(); if ($parser->isDateRange($value)) { return $parser->parseRange($value); } @@ -2044,7 +2042,6 @@ class OperatorQuerySearch implements SearchInterface $this->collector->withAccountInformation()->withCategoryInformation()->withBudgetInformation(); $this->setLimit((int) app('preferences')->getForUser($user, 'listPageSize', 50)->data); - } /** diff --git a/app/Support/Steam.php b/app/Support/Steam.php index fa6718cd9d..8b3bd2270d 100644 --- a/app/Support/Steam.php +++ b/app/Support/Steam.php @@ -43,7 +43,6 @@ use ValueError; */ class Steam { - /** * @param Account $account * @param Carbon $date @@ -53,7 +52,7 @@ class Steam public function balanceIgnoreVirtual(Account $account, Carbon $date): string { // abuse chart properties: - $cache = new CacheProperties; + $cache = new CacheProperties(); $cache->addProperty($account->id); $cache->addProperty('balance-no-virtual'); $cache->addProperty($date); @@ -124,7 +123,7 @@ class Steam public function balanceInRange(Account $account, Carbon $start, Carbon $end, ?TransactionCurrency $currency = null): array { // abuse chart properties: - $cache = new CacheProperties; + $cache = new CacheProperties(); $cache->addProperty($account->id); $cache->addProperty('balance-in-range'); $cache->addProperty($currency ? $currency->id : 0); @@ -210,7 +209,7 @@ class Steam public function balance(Account $account, Carbon $date, ?TransactionCurrency $currency = null): string { // abuse chart properties: - $cache = new CacheProperties; + $cache = new CacheProperties(); $cache->addProperty($account->id); $cache->addProperty('balance'); $cache->addProperty($date); @@ -259,7 +258,7 @@ class Steam { $ids = $accounts->pluck('id')->toArray(); // cache this property. - $cache = new CacheProperties; + $cache = new CacheProperties(); $cache->addProperty($ids); $cache->addProperty('balances'); $cache->addProperty($date); @@ -292,7 +291,7 @@ class Steam { $ids = $accounts->pluck('id')->toArray(); // cache this property. - $cache = new CacheProperties; + $cache = new CacheProperties(); $cache->addProperty($ids); $cache->addProperty('balances-per-currency'); $cache->addProperty($date); @@ -321,7 +320,7 @@ class Steam public function balancePerCurrency(Account $account, Carbon $date): array { // abuse chart properties: - $cache = new CacheProperties; + $cache = new CacheProperties(); $cache->addProperty($account->id); $cache->addProperty('balance-per-currency'); $cache->addProperty($date); diff --git a/app/Support/System/GeneratesInstallationId.php b/app/Support/System/GeneratesInstallationId.php index f03dc048c5..c40eb89c65 100644 --- a/app/Support/System/GeneratesInstallationId.php +++ b/app/Support/System/GeneratesInstallationId.php @@ -58,5 +58,4 @@ trait GeneratesInstallationId app('fireflyconfig')->set('installation_id', $uniqueId); } } - } diff --git a/app/Support/System/OAuthKeys.php b/app/Support/System/OAuthKeys.php index 1eff32208e..59ad7d15dc 100644 --- a/app/Support/System/OAuthKeys.php +++ b/app/Support/System/OAuthKeys.php @@ -146,5 +146,4 @@ class OAuthKeys file_put_contents($public, $publicContent); return true; } - } diff --git a/app/Support/Twig/AmountFormat.php b/app/Support/Twig/AmountFormat.php index 74eac42b39..b099496113 100644 --- a/app/Support/Twig/AmountFormat.php +++ b/app/Support/Twig/AmountFormat.php @@ -120,11 +120,10 @@ class AmountFormat extends AbstractExtension { return new TwigFunction( 'formatAmountBySymbol', - static function (string $amount, string $symbol, int $decimalPlaces = null, bool $coloured = null): string { $decimalPlaces = $decimalPlaces ?? 2; $coloured = $coloured ?? true; - $currency = new TransactionCurrency; + $currency = new TransactionCurrency(); $currency->symbol = $symbol; $currency->decimal_places = $decimalPlaces; diff --git a/app/Support/Twig/General.php b/app/Support/Twig/General.php index 66e5ca7ae0..7d7041bf18 100644 --- a/app/Support/Twig/General.php +++ b/app/Support/Twig/General.php @@ -114,7 +114,7 @@ class General extends AbstractExtension return 'fa-file-o'; case 'application/pdf': return 'fa-file-pdf-o'; - /* image */ + /* image */ case 'image/png': case 'image/jpeg': case 'image/svg+xml': @@ -122,7 +122,7 @@ class General extends AbstractExtension case 'image/heic-sequence': case 'application/vnd.oasis.opendocument.image': return 'fa-file-image-o'; - /* MS word */ + /* MS word */ case 'application/msword': case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': case 'application/vnd.openxmlformats-officedocument.wordprocessingml.template': @@ -137,7 +137,7 @@ class General extends AbstractExtension case 'application/vnd.oasis.opendocument.text-web': case 'application/vnd.oasis.opendocument.text-master': return 'fa-file-word-o'; - /* MS excel */ + /* MS excel */ case 'application/vnd.ms-excel': case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': case 'application/vnd.openxmlformats-officedocument.spreadsheetml.template': @@ -147,7 +147,7 @@ class General extends AbstractExtension case 'application/vnd.oasis.opendocument.spreadsheet': case 'application/vnd.oasis.opendocument.spreadsheet-template': return 'fa-file-excel-o'; - /* MS powerpoint */ + /* MS powerpoint */ case 'application/vnd.ms-powerpoint': case 'application/vnd.openxmlformats-officedocument.presentationml.presentation': case 'application/vnd.openxmlformats-officedocument.presentationml.template': @@ -158,7 +158,7 @@ class General extends AbstractExtension case 'application/vnd.oasis.opendocument.presentation': case 'application/vnd.oasis.opendocument.presentation-template': return 'fa-file-powerpoint-o'; - /* calc */ + /* calc */ case 'application/vnd.sun.xml.draw': case 'application/vnd.sun.xml.draw.template': case 'application/vnd.stardivision.draw': @@ -171,7 +171,6 @@ class General extends AbstractExtension case 'application/vnd.oasis.opendocument.formula': case 'application/vnd.oasis.opendocument.database': return 'fa-calculator'; - } }, ['is_safe' => ['html']] @@ -184,9 +183,8 @@ class General extends AbstractExtension protected function markdown(): TwigFilter { return new TwigFilter( - 'markdown', + 'markdown', static function (string $text): string { - $converter = new GithubFlavoredMarkdownConverter( [ 'allow_unsafe_links' => false, @@ -196,7 +194,8 @@ class General extends AbstractExtension ); return (string) $converter->convert($text); - }, ['is_safe' => ['html']] + }, + ['is_safe' => ['html']] ); } diff --git a/app/Support/Twig/TransactionGroupTwig.php b/app/Support/Twig/TransactionGroupTwig.php index 935a75107b..5f414369aa 100644 --- a/app/Support/Twig/TransactionGroupTwig.php +++ b/app/Support/Twig/TransactionGroupTwig.php @@ -112,7 +112,6 @@ class TransactionGroupTwig extends AbstractExtension */ private function signAmount(string $amount, string $transactionType, string $sourceType): string { - // withdrawals stay negative if ($transactionType !== TransactionType::WITHDRAWAL) { $amount = bcmul($amount, '-1'); diff --git a/app/TransactionRules/Actions/AppendDescriptionToNotes.php b/app/TransactionRules/Actions/AppendDescriptionToNotes.php index b7fe069ccd..c69e5e0cb4 100644 --- a/app/TransactionRules/Actions/AppendDescriptionToNotes.php +++ b/app/TransactionRules/Actions/AppendDescriptionToNotes.php @@ -57,7 +57,7 @@ class AppendDescriptionToNotes implements ActionInterface } $note = $object->notes()->first(); if (null === $note) { - $note = new Note; + $note = new Note(); $note->noteable()->associate($object); $note->text = ''; } diff --git a/app/TransactionRules/Actions/AppendNotes.php b/app/TransactionRules/Actions/AppendNotes.php index bb88302fe6..a521334d1a 100644 --- a/app/TransactionRules/Actions/AppendNotes.php +++ b/app/TransactionRules/Actions/AppendNotes.php @@ -50,13 +50,11 @@ class AppendNotes implements ActionInterface */ public function actOnArray(array $journal): bool { - $dbNote = Note - :: - where('noteable_id', (int) $journal['transaction_journal_id']) + $dbNote = Note::where('noteable_id', (int) $journal['transaction_journal_id']) ->where('noteable_type', TransactionJournal::class) ->first(['notes.*']); if (null === $dbNote) { - $dbNote = new Note; + $dbNote = new Note(); $dbNote->noteable_id = (int) $journal['transaction_journal_id']; $dbNote->noteable_type = TransactionJournal::class; $dbNote->text = ''; diff --git a/app/TransactionRules/Actions/AppendNotesToDescription.php b/app/TransactionRules/Actions/AppendNotesToDescription.php index d4ecc4e2e0..f26e8677bc 100644 --- a/app/TransactionRules/Actions/AppendNotesToDescription.php +++ b/app/TransactionRules/Actions/AppendNotesToDescription.php @@ -65,7 +65,7 @@ class AppendNotesToDescription implements ActionInterface $note = $object->notes()->first(); if (null === $note) { Log::debug('Journal has no notes.'); - $note = new Note; + $note = new Note(); $note->noteable()->associate($object); $note->text = ''; } diff --git a/app/TransactionRules/Actions/ClearBudget.php b/app/TransactionRules/Actions/ClearBudget.php index 8faa733584..c58eb59dd5 100644 --- a/app/TransactionRules/Actions/ClearBudget.php +++ b/app/TransactionRules/Actions/ClearBudget.php @@ -33,7 +33,6 @@ use Log; */ class ClearBudget implements ActionInterface { - private RuleAction $action; /** diff --git a/app/TransactionRules/Actions/ConvertToTransfer.php b/app/TransactionRules/Actions/ConvertToTransfer.php index 9e3533c322..9d3035db24 100644 --- a/app/TransactionRules/Actions/ConvertToTransfer.php +++ b/app/TransactionRules/Actions/ConvertToTransfer.php @@ -82,8 +82,10 @@ class ConvertToTransfer implements ActionInterface if (null === $asset) { Log::error( sprintf( - 'Journal #%d cannot be converted because no asset with name "%s" exists (rule #%d).', $journal['transaction_journal_id'], - $this->action->action_value, $this->action->rule_id + 'Journal #%d cannot be converted because no asset with name "%s" exists (rule #%d).', + $journal['transaction_journal_id'], + $this->action->action_value, + $this->action->rule_id ) ); @@ -187,5 +189,4 @@ class ConvertToTransfer implements ActionInterface return true; } - } diff --git a/app/TransactionRules/Actions/ConvertToWithdrawal.php b/app/TransactionRules/Actions/ConvertToWithdrawal.php index 2f172f895e..f7844045a4 100644 --- a/app/TransactionRules/Actions/ConvertToWithdrawal.php +++ b/app/TransactionRules/Actions/ConvertToWithdrawal.php @@ -121,7 +121,6 @@ class ConvertToWithdrawal implements ActionInterface Log::debug('Converted deposit to withdrawal.'); return true; - } /** diff --git a/app/TransactionRules/Actions/DeleteTransaction.php b/app/TransactionRules/Actions/DeleteTransaction.php index 45ddb01011..2912082630 100644 --- a/app/TransactionRules/Actions/DeleteTransaction.php +++ b/app/TransactionRules/Actions/DeleteTransaction.php @@ -59,7 +59,8 @@ class DeleteTransaction implements ActionInterface Log::debug( sprintf( 'RuleAction DeleteTransaction DELETED the entire transaction group of journal #%d ("%s").', - $journal['transaction_journal_id'], $journal['description'] + $journal['transaction_journal_id'], + $journal['description'] ) ); $group = TransactionGroup::find($journal['transaction_group_id']); diff --git a/app/TransactionRules/Actions/LinkToBill.php b/app/TransactionRules/Actions/LinkToBill.php index 96696ac89a..c9a3802aba 100644 --- a/app/TransactionRules/Actions/LinkToBill.php +++ b/app/TransactionRules/Actions/LinkToBill.php @@ -87,7 +87,8 @@ class LinkToBill implements ActionInterface Log::error( sprintf( 'RuleAction LinkToBill could not set the bill of journal #%d to bill "%s": no such bill found or not a withdrawal.', - $journal['transaction_journal_id'], $billName + $journal['transaction_journal_id'], + $billName ) ); diff --git a/app/TransactionRules/Actions/MoveDescriptionToNotes.php b/app/TransactionRules/Actions/MoveDescriptionToNotes.php index a524d0a1eb..45faf1aef6 100644 --- a/app/TransactionRules/Actions/MoveDescriptionToNotes.php +++ b/app/TransactionRules/Actions/MoveDescriptionToNotes.php @@ -62,7 +62,7 @@ class MoveDescriptionToNotes implements ActionInterface } $note = $object->notes()->first(); if (null === $note) { - $note = new Note; + $note = new Note(); $note->noteable()->associate($object); $note->text = ''; } diff --git a/app/TransactionRules/Actions/PrependNotes.php b/app/TransactionRules/Actions/PrependNotes.php index 6856af40e1..9ff40f9ee6 100644 --- a/app/TransactionRules/Actions/PrependNotes.php +++ b/app/TransactionRules/Actions/PrependNotes.php @@ -50,13 +50,11 @@ class PrependNotes implements ActionInterface */ public function actOnArray(array $journal): bool { - $dbNote = Note - :: - where('noteable_id', (int) $journal['transaction_journal_id']) + $dbNote = Note::where('noteable_id', (int) $journal['transaction_journal_id']) ->where('noteable_type', TransactionJournal::class) ->first(['notes.*']); if (null === $dbNote) { - $dbNote = new Note; + $dbNote = new Note(); $dbNote->noteable_id = (int) $journal['transaction_journal_id']; $dbNote->noteable_type = TransactionJournal::class; $dbNote->text = ''; diff --git a/app/TransactionRules/Actions/RemoveAllTags.php b/app/TransactionRules/Actions/RemoveAllTags.php index 0d446cc499..486ec340f9 100644 --- a/app/TransactionRules/Actions/RemoveAllTags.php +++ b/app/TransactionRules/Actions/RemoveAllTags.php @@ -66,5 +66,4 @@ class RemoveAllTags implements ActionInterface return true; } - } diff --git a/app/TransactionRules/Actions/RemoveTag.php b/app/TransactionRules/Actions/RemoveTag.php index 916f8af499..e19875655a 100644 --- a/app/TransactionRules/Actions/RemoveTag.php +++ b/app/TransactionRules/Actions/RemoveTag.php @@ -63,7 +63,7 @@ class RemoveTag implements ActionInterface return false; } $count = DB::table('tag_transaction_journal')->where('transaction_journal_id', $journal['transaction_journal_id'])->where('tag_id', $tag->id)->count(); - if(0 === $count) { + if (0 === $count) { Log::debug(sprintf('RuleAction RemoveTag tried to remove tag "%s" from journal #%d but no such tag is linked.', $name, $journal['transaction_journal_id'])); return false; } diff --git a/app/TransactionRules/Actions/SetBudget.php b/app/TransactionRules/Actions/SetBudget.php index 77c8d9b030..4bd2b078d0 100644 --- a/app/TransactionRules/Actions/SetBudget.php +++ b/app/TransactionRules/Actions/SetBudget.php @@ -59,7 +59,8 @@ class SetBudget implements ActionInterface if (null === $budget) { Log::debug( sprintf( - 'RuleAction SetBudget could not set budget of journal #%d to "%s" because no such budget exists.', $journal['transaction_journal_id'], + 'RuleAction SetBudget could not set budget of journal #%d to "%s" because no such budget exists.', + $journal['transaction_journal_id'], $search ) ); diff --git a/app/TransactionRules/Actions/SetCategory.php b/app/TransactionRules/Actions/SetCategory.php index f69a913225..6dec531851 100644 --- a/app/TransactionRules/Actions/SetCategory.php +++ b/app/TransactionRules/Actions/SetCategory.php @@ -67,7 +67,8 @@ class SetCategory implements ActionInterface if (null === $category) { Log::debug( sprintf( - 'RuleAction SetCategory could not set category of journal #%d to "%s" because no such category exists.', $journal['transaction_journal_id'], + 'RuleAction SetCategory could not set category of journal #%d to "%s" because no such category exists.', + $journal['transaction_journal_id'], $search ) ); @@ -77,7 +78,9 @@ class SetCategory implements ActionInterface Log::debug( sprintf( - 'RuleAction SetCategory set the category of journal #%d to category #%d ("%s").', $journal['transaction_journal_id'], $category->id, + 'RuleAction SetCategory set the category of journal #%d to category #%d ("%s").', + $journal['transaction_journal_id'], + $category->id, $category->name ) ); diff --git a/app/TransactionRules/Actions/SetDestinationAccount.php b/app/TransactionRules/Actions/SetDestinationAccount.php index 4ce2fe08d5..a283fea95a 100644 --- a/app/TransactionRules/Actions/SetDestinationAccount.php +++ b/app/TransactionRules/Actions/SetDestinationAccount.php @@ -75,7 +75,9 @@ class SetDestinationAccount implements ActionInterface if ((TransactionType::DEPOSIT === $type || TransactionType::TRANSFER === $type) && null === $newAccount) { Log::error( sprintf( - 'Cant change destination account of journal #%d because no asset account with name "%s" exists.', $object->id, $this->action->action_value + 'Cant change destination account of journal #%d because no asset account with name "%s" exists.', + $object->id, + $this->action->action_value ) ); @@ -99,7 +101,8 @@ class SetDestinationAccount implements ActionInterface if (null !== $newAccount && (int) $newAccount->id === (int) $source->account_id) { Log::error( sprintf( - 'New destination account ID #%d and current source account ID #%d are the same. Do nothing.', $newAccount->id, + 'New destination account ID #%d and current source account ID #%d are the same. Do nothing.', + $newAccount->id, $source->account_id ) ); @@ -126,8 +129,6 @@ class SetDestinationAccount implements ActionInterface Log::debug(sprintf('Updated journal #%d (group #%d) and gave it new destination account ID.', $object->id, $object->transaction_group_id)); return true; - - } /** @@ -167,6 +168,4 @@ class SetDestinationAccount implements ActionInterface return $account; } - - } diff --git a/app/TransactionRules/Actions/SetNotes.php b/app/TransactionRules/Actions/SetNotes.php index 1cd1147b6d..76457cb887 100644 --- a/app/TransactionRules/Actions/SetNotes.php +++ b/app/TransactionRules/Actions/SetNotes.php @@ -53,7 +53,7 @@ class SetNotes implements ActionInterface $dbNote = Note::where('noteable_id', $journal['transaction_journal_id']) ->where('noteable_type', TransactionJournal::class)->first(); if (null === $dbNote) { - $dbNote = new Note; + $dbNote = new Note(); $dbNote->noteable_id = $journal['transaction_journal_id']; $dbNote->noteable_type = TransactionJournal::class; $dbNote->text = ''; @@ -64,7 +64,9 @@ class SetNotes implements ActionInterface Log::debug( sprintf( - 'RuleAction SetNotes changed the notes of journal #%d from "%s" to "%s".', $journal['transaction_journal_id'], $oldNotes, + 'RuleAction SetNotes changed the notes of journal #%d from "%s" to "%s".', + $journal['transaction_journal_id'], + $oldNotes, $this->action->action_value ) ); diff --git a/app/TransactionRules/Actions/SetSourceAccount.php b/app/TransactionRules/Actions/SetSourceAccount.php index 35836931d5..a264fdd176 100644 --- a/app/TransactionRules/Actions/SetSourceAccount.php +++ b/app/TransactionRules/Actions/SetSourceAccount.php @@ -96,7 +96,8 @@ class SetSourceAccount implements ActionInterface if (null !== $newAccount && (int) $newAccount->id === (int) $destination->account_id) { Log::error( sprintf( - 'New source account ID #%d and current destination account ID #%d are the same. Do nothing.', $newAccount->id, + 'New source account ID #%d and current destination account ID #%d are the same. Do nothing.', + $newAccount->id, $destination->account_id ) ); diff --git a/app/TransactionRules/Actions/UpdatePiggybank.php b/app/TransactionRules/Actions/UpdatePiggybank.php index 2fc4de30b0..f0987283d9 100644 --- a/app/TransactionRules/Actions/UpdatePiggybank.php +++ b/app/TransactionRules/Actions/UpdatePiggybank.php @@ -39,7 +39,6 @@ use Log; */ class UpdatePiggybank implements ActionInterface { - /** @var RuleAction The rule action */ private $action; @@ -107,7 +106,9 @@ class UpdatePiggybank implements ActionInterface } Log::info( sprintf( - 'Piggy bank is not linked to source ("#%d") or destination ("#%d"), so no action will be taken.', $source->account_id, $destination->account_id + 'Piggy bank is not linked to source ("#%d") or destination ("#%d"), so no action will be taken.', + $source->account_id, + $destination->account_id ) ); diff --git a/app/TransactionRules/Engine/RuleEngineInterface.php b/app/TransactionRules/Engine/RuleEngineInterface.php index c5cf66c2cd..d6e54d0002 100644 --- a/app/TransactionRules/Engine/RuleEngineInterface.php +++ b/app/TransactionRules/Engine/RuleEngineInterface.php @@ -73,5 +73,4 @@ interface RuleEngineInterface * @param User $user */ public function setUser(User $user): void; - } diff --git a/app/TransactionRules/Engine/SearchRuleEngine.php b/app/TransactionRules/Engine/SearchRuleEngine.php index 3ca0cd33cb..19c45599d0 100644 --- a/app/TransactionRules/Engine/SearchRuleEngine.php +++ b/app/TransactionRules/Engine/SearchRuleEngine.php @@ -50,8 +50,8 @@ class SearchRuleEngine implements RuleEngineInterface public function __construct() { - $this->rules = new Collection; - $this->groups = new Collection; + $this->rules = new Collection(); + $this->groups = new Collection(); $this->operators = []; $this->resultCount = []; } @@ -71,9 +71,9 @@ class SearchRuleEngine implements RuleEngineInterface public function find(): Collection { Log::debug('SearchRuleEngine::find()'); - $collection = new Collection; + $collection = new Collection(); foreach ($this->rules as $rule) { - $found = new Collection; + $found = new Collection(); if (true === $rule->strict) { $found = $this->findStrictRule($rule); } @@ -216,7 +216,7 @@ class SearchRuleEngine implements RuleEngineInterface private function findNonStrictRule(Rule $rule): Collection { // start a search query for individual each trigger: - $total = new Collection; + $total = new Collection(); $count = 0; /** @var Collection $triggers */ @@ -502,7 +502,6 @@ class SearchRuleEngine implements RuleEngineInterface return; } } - } /** @@ -534,7 +533,6 @@ class SearchRuleEngine implements RuleEngineInterface */ public function setRules(Collection $rules): void { - Log::debug(__METHOD__); foreach ($rules as $rule) { if ($rule instanceof Rule) { diff --git a/app/Transformers/AccountTransformer.php b/app/Transformers/AccountTransformer.php index a283365d9c..a6227be244 100644 --- a/app/Transformers/AccountTransformer.php +++ b/app/Transformers/AccountTransformer.php @@ -45,7 +45,7 @@ class AccountTransformer extends AbstractTransformer */ public function __construct() { - $this->parameters = new ParameterBag; + $this->parameters = new ParameterBag(); $this->repository = app(AccountRepositoryInterface::class); } @@ -92,7 +92,7 @@ class AccountTransformer extends AbstractTransformer // no order for some accounts: $order = (int) $account->order; - if (!in_array(strtolower($accountType), ['liability', 'liabilities', 'asset'])) { + if (!in_array(strtolower($accountType), ['liability', 'liabilities', 'asset'], true)) { $order = null; } diff --git a/app/Transformers/AttachmentTransformer.php b/app/Transformers/AttachmentTransformer.php index 430feeb9b1..3d03a79c4d 100644 --- a/app/Transformers/AttachmentTransformer.php +++ b/app/Transformers/AttachmentTransformer.php @@ -76,5 +76,4 @@ class AttachmentTransformer extends AbstractTransformer ], ]; } - } diff --git a/app/Transformers/BillTransformer.php b/app/Transformers/BillTransformer.php index 9885840f30..f469b0c698 100644 --- a/app/Transformers/BillTransformer.php +++ b/app/Transformers/BillTransformer.php @@ -254,7 +254,7 @@ class BillTransformer extends AbstractTransformer return []; } - $set = new Collection; + $set = new Collection(); $currentStart = clone $this->parameters->get('start'); $loop = 0; while ($currentStart <= $this->parameters->get('end')) { diff --git a/app/Transformers/BudgetLimitTransformer.php b/app/Transformers/BudgetLimitTransformer.php index efea0b5d7f..d7431a77ff 100644 --- a/app/Transformers/BudgetLimitTransformer.php +++ b/app/Transformers/BudgetLimitTransformer.php @@ -48,7 +48,7 @@ class BudgetLimitTransformer extends AbstractTransformer */ public function includeBudget(BudgetLimit $limit) { - return $this->item($limit->budget, new BudgetTransformer, 'budgets'); + return $this->item($limit->budget, new BudgetTransformer(), 'budgets'); } /** @@ -63,7 +63,11 @@ class BudgetLimitTransformer extends AbstractTransformer $repository = app(OperationsRepository::class); $repository->setUser($budgetLimit->budget->user); $expenses = $repository->sumExpenses( - $budgetLimit->start_date, $budgetLimit->end_date, null, new Collection([$budgetLimit->budget]), $budgetLimit->transactionCurrency + $budgetLimit->start_date, + $budgetLimit->end_date, + null, + new Collection([$budgetLimit->budget]), + $budgetLimit->transactionCurrency ); $currency = $budgetLimit->transactionCurrency; $amount = $budgetLimit->amount; diff --git a/app/Transformers/BudgetTransformer.php b/app/Transformers/BudgetTransformer.php index 3f5cf67e95..218083d9b2 100644 --- a/app/Transformers/BudgetTransformer.php +++ b/app/Transformers/BudgetTransformer.php @@ -126,5 +126,4 @@ class BudgetTransformer extends AbstractTransformer return $return; } - } diff --git a/app/Transformers/CurrencyTransformer.php b/app/Transformers/CurrencyTransformer.php index ab78269e8e..34e35045aa 100644 --- a/app/Transformers/CurrencyTransformer.php +++ b/app/Transformers/CurrencyTransformer.php @@ -30,7 +30,6 @@ use FireflyIII\Models\TransactionCurrency; */ class CurrencyTransformer extends AbstractTransformer { - /** * Transform the currency. * diff --git a/app/Transformers/ObjectGroupTransformer.php b/app/Transformers/ObjectGroupTransformer.php index 3f350d79cf..6de992cea0 100644 --- a/app/Transformers/ObjectGroupTransformer.php +++ b/app/Transformers/ObjectGroupTransformer.php @@ -69,5 +69,4 @@ class ObjectGroupTransformer extends AbstractTransformer ], ]; } - } diff --git a/app/Transformers/PiggyBankEventTransformer.php b/app/Transformers/PiggyBankEventTransformer.php index 80da4595c1..caa8b52042 100644 --- a/app/Transformers/PiggyBankEventTransformer.php +++ b/app/Transformers/PiggyBankEventTransformer.php @@ -98,5 +98,4 @@ class PiggyBankEventTransformer extends AbstractTransformer ], ]; } - } diff --git a/app/Transformers/PreferenceTransformer.php b/app/Transformers/PreferenceTransformer.php index 402966786f..5a6421050f 100644 --- a/app/Transformers/PreferenceTransformer.php +++ b/app/Transformers/PreferenceTransformer.php @@ -46,7 +46,5 @@ class PreferenceTransformer extends AbstractTransformer 'name' => $preference->name, 'data' => $preference->data, ]; - } - } diff --git a/app/Transformers/RecurrenceTransformer.php b/app/Transformers/RecurrenceTransformer.php index 5e171eb140..42172ea2e3 100644 --- a/app/Transformers/RecurrenceTransformer.php +++ b/app/Transformers/RecurrenceTransformer.php @@ -60,7 +60,6 @@ class RecurrenceTransformer extends AbstractTransformer $this->factory = app(CategoryFactory::class); $this->budgetRepos = app(BudgetRepositoryInterface::class); $this->billRepos = app(BillRepositoryInterface::class); - } /** @@ -138,7 +137,7 @@ class RecurrenceTransformer extends AbstractTransformer ]; // get the (future) occurrences for this specific type of repetition: - $occurrences = $this->repository->getXOccurrencesSince($repetition, $fromDate, new Carbon, 5); + $occurrences = $this->repository->getXOccurrencesSince($repetition, $fromDate, new Carbon(), 5); /** @var Carbon $carbon */ foreach ($occurrences as $carbon) { $repetitionArray['occurrences'][] = $carbon->toAtomString(); @@ -163,7 +162,6 @@ class RecurrenceTransformer extends AbstractTransformer // get all transactions: /** @var RecurrenceTransaction $transaction */ foreach ($recurrence->recurrenceTransactions()->get() as $transaction) { - $sourceAccount = $transaction->sourceAccount; $destinationAccount = $transaction->destinationAccount; $foreignCurrencyCode = null; @@ -306,5 +304,4 @@ class RecurrenceTransformer extends AbstractTransformer return $array; } - } diff --git a/app/Transformers/RuleGroupTransformer.php b/app/Transformers/RuleGroupTransformer.php index 61748c86f6..cd57727424 100644 --- a/app/Transformers/RuleGroupTransformer.php +++ b/app/Transformers/RuleGroupTransformer.php @@ -30,7 +30,6 @@ use FireflyIII\Models\RuleGroup; */ class RuleGroupTransformer extends AbstractTransformer { - /** * Transform the rule group * diff --git a/app/Transformers/TagTransformer.php b/app/Transformers/TagTransformer.php index 9f74dc66b4..99d81fb1c5 100644 --- a/app/Transformers/TagTransformer.php +++ b/app/Transformers/TagTransformer.php @@ -31,7 +31,6 @@ use FireflyIII\Models\Tag; */ class TagTransformer extends AbstractTransformer { - /** * Transform a tag. * @@ -73,5 +72,4 @@ class TagTransformer extends AbstractTransformer ], ]; } - } diff --git a/app/Transformers/TransactionGroupTransformer.php b/app/Transformers/TransactionGroupTransformer.php index 02ea3271a7..4baa7e8c95 100644 --- a/app/Transformers/TransactionGroupTransformer.php +++ b/app/Transformers/TransactionGroupTransformer.php @@ -126,7 +126,7 @@ class TransactionGroupTransformer extends AbstractTransformer $metaDateData = $this->groupRepos->getMetaDateFields((int) $row['transaction_journal_id'], $this->metaDateFields); $type = $this->stringFromArray($transaction, 'transaction_type_type', TransactionType::WITHDRAWAL); - + $longitude = null; $latitude = null; $zoomLevel = null; diff --git a/app/Transformers/UserTransformer.php b/app/Transformers/UserTransformer.php index 8b8ca5b5ee..6180f96462 100644 --- a/app/Transformers/UserTransformer.php +++ b/app/Transformers/UserTransformer.php @@ -61,5 +61,4 @@ class UserTransformer extends AbstractTransformer ], ]; } - } diff --git a/app/Transformers/V2/AccountTransformer.php b/app/Transformers/V2/AccountTransformer.php index ba3e23b0ca..16db6e4a9d 100644 --- a/app/Transformers/V2/AccountTransformer.php +++ b/app/Transformers/V2/AccountTransformer.php @@ -131,8 +131,7 @@ class AccountTransformer extends AbstractTransformer // get currencies: $accountIds = $objects->pluck('id')->toArray(); - $meta = AccountMeta - ::whereIn('account_id', $accountIds) + $meta = AccountMeta::whereIn('account_id', $accountIds) ->where('name', 'currency_id') ->get(['account_meta.id', 'account_meta.account_id', 'account_meta.name', 'account_meta.data']); $currencyIds = $meta->pluck('data')->toArray(); diff --git a/app/Transformers/V2/BudgetLimitTransformer.php b/app/Transformers/V2/BudgetLimitTransformer.php index 97f9a58a77..792ead66ea 100644 --- a/app/Transformers/V2/BudgetLimitTransformer.php +++ b/app/Transformers/V2/BudgetLimitTransformer.php @@ -48,7 +48,7 @@ class BudgetLimitTransformer extends AbstractTransformer */ public function includeBudget(BudgetLimit $limit) { - return $this->item($limit->budget, new BudgetTransformer, 'budgets'); + return $this->item($limit->budget, new BudgetTransformer(), 'budgets'); } /** diff --git a/app/Transformers/V2/PreferenceTransformer.php b/app/Transformers/V2/PreferenceTransformer.php index b9898bcd9c..cbf3501bf2 100644 --- a/app/Transformers/V2/PreferenceTransformer.php +++ b/app/Transformers/V2/PreferenceTransformer.php @@ -47,7 +47,6 @@ class PreferenceTransformer extends AbstractTransformer 'name' => $preference->name, 'data' => $preference->data, ]; - } /** diff --git a/app/Transformers/V2/TransactionGroupTransformer.php b/app/Transformers/V2/TransactionGroupTransformer.php index 1bf5d6e8ff..830d995fc0 100644 --- a/app/Transformers/V2/TransactionGroupTransformer.php +++ b/app/Transformers/V2/TransactionGroupTransformer.php @@ -260,7 +260,7 @@ class TransactionGroupTransformer extends AbstractTransformer */ private function date(?string $string): ?Carbon { - if(null === $string) { + if (null === $string) { return null; } return Carbon::createFromFormat('Y-m-d', $string); diff --git a/app/Transformers/WebhookAttemptTransformer.php b/app/Transformers/WebhookAttemptTransformer.php index a271a917d3..3dceadb913 100644 --- a/app/Transformers/WebhookAttemptTransformer.php +++ b/app/Transformers/WebhookAttemptTransformer.php @@ -49,5 +49,4 @@ class WebhookAttemptTransformer extends AbstractTransformer 'response' => $attempt->response, ]; } - } diff --git a/app/Transformers/WebhookMessageTransformer.php b/app/Transformers/WebhookMessageTransformer.php index 9ed9c76d16..e779665b7d 100644 --- a/app/Transformers/WebhookMessageTransformer.php +++ b/app/Transformers/WebhookMessageTransformer.php @@ -41,7 +41,6 @@ class WebhookMessageTransformer extends AbstractTransformer */ public function transform(WebhookMessage $message): array { - $json = '{}'; try { $json = json_encode($message->message, JSON_THROW_ON_ERROR); @@ -60,5 +59,4 @@ class WebhookMessageTransformer extends AbstractTransformer 'message' => $json, ]; } - } diff --git a/app/Validation/Account/AccountValidatorProperties.php b/app/Validation/Account/AccountValidatorProperties.php index 61197490ab..b77f592bdf 100644 --- a/app/Validation/Account/AccountValidatorProperties.php +++ b/app/Validation/Account/AccountValidatorProperties.php @@ -31,5 +31,4 @@ namespace FireflyIII\Validation\Account; */ trait AccountValidatorProperties { - } diff --git a/app/Validation/Account/DepositValidation.php b/app/Validation/Account/DepositValidation.php index 9e71bde252..1746123286 100644 --- a/app/Validation/Account/DepositValidation.php +++ b/app/Validation/Account/DepositValidation.php @@ -153,7 +153,7 @@ trait DepositValidation $result = true; // set the source to be a (dummy) revenue account. - $account = new Account; + $account = new Account(); $accountType = AccountType::whereType(AccountType::REVENUE)->first(); $account->accountType = $accountType; $this->source = $account; diff --git a/app/Validation/Account/LiabilityValidation.php b/app/Validation/Account/LiabilityValidation.php index 683eabe2d2..30a23ebedf 100644 --- a/app/Validation/Account/LiabilityValidation.php +++ b/app/Validation/Account/LiabilityValidation.php @@ -24,7 +24,6 @@ declare(strict_types=1); namespace FireflyIII\Validation\Account; - use FireflyIII\Models\Account; use FireflyIII\Models\AccountType; use Log; @@ -34,7 +33,6 @@ use Log; */ trait LiabilityValidation { - /** * @param array $array * @@ -89,7 +87,7 @@ trait LiabilityValidation } if (true === $result) { // set the source to be a (dummy) revenue account. - $account = new Account; + $account = new Account(); $accountType = AccountType::whereType(AccountType::LIABILITY_CREDIT)->first(); $account->accountType = $accountType; $this->source = $account; @@ -97,5 +95,4 @@ trait LiabilityValidation return $result; } - } diff --git a/app/Validation/Account/OBValidation.php b/app/Validation/Account/OBValidation.php index 60b107da9a..b422455eeb 100644 --- a/app/Validation/Account/OBValidation.php +++ b/app/Validation/Account/OBValidation.php @@ -139,7 +139,7 @@ trait OBValidation $result = true; // set the source to be a (dummy) initial balance account. - $account = new Account; + $account = new Account(); $accountType = AccountType::whereType(AccountType::INITIAL_BALANCE)->first(); $account->accountType = $accountType; $this->source = $account; diff --git a/app/Validation/Account/ReconciliationValidation.php b/app/Validation/Account/ReconciliationValidation.php index 3e8d2962be..55b5ff89a9 100644 --- a/app/Validation/Account/ReconciliationValidation.php +++ b/app/Validation/Account/ReconciliationValidation.php @@ -86,7 +86,7 @@ trait ReconciliationValidation // source to the asset account that is the destination. if (null === $accountId && null === $accountName) { Log::debug('The source is valid because ID and name are NULL.'); - $this->source = new Account; + $this->source = new Account(); return true; } @@ -107,5 +107,4 @@ trait ReconciliationValidation return true; } - } diff --git a/app/Validation/AccountValidator.php b/app/Validation/AccountValidator.php index 16bb89c58c..803234c38e 100644 --- a/app/Validation/AccountValidator.php +++ b/app/Validation/AccountValidator.php @@ -42,7 +42,13 @@ use Log; */ class AccountValidator { - use AccountValidatorProperties, WithdrawalValidation, DepositValidation, TransferValidation, ReconciliationValidation, OBValidation, LiabilityValidation; + use AccountValidatorProperties; + use WithdrawalValidation; + use DepositValidation; + use TransferValidation; + use ReconciliationValidation; + use OBValidation; + use LiabilityValidation; public bool $createMode; public string $destError; @@ -258,5 +264,4 @@ class AccountValidator return null; } - } diff --git a/app/Validation/Api/Data/Bulk/ValidatesBulkTransactionQuery.php b/app/Validation/Api/Data/Bulk/ValidatesBulkTransactionQuery.php index b67d03384d..ca083d63fb 100644 --- a/app/Validation/Api/Data/Bulk/ValidatesBulkTransactionQuery.php +++ b/app/Validation/Api/Data/Bulk/ValidatesBulkTransactionQuery.php @@ -73,5 +73,4 @@ trait ValidatesBulkTransactionQuery } } } - } diff --git a/app/Validation/AutoBudget/ValidatesAutoBudgetRequest.php b/app/Validation/AutoBudget/ValidatesAutoBudgetRequest.php index eb3eeca742..e45ffe0d39 100644 --- a/app/Validation/AutoBudget/ValidatesAutoBudgetRequest.php +++ b/app/Validation/AutoBudget/ValidatesAutoBudgetRequest.php @@ -67,7 +67,7 @@ trait ValidatesAutoBudgetRequest $validator->errors()->add('auto_budget_amount', (string) trans('validation.require_currency_info')); } // too big amount - if((int)$amount > 268435456) { + if ((int)$amount > 268435456) { $validator->errors()->add('auto_budget_amount', (string) trans('validation.amount_required_for_auto_budget')); return; } diff --git a/app/Validation/CurrencyValidation.php b/app/Validation/CurrencyValidation.php index a1cc7cf921..331103dc6e 100644 --- a/app/Validation/CurrencyValidation.php +++ b/app/Validation/CurrencyValidation.php @@ -49,7 +49,8 @@ trait CurrencyValidation if (array_key_exists('foreign_amount', $transaction) && !(array_key_exists('foreign_currency_id', $transaction) || array_key_exists( - 'foreign_currency_code', $transaction + 'foreign_currency_code', + $transaction )) && 0 !== bccomp('0', $transaction['foreign_amount']) ) { @@ -61,7 +62,8 @@ trait CurrencyValidation // if the currency is present, then the amount must be present as well. if ((array_key_exists('foreign_currency_id', $transaction) || array_key_exists('foreign_currency_code', $transaction)) && !array_key_exists( - 'foreign_amount', $transaction + 'foreign_amount', + $transaction )) { $validator->errors()->add( 'transactions.' . $index . '.foreign_amount', diff --git a/app/Validation/FireflyValidator.php b/app/Validation/FireflyValidator.php index 92d66a5170..45af8719e7 100644 --- a/app/Validation/FireflyValidator.php +++ b/app/Validation/FireflyValidator.php @@ -47,6 +47,7 @@ use PragmaRX\Google2FA\Exceptions\IncompatibleWithGoogleAuthenticatorException; use PragmaRX\Google2FA\Exceptions\InvalidCharactersException; use PragmaRX\Google2FA\Exceptions\SecretKeyTooShortException; use ValueError; + use function is_string; /** @@ -54,7 +55,6 @@ use function is_string; */ class FireflyValidator extends Validator { - /** * @param mixed $attribute * @param mixed $value @@ -364,7 +364,7 @@ class FireflyValidator extends Validator } // check if it's an existing account. - if (in_array($triggerType, ['destination_account_id', 'source_account_id'])) { + if (in_array($triggerType, ['destination_account_id', 'source_account_id'], true)) { return is_numeric($value) && (int) $value > 0; } @@ -382,7 +382,6 @@ class FireflyValidator extends Validator try { $parser->parseDate($value); } catch (FireflyException $e) { - Log::error($e->getMessage()); return false; @@ -390,7 +389,6 @@ class FireflyValidator extends Validator } return true; - } /** @@ -424,7 +422,6 @@ class FireflyValidator extends Validator */ public function validateUniqueAccountForUser($attribute, $value, $parameters): bool { - // because a user does not have to be logged in (tests and what-not). if (!auth()->check()) { return $this->validateAccountAnonymously(); @@ -501,7 +498,6 @@ class FireflyValidator extends Validator ); return null === $result; - } /** @@ -812,7 +808,6 @@ class FireflyValidator extends Validator public function validateUniqueWebhook($value, $parameters): bool { if (auth()->check()) { - $triggers = Webhook::getTriggersForValidation(); $responses = Webhook::getResponsesForValidation(); $deliveries = Webhook::getDeliveriesForValidation(); diff --git a/app/Validation/GroupValidation.php b/app/Validation/GroupValidation.php index d4802bcc9e..7ae55d6c6a 100644 --- a/app/Validation/GroupValidation.php +++ b/app/Validation/GroupValidation.php @@ -35,7 +35,6 @@ use Log; */ trait GroupValidation { - /** * @param Validator $validator * @@ -62,10 +61,12 @@ trait GroupValidation // set errors: if (false === $hasAccountInfo && !$hasJournalId) { $validator->errors()->add( - sprintf('transactions.%d.source_id', $index), (string) trans('validation.generic_no_source') + sprintf('transactions.%d.source_id', $index), + (string) trans('validation.generic_no_source') ); $validator->errors()->add( - sprintf('transactions.%d.destination_id', $index), (string) trans('validation.generic_no_destination') + sprintf('transactions.%d.destination_id', $index), + (string) trans('validation.generic_no_destination') ); } } @@ -93,7 +94,8 @@ trait GroupValidation // no valid descriptions? if (0 === $validDescriptions) { $validator->errors()->add( - 'transactions.0.description', (string) trans('validation.filled', ['attribute' => (string) trans('validation.attributes.description')]) + 'transactions.0.description', + (string) trans('validation.filled', ['attribute' => (string) trans('validation.attributes.description')]) ); } }