From 9265012f76e931fc04b0f699315fd1adeb1c4d41 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20B=C3=BCrk?= <stefan@buerk.tech>
Date: Tue, 25 Jun 2024 15:21:24 +0200
Subject: [PATCH] [TASK] Avoid implicitly nullable class method parameter in
 `EXT:reports`
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

With PHP 8.4 marking method parameter implicitly nullable
is deprecated and will emit a `E_DEPRECATED` warning. One
recommended way to resolve this, is making it explicitly
nullable using the `?` nullable operator. [1]

This prepares the way towards PHP 8.4 compatibility.

[1] https://php.watch/versions/8.4/implicitly-marking-parameter-type-nullable-deprecated

Resolves: #104206
Releases: main, 12.4, 11.5
Change-Id: I0d82e0474143f63870f772002de52d26c6c960fd
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/84908
Tested-by: Stefan Bürk <stefan@buerk.tech>
Tested-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Stefan Bürk <stefan@buerk.tech>
Tested-by: core-ci <typo3@b13.com>
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
---
 typo3/sysext/reports/Classes/Report/Status/SecurityStatus.php | 2 +-
 typo3/sysext/reports/Classes/Report/Status/Status.php         | 4 ++--
 typo3/sysext/reports/Classes/RequestAwareReportInterface.php  | 2 +-
 .../reports/Classes/RequestAwareStatusProviderInterface.php   | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/typo3/sysext/reports/Classes/Report/Status/SecurityStatus.php b/typo3/sysext/reports/Classes/Report/Status/SecurityStatus.php
index 9787abe59948..e441e0d6e88a 100644
--- a/typo3/sysext/reports/Classes/Report/Status/SecurityStatus.php
+++ b/typo3/sysext/reports/Classes/Report/Status/SecurityStatus.php
@@ -48,7 +48,7 @@ class SecurityStatus implements RequestAwareStatusProviderInterface
      * @param ServerRequestInterface|null $request
      * @return ReportStatus[] List of statuses
      */
-    public function getStatus(ServerRequestInterface $request = null)
+    public function getStatus(?ServerRequestInterface $request = null)
     {
         $statuses = [
             'trustedHostsPattern' => $this->getTrustedHostsPatternStatus(),
diff --git a/typo3/sysext/reports/Classes/Report/Status/Status.php b/typo3/sysext/reports/Classes/Report/Status/Status.php
index 317a19fe23e4..afefb4c90d6f 100644
--- a/typo3/sysext/reports/Classes/Report/Status/Status.php
+++ b/typo3/sysext/reports/Classes/Report/Status/Status.php
@@ -51,7 +51,7 @@ class Status implements RequestAwareReportInterface
      * @param ServerRequestInterface|null $request the currently handled request
      * @return string The status report as HTML
      */
-    public function getReport(ServerRequestInterface $request = null)
+    public function getReport(?ServerRequestInterface $request = null)
     {
         $status = $this->getSystemStatus($request);
         $registry = GeneralUtility::makeInstance(Registry::class);
@@ -81,7 +81,7 @@ class Status implements RequestAwareReportInterface
      * @param ServerRequestInterface $request
      * @return \TYPO3\CMS\Reports\Status[][]
      */
-    public function getSystemStatus(ServerRequestInterface $request = null)
+    public function getSystemStatus(?ServerRequestInterface $request = null)
     {
         $status = [];
         foreach ($this->statusProviders as $statusProviderId => $statusProviderList) {
diff --git a/typo3/sysext/reports/Classes/RequestAwareReportInterface.php b/typo3/sysext/reports/Classes/RequestAwareReportInterface.php
index 9feb32c1cdc4..f3b13af169d1 100644
--- a/typo3/sysext/reports/Classes/RequestAwareReportInterface.php
+++ b/typo3/sysext/reports/Classes/RequestAwareReportInterface.php
@@ -30,5 +30,5 @@ interface RequestAwareReportInterface extends ReportInterface
      * @param ServerRequestInterface|null $request the currently handled request
      * @return string A reports rendered HTML
      */
-    public function getReport(ServerRequestInterface $request = null);
+    public function getReport(?ServerRequestInterface $request = null);
 }
diff --git a/typo3/sysext/reports/Classes/RequestAwareStatusProviderInterface.php b/typo3/sysext/reports/Classes/RequestAwareStatusProviderInterface.php
index 82ecf96386e3..f0b7890cf900 100644
--- a/typo3/sysext/reports/Classes/RequestAwareStatusProviderInterface.php
+++ b/typo3/sysext/reports/Classes/RequestAwareStatusProviderInterface.php
@@ -30,5 +30,5 @@ interface RequestAwareStatusProviderInterface extends StatusProviderInterface
      * @param ServerRequestInterface|null $request the currently handled request
      * @return array An array of \TYPO3\CMS\Reports\Status objects
      */
-    public function getStatus(ServerRequestInterface $request = null);
+    public function getStatus(?ServerRequestInterface $request = null);
 }
-- 
GitLab