mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-18 12:28:46 +00:00
Fix code quality with rector [skip ci]
This commit is contained in:
@@ -68,7 +68,7 @@ class CreateController extends Controller
|
||||
*
|
||||
* @return Factory|View
|
||||
*/
|
||||
public function create(Request $request)
|
||||
public function create(Request $request): Factory|\Illuminate\Contracts\View\View
|
||||
{
|
||||
if (true !== session('categories.create.fromStore')) {
|
||||
$this->rememberPreviousUrl('categories.create.url');
|
||||
@@ -76,7 +76,7 @@ class CreateController extends Controller
|
||||
$request->session()->forget('categories.create.fromStore');
|
||||
$subTitle = (string) trans('firefly.create_new_category');
|
||||
|
||||
return view('categories.create', compact('subTitle'));
|
||||
return view('categories.create', ['subTitle' => $subTitle]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -64,22 +64,20 @@ class DeleteController extends Controller
|
||||
*
|
||||
* @return Factory|View
|
||||
*/
|
||||
public function delete(Category $category)
|
||||
public function delete(Category $category): Factory|\Illuminate\Contracts\View\View
|
||||
{
|
||||
$subTitle = (string) trans('firefly.delete_category', ['name' => $category->name]);
|
||||
|
||||
// put previous url in session
|
||||
$this->rememberPreviousUrl('categories.delete.url');
|
||||
|
||||
return view('categories.delete', compact('category', 'subTitle'));
|
||||
return view('categories.delete', ['category' => $category, 'subTitle' => $subTitle]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy a category.
|
||||
*
|
||||
* @return Redirector|RedirectResponse
|
||||
*/
|
||||
public function destroy(Request $request, Category $category)
|
||||
public function destroy(Request $request, Category $category): Redirector|RedirectResponse
|
||||
{
|
||||
$name = $category->name;
|
||||
$this->repository->destroy($category);
|
||||
|
||||
@@ -68,7 +68,7 @@ class EditController extends Controller
|
||||
*
|
||||
* @return Factory|View
|
||||
*/
|
||||
public function edit(Request $request, Category $category)
|
||||
public function edit(Request $request, Category $category): Factory|\Illuminate\Contracts\View\View
|
||||
{
|
||||
$subTitle = (string) trans('firefly.edit_category', ['name' => $category->name]);
|
||||
|
||||
@@ -82,15 +82,13 @@ class EditController extends Controller
|
||||
'notes' => $request->old('notes') ?? $this->repository->getNoteText($category),
|
||||
];
|
||||
|
||||
return view('categories.edit', compact('category', 'subTitle', 'preFilled'));
|
||||
return view('categories.edit', ['category' => $category, 'subTitle' => $subTitle, 'preFilled' => $preFilled]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update category.
|
||||
*
|
||||
* @return Redirector|RedirectResponse
|
||||
*/
|
||||
public function update(CategoryFormRequest $request, Category $category)
|
||||
public function update(CategoryFormRequest $request, Category $category): Redirector|RedirectResponse
|
||||
{
|
||||
$data = $request->getCategoryData();
|
||||
$this->repository->update($category, $data);
|
||||
|
||||
@@ -69,7 +69,7 @@ class IndexController extends Controller
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function index(Request $request)
|
||||
public function index(Request $request): Factory|\Illuminate\Contracts\View\View
|
||||
{
|
||||
$page = 0 === (int) $request->get('page') ? 1 : (int) $request->get('page');
|
||||
$pageSize = (int) app('preferences')->get('listPageSize', 50)->data;
|
||||
@@ -87,6 +87,6 @@ class IndexController extends Controller
|
||||
$categories = new LengthAwarePaginator($collection, $total, $pageSize, $page);
|
||||
$categories->setPath(route('categories.index'));
|
||||
|
||||
return view('categories.index', compact('categories'));
|
||||
return view('categories.index', ['categories' => $categories]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ class NoCategoryController extends Controller
|
||||
* @throws FireflyException
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function show(Request $request, ?Carbon $start = null, ?Carbon $end = null)
|
||||
public function show(Request $request, ?Carbon $start = null, ?Carbon $end = null): Factory|\Illuminate\Contracts\View\View
|
||||
{
|
||||
Log::debug('Start of noCategory()');
|
||||
$start ??= session('start');
|
||||
@@ -104,7 +104,7 @@ class NoCategoryController extends Controller
|
||||
$groups = $collector->getPaginatedGroups();
|
||||
$groups->setPath(route('categories.no-category', [$start->format('Y-m-d'), $end->format('Y-m-d')]));
|
||||
|
||||
return view('categories.no-category', compact('groups', 'subTitle', 'periods', 'start', 'end'));
|
||||
return view('categories.no-category', ['groups' => $groups, 'subTitle' => $subTitle, 'periods' => $periods, 'start' => $start, 'end' => $end]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,7 +115,7 @@ class NoCategoryController extends Controller
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function showAll(Request $request)
|
||||
public function showAll(Request $request): Factory|\Illuminate\Contracts\View\View
|
||||
{
|
||||
// default values:
|
||||
$start = null;
|
||||
@@ -140,6 +140,6 @@ class NoCategoryController extends Controller
|
||||
$groups = $collector->getPaginatedGroups();
|
||||
$groups->setPath(route('categories.no-category.all'));
|
||||
|
||||
return view('categories.no-category', compact('groups', 'subTitle', 'periods', 'start', 'end'));
|
||||
return view('categories.no-category', ['groups' => $groups, 'subTitle' => $subTitle, 'periods' => $periods, 'start' => $start, 'end' => $end]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ class ShowController extends Controller
|
||||
* @throws FireflyException
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function show(Request $request, Category $category, ?Carbon $start = null, ?Carbon $end = null)
|
||||
public function show(Request $request, Category $category, ?Carbon $start = null, ?Carbon $end = null): Factory|\Illuminate\Contracts\View\View
|
||||
{
|
||||
$start ??= session('start', today(config('app.timezone'))->startOfMonth());
|
||||
$end ??= session('end', today(config('app.timezone'))->endOfMonth());
|
||||
@@ -109,7 +109,7 @@ class ShowController extends Controller
|
||||
$groups = $collector->getPaginatedGroups();
|
||||
$groups->setPath($path);
|
||||
|
||||
return view('categories.show', compact('category', 'attachments', 'groups', 'periods', 'subTitle', 'subTitleIcon', 'start', 'end'));
|
||||
return view('categories.show', ['category' => $category, 'attachments' => $attachments, 'groups' => $groups, 'periods' => $periods, 'subTitle' => $subTitle, 'subTitleIcon' => $subTitleIcon, 'start' => $start, 'end' => $end]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -120,7 +120,7 @@ class ShowController extends Controller
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function showAll(Request $request, Category $category)
|
||||
public function showAll(Request $request, Category $category): Factory|\Illuminate\Contracts\View\View
|
||||
{
|
||||
// default values:
|
||||
$subTitleIcon = 'fa-bookmark';
|
||||
@@ -149,6 +149,6 @@ class ShowController extends Controller
|
||||
$groups = $collector->getPaginatedGroups();
|
||||
$groups->setPath($path);
|
||||
|
||||
return view('categories.show', compact('category', 'attachments', 'groups', 'periods', 'subTitle', 'subTitleIcon', 'start', 'end'));
|
||||
return view('categories.show', ['category' => $category, 'attachments' => $attachments, 'groups' => $groups, 'periods' => $periods, 'subTitle' => $subTitle, 'subTitleIcon' => $subTitleIcon, 'start' => $start, 'end' => $end]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user