From 6448b4c17af4a614fabbddb617ca371e51145a01 Mon Sep 17 00:00:00 2001
From: Simon Schaufelberger <simonschaufi+typo3@gmail.com>
Date: Thu, 5 Oct 2023 23:55:22 +0200
Subject: [PATCH] [BUGFIX] Use the correct return type for method
 copyRecord_raw

DataHandler->copyRecord_raw can also return null.
This should be reflected in the doc header as well.

Resolves: #102098
Releases: main, 12.4, 11.5
Change-Id: Ic7a12233efd32b67f0bf25d6478a03f807a5623e
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/81353
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: core-ci <typo3@b13.com>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
---
 Build/phpstan/phpstan-baseline.neon                    | 5 -----
 typo3/sysext/core/Classes/DataHandling/DataHandler.php | 2 +-
 2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/Build/phpstan/phpstan-baseline.neon b/Build/phpstan/phpstan-baseline.neon
index 6f276a7a46ac..0b3cc298bb1d 100644
--- a/Build/phpstan/phpstan-baseline.neon
+++ b/Build/phpstan/phpstan-baseline.neon
@@ -700,11 +700,6 @@ parameters:
 			count: 1
 			path: ../../typo3/sysext/core/Classes/DataHandling/DataHandler.php
 
-		-
-			message: "#^Method TYPO3\\\\CMS\\\\Core\\\\DataHandling\\\\DataHandler\\:\\:copyRecord_raw\\(\\) should return int but returns null\\.$#"
-			count: 4
-			path: ../../typo3/sysext/core/Classes/DataHandling/DataHandler.php
-
 		-
 			message: "#^Method TYPO3\\\\CMS\\\\Core\\\\DataHandling\\\\DataHandler\\:\\:doesPageHaveUnallowedTables\\(\\) should return array\\|bool but returns string\\.$#"
 			count: 1
diff --git a/typo3/sysext/core/Classes/DataHandling/DataHandler.php b/typo3/sysext/core/Classes/DataHandling/DataHandler.php
index 0e5262ef9498..e1b3406ceac8 100644
--- a/typo3/sysext/core/Classes/DataHandling/DataHandler.php
+++ b/typo3/sysext/core/Classes/DataHandling/DataHandler.php
@@ -3594,7 +3594,7 @@ class DataHandler implements LoggerAwareInterface
      * @param int $pid Element PID (real PID, not checked)
      * @param array $overrideArray Override array - must NOT contain any fields not in the table!
      * @param array $workspaceOptions Options to be forwarded if actions happen on a workspace currently
-     * @return int Returns the new ID of the record (if applicable)
+     * @return int|null Returns the new ID of the record (if applicable)
      * @internal should only be used from within DataHandler
      */
     public function copyRecord_raw($table, $uid, $pid, $overrideArray = [], array $workspaceOptions = [])
-- 
GitLab