mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-10-27 16:26:32 +01:00
PHP 8.4 fixes - Implicitly nullable parameter declarations deprecated
This commit is contained in:
@@ -904,7 +904,7 @@ class Admin
|
||||
* @return object
|
||||
* @throws \RuntimeException
|
||||
*/
|
||||
public function getConfigurationData($type, array $post = null)
|
||||
public function getConfigurationData($type, ?array $post = null)
|
||||
{
|
||||
static $data = [];
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ class AdminController extends AdminBaseController
|
||||
* @param array|null $post
|
||||
* @return void
|
||||
*/
|
||||
public function initialize(Grav $grav = null, $view = null, $task = null, $route = null, $post = null)
|
||||
public function initialize(?Grav $grav = null, $view = null, $task = null, $route = null, $post = null)
|
||||
{
|
||||
$this->grav = $grav;
|
||||
$this->admin = $this->grav['admin'];
|
||||
@@ -2717,7 +2717,7 @@ class AdminController extends AdminBaseController
|
||||
* @param PageInterface|null $page
|
||||
* @return Media|null
|
||||
*/
|
||||
public function getMedia(PageInterface $page = null)
|
||||
public function getMedia(?PageInterface $page = null)
|
||||
{
|
||||
$page = $page ?? $this->admin->page($this->route);
|
||||
if (!$page) {
|
||||
|
||||
@@ -140,7 +140,7 @@ abstract class AbstractController implements RequestHandlerInterface
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
public function getPost(string $name = null, $default = null)
|
||||
public function getPost(?string $name = null, $default = null)
|
||||
{
|
||||
$body = $this->request->getParsedBody();
|
||||
|
||||
@@ -167,7 +167,7 @@ abstract class AbstractController implements RequestHandlerInterface
|
||||
* @param string|null $type
|
||||
* @return FormInterface
|
||||
*/
|
||||
public function getForm(string $type = null): FormInterface
|
||||
public function getForm(?string $type = null): FormInterface
|
||||
{
|
||||
$object = $this->getObject();
|
||||
if (!$object) {
|
||||
@@ -227,7 +227,7 @@ abstract class AbstractController implements RequestHandlerInterface
|
||||
* @param int $code
|
||||
* @return Response
|
||||
*/
|
||||
public function createHtmlResponse(string $content, int $code = null): ResponseInterface
|
||||
public function createHtmlResponse(string $content, ?int $code = null): ResponseInterface
|
||||
{
|
||||
return new Response($code ?: 200, [], $content);
|
||||
}
|
||||
@@ -255,7 +255,7 @@ abstract class AbstractController implements RequestHandlerInterface
|
||||
* @param int $code
|
||||
* @return Response
|
||||
*/
|
||||
public function createRedirectResponse(string $url, int $code = null): ResponseInterface
|
||||
public function createRedirectResponse(string $url, ?int $code = null): ResponseInterface
|
||||
{
|
||||
if (null === $code || $code < 301 || $code > 307) {
|
||||
$code = $this->grav['config']->get('system.pages.redirect_default_code', 302);
|
||||
|
||||
@@ -117,7 +117,7 @@ abstract class AdminController
|
||||
* @param string|null $lang
|
||||
* @return string
|
||||
*/
|
||||
public function getAdminUrl(string $route, string $lang = null): string
|
||||
public function getAdminUrl(string $route, ?string $lang = null): string
|
||||
{
|
||||
/** @var Pages $pages */
|
||||
$pages = $this->grav['pages'];
|
||||
@@ -131,7 +131,7 @@ abstract class AdminController
|
||||
* @param string|null $lang
|
||||
* @return string
|
||||
*/
|
||||
public function getAbsoluteAdminUrl(string $route, string $lang = null): string
|
||||
public function getAbsoluteAdminUrl(string $route, ?string $lang = null): string
|
||||
{
|
||||
/** @var Pages $pages */
|
||||
$pages = $this->grav['pages'];
|
||||
@@ -319,7 +319,7 @@ abstract class AdminController
|
||||
* @param int|null $code
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
protected function createRedirectResponse(string $url = null, int $code = null): ResponseInterface
|
||||
protected function createRedirectResponse(?string $url = null, ?int $code = null): ResponseInterface
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ class LoginController extends AdminController
|
||||
* @param string|null $token
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function displayReset(string $username = null, string $token = null): ResponseInterface
|
||||
public function displayReset(?string $username = null, ?string $token = null): ResponseInterface
|
||||
{
|
||||
if ('' === (string)$username || '' === (string)$token) {
|
||||
$this->setMessage($this->translate('PLUGIN_ADMIN.RESET_INVALID_LINK'), 'error');
|
||||
@@ -318,7 +318,7 @@ class LoginController extends AdminController
|
||||
* @param string|null $token
|
||||
* @return ResponseInterface
|
||||
*/
|
||||
public function taskReset(string $username = null, string $token = null): ResponseInterface
|
||||
public function taskReset(?string $username = null, ?string $token = null): ResponseInterface
|
||||
{
|
||||
$this->page = $this->createPage('reset');
|
||||
$this->form = $this->getForm('admin-login-reset');
|
||||
|
||||
@@ -83,7 +83,7 @@ class AdminTwigExtension extends AbstractExtension
|
||||
return clone $obj;
|
||||
}
|
||||
|
||||
public function adminRouteFunc(string $route = '', string $languageCode = null)
|
||||
public function adminRouteFunc(string $route = '', ?string $languageCode = null)
|
||||
{
|
||||
/** @var Admin $admin */
|
||||
$admin = Grav::instance()['admin'];
|
||||
|
||||
Reference in New Issue
Block a user