Fix code quality with rector [skip ci]

This commit is contained in:
James Cole
2025-11-09 09:07:14 +01:00
parent 38691d6fdf
commit d2610be790
262 changed files with 873 additions and 1186 deletions

View File

@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Controllers;
use Illuminate\Support\Facades\Log;
use Exception;
use FireflyIII\Events\UserChangedEmail;
use FireflyIII\Exceptions\FireflyException;
@@ -79,7 +80,7 @@ class ProfileController extends Controller
);
$authGuard = config('firefly.authentication_guard');
$this->internalAuth = 'web' === $authGuard;
app('log')->debug(sprintf('ProfileController::__construct(). Authentication guard is "%s"', $authGuard));
Log::debug(sprintf('ProfileController::__construct(). Authentication guard is "%s"', $authGuard));
$this->middleware(IsDemoUser::class)->except(['index']);
}
@@ -132,7 +133,7 @@ class ProfileController extends Controller
$subTitle = (string) trans('firefly.delete_account');
$subTitleIcon = 'fa-trash';
return view('profile.delete-account', compact('title', 'subTitle', 'subTitleIcon'));
return view('profile.delete-account', ['title' => $title, 'subTitle' => $subTitle, 'subTitleIcon' => $subTitleIcon]);
}
/**
@@ -172,7 +173,7 @@ class ProfileController extends Controller
return view(
'profile.index',
compact('subTitle', 'mfaBackupCount', 'userId', 'accessToken', 'enabled2FA', 'isInternalAuth')
['subTitle' => $subTitle, 'mfaBackupCount' => $mfaBackupCount, 'userId' => $userId, 'accessToken' => $accessToken, 'enabled2FA' => $enabled2FA, 'isInternalAuth' => $isInternalAuth]
);
}
@@ -247,15 +248,13 @@ class ProfileController extends Controller
$subTitle = (string) trans('firefly.change_your_email');
$subTitleIcon = 'fa-envelope';
return view('profile.change-email', compact('title', 'subTitle', 'subTitleIcon', 'email'));
return view('profile.change-email', ['title' => $title, 'subTitle' => $subTitle, 'subTitleIcon' => $subTitleIcon, 'email' => $email]);
}
/**
* Submit change password form.
*
* @return Redirector|RedirectResponse
*/
public function postChangePassword(ProfileFormRequest $request, UserRepositoryInterface $repository)
public function postChangePassword(ProfileFormRequest $request, UserRepositoryInterface $repository): Redirector|RedirectResponse
{
if (!$this->internalAuth) {
$request->session()->flash('error', trans('firefly.external_user_mgt_disabled'));
@@ -289,7 +288,7 @@ class ProfileController extends Controller
*
* @return Factory|Redirector|RedirectResponse|View
*/
public function changePassword(Request $request)
public function changePassword(Request $request): Redirector|RedirectResponse|Factory|\Illuminate\Contracts\View\View
{
if (!$this->internalAuth) {
$request->session()->flash('error', trans('firefly.external_user_mgt_disabled'));
@@ -301,15 +300,13 @@ class ProfileController extends Controller
$subTitle = (string) trans('firefly.change_your_password');
$subTitleIcon = 'fa-key';
return view('profile.change-password', compact('title', 'subTitle', 'subTitleIcon'));
return view('profile.change-password', ['title' => $title, 'subTitle' => $subTitle, 'subTitleIcon' => $subTitleIcon]);
}
/**
* Submit delete account.
*
* @return Redirector|RedirectResponse
*/
public function postDeleteAccount(UserRepositoryInterface $repository, DeleteAccountFormRequest $request)
public function postDeleteAccount(UserRepositoryInterface $repository, DeleteAccountFormRequest $request): Redirector|RedirectResponse
{
if (!$this->internalAuth) {
$request->session()->flash('error', trans('firefly.external_user_mgt_disabled'));
@@ -325,7 +322,7 @@ class ProfileController extends Controller
/** @var User $user */
$user = auth()->user();
app('log')->info(sprintf('User #%d has opted to delete their account', auth()->user()->id));
Log::info(sprintf('User #%d has opted to delete their account', auth()->user()->id));
// make repository delete user:
auth()->logout();
session()->flush();
@@ -339,7 +336,7 @@ class ProfileController extends Controller
*
* @throws AuthenticationException
*/
public function postLogoutOtherSessions(Request $request)
public function postLogoutOtherSessions(Request $request): Redirector|RedirectResponse
{
if (!$this->internalAuth) {
session()->flash('info', (string) trans('firefly.external_auth_disabled'));
@@ -364,11 +361,10 @@ class ProfileController extends Controller
/**
* Regenerate access token.
*
* @return Redirector|RedirectResponse
*
* @throws Exception
*/
public function regenerate(Request $request)
public function regenerate(Request $request): Redirector|RedirectResponse
{
if (!$this->internalAuth) {
$request->session()->flash('error', trans('firefly.external_user_mgt_disabled'));
@@ -388,11 +384,10 @@ class ProfileController extends Controller
/**
* Undo change of user email address.
*
* @return Redirector|RedirectResponse
*
* @throws FireflyException
*/
public function undoEmailChange(UserRepositoryInterface $repository, string $token, string $hash)
public function undoEmailChange(UserRepositoryInterface $repository, string $token, string $hash): Redirector|RedirectResponse
{
if (!$this->internalAuth) {
throw new FireflyException(trans('firefly.external_user_mgt_disabled'));