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

@@ -60,7 +60,7 @@ class ConfigurationController extends Controller
*
* @return Factory|View
*/
public function index()
public function index(): Factory|\Illuminate\Contracts\View\View
{
$subTitle = (string) trans('firefly.instance_configuration');
$subTitleIcon = 'fa-wrench';
@@ -75,7 +75,7 @@ class ConfigurationController extends Controller
return view(
'settings.configuration.index',
compact('subTitle', 'subTitleIcon', 'singleUserMode', 'isDemoSite', 'siteOwner')
['subTitle' => $subTitle, 'subTitleIcon' => $subTitleIcon, 'singleUserMode' => $singleUserMode, 'isDemoSite' => $isDemoSite, 'siteOwner' => $siteOwner]
);
}

View File

@@ -53,7 +53,7 @@ class HomeController extends Controller
* @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface
*/
public function index()
public function index(): Factory|\Illuminate\Contracts\View\View
{
Log::channel('audit')->info('User visits admin index.');
$title = (string) trans('firefly.system_settings');
@@ -64,6 +64,6 @@ class HomeController extends Controller
$email = $pref->data;
}
return view('settings.index', compact('title', 'mainTitleIcon', 'email'));
return view('settings.index', ['title' => $title, 'mainTitleIcon' => $mainTitleIcon, 'email' => $email]);
}
}

View File

@@ -66,7 +66,7 @@ class LinkController extends Controller
*
* @return Factory|View
*/
public function create()
public function create(): Factory|\Illuminate\Contracts\View\View
{
Log::channel('audit')->info('User visits link index.');
@@ -78,7 +78,7 @@ class LinkController extends Controller
$this->rememberPreviousUrl('link-types.create.url');
}
return view('settings.link.create', compact('subTitle', 'subTitleIcon'));
return view('settings.link.create', ['subTitle' => $subTitle, 'subTitleIcon' => $subTitleIcon]);
}
/**
@@ -86,7 +86,7 @@ class LinkController extends Controller
*
* @return Factory|Redirector|RedirectResponse|View
*/
public function delete(Request $request, LinkType $linkType)
public function delete(Request $request, LinkType $linkType): Redirector|RedirectResponse|Factory|\Illuminate\Contracts\View\View
{
if (false === $linkType->editable) {
$request->session()->flash('error', (string) trans('firefly.cannot_edit_link_type', ['name' => e($linkType->name)]));
@@ -111,15 +111,13 @@ class LinkController extends Controller
// put previous url in session
$this->rememberPreviousUrl('link-types.delete.url');
return view('settings.link.delete', compact('linkType', 'subTitle', 'moveTo', 'count'));
return view('settings.link.delete', ['linkType' => $linkType, 'subTitle' => $subTitle, 'moveTo' => $moveTo, 'count' => $count]);
}
/**
* Actually destroy the link.
*
* @return Redirector|RedirectResponse
*/
public function destroy(Request $request, LinkType $linkType)
public function destroy(Request $request, LinkType $linkType): Redirector|RedirectResponse
{
Log::channel('audit')->info(sprintf('User destroyed link type #%d', $linkType->id));
$name = $linkType->name;
@@ -137,7 +135,7 @@ class LinkController extends Controller
*
* @return Factory|Redirector|RedirectResponse|View
*/
public function edit(Request $request, LinkType $linkType)
public function edit(Request $request, LinkType $linkType): Redirector|RedirectResponse|Factory|\Illuminate\Contracts\View\View
{
if (false === $linkType->editable) {
$request->session()->flash('error', (string) trans('firefly.cannot_edit_link_type', ['name' => e($linkType->name)]));
@@ -155,7 +153,7 @@ class LinkController extends Controller
}
$request->session()->forget('link-types.edit.fromUpdate');
return view('settings.link.edit', compact('subTitle', 'subTitleIcon', 'linkType'));
return view('settings.link.edit', ['subTitle' => $subTitle, 'subTitleIcon' => $subTitleIcon, 'linkType' => $linkType]);
}
/**
@@ -163,7 +161,7 @@ class LinkController extends Controller
*
* @return Factory|View
*/
public function index()
public function index(): Factory|\Illuminate\Contracts\View\View
{
$subTitle = (string) trans('firefly.journal_link_configuration');
$subTitleIcon = 'fa-link';
@@ -176,7 +174,7 @@ class LinkController extends Controller
}
);
return view('settings.link.index', compact('subTitle', 'subTitleIcon', 'linkTypes'));
return view('settings.link.index', ['subTitle' => $subTitle, 'subTitleIcon' => $subTitleIcon, 'linkTypes' => $linkTypes]);
}
/**
@@ -184,7 +182,7 @@ class LinkController extends Controller
*
* @return Factory|View
*/
public function show(LinkType $linkType)
public function show(LinkType $linkType): Factory|\Illuminate\Contracts\View\View
{
$subTitle = (string) trans('firefly.overview_for_link', ['name' => $linkType->name]);
$subTitleIcon = 'fa-link';
@@ -192,7 +190,7 @@ class LinkController extends Controller
Log::channel('audit')->info(sprintf('User viewing link type #%d', $linkType->id));
return view('settings.link.show', compact('subTitle', 'subTitleIcon', 'linkType', 'links'));
return view('settings.link.show', ['subTitle' => $subTitle, 'subTitleIcon' => $subTitleIcon, 'linkType' => $linkType, 'links' => $links]);
}
/**

View File

@@ -74,23 +74,7 @@ class NotificationController extends Controller
return view(
'settings.notifications.index',
compact(
'title',
'subTitle',
'forcedAvailability',
'mainTitleIcon',
'subTitleIcon',
'channels',
'slackUrl',
'notifications',
'pushoverAppToken',
'pushoverUserToken',
'ntfyServer',
'ntfyTopic',
'ntfyAuth',
'ntfyUser',
'ntfyPass'
)
['title' => $title, 'subTitle' => $subTitle, 'forcedAvailability' => $forcedAvailability, 'mainTitleIcon' => $mainTitleIcon, 'subTitleIcon' => $subTitleIcon, 'channels' => $channels, 'slackUrl' => $slackUrl, 'notifications' => $notifications, 'pushoverAppToken' => $pushoverAppToken, 'pushoverUserToken' => $pushoverUserToken, 'ntfyServer' => $ntfyServer, 'ntfyTopic' => $ntfyTopic, 'ntfyAuth' => $ntfyAuth, 'ntfyUser' => $ntfyUser, 'ntfyPass' => $ntfyPass]
);
}
@@ -142,7 +126,7 @@ class NotificationController extends Controller
case 'pushover':
case 'ntfy':
$owner = new OwnerNotifiable();
app('log')->debug(sprintf('Now in testNotification("%s") controller.', $channel));
Log::debug(sprintf('Now in testNotification("%s") controller.', $channel));
event(new OwnerTestNotificationChannel($channel, $owner));
session()->flash('success', (string) trans('firefly.notification_test_executed', ['channel' => $channel]));
}

View File

@@ -63,7 +63,7 @@ class UpdateController extends Controller
*
* @return Factory|View
*/
public function index()
public function index(): Factory|\Illuminate\Contracts\View\View
{
$subTitle = (string) trans('firefly.update_check_title');
$subTitleIcon = 'fa-star';
@@ -83,15 +83,13 @@ class UpdateController extends Controller
'alpha' => (string) trans('firefly.update_channel_alpha'),
];
return view('settings.update.index', compact('subTitle', 'subTitleIcon', 'selected', 'options', 'channelSelected', 'channelOptions'));
return view('settings.update.index', ['subTitle' => $subTitle, 'subTitleIcon' => $subTitleIcon, 'selected' => $selected, 'options' => $options, 'channelSelected' => $channelSelected, 'channelOptions' => $channelOptions]);
}
/**
* Post new settings.
*
* @return Redirector|RedirectResponse
*/
public function post(Request $request)
public function post(Request $request): Redirector|RedirectResponse
{
$checkForUpdates = (int) $request->get('check_for_updates');
$channel = $request->get('update_channel');

View File

@@ -23,6 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Controllers\Admin;
use Illuminate\Support\Facades\Log;
use FireflyIII\Events\Admin\InvitationCreated;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Http\Controllers\Controller;
@@ -72,7 +73,7 @@ class UserController extends Controller
/**
* @return Application|Factory|Redirector|RedirectResponse|View
*/
public function delete(User $user)
public function delete(User $user): Redirector|RedirectResponse|Factory|\Illuminate\Contracts\View\View
{
if ($this->externalIdentity) {
request()->session()->flash('error', trans('firefly.external_user_mgt_disabled'));
@@ -82,19 +83,19 @@ class UserController extends Controller
$subTitle = (string) trans('firefly.delete_user', ['email' => $user->email]);
return view('settings.users.delete', compact('user', 'subTitle'));
return view('settings.users.delete', ['user' => $user, 'subTitle' => $subTitle]);
}
public function deleteInvite(InvitedUser $invitedUser): JsonResponse
{
app('log')->debug('Will now delete invitation');
Log::debug('Will now delete invitation');
if (true === $invitedUser->redeemed) {
app('log')->debug('Is already redeemed.');
Log::debug('Is already redeemed.');
session()->flash('error', trans('firefly.invite_is_already_redeemed', ['address' => $invitedUser->email]));
return response()->json(['success' => false]);
}
app('log')->debug('Delete!');
Log::debug('Delete!');
session()->flash('success', trans('firefly.invite_is_deleted', ['address' => $invitedUser->email]));
$this->repository->deleteInvite($invitedUser);
@@ -103,10 +104,8 @@ class UserController extends Controller
/**
* Destroy a user.
*
* @return Redirector|RedirectResponse
*/
public function destroy(User $user)
public function destroy(User $user): Redirector|RedirectResponse
{
if ($this->externalIdentity) {
request()->session()->flash('error', trans('firefly.external_user_mgt_disabled'));
@@ -124,7 +123,7 @@ class UserController extends Controller
*
* @return Factory|View
*/
public function edit(User $user)
public function edit(User $user): Factory|\Illuminate\Contracts\View\View
{
$canEditDetails = true;
if ($this->externalIdentity) {
@@ -147,7 +146,7 @@ class UserController extends Controller
'email_changed' => (string) trans('firefly.block_code_email_changed'),
];
return view('settings.users.edit', compact('user', 'canEditDetails', 'subTitle', 'subTitleIcon', 'codes', 'currentUser', 'isAdmin'));
return view('settings.users.edit', ['user' => $user, 'canEditDetails' => $canEditDetails, 'subTitle' => $subTitle, 'subTitleIcon' => $subTitleIcon, 'codes' => $codes, 'currentUser' => $currentUser, 'isAdmin' => $isAdmin]);
}
/**
@@ -159,7 +158,7 @@ class UserController extends Controller
* @throws FireflyException
* @throws NotFoundExceptionInterface
*/
public function index()
public function index(): Factory|\Illuminate\Contracts\View\View
{
$subTitle = (string) trans('firefly.user_administration');
$subTitleIcon = 'fa-users';
@@ -181,7 +180,7 @@ class UserController extends Controller
}
);
return view('settings.users.index', compact('subTitle', 'subTitleIcon', 'users', 'allowInvites', 'invitedUsers'));
return view('settings.users.index', ['subTitle' => $subTitle, 'subTitleIcon' => $subTitleIcon, 'users' => $users, 'allowInvites' => $allowInvites, 'invitedUsers' => $invitedUsers]);
}
public function invite(InviteUserFormRequest $request): RedirectResponse
@@ -201,7 +200,7 @@ class UserController extends Controller
*
* @return Factory|View
*/
public function show(User $user)
public function show(User $user): Factory|\Illuminate\Contracts\View\View
{
$title = (string) trans('firefly.system_settings');
$mainTitleIcon = 'fa-hand-spock-o';
@@ -211,14 +210,7 @@ class UserController extends Controller
return view(
'settings.users.show',
compact(
'title',
'mainTitleIcon',
'subTitle',
'subTitleIcon',
'information',
'user'
)
['title' => $title, 'mainTitleIcon' => $mainTitleIcon, 'subTitle' => $subTitle, 'subTitleIcon' => $subTitleIcon, 'information' => $information, 'user' => $user]
);
}
@@ -229,7 +221,7 @@ class UserController extends Controller
*/
public function update(UserFormRequest $request, User $user)
{
app('log')->debug('Actually here');
Log::debug('Actually here');
$data = $request->getUserData();
// var_dump($data);