diff --git a/app/Handlers/Events/APIEventHandler.php b/app/Handlers/Events/APIEventHandler.php index 400c0fdca1..7ca67c5d2d 100644 --- a/app/Handlers/Events/APIEventHandler.php +++ b/app/Handlers/Events/APIEventHandler.php @@ -55,8 +55,7 @@ class APIEventHandler $user = $repository->find((int) $event->userId); if (null !== $user) { - Notification::send($user, new NewAccessToken); + Notification::send($user, new NewAccessToken()); } } - } diff --git a/app/Handlers/Events/AuditEventHandler.php b/app/Handlers/Events/AuditEventHandler.php index 25ee882a19..5bb7917715 100644 --- a/app/Handlers/Events/AuditEventHandler.php +++ b/app/Handlers/Events/AuditEventHandler.php @@ -29,7 +29,6 @@ use FireflyIII\Repositories\AuditLogEntry\ALERepositoryInterface; class AuditEventHandler { - /** * @param TriggeredAuditLog $event * @return void @@ -47,5 +46,4 @@ class AuditEventHandler $repository = app(ALERepositoryInterface::class); $repository->store($array); } - } diff --git a/app/Handlers/Events/AutomationHandler.php b/app/Handlers/Events/AutomationHandler.php index 4b048c126c..5e120c0391 100644 --- a/app/Handlers/Events/AutomationHandler.php +++ b/app/Handlers/Events/AutomationHandler.php @@ -41,7 +41,6 @@ use Mail; */ class AutomationHandler { - /** * Respond to the creation of X journals. * diff --git a/app/Handlers/Events/DestroyedGroupEventHandler.php b/app/Handlers/Events/DestroyedGroupEventHandler.php index e6ddb6a9c7..f8b20503bd 100644 --- a/app/Handlers/Events/DestroyedGroupEventHandler.php +++ b/app/Handlers/Events/DestroyedGroupEventHandler.php @@ -51,6 +51,6 @@ class DestroyedGroupEventHandler $engine->setTrigger(WebhookTrigger::DESTROY_TRANSACTION->value); $engine->generateMessages(); - event(new RequestedSendWebhookMessages); + event(new RequestedSendWebhookMessages()); } } diff --git a/app/Handlers/Events/StoredAccountEventHandler.php b/app/Handlers/Events/StoredAccountEventHandler.php index 59c670e135..a4a48f4cbf 100644 --- a/app/Handlers/Events/StoredAccountEventHandler.php +++ b/app/Handlers/Events/StoredAccountEventHandler.php @@ -43,5 +43,4 @@ class StoredAccountEventHandler $object->setAccount($account); $object->recalculate(); } - } diff --git a/app/Handlers/Events/StoredGroupEventHandler.php b/app/Handlers/Events/StoredGroupEventHandler.php index bd831188fd..392ee20009 100644 --- a/app/Handlers/Events/StoredGroupEventHandler.php +++ b/app/Handlers/Events/StoredGroupEventHandler.php @@ -118,7 +118,6 @@ class StoredGroupEventHandler $engine->generateMessages(); // trigger event to send them: - event(new RequestedSendWebhookMessages); + event(new RequestedSendWebhookMessages()); } - } diff --git a/app/Handlers/Events/UpdatedAccountEventHandler.php b/app/Handlers/Events/UpdatedAccountEventHandler.php index 096ab5f99c..6874fcbba4 100644 --- a/app/Handlers/Events/UpdatedAccountEventHandler.php +++ b/app/Handlers/Events/UpdatedAccountEventHandler.php @@ -24,7 +24,6 @@ declare(strict_types=1); namespace FireflyIII\Handlers\Events; - use FireflyIII\Events\UpdatedAccount; use FireflyIII\Services\Internal\Support\CreditRecalculateService; diff --git a/app/Handlers/Events/UpdatedGroupEventHandler.php b/app/Handlers/Events/UpdatedGroupEventHandler.php index 39a21239ff..f8cd1e16a6 100644 --- a/app/Handlers/Events/UpdatedGroupEventHandler.php +++ b/app/Handlers/Events/UpdatedGroupEventHandler.php @@ -110,7 +110,7 @@ class UpdatedGroupEventHandler $engine->setTrigger(WebhookTrigger::UPDATE_TRANSACTION->value); $engine->generateMessages(); - event(new RequestedSendWebhookMessages); + event(new RequestedSendWebhookMessages()); } /** @@ -155,6 +155,5 @@ class UpdatedGroupEventHandler Transaction::whereIn('transaction_journal_id', $all) ->where('amount', '>', 0)->update(['account_id' => $destAccount->id]); } - } } diff --git a/app/Handlers/Events/UserEventHandler.php b/app/Handlers/Events/UserEventHandler.php index cc96479cdf..6d4cb7c51d 100644 --- a/app/Handlers/Events/UserEventHandler.php +++ b/app/Handlers/Events/UserEventHandler.php @@ -89,7 +89,6 @@ class UserEventHandler $url = route('invite', [$event->invitee->invite_code]); try { Mail::to($invitee)->send(new InvitationMail($invitee, $admin, $url)); - } catch (Exception $e) { // @phpstan-ignore-line Log::error($e->getMessage()); } @@ -101,7 +100,7 @@ class UserEventHandler */ public function createExchangeRates(RegisteredUser $event): void { - $seeder = new ExchangeRateSeeder; + $seeder = new ExchangeRateSeeder(); $seeder->run(); } @@ -246,7 +245,6 @@ class UserEventHandler try { Mail::to($newEmail)->send(new ConfirmEmailChangeMail($newEmail, $oldEmail, $url)); - } catch (Exception $e) { // @phpstan-ignore-line Log::error($e->getMessage()); } @@ -270,7 +268,6 @@ class UserEventHandler $url = route('profile.undo-email-change', [$token->data, $hashed]); try { Mail::to($oldEmail)->send(new UndoEmailChangeMail($newEmail, $oldEmail, $url)); - } catch (Exception $e) { // @phpstan-ignore-line Log::error($e->getMessage()); } @@ -296,7 +293,7 @@ class UserEventHandler { $sendMail = FireflyConfig::get('notification_user_new_reg', true)->data; if ($sendMail) { - Notification::send($event->user, new UserRegistrationNotification); + Notification::send($event->user, new UserRegistrationNotification()); } } @@ -374,6 +371,5 @@ class UserEventHandler if (false === $inArray && true === $send) { event(new DetectedNewIPAddress($user, $ip)); } - } } diff --git a/app/Handlers/Events/WebhookEventHandler.php b/app/Handlers/Events/WebhookEventHandler.php index 2a75380c21..918d8a07c1 100644 --- a/app/Handlers/Events/WebhookEventHandler.php +++ b/app/Handlers/Events/WebhookEventHandler.php @@ -38,8 +38,7 @@ class WebhookEventHandler public function sendWebhookMessages(): void { // kick off the job! - $messages = WebhookMessage - ::where('webhook_messages.sent', 0) + $messages = WebhookMessage::where('webhook_messages.sent', 0) //->where('webhook_messages.errored', 0) ->get(['webhook_messages.*']) ->filter( diff --git a/app/Helpers/Attachments/AttachmentHelper.php b/app/Helpers/Attachments/AttachmentHelper.php index 42a2001d22..2f307cec2f 100644 --- a/app/Helpers/Attachments/AttachmentHelper.php +++ b/app/Helpers/Attachments/AttachmentHelper.php @@ -59,9 +59,9 @@ class AttachmentHelper implements AttachmentHelperInterface { $this->maxUploadSize = (int) config('firefly.maxUploadSize'); $this->allowedMimes = (array) config('firefly.allowedMimes'); - $this->errors = new MessageBag; - $this->messages = new MessageBag; - $this->attachments = new Collection; + $this->errors = new MessageBag(); + $this->messages = new MessageBag(); + $this->attachments = new Collection(); $this->uploadDisk = Storage::disk('upload'); } @@ -145,11 +145,9 @@ class AttachmentHelper implements AttachmentHelperInterface { $resource = tmpfile(); if (false === $resource) { - Log::error('Cannot create temp-file for file upload.'); return false; - } if ('' === $content) { @@ -239,7 +237,7 @@ class AttachmentHelper implements AttachmentHelperInterface $user = $model->account->user; } - $attachment = new Attachment; // create Attachment object. + $attachment = new Attachment(); // create Attachment object. $attachment->user()->associate($user); $attachment->attachable()->associate($model); $attachment->md5 = md5_file($file->getRealPath()); diff --git a/app/Helpers/Collector/Extensions/AccountCollection.php b/app/Helpers/Collector/Extensions/AccountCollection.php index 3906b06fcc..afb2466ea4 100644 --- a/app/Helpers/Collector/Extensions/AccountCollection.php +++ b/app/Helpers/Collector/Extensions/AccountCollection.php @@ -33,7 +33,6 @@ use Illuminate\Support\Collection; */ trait AccountCollection { - /** * These accounts must not be included. * diff --git a/app/Helpers/Collector/Extensions/AmountCollection.php b/app/Helpers/Collector/Extensions/AmountCollection.php index 8f1e7c5b3c..7e71d6e422 100644 --- a/app/Helpers/Collector/Extensions/AmountCollection.php +++ b/app/Helpers/Collector/Extensions/AmountCollection.php @@ -32,7 +32,6 @@ use Illuminate\Database\Eloquent\Builder as EloquentBuilder; */ trait AmountCollection { - /** * Get transactions with a specific amount. * diff --git a/app/Helpers/Collector/Extensions/MetaCollection.php b/app/Helpers/Collector/Extensions/MetaCollection.php index d2347db148..d789bab0a3 100644 --- a/app/Helpers/Collector/Extensions/MetaCollection.php +++ b/app/Helpers/Collector/Extensions/MetaCollection.php @@ -855,7 +855,7 @@ trait MetaCollection $filter = function (int $index, array $object) use ($list): bool { foreach ($object['transactions'] as $transaction) { foreach ($transaction['tags'] as $tag) { - if (in_array($tag['name'], $list)) { + if (in_array($tag['name'], $list, true)) { return false; } } diff --git a/app/Helpers/Collector/Extensions/TimeCollection.php b/app/Helpers/Collector/Extensions/TimeCollection.php index 8a2e715d5a..605f8dcab5 100644 --- a/app/Helpers/Collector/Extensions/TimeCollection.php +++ b/app/Helpers/Collector/Extensions/TimeCollection.php @@ -100,7 +100,6 @@ trait TimeCollection $this->postFilters[] = $filter; return $this; - } /** @@ -430,7 +429,6 @@ trait TimeCollection { $this->query->whereMonth('transaction_journals.date', '>=', $month); return $this; - } /** @@ -441,7 +439,6 @@ trait TimeCollection { $this->query->whereMonth('transaction_journals.date', '<=', $month); return $this; - } /** @@ -718,7 +715,6 @@ trait TimeCollection }; $this->postFilters[] = $filter; return $this; - } /** @@ -841,5 +837,4 @@ trait TimeCollection $this->query->whereYear('transaction_journals.date', '!=', $year); return $this; } - } diff --git a/app/Helpers/Collector/GroupCollector.php b/app/Helpers/Collector/GroupCollector.php index a744774891..8b655012b6 100644 --- a/app/Helpers/Collector/GroupCollector.php +++ b/app/Helpers/Collector/GroupCollector.php @@ -50,7 +50,12 @@ use Log; */ class GroupCollector implements GroupCollectorInterface { - use CollectorProperties, AccountCollection, AmountCollection, TimeCollection, MetaCollection, AttachmentCollection; + use CollectorProperties; + use AccountCollection; + use AmountCollection; + use TimeCollection; + use MetaCollection; + use AttachmentCollection; /** * Group collector constructor. @@ -352,7 +357,6 @@ class GroupCollector implements GroupCollectorInterface */ public function excludeIds(array $groupIds): GroupCollectorInterface { - $this->query->whereNotIn('transaction_groups.id', $groupIds); return $this; @@ -767,7 +771,7 @@ class GroupCollector implements GroupCollectorInterface * @var Closure $function */ foreach ($this->postFilters as $function) { - $nextCollection = new Collection; + $nextCollection = new Collection(); // loop everything in the current collection // and save it (or not) in the new collection. // that new collection is the next current collection @@ -874,7 +878,6 @@ class GroupCollector implements GroupCollectorInterface */ public function setIds(array $groupIds): GroupCollectorInterface { - $this->query->whereIn('transaction_groups.id', $groupIds); return $this; @@ -992,7 +995,6 @@ class GroupCollector implements GroupCollectorInterface if (null === $this->user) { $this->user = $user; $this->startQuery(); - } return $this; diff --git a/app/Helpers/Collector/GroupCollectorInterface.php b/app/Helpers/Collector/GroupCollectorInterface.php index 26e0fb2d74..40704ea139 100644 --- a/app/Helpers/Collector/GroupCollectorInterface.php +++ b/app/Helpers/Collector/GroupCollectorInterface.php @@ -1395,6 +1395,4 @@ interface GroupCollectorInterface * @return GroupCollectorInterface */ public function yearIsNot(string $year): GroupCollectorInterface; - - } diff --git a/app/Helpers/Report/NetWorth.php b/app/Helpers/Report/NetWorth.php index fa686b3af4..b0158d1b9f 100644 --- a/app/Helpers/Report/NetWorth.php +++ b/app/Helpers/Report/NetWorth.php @@ -67,7 +67,7 @@ class NetWorth implements NetWorthInterface public function getNetWorthByCurrency(Collection $accounts, Carbon $date): array { // start in the past, end in the future? use $date - $cache = new CacheProperties; + $cache = new CacheProperties(); $cache->addProperty($date); $cache->addProperty('net-worth-by-currency'); $cache->addProperty(implode(',', $accounts->pluck('id')->toArray())); @@ -184,7 +184,7 @@ class NetWorth implements NetWorthInterface private function getAccounts(): Collection { $accounts = $this->accountRepository->getAccountsByType([AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE, AccountType::DEFAULT, AccountType::CREDITCARD]); - $filtered = new Collection; + $filtered = new Collection(); /** @var Account $account */ foreach ($accounts as $account) { if (1 === (int) $this->accountRepository->getMetaValue($account, 'include_net_worth')) { diff --git a/app/Helpers/Report/NetWorthInterface.php b/app/Helpers/Report/NetWorthInterface.php index c4bd89c199..b1f65500f2 100644 --- a/app/Helpers/Report/NetWorthInterface.php +++ b/app/Helpers/Report/NetWorthInterface.php @@ -66,5 +66,4 @@ interface NetWorthInterface * @return array */ public function sumNetWorthByCurrency(Carbon $date): array; - } diff --git a/app/Helpers/Report/PopupReportInterface.php b/app/Helpers/Report/PopupReportInterface.php index 4e46ee3805..45bad68c83 100644 --- a/app/Helpers/Report/PopupReportInterface.php +++ b/app/Helpers/Report/PopupReportInterface.php @@ -31,7 +31,6 @@ use FireflyIII\Models\Category; */ interface PopupReportInterface { - /** * Get balances for budget. * diff --git a/app/Helpers/Webhook/Sha3SignatureGenerator.php b/app/Helpers/Webhook/Sha3SignatureGenerator.php index 33f2f4dbdf..74fb96dfdd 100644 --- a/app/Helpers/Webhook/Sha3SignatureGenerator.php +++ b/app/Helpers/Webhook/Sha3SignatureGenerator.php @@ -28,7 +28,6 @@ use FireflyIII\Models\WebhookMessage; use JsonException; use Log; - /** * Class Sha3SignatureGenerator */ diff --git a/app/Http/Controllers/Account/DeleteController.php b/app/Http/Controllers/Account/DeleteController.php index 35901e59b7..b58bbb75ba 100644 --- a/app/Http/Controllers/Account/DeleteController.php +++ b/app/Http/Controllers/Account/DeleteController.php @@ -113,5 +113,4 @@ class DeleteController extends Controller return redirect($this->getPreviousUrl('accounts.delete.url')); } - } diff --git a/app/Http/Controllers/Account/IndexController.php b/app/Http/Controllers/Account/IndexController.php index f0a5779e2c..3c981342f9 100644 --- a/app/Http/Controllers/Account/IndexController.php +++ b/app/Http/Controllers/Account/IndexController.php @@ -120,7 +120,6 @@ class IndexController extends Controller $accounts->setPath(route('accounts.inactive.index', [$objectType])); return view('accounts.index', compact('objectType', 'inactivePage', 'subTitleIcon', 'subTitle', 'page', 'accounts')); - } /** diff --git a/app/Http/Controllers/Account/ReconcileController.php b/app/Http/Controllers/Account/ReconcileController.php index 7c4b7d18b9..2d9c04fae6 100644 --- a/app/Http/Controllers/Account/ReconcileController.php +++ b/app/Http/Controllers/Account/ReconcileController.php @@ -96,11 +96,9 @@ class ReconcileController extends Controller return $this->redirectAccountToAccount($account); } if (AccountType::ASSET !== $account->accountType->type) { - session()->flash('error', (string) trans('firefly.must_be_asset_account')); return redirect(route('accounts.index', [config(sprintf('firefly.shortNamesByFullName.%s', $account->accountType->type))])); - } $currency = $this->accountRepos->getAccountCurrency($account) ?? app('amount')->getDefaultCurrency(); @@ -110,11 +108,10 @@ class ReconcileController extends Controller // get start and end if (null === $start && null === $end) { - /** @var Carbon $start */ - $start = clone session('start', app('navigation')->startOfPeriod(new Carbon, $range)); + $start = clone session('start', app('navigation')->startOfPeriod(new Carbon(), $range)); /** @var Carbon $end */ - $end = clone session('end', app('navigation')->endOfPeriod(new Carbon, $range)); + $end = clone session('end', app('navigation')->endOfPeriod(new Carbon(), $range)); } if (null === $end) { /** @var Carbon $end */ diff --git a/app/Http/Controllers/Account/ShowController.php b/app/Http/Controllers/Account/ShowController.php index 4083d4100d..23590af022 100644 --- a/app/Http/Controllers/Account/ShowController.php +++ b/app/Http/Controllers/Account/ShowController.php @@ -188,7 +188,7 @@ class ShowController extends Controller $pageSize = (int) app('preferences')->get('listPageSize', 50)->data; $currency = $this->repository->getAccountCurrency($account) ?? app('amount')->getDefaultCurrency(); $subTitle = (string) trans('firefly.all_journals_for_account', ['name' => $account->name]); - $periods = new Collection; + $periods = new Collection(); /** @var GroupCollectorInterface $collector */ $collector = app(GroupCollectorInterface::class); $collector->setAccounts(new Collection([$account]))->setLimit($pageSize)->setPage($page)->withAccountInformation()->withCategoryInformation(); diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index 8fcb945cac..706234633c 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -246,11 +246,9 @@ class UserController extends Controller app('preferences')->mark(); $redirect = redirect($this->getPreviousUrl('users.edit.url')); if (1 === (int) $request->get('return_to_edit')) { - session()->put('users.edit.fromUpdate', true); $redirect = redirect(route('admin.users.edit', [$user->id]))->withInput(['return_to_edit' => 1]); - } // redirect to previous URL. diff --git a/app/Http/Controllers/AttachmentController.php b/app/Http/Controllers/AttachmentController.php index 2fe07a7d0f..c33e0f26f0 100644 --- a/app/Http/Controllers/AttachmentController.php +++ b/app/Http/Controllers/AttachmentController.php @@ -40,7 +40,6 @@ use Illuminate\View\View; */ class AttachmentController extends Controller { - /** @var AttachmentRepositoryInterface Attachment repository */ private $repository; @@ -198,11 +197,9 @@ class AttachmentController extends Controller $redirect = redirect($this->getPreviousUrl('attachments.edit.url')); if (1 === (int) $request->get('return_to_edit')) { - $request->session()->put('attachments.edit.fromUpdate', true); $redirect = redirect(route('attachments.edit', [$attachment->id]))->withInput(['return_to_edit' => 1]); - } // redirect to previous URL. diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 80dfe094d1..4a92da436c 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -52,7 +52,8 @@ use Log; */ class LoginController extends Controller { - use AuthenticatesUsers, ThrottlesLogins; + use AuthenticatesUsers; + use ThrottlesLogins; /** * Where to redirect users after login. diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 3722b19669..3c3985de88 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -51,7 +51,8 @@ use Psr\Container\NotFoundExceptionInterface; */ class RegisterController extends Controller { - use RegistersUsers, CreateStuff; + use RegistersUsers; + use CreateStuff; /** * Where to redirect users after registration. @@ -74,7 +75,6 @@ class RegisterController extends Controller if ('eloquent' !== $loginProvider || 'web' !== $authGuard) { throw new FireflyException('Using external identity provider. Cannot continue.'); } - } /** @@ -191,7 +191,7 @@ class RegisterController extends Controller return view('error', compact('message')); } - if(false === $validCode) { + if (false === $validCode) { $message = 'Invalid code.'; return view('error', compact('message')); diff --git a/app/Http/Controllers/Bill/EditController.php b/app/Http/Controllers/Bill/EditController.php index 0c4f459045..41372dc510 100644 --- a/app/Http/Controllers/Bill/EditController.php +++ b/app/Http/Controllers/Bill/EditController.php @@ -144,11 +144,9 @@ class EditController extends Controller $redirect = redirect($this->getPreviousUrl('bills.edit.url')); if (1 === (int) $request->get('return_to_edit')) { - $request->session()->put('bills.edit.fromUpdate', true); $redirect = redirect(route('bills.edit', [$bill->id]))->withInput(['return_to_edit' => 1]); - } return $redirect; diff --git a/app/Http/Controllers/Bill/IndexController.php b/app/Http/Controllers/Bill/IndexController.php index 5fd72fa205..eff331c03f 100644 --- a/app/Http/Controllers/Bill/IndexController.php +++ b/app/Http/Controllers/Bill/IndexController.php @@ -77,7 +77,7 @@ class IndexController extends Controller $total = $collection->count(); $defaultCurrency = app('amount')->getDefaultCurrency(); - $parameters = new ParameterBag; + $parameters = new ParameterBag(); $parameters->set('start', $start); $parameters->set('end', $end); diff --git a/app/Http/Controllers/Bill/ShowController.php b/app/Http/Controllers/Bill/ShowController.php index dbcfb83502..421ded5214 100644 --- a/app/Http/Controllers/Bill/ShowController.php +++ b/app/Http/Controllers/Bill/ShowController.php @@ -88,7 +88,7 @@ class ShowController extends Controller return redirect(route('bills.show', [$bill->id])); } - $set = new Collection; + $set = new Collection(); if (true === $bill->active) { $set = $this->repository->getRulesForBill($bill); $total = 0; @@ -167,7 +167,7 @@ class ShowController extends Controller // transform any attachments as well. $collection = $this->repository->getAttachments($bill); - $attachments = new Collection; + $attachments = new Collection(); if ($collection->count() > 0) { @@ -183,5 +183,4 @@ class ShowController extends Controller return view('bills.show', compact('attachments', 'groups', 'rules', 'yearAverage', 'overallAverage', 'year', 'object', 'bill', 'subTitle')); } - } diff --git a/app/Http/Controllers/Budget/BudgetLimitController.php b/app/Http/Controllers/Budget/BudgetLimitController.php index b89884e40b..7e8ab14b96 100644 --- a/app/Http/Controllers/Budget/BudgetLimitController.php +++ b/app/Http/Controllers/Budget/BudgetLimitController.php @@ -160,7 +160,7 @@ class BudgetLimitController extends Controller if ((int) $amount > 268435456) { $amount = '268435456'; } - if((float) $amount < 0.0) { + if ((float) $amount < 0.0) { $amount = bcmul($amount, '-1'); } @@ -229,7 +229,7 @@ class BudgetLimitController extends Controller if ((int) $amount > 268435456) { // 268 million $amount = '268435456'; } - if((float) $amount < 0.0) { + if ((float) $amount < 0.0) { $amount = bcmul($amount, '-1'); } diff --git a/app/Http/Controllers/Budget/CreateController.php b/app/Http/Controllers/Budget/CreateController.php index 03bda94126..83f777b48f 100644 --- a/app/Http/Controllers/Budget/CreateController.php +++ b/app/Http/Controllers/Budget/CreateController.php @@ -139,11 +139,9 @@ class CreateController extends Controller $redirect = redirect($this->getPreviousUrl('budgets.create.url')); if (1 === (int) $request->get('create_another')) { - $request->session()->put('budgets.create.fromStore', true); $redirect = redirect(route('budgets.create'))->withInput(); - } return $redirect; diff --git a/app/Http/Controllers/Budget/DeleteController.php b/app/Http/Controllers/Budget/DeleteController.php index 11deeaa906..d4cfa19ff8 100644 --- a/app/Http/Controllers/Budget/DeleteController.php +++ b/app/Http/Controllers/Budget/DeleteController.php @@ -95,5 +95,4 @@ class DeleteController extends Controller return redirect($this->getPreviousUrl('budgets.delete.url')); } - } diff --git a/app/Http/Controllers/Budget/EditController.php b/app/Http/Controllers/Budget/EditController.php index da94091bc4..8ffe0e4356 100644 --- a/app/Http/Controllers/Budget/EditController.php +++ b/app/Http/Controllers/Budget/EditController.php @@ -149,11 +149,9 @@ class EditController extends Controller } if (1 === (int) $request->get('return_to_edit')) { - $request->session()->put('budgets.edit.fromUpdate', true); $redirect = redirect(route('budgets.edit', [$budget->id]))->withInput(['return_to_edit' => 1]); - } return $redirect; diff --git a/app/Http/Controllers/Budget/IndexController.php b/app/Http/Controllers/Budget/IndexController.php index 1148858c02..45b6c3ec8b 100644 --- a/app/Http/Controllers/Budget/IndexController.php +++ b/app/Http/Controllers/Budget/IndexController.php @@ -123,7 +123,7 @@ class IndexController extends Controller // get budgeted for default currency: if (empty($availableBudgets)) { - $budgeted = $this->blRepository->budgeted($start, $end, $defaultCurrency,); + $budgeted = $this->blRepository->budgeted($start, $end, $defaultCurrency, ); $spentArr = $this->opsRepository->sumExpenses($start, $end, null, null, $defaultCurrency); $spent = $spentArr[$defaultCurrency->id]['sum'] ?? '0'; unset($spentArr); @@ -137,10 +137,25 @@ class IndexController extends Controller $inactive = $this->repository->getInactiveBudgets(); return view( - 'budgets.index', compact( - 'availableBudgets', 'budgeted', 'spent', 'prevLoop', 'nextLoop', 'budgets', 'currencies', 'periodTitle', - 'defaultCurrency', 'activeDaysPassed', 'activeDaysLeft', 'inactive', 'budgets', 'start', 'end', 'sums' - ) + 'budgets.index', + compact( + 'availableBudgets', + 'budgeted', + 'spent', + 'prevLoop', + 'nextLoop', + 'budgets', + 'currencies', + 'periodTitle', + 'defaultCurrency', + 'activeDaysPassed', + 'activeDaysLeft', + 'inactive', + 'budgets', + 'start', + 'end', + 'sums' + ) ); } @@ -167,7 +182,7 @@ class IndexController extends Controller $array['spent'] = $spentArr[$entry->transaction_currency_id]['sum'] ?? '0'; // budgeted in period: - $budgeted = $this->blRepository->budgeted($entry->start_date, $entry->end_date, $entry->transactionCurrency,); + $budgeted = $this->blRepository->budgeted($entry->start_date, $entry->end_date, $entry->transactionCurrency, ); $array['budgeted'] = $budgeted; $availableBudgets[] = $array; unset($spentArr); diff --git a/app/Http/Controllers/Budget/ShowController.php b/app/Http/Controllers/Budget/ShowController.php index a92989f85d..f41c24ecb4 100644 --- a/app/Http/Controllers/Budget/ShowController.php +++ b/app/Http/Controllers/Budget/ShowController.php @@ -44,7 +44,8 @@ use Illuminate\View\View; */ class ShowController extends Controller { - use PeriodOverview, AugumentData; + use PeriodOverview; + use AugumentData; protected JournalRepositoryInterface $journalRepos; private BudgetRepositoryInterface $repository; @@ -123,10 +124,9 @@ class ShowController extends Controller */ public function noBudgetAll(Request $request) { - $subTitle = (string) trans('firefly.all_journals_without_budget'); $first = $this->journalRepos->firstNull(); - $start = null === $first ? new Carbon : $first->date; + $start = null === $first ? new Carbon() : $first->date; $end = today(config('app.timezone')); $page = (int) $request->get('page'); $pageSize = (int) app('preferences')->get('listPageSize', 50)->data; diff --git a/app/Http/Controllers/Category/CreateController.php b/app/Http/Controllers/Category/CreateController.php index d29d739735..725c39e71b 100644 --- a/app/Http/Controllers/Category/CreateController.php +++ b/app/Http/Controllers/Category/CreateController.php @@ -112,11 +112,9 @@ class CreateController extends Controller $redirect = redirect(route('categories.index')); if (1 === (int) $request->get('create_another')) { - $request->session()->put('categories.create.fromStore', true); $redirect = redirect(route('categories.create'))->withInput(); - } return $redirect; diff --git a/app/Http/Controllers/Category/EditController.php b/app/Http/Controllers/Category/EditController.php index 0038532d0e..f94bf53808 100644 --- a/app/Http/Controllers/Category/EditController.php +++ b/app/Http/Controllers/Category/EditController.php @@ -39,7 +39,6 @@ use Illuminate\View\View; */ class EditController extends Controller { - private AttachmentHelperInterface $attachments; private CategoryRepositoryInterface $repository; @@ -120,11 +119,9 @@ class EditController extends Controller $redirect = redirect($this->getPreviousUrl('categories.edit.url')); if (1 === (int) $request->get('return_to_edit')) { - $request->session()->put('categories.edit.fromUpdate', true); $redirect = redirect(route('categories.edit', [$category->id])); - } return $redirect; diff --git a/app/Http/Controllers/Category/IndexController.php b/app/Http/Controllers/Category/IndexController.php index ee07147caa..27dab05624 100644 --- a/app/Http/Controllers/Category/IndexController.php +++ b/app/Http/Controllers/Category/IndexController.php @@ -81,7 +81,7 @@ class IndexController extends Controller $collection->each( function (Category $category) { - $category->lastActivity = $this->repository->lastUseDate($category, new Collection); + $category->lastActivity = $this->repository->lastUseDate($category, new Collection()); } ); @@ -91,5 +91,4 @@ class IndexController extends Controller return view('categories.index', compact('categories')); } - } diff --git a/app/Http/Controllers/Category/NoCategoryController.php b/app/Http/Controllers/Category/NoCategoryController.php index 515bfbb16f..268d2a44b3 100644 --- a/app/Http/Controllers/Category/NoCategoryController.php +++ b/app/Http/Controllers/Category/NoCategoryController.php @@ -125,13 +125,13 @@ class NoCategoryController extends Controller // default values: $start = null; $end = null; - $periods = new Collection; + $periods = new Collection(); $page = (int) $request->get('page'); $pageSize = (int) app('preferences')->get('listPageSize', 50)->data; Log::debug('Start of noCategory()'); $subTitle = (string) trans('firefly.all_journals_without_category'); $first = $this->journalRepos->firstNull(); - $start = null === $first ? new Carbon : $first->date; + $start = null === $first ? new Carbon() : $first->date; $end = today(config('app.timezone')); Log::debug(sprintf('Start for noCategory() is %s', $start->format('Y-m-d'))); Log::debug(sprintf('End for noCategory() is %s', $end->format('Y-m-d'))); diff --git a/app/Http/Controllers/Category/ShowController.php b/app/Http/Controllers/Category/ShowController.php index a3eb24c391..346148c78c 100644 --- a/app/Http/Controllers/Category/ShowController.php +++ b/app/Http/Controllers/Category/ShowController.php @@ -132,7 +132,7 @@ class ShowController extends Controller $pageSize = (int) app('preferences')->get('listPageSize', 50)->data; $start = null; $end = null; - $periods = new Collection; + $periods = new Collection(); $subTitle = (string) trans('firefly.all_journals_for_category', ['name' => $category->name]); $first = $this->repository->firstUseDate($category); diff --git a/app/Http/Controllers/Chart/AccountController.php b/app/Http/Controllers/Chart/AccountController.php index c32c8a0ac5..58e1af188f 100644 --- a/app/Http/Controllers/Chart/AccountController.php +++ b/app/Http/Controllers/Chart/AccountController.php @@ -48,7 +48,9 @@ use Log; */ class AccountController extends Controller { - use DateCalculation, AugumentData, ChartGeneration; + use DateCalculation; + use AugumentData; + use ChartGeneration; protected GeneratorInterface $generator; private AccountRepositoryInterface $accountRepository; @@ -88,7 +90,7 @@ class AccountController extends Controller $start = clone session('start', Carbon::now()->startOfMonth()); /** @var Carbon $end */ $end = clone session('end', Carbon::now()->endOfMonth()); - $cache = new CacheProperties; + $cache = new CacheProperties(); $cache->addProperty($start); $cache->addProperty($end); $cache->addProperty('chart.account.expense-accounts'); @@ -196,7 +198,7 @@ class AccountController extends Controller */ public function expenseBudget(Account $account, Carbon $start, Carbon $end): JsonResponse { - $cache = new CacheProperties; + $cache = new CacheProperties(); $cache->addProperty($account->id); $cache->addProperty($start); $cache->addProperty($end); @@ -271,7 +273,7 @@ class AccountController extends Controller */ public function expenseCategory(Account $account, Carbon $start, Carbon $end): JsonResponse { - $cache = new CacheProperties; + $cache = new CacheProperties(); $cache->addProperty($account->id); $cache->addProperty($start); $cache->addProperty($end); @@ -372,7 +374,7 @@ class AccountController extends Controller */ public function incomeCategory(Account $account, Carbon $start, Carbon $end): JsonResponse { - $cache = new CacheProperties; + $cache = new CacheProperties(); $cache->addProperty($account->id); $cache->addProperty($start); $cache->addProperty($end); @@ -432,7 +434,7 @@ class AccountController extends Controller public function period(Account $account, Carbon $start, Carbon $end): JsonResponse { $chartData = []; - $cache = new CacheProperties; + $cache = new CacheProperties(); $cache->addProperty('chart.account.period'); $cache->addProperty($start); $cache->addProperty($end); @@ -508,7 +510,6 @@ class AccountController extends Controller $current = app('navigation')->addPeriod($current, $step, 0); } break; - } $result['entries'] = $entries; @@ -547,7 +548,7 @@ class AccountController extends Controller $start = clone session('start', Carbon::now()->startOfMonth()); /** @var Carbon $end */ $end = clone session('end', Carbon::now()->endOfMonth()); - $cache = new CacheProperties; + $cache = new CacheProperties(); $cache->addProperty($start); $cache->addProperty($end); $cache->addProperty('chart.account.revenue-accounts'); diff --git a/app/Http/Controllers/Chart/BillController.php b/app/Http/Controllers/Chart/BillController.php index ff1782f1b5..5c5b1a5a86 100644 --- a/app/Http/Controllers/Chart/BillController.php +++ b/app/Http/Controllers/Chart/BillController.php @@ -62,7 +62,7 @@ class BillController extends Controller { $start = session('start', Carbon::now()->startOfMonth()); $end = session('end', Carbon::now()->endOfMonth()); - $cache = new CacheProperties; + $cache = new CacheProperties(); $cache->addProperty($start); $cache->addProperty($end); $cache->addProperty('chart.bill.frontpage'); @@ -106,7 +106,7 @@ class BillController extends Controller */ public function single(Bill $bill): JsonResponse { - $cache = new CacheProperties; + $cache = new CacheProperties(); $cache->addProperty('chart.bill.single'); $cache->addProperty($bill->id); if ($cache->has()) { diff --git a/app/Http/Controllers/Chart/BudgetController.php b/app/Http/Controllers/Chart/BudgetController.php index e58025f58a..f0a6afb361 100644 --- a/app/Http/Controllers/Chart/BudgetController.php +++ b/app/Http/Controllers/Chart/BudgetController.php @@ -49,7 +49,8 @@ use JsonException; */ class BudgetController extends Controller { - use DateCalculation, AugumentData; + use DateCalculation; + use AugumentData; protected GeneratorInterface $generator; protected OperationsRepositoryInterface $opsRepository; @@ -209,7 +210,7 @@ class BudgetController extends Controller /** @var GroupCollectorInterface $collector */ $collector = app(GroupCollectorInterface::class); $budgetLimitId = null === $budgetLimit ? 0 : $budgetLimit->id; - $cache = new CacheProperties; + $cache = new CacheProperties(); $cache->addProperty($budget->id); $cache->addProperty($budgetLimitId); $cache->addProperty('chart.budget.expense-asset'); @@ -277,7 +278,7 @@ class BudgetController extends Controller /** @var GroupCollectorInterface $collector */ $collector = app(GroupCollectorInterface::class); $budgetLimitId = null === $budgetLimit ? 0 : $budgetLimit->id; - $cache = new CacheProperties; + $cache = new CacheProperties(); $cache->addProperty($budget->id); $cache->addProperty($budgetLimitId); $cache->addProperty('chart.budget.expense-category'); @@ -341,7 +342,7 @@ class BudgetController extends Controller /** @var GroupCollectorInterface $collector */ $collector = app(GroupCollectorInterface::class); $budgetLimitId = null === $budgetLimit ? 0 : $budgetLimit->id; - $cache = new CacheProperties; + $cache = new CacheProperties(); $cache->addProperty($budget->id); $cache->addProperty($budgetLimitId); $cache->addProperty('chart.budget.expense-expense'); diff --git a/app/Http/Controllers/Chart/BudgetReportController.php b/app/Http/Controllers/Chart/BudgetReportController.php index a343594303..46529e2304 100644 --- a/app/Http/Controllers/Chart/BudgetReportController.php +++ b/app/Http/Controllers/Chart/BudgetReportController.php @@ -41,7 +41,8 @@ use Illuminate\Support\Collection; */ class BudgetReportController extends Controller { - use AugumentData, TransactionCalculation; + use AugumentData; + use TransactionCalculation; /** @var GeneratorInterface Chart generation methods. */ private $generator; diff --git a/app/Http/Controllers/Chart/CategoryController.php b/app/Http/Controllers/Chart/CategoryController.php index 3fe07457c5..7d34da8e3c 100644 --- a/app/Http/Controllers/Chart/CategoryController.php +++ b/app/Http/Controllers/Chart/CategoryController.php @@ -46,7 +46,9 @@ use JsonException; */ class CategoryController extends Controller { - use DateCalculation, AugumentData, ChartGeneration; + use DateCalculation; + use AugumentData; + use ChartGeneration; /** @var GeneratorInterface Chart generation methods. */ protected $generator; @@ -77,7 +79,7 @@ class CategoryController extends Controller public function all(Category $category): JsonResponse { // cache results: - $cache = new CacheProperties; + $cache = new CacheProperties(); $cache->addProperty('chart.category.all'); $cache->addProperty($category->id); if ($cache->has()) { @@ -125,7 +127,7 @@ class CategoryController extends Controller $start = session('start', Carbon::now()->startOfMonth()); $end = session('end', Carbon::now()->endOfMonth()); // chart properties for cache: - $cache = new CacheProperties; + $cache = new CacheProperties(); $cache->addProperty($start); $cache->addProperty($end); $cache->addProperty('chart.category.frontpage'); @@ -154,7 +156,7 @@ class CategoryController extends Controller */ public function reportPeriod(Category $category, Collection $accounts, Carbon $start, Carbon $end): JsonResponse { - $cache = new CacheProperties; + $cache = new CacheProperties(); $cache->addProperty($start); $cache->addProperty($end); $cache->addProperty('chart.category.period'); @@ -202,7 +204,6 @@ class CategoryController extends Controller $collection = new Collection([$category]); $expenses = $opsRepository->listExpenses($start, $end, null, $collection); $income = $opsRepository->listIncome($start, $end, null, $collection); - } $currencies = array_unique(array_merge(array_keys($income), array_keys($expenses))); $periods = app('navigation')->listOfPeriods($start, $end); @@ -269,7 +270,7 @@ class CategoryController extends Controller */ public function reportPeriodNoCategory(Collection $accounts, Carbon $start, Carbon $end): JsonResponse { - $cache = new CacheProperties; + $cache = new CacheProperties(); $cache->addProperty($start); $cache->addProperty($end); $cache->addProperty('chart.category.period.no-cat'); @@ -305,7 +306,7 @@ class CategoryController extends Controller [$end, $start] = [$start, $end]; } - $cache = new CacheProperties; + $cache = new CacheProperties(); $cache->addProperty($start); $cache->addProperty($end); $cache->addProperty($category->id); diff --git a/app/Http/Controllers/Chart/CategoryReportController.php b/app/Http/Controllers/Chart/CategoryReportController.php index 1f16d0f265..c89b98a9b7 100644 --- a/app/Http/Controllers/Chart/CategoryReportController.php +++ b/app/Http/Controllers/Chart/CategoryReportController.php @@ -39,7 +39,8 @@ use Illuminate\Support\Collection; */ class CategoryReportController extends Controller { - use AugumentData, TransactionCalculation; + use AugumentData; + use TransactionCalculation; /** @var GeneratorInterface Chart generation methods. */ private $generator; diff --git a/app/Http/Controllers/Chart/DoubleReportController.php b/app/Http/Controllers/Chart/DoubleReportController.php index 072ed7471b..c223a4463e 100644 --- a/app/Http/Controllers/Chart/DoubleReportController.php +++ b/app/Http/Controllers/Chart/DoubleReportController.php @@ -38,7 +38,6 @@ use Illuminate\Support\Collection; */ class DoubleReportController extends Controller { - /** @var GeneratorInterface Chart generation methods. */ private $generator; /** @var OperationsRepositoryInterface */ diff --git a/app/Http/Controllers/Chart/ExpenseReportController.php b/app/Http/Controllers/Chart/ExpenseReportController.php index 4ee879e09f..ce9783ef54 100644 --- a/app/Http/Controllers/Chart/ExpenseReportController.php +++ b/app/Http/Controllers/Chart/ExpenseReportController.php @@ -42,7 +42,8 @@ use JsonException; */ class ExpenseReportController extends Controller { - use AugumentData, TransactionCalculation; + use AugumentData; + use TransactionCalculation; /** @var AccountRepositoryInterface The account repository */ protected $accountRepository; @@ -82,7 +83,7 @@ class ExpenseReportController extends Controller */ public function mainChart(Collection $accounts, Collection $expense, Carbon $start, Carbon $end): JsonResponse { - $cache = new CacheProperties; + $cache = new CacheProperties(); $cache->addProperty('chart.expense.report.main'); $cache->addProperty($accounts); $cache->addProperty($expense); @@ -98,7 +99,7 @@ class ExpenseReportController extends Controller $currentStart = clone $start; $combined = $this->combineAccounts($expense); // make "all" set: - $all = new Collection; + $all = new Collection(); foreach ($combined as $name => $combination) { $all = $all->merge($combination); } diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index 6b8e669766..87a4293967 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -36,7 +36,11 @@ use Route; */ abstract class Controller extends BaseController { - use AuthorizesRequests, DispatchesJobs, ValidatesRequests, RequestInformation, UserNavigation; + use AuthorizesRequests; + use DispatchesJobs; + use ValidatesRequests; + use RequestInformation; + use UserNavigation; protected string $dateTimeFormat; protected string $monthAndDayFormat; diff --git a/app/Http/Controllers/CurrencyController.php b/app/Http/Controllers/CurrencyController.php index 6b61c923f6..c5a95a6e1b 100644 --- a/app/Http/Controllers/CurrencyController.php +++ b/app/Http/Controllers/CurrencyController.php @@ -139,12 +139,10 @@ class CurrencyController extends Controller /** @var User $user */ $user = auth()->user(); if (!$this->userRepository->hasRole($user, 'owner')) { - $request->session()->flash('error', (string) trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))])); Log::channel('audit')->info(sprintf('Tried to visit page to delete currency %s but is not site owner.', $currency->code)); return redirect(route('currencies.index')); - } if ($this->repository->currencyInUse($currency)) { @@ -177,12 +175,10 @@ class CurrencyController extends Controller /** @var User $user */ $user = auth()->user(); if (!$this->userRepository->hasRole($user, 'owner')) { - $request->session()->flash('error', (string) trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))])); Log::channel('audit')->info(sprintf('Tried to delete currency %s but is not site owner.', $currency->code)); return redirect(route('currencies.index')); - } if ($this->repository->currencyInUse($currency)) { @@ -228,16 +224,13 @@ class CurrencyController extends Controller /** @var User $user */ $user = auth()->user(); if (!$this->userRepository->hasRole($user, 'owner')) { - $request->session()->flash('error', (string) trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))])); Log::channel('audit')->info(sprintf('Tried to disable currency %s but is not site owner.', $currency->code)); return response()->json([]); - } // currency cannot be in use. if ($this->repository->currencyInUse($currency)) { - $location = $this->repository->currencyInUseAt($currency); $message = (string) trans(sprintf('firefly.cannot_disable_currency_%s', $location), ['name' => e($currency->name)]); @@ -274,12 +267,10 @@ class CurrencyController extends Controller /** @var User $user */ $user = auth()->user(); if (!$this->userRepository->hasRole($user, 'owner')) { - $request->session()->flash('error', (string) trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))])); Log::channel('audit')->info(sprintf('Tried to edit currency %s but is not owner.', $currency->code)); return redirect(route('currencies.index')); - } $subTitleIcon = 'fa-pencil'; @@ -371,12 +362,10 @@ class CurrencyController extends Controller $user = auth()->user(); $data = $request->getCurrencyData(); if (!$this->userRepository->hasRole($user, 'owner')) { - Log::error('User ' . auth()->user()->id . ' is not admin, but tried to store a currency.'); Log::channel('audit')->info('Tried to create (POST) currency without admin rights.', $data); return redirect($this->getPreviousUrl('currencies.create.url')); - } $data['enabled'] = true; @@ -394,11 +383,9 @@ class CurrencyController extends Controller $request->session()->flash('success', (string) trans('firefly.created_currency', ['name' => $currency->name])); Log::channel('audit')->info('Created (POST) currency.', $data); if (1 === (int) $request->get('create_another')) { - $request->session()->put('currencies.create.fromStore', true); $redirect = redirect(route('currencies.create'))->withInput(); - } } @@ -423,12 +410,10 @@ class CurrencyController extends Controller $data['enabled'] = true; } if (!$this->userRepository->hasRole($user, 'owner')) { - $request->session()->flash('error', (string) trans('firefly.ask_site_owner', ['owner' => e(config('firefly.site_owner'))])); Log::channel('audit')->info('Tried to update (POST) currency without admin rights.', $data); return redirect(route('currencies.index')); - } $currency = $this->repository->update($currency, $data); Log::channel('audit')->info('Updated (POST) currency.', $data); @@ -436,11 +421,9 @@ class CurrencyController extends Controller app('preferences')->mark(); if (1 === (int) $request->get('return_to_edit')) { - $request->session()->put('currencies.edit.fromUpdate', true); return redirect(route('currencies.edit', [$currency->id])); - } return redirect($this->getPreviousUrl('currencies.edit.url')); diff --git a/app/Http/Controllers/DebugController.php b/app/Http/Controllers/DebugController.php index 451f92d9d7..c5dceb0820 100644 --- a/app/Http/Controllers/DebugController.php +++ b/app/Http/Controllers/DebugController.php @@ -98,7 +98,6 @@ class DebugController extends Controller Log::debug('Call twig:clean...'); try { Artisan::call('twig:clean'); - } catch (Exception $e) { // @phpstan-ignore-line // @ignoreException } @@ -189,11 +188,9 @@ class DebugController extends Controller if (null !== $logFile) { try { $logContent = file_get_contents($logFile); - } catch (Exception $e) { // @phpstan-ignore-line // @ignoreException } - } } } @@ -238,7 +235,6 @@ class DebugController extends Controller 'defaultLanguage', 'defaultLocale', 'isDocker' - ) ); } diff --git a/app/Http/Controllers/JavascriptController.php b/app/Http/Controllers/JavascriptController.php index 48d6e0f007..1acb51fa84 100644 --- a/app/Http/Controllers/JavascriptController.php +++ b/app/Http/Controllers/JavascriptController.php @@ -166,5 +166,4 @@ class JavascriptController extends Controller ->view('v2.javascript.variables', $data) ->header('Content-Type', 'text/javascript'); } - } diff --git a/app/Http/Controllers/NewUserController.php b/app/Http/Controllers/NewUserController.php index e0c3ab04e7..36bded971b 100644 --- a/app/Http/Controllers/NewUserController.php +++ b/app/Http/Controllers/NewUserController.php @@ -95,7 +95,6 @@ class NewUserController extends Controller $language = $request->convertString('language'); if (!array_key_exists($language, config('firefly.languages'))) { $language = 'en_US'; - } // set language preference: @@ -133,5 +132,4 @@ class NewUserController extends Controller return redirect(route('index')); } - } diff --git a/app/Http/Controllers/PreferencesController.php b/app/Http/Controllers/PreferencesController.php index 18e0a6d45b..401a404257 100644 --- a/app/Http/Controllers/PreferencesController.php +++ b/app/Http/Controllers/PreferencesController.php @@ -195,10 +195,10 @@ class PreferencesController extends Controller // slack URL: $url = (string) $request->get('slackUrl'); - if(str_starts_with($url, 'https://hooks.slack.com/services/')){ + if (str_starts_with($url, 'https://hooks.slack.com/services/')) { app('preferences')->set('slack_webhook_url', $url); } - if('' === $url) { + if ('' === $url) { app('preferences')->delete('slack_webhook_url'); } diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index 9bfccfa72a..7f381d2513 100644 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -210,9 +210,7 @@ class ProfileController extends Controller public function confirmEmailChange(UserRepositoryInterface $repository, string $token) { if (!$this->internalAuth || !$this->internalIdentity) { - throw new FireflyException(trans('firefly.external_user_mgt_disabled')); - } // find preference with this token value. /** @var Collection $set */ @@ -349,7 +347,8 @@ class ProfileController extends Controller } return view( - 'profile.index', compact('subTitle', 'mfaBackupCount', 'userId', 'accessToken', 'enabled2FA', 'isInternalAuth', 'isInternalIdentity') + 'profile.index', + compact('subTitle', 'mfaBackupCount', 'userId', 'accessToken', 'enabled2FA', 'isInternalAuth', 'isInternalIdentity') ); } @@ -633,7 +632,6 @@ class ProfileController extends Controller session()->flash('error', (string) trans('auth.failed')); return redirect(route('profile.index')); - } /** diff --git a/app/Http/Controllers/SearchController.php b/app/Http/Controllers/SearchController.php index c532600228..87da6d22dd 100644 --- a/app/Http/Controllers/SearchController.php +++ b/app/Http/Controllers/SearchController.php @@ -119,7 +119,6 @@ class SearchController extends Controller try { $html = view('search.search', compact('groups', 'hasPages', 'searchTime'))->render(); - } catch (Throwable $e) { // @phpstan-ignore-line Log::error(sprintf('Cannot render search.search: %s', $e->getMessage())); $html = 'Could not render view.'; diff --git a/app/Http/Controllers/TagController.php b/app/Http/Controllers/TagController.php index 57e7a6684c..6651f92317 100644 --- a/app/Http/Controllers/TagController.php +++ b/app/Http/Controllers/TagController.php @@ -335,11 +335,9 @@ class TagController extends Controller } $redirect = redirect($this->getPreviousUrl('tags.create.url')); if (1 === (int) $request->get('create_another')) { - session()->put('tags.create.fromStore', true); $redirect = redirect(route('tags.create'))->withInput(); - } return $redirect; @@ -376,11 +374,9 @@ class TagController extends Controller } $redirect = redirect($this->getPreviousUrl('tags.edit.url')); if (1 === (int) $request->get('return_to_edit')) { - session()->put('tags.edit.fromUpdate', true); $redirect = redirect(route('tags.edit', [$tag->id]))->withInput(['return_to_edit' => 1]); - } // redirect to previous URL.