From b690f59646f7a510ce2c47dab8e6f4cb31b33e33 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Thu, 28 Nov 2024 14:05:25 +1300 Subject: [PATCH] API Explicity mark nullable parameters for PHP 8.4 --- src/Controllers/HistoryViewerController.php | 4 ++-- src/Forms/DataObjectVersionFormFactory.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Controllers/HistoryViewerController.php b/src/Controllers/HistoryViewerController.php index 8a5280d..0a1e880 100644 --- a/src/Controllers/HistoryViewerController.php +++ b/src/Controllers/HistoryViewerController.php @@ -355,7 +355,7 @@ public function getCompareForm(array $context) return $form; } - public function versionForm(HTTPRequest $request = null) + public function versionForm(?HTTPRequest $request = null) { if (!$request) { $this->jsonError(400); @@ -373,7 +373,7 @@ public function versionForm(HTTPRequest $request = null) } } - public function compareForm(HTTPRequest $request = null) + public function compareForm(?HTTPRequest $request = null) { if (!$request) { $this->jsonError(400); diff --git a/src/Forms/DataObjectVersionFormFactory.php b/src/Forms/DataObjectVersionFormFactory.php index a98d1b7..0790335 100644 --- a/src/Forms/DataObjectVersionFormFactory.php +++ b/src/Forms/DataObjectVersionFormFactory.php @@ -38,7 +38,7 @@ class DataObjectVersionFormFactory implements FormFactory DataObjectVersionFormFactory::TYPE_HISTORY, ]; - public function getForm(RequestHandler $controller = null, $name = FormFactory::DEFAULT_NAME, $context = []) + public function getForm(?RequestHandler $controller = null, $name = FormFactory::DEFAULT_NAME, $context = []) { // Validate context foreach ($this->getRequiredContext() as $required) { @@ -91,7 +91,7 @@ public function isReadonlyFormType(array $context) return in_array($this->getFormType($context), $this->config()->get('readonly_types') ?? []); } - protected function getFormFields(RequestHandler $controller = null, $name, $context = []) + protected function getFormFields(?RequestHandler $controller = null, $name, $context = []) { $record = $context['Record']; /** @var FieldList $fields */ @@ -157,7 +157,7 @@ protected function removeSelectedRightTitles(FieldList $fields) } } - protected function getFormActions(RequestHandler $controller = null, $formName, $context = []) + protected function getFormActions(?RequestHandler $controller = null, $formName, $context = []) { $actions = FieldList::create(); $this->invokeWithExtensions('updateFormActions', $actions, $controller, $formName, $context);