From 8bd60bc9ee524e932f4fa6087581ae1b5036efb0 Mon Sep 17 00:00:00 2001 From: Alexander Schnitzler Date: Mon, 11 May 2020 17:33:41 +0200 Subject: [PATCH] [TASK] Fix phpstan checkFunctionArgumentTypes errors in ext:core Configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch fixes incompatible type usage in function arguments and is preparatory work for introducing native type hints and strict mode in all core files. Releases: master, 10.4 Resolves: #92253 Change-Id: Ibbf42d227458a4480fffc5993034f8c36d9bae3e Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/65674 Tested-by: Jörg Bösche Tested-by: TYPO3com Tested-by: Daniel Goerz Tested-by: Sascha Egerer Reviewed-by: Jörg Bösche Reviewed-by: Oliver Klee Reviewed-by: Daniel Goerz Reviewed-by: Sascha Egerer --- .../core/Classes/Configuration/ExtensionConfiguration.php | 2 +- .../core/Classes/Configuration/FlexForm/FlexFormTools.php | 4 ++-- .../core/Classes/Configuration/Loader/PageTsConfigLoader.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/typo3/sysext/core/Classes/Configuration/ExtensionConfiguration.php b/typo3/sysext/core/Classes/Configuration/ExtensionConfiguration.php index db120c32ab5a..515bf89c9da0 100644 --- a/typo3/sysext/core/Classes/Configuration/ExtensionConfiguration.php +++ b/typo3/sysext/core/Classes/Configuration/ExtensionConfiguration.php @@ -278,7 +278,7 @@ public function getDefaultConfigurationRawString(string $extensionKey): string 'EXT:' . $extensionKey . '/ext_conf_template.txt' ); if (file_exists($extConfTemplateFileLocation)) { - $rawString = file_get_contents($extConfTemplateFileLocation); + $rawString = (string)file_get_contents($extConfTemplateFileLocation); } return $rawString; } diff --git a/typo3/sysext/core/Classes/Configuration/FlexForm/FlexFormTools.php b/typo3/sysext/core/Classes/Configuration/FlexForm/FlexFormTools.php index 43234c7fbe64..7e32ddaa9caf 100644 --- a/typo3/sysext/core/Classes/Configuration/FlexForm/FlexFormTools.php +++ b/typo3/sysext/core/Classes/Configuration/FlexForm/FlexFormTools.php @@ -690,7 +690,7 @@ public function parseDataStructureByIdentifier(string $identifier): array 1478105826 ); } - $dataStructure = file_get_contents($file); + $dataStructure = (string)file_get_contents($file); } // Parse main structure @@ -729,7 +729,7 @@ public function parseDataStructureByIdentifier(string $identifier): array $file = GeneralUtility::getFileAbsFileName(trim($sheetStructure)); } if ($file && @is_file($file)) { - $sheetStructure = GeneralUtility::xml2array(file_get_contents($file)); + $sheetStructure = GeneralUtility::xml2array((string)file_get_contents($file)); } } $dataStructure['sheets'][$sheetName] = $sheetStructure; diff --git a/typo3/sysext/core/Classes/Configuration/Loader/PageTsConfigLoader.php b/typo3/sysext/core/Classes/Configuration/Loader/PageTsConfigLoader.php index 3f921faaa713..50e861e823de 100644 --- a/typo3/sysext/core/Classes/Configuration/Loader/PageTsConfigLoader.php +++ b/typo3/sysext/core/Classes/Configuration/Loader/PageTsConfigLoader.php @@ -93,7 +93,7 @@ public function collect(array $rootLine): array $extensionPath = ExtensionManagementUtility::extPath($includeTsConfigFileExtensionKey); $includeTsConfigFileAndPath = PathUtility::getCanonicalPath($extensionPath . $includeTsConfigFilename); if (strpos($includeTsConfigFileAndPath, $extensionPath) === 0 && file_exists($includeTsConfigFileAndPath)) { - $tsData['page_' . $page['uid'] . '_includes_' . $key] = file_get_contents($includeTsConfigFileAndPath); + $tsData['page_' . $page['uid'] . '_includes_' . $key] = (string)file_get_contents($includeTsConfigFileAndPath); } } }