mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-09 20:11:22 +00:00
Fix code quality with rector [skip ci]
This commit is contained in:
@@ -65,22 +65,20 @@ class AttachmentController extends Controller
|
||||
*
|
||||
* @return Factory|View
|
||||
*/
|
||||
public function delete(Attachment $attachment)
|
||||
public function delete(Attachment $attachment): Factory|\Illuminate\Contracts\View\View
|
||||
{
|
||||
$subTitle = (string) trans('firefly.delete_attachment', ['name' => $attachment->filename]);
|
||||
|
||||
// put previous url in session
|
||||
$this->rememberPreviousUrl('attachments.delete.url');
|
||||
|
||||
return view('attachments.delete', compact('attachment', 'subTitle'));
|
||||
return view('attachments.delete', ['attachment' => $attachment, 'subTitle' => $subTitle]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy attachment.
|
||||
*
|
||||
* @return Redirector|RedirectResponse
|
||||
*/
|
||||
public function destroy(Request $request, Attachment $attachment)
|
||||
public function destroy(Request $request, Attachment $attachment): Redirector|RedirectResponse
|
||||
{
|
||||
$name = $attachment->filename;
|
||||
|
||||
@@ -123,7 +121,7 @@ class AttachmentController extends Controller
|
||||
}
|
||||
$message = 'Could not find the indicated attachment. The file is no longer there.';
|
||||
|
||||
return view('errors.error', compact('message'));
|
||||
return view('errors.error', ['message' => $message]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -131,7 +129,7 @@ class AttachmentController extends Controller
|
||||
*
|
||||
* @return Factory|View
|
||||
*/
|
||||
public function edit(Request $request, Attachment $attachment)
|
||||
public function edit(Request $request, Attachment $attachment): Factory|\Illuminate\Contracts\View\View
|
||||
{
|
||||
$subTitleIcon = 'fa-pencil';
|
||||
$subTitle = (string) trans('firefly.edit_attachment', ['name' => $attachment->filename]);
|
||||
@@ -146,7 +144,7 @@ class AttachmentController extends Controller
|
||||
];
|
||||
$request->session()->flash('preFilled', $preFilled);
|
||||
|
||||
return view('attachments.edit', compact('attachment', 'subTitleIcon', 'subTitle'));
|
||||
return view('attachments.edit', ['attachment' => $attachment, 'subTitleIcon' => $subTitleIcon, 'subTitle' => $subTitle]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -154,18 +152,18 @@ class AttachmentController extends Controller
|
||||
*
|
||||
* @return Factory|View
|
||||
*/
|
||||
public function index()
|
||||
public function index(): Factory|\Illuminate\Contracts\View\View
|
||||
{
|
||||
$set = $this->repository->get()->reverse();
|
||||
$set = $set->each(
|
||||
function (Attachment $attachment) {
|
||||
function (Attachment $attachment): Attachment {
|
||||
$attachment->file_exists = $this->repository->exists($attachment);
|
||||
|
||||
return $attachment;
|
||||
}
|
||||
);
|
||||
|
||||
return view('attachments.index', compact('set'));
|
||||
return view('attachments.index', ['set' => $set]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -226,6 +224,6 @@ class AttachmentController extends Controller
|
||||
|
||||
$message = 'Could not find the indicated attachment. The file is no longer there.';
|
||||
|
||||
return view('errors.error', compact('message'));
|
||||
return view('errors.error', ['message' => $message]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user