From af771aa50e326f44c0602e25aa2a01f500d77f18 Mon Sep 17 00:00:00 2001
From: Christian Kuhn <lolli@schwarzbu.ch>
Date: Sun, 26 May 2024 14:38:49 +0200
Subject: [PATCH] [BUGFIX] Avoid 4th argument on GU::callUserFunction() in test
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

GeneralUtility::callUserFunction() has only three
parameters, as detected by phpstan.

Resolves: #103923
Releases: main, 12.4
Change-Id: I31fc48f343558dd2e0d73feeb3933e249fa625a4
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/84410
Tested-by: Stefan Bürk <stefan@buerk.tech>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: core-ci <typo3@b13.com>
Reviewed-by: Stefan Bürk <stefan@buerk.tech>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
---
 Build/phpstan/phpstan-baseline.neon                        | 5 -----
 .../sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php  | 7 +------
 2 files changed, 1 insertion(+), 11 deletions(-)

diff --git a/Build/phpstan/phpstan-baseline.neon b/Build/phpstan/phpstan-baseline.neon
index 3062051d3561..9d725670db13 100644
--- a/Build/phpstan/phpstan-baseline.neon
+++ b/Build/phpstan/phpstan-baseline.neon
@@ -850,11 +850,6 @@ parameters:
 			count: 1
 			path: ../../typo3/sysext/core/Tests/Unit/Tree/TableConfiguration/TreeDataProviderFactoryTest.php
 
-		-
-			message: "#^Static method TYPO3\\\\CMS\\\\Core\\\\Utility\\\\GeneralUtility\\:\\:callUserFunction\\(\\) invoked with 4 parameters, 2\\-3 required\\.$#"
-			count: 1
-			path: ../../typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php
-
 		-
 			message: "#^Call to an undefined method TYPO3\\\\CMS\\\\Core\\\\Tests\\\\UnitDeprecated\\\\Compatibility\\\\Fixtures\\\\PublicMethodDeprecationTraitTextFixture\\:\\:doesNotExist\\(\\)\\.$#"
 			count: 1
diff --git a/typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php b/typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php
index 6d6398fc823a..96a66b50aa6d 100644
--- a/typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php
+++ b/typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php
@@ -3084,12 +3084,7 @@ final class GeneralUtilityTest extends UnitTestCase
     public function callUserFunctionCanCallClosure(): void
     {
         $inputData = ['foo' => 'bar'];
-        $result = GeneralUtility::callUserFunction(
-            static fn(): string => 'Worked fine',
-            $inputData,
-            $this,
-            ''
-        );
+        $result = GeneralUtility::callUserFunction(static fn(): string => 'Worked fine', $inputData, $this);
         self::assertEquals('Worked fine', $result);
     }
 
-- 
GitLab