refactor: better php8 usage

- Change simple property init and assign to constructor promotion
- Remove unused variable in catch()
- Change docs types to union types, where possible
This commit is contained in:
HDVinnie
2021-05-15 22:41:28 -04:00
parent 041927202c
commit 3407075214
174 changed files with 237 additions and 1365 deletions
+6 -18
View File
@@ -23,10 +23,8 @@ class PageController extends Controller
{
/**
* Display All Pages.
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function index()
public function index(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
{
$pages = Page::all();
@@ -37,10 +35,8 @@ class PageController extends Controller
* Show A Page.
*
* @param \App\Models\Page $id
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function show($id)
public function show($id): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
{
$page = Page::findOrFail($id);
@@ -49,10 +45,8 @@ class PageController extends Controller
/**
* Show Staff Page.
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function staff()
public function staff(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
{
$staff = DB::table('users')->leftJoin('groups', 'users.group_id', '=', 'groups.id')->select(['users.id', 'users.title', 'users.username', 'groups.name', 'groups.color', 'groups.icon'])->where('groups.is_admin', 1)->orWhere('groups.is_modo', 1)->get();
@@ -61,10 +55,8 @@ class PageController extends Controller
/**
* Show Internals Page.
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function internal()
public function internal(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
{
$internal = DB::table('users')->leftJoin('groups', 'users.group_id', '=', 'groups.id')->select(['users.id', 'users.title', 'users.username', 'groups.name', 'groups.color', 'groups.icon'])->where('groups.is_internal', 1)->get();
@@ -73,10 +65,8 @@ class PageController extends Controller
/**
* Show Blacklist Page.
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function blacklist()
public function blacklist(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
{
$clients = \config('client-blacklist.clients', []);
@@ -85,10 +75,8 @@ class PageController extends Controller
/**
* Show About Us Page.
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function about()
public function about(): \Illuminate\Contracts\View\Factory|\Illuminate\View\View
{
return \view('page.aboutus');
}