diff --git a/Build/phpstan/phpstan-baseline.neon b/Build/phpstan/phpstan-baseline.neon index 81605ce7f33a4e7ff230ea601d10b5799dba6753..3fb5cc7f61c3eaea00fc45127bec354051036f8a 100644 --- a/Build/phpstan/phpstan-baseline.neon +++ b/Build/phpstan/phpstan-baseline.neon @@ -1170,11 +1170,6 @@ parameters: count: 1 path: ../../typo3/sysext/core/Classes/TypoScript/TemplateService.php - - - message: "#^If condition is always false\\.$#" - count: 1 - path: ../../typo3/sysext/core/Classes/Utility/CommandUtility.php - - message: "#^Call to an undefined method TYPO3\\\\CMS\\\\Core\\\\Cache\\\\Frontend\\\\FrontendInterface\\:\\:require\\(\\)\\.$#" count: 3 diff --git a/typo3/sysext/core/Classes/Utility/CommandUtility.php b/typo3/sysext/core/Classes/Utility/CommandUtility.php index 7a9e07f044f978ad174f26114bd9da4bc211c588..7df4338bd82b36f488659f2ac81f8e236832351f 100644 --- a/typo3/sysext/core/Classes/Utility/CommandUtility.php +++ b/typo3/sysext/core/Classes/Utility/CommandUtility.php @@ -73,9 +73,9 @@ class CommandUtility * * The key is a path. The value is either the same path, or false if the path is not valid. * - * @var array<string, string|false> + * @var array<string, string|false>|null */ - protected static array $paths; + protected static ?array $paths = null; /** * Wrapper function for php exec function diff --git a/typo3/sysext/core/Tests/Unit/Utility/CommandUtilityTest.php b/typo3/sysext/core/Tests/Unit/Utility/CommandUtilityTest.php index 5715e17d8c02f1530ba861fd3ba82152ba2d6158..ae29eb27fa12d73d951bffb73ea3d51dcd4a30a3 100644 --- a/typo3/sysext/core/Tests/Unit/Utility/CommandUtilityTest.php +++ b/typo3/sysext/core/Tests/Unit/Utility/CommandUtilityTest.php @@ -203,4 +203,21 @@ class CommandUtilityTest extends UnitTestCase $actualQuoted = $commandUtilityMock->_call('unQuoteFilenames', $source); self::assertEquals($expectedQuoted, $actualQuoted); } + + /** + * Test to ensure that, the error isn't happening + * Error: Typed static property TYPO3\CMS\Core\Utility\CommandUtility::$paths must not be + * accessed before initialization + * + * @test + */ + public function getCommandWithPhpReturnsPathToPhpExecutable(): void + { + $commandUtilityMock = $this->getAccessibleMock(CommandUtility::class, ['dummy']); + $command = $commandUtilityMock->_call('getCommand', 'php'); + + self::assertIsString($command); + self::assertNotEmpty($command); + self::assertStringContainsString('php', $command); + } }