mirror of
https://github.com/ad-aures/castopod.git
synced 2026-04-15 20:47:46 +02:00
refactor: update code base to php 8 and set phpstan lvl to 6
This commit is contained in:
parent
4a33c50fb6
commit
6b74a9e98a
124 changed files with 1810 additions and 2157 deletions
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
namespace App\Controllers\Admin;
|
||||
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use App\Entities\Page;
|
||||
use CodeIgniter\Exceptions\PageNotFoundException;
|
||||
use App\Models\PageModel;
|
||||
|
|
@ -19,7 +20,7 @@ class PageController extends BaseController
|
|||
*/
|
||||
protected $page;
|
||||
|
||||
public function _remap($method, ...$params)
|
||||
public function _remap(string $method, string ...$params): mixed
|
||||
{
|
||||
if (count($params) === 0) {
|
||||
return $this->$method();
|
||||
|
|
@ -32,7 +33,7 @@ class PageController extends BaseController
|
|||
throw PageNotFoundException::forPageNotFound();
|
||||
}
|
||||
|
||||
function list()
|
||||
function list(): string
|
||||
{
|
||||
$data = [
|
||||
'pages' => (new PageModel())->findAll(),
|
||||
|
|
@ -41,19 +42,19 @@ class PageController extends BaseController
|
|||
return view('admin/page/list', $data);
|
||||
}
|
||||
|
||||
function view()
|
||||
function view(): string
|
||||
{
|
||||
return view('admin/page/view', ['page' => $this->page]);
|
||||
}
|
||||
|
||||
function create()
|
||||
function create(): string
|
||||
{
|
||||
helper('form');
|
||||
|
||||
return view('admin/page/create');
|
||||
}
|
||||
|
||||
function attemptCreate()
|
||||
function attemptCreate(): RedirectResponse
|
||||
{
|
||||
$page = new Page([
|
||||
'title' => $this->request->getPost('title'),
|
||||
|
|
@ -80,7 +81,7 @@ class PageController extends BaseController
|
|||
);
|
||||
}
|
||||
|
||||
function edit()
|
||||
function edit(): string
|
||||
{
|
||||
helper('form');
|
||||
|
||||
|
|
@ -88,7 +89,7 @@ class PageController extends BaseController
|
|||
return view('admin/page/edit', ['page' => $this->page]);
|
||||
}
|
||||
|
||||
function attemptEdit()
|
||||
function attemptEdit(): RedirectResponse
|
||||
{
|
||||
$this->page->title = $this->request->getPost('title');
|
||||
$this->page->slug = $this->request->getPost('slug');
|
||||
|
|
@ -106,7 +107,7 @@ class PageController extends BaseController
|
|||
return redirect()->route('page-list');
|
||||
}
|
||||
|
||||
public function delete()
|
||||
public function delete(): RedirectResponse
|
||||
{
|
||||
(new PageModel())->delete($this->page->id);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue