From b00e20a9b8e88fad2ae50aa0b46df76eb192a585 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20B=C3=BCrk?= <stefan@buerk.tech>
Date: Mon, 24 Jun 2024 16:12:25 +0200
Subject: [PATCH] [TASK] Avoid implicitly nullable class method parameter in
 `EXT:sys_note`
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: #104196
Releases: main, 12.4, 11.5
Change-Id: Iec724407eed8edefed48c2e032b2105b42cabc94
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/84885
Tested-by: Oliver Klee <typo3-coding@oliverklee.de>
Tested-by: Stefan Bürk <stefan@buerk.tech>
Reviewed-by: Fabien Udriot <fudriot@omic.ch>
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Tested-by: core-ci <typo3@b13.com>
Reviewed-by: Stefan Bürk <stefan@buerk.tech>
---
 typo3/sysext/sys_note/Classes/Controller/NoteController.php     | 2 +-
 .../sys_note/Classes/Domain/Repository/SysNoteRepository.php    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/typo3/sysext/sys_note/Classes/Controller/NoteController.php b/typo3/sysext/sys_note/Classes/Controller/NoteController.php
index b30bf3fe348c..8f09713fd73c 100644
--- a/typo3/sysext/sys_note/Classes/Controller/NoteController.php
+++ b/typo3/sysext/sys_note/Classes/Controller/NoteController.php
@@ -50,7 +50,7 @@ class NoteController
      * @param int|null $position null for no restriction, integer for defined position
      * @return string
      */
-    public function listAction($pids, int $position = null): string
+    public function listAction($pids, ?int $position = null): string
     {
         $backendUser = $this->getBackendUser();
         if (empty($pids)
diff --git a/typo3/sysext/sys_note/Classes/Domain/Repository/SysNoteRepository.php b/typo3/sysext/sys_note/Classes/Domain/Repository/SysNoteRepository.php
index 136a7d81040b..95a786a20cdb 100644
--- a/typo3/sysext/sys_note/Classes/Domain/Repository/SysNoteRepository.php
+++ b/typo3/sysext/sys_note/Classes/Domain/Repository/SysNoteRepository.php
@@ -39,7 +39,7 @@ class SysNoteRepository
      * @param int|null $position null for no restriction, integer for defined position
      * @return array
      */
-    public function findByPidsAndAuthorId($pids, int $author, int $position = null): array
+    public function findByPidsAndAuthorId($pids, int $author, ?int $position = null): array
     {
         $pids = GeneralUtility::intExplode(',', (string)$pids);
 
-- 
GitLab