diff --git a/Build/Scripts/composer-for-core-version.sh b/Build/Scripts/composer-for-core-version.sh index 1532abc5..60044e0d 100755 --- a/Build/Scripts/composer-for-core-version.sh +++ b/Build/Scripts/composer-for-core-version.sh @@ -6,6 +6,7 @@ composer_cleanup() { echo -e "💥 Cleanup folders" rm -Rf \ + .cache/phpstan/* \ .Build/vendor/* \ .Build/var/* \ .Build/bin/* \ diff --git a/Build/phpstan/Core12/phpstan-baseline.neon b/Build/phpstan/Core12/phpstan-baseline.neon index 3bb73956..4bc67bfb 100644 --- a/Build/phpstan/Core12/phpstan-baseline.neon +++ b/Build/phpstan/Core12/phpstan-baseline.neon @@ -40,6 +40,11 @@ parameters: count: 1 path: ../../../Classes/Service/LanguageService.php + - + message: "#^Call to method write\\(\\) on an unknown class TYPO3\\\\CMS\\\\Core\\\\Configuration\\\\SiteWriter\\.$#" + count: 1 + path: ../../../Classes/Upgrades/FormalityUpgradeWizard.php + - message: "#^Method WebVision\\\\Deepltranslate\\\\Core\\\\Utility\\\\DeeplBackendUtility\\:\\:buildBackendRoute\\(\\) has parameter \\$parameters with no value type specified in iterable type array\\.$#" count: 1 @@ -105,6 +110,16 @@ parameters: count: 1 path: ../../../Tests/Functional/Fixtures/Frontend/PhpError.php + - + message: "#^Class TYPO3\\\\CMS\\\\Core\\\\Configuration\\\\SiteConfiguration constructor invoked with 7 parameters, 2\\-3 required\\.$#" + count: 1 + path: ../../../Tests/Functional/Hooks/TranslateHookTest.php + + - + message: "#^Class TYPO3\\\\CMS\\\\Core\\\\Site\\\\Set\\\\SetRegistry not found\\.$#" + count: 1 + path: ../../../Tests/Functional/Hooks/TranslateHookTest.php + - message: "#^Method WebVision\\\\Deepltranslate\\\\Core\\\\Tests\\\\Functional\\\\Hooks\\\\TranslateHookTest\\:\\:buildDefaultLanguageConfiguration\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -155,6 +170,26 @@ parameters: count: 1 path: ../../../Tests/Functional/Hooks/TranslateHookTest.php + - + message: "#^Parameter \\#2 \\$eventDispatcher of class TYPO3\\\\CMS\\\\Core\\\\Configuration\\\\SiteConfiguration constructor expects Psr\\\\EventDispatcher\\\\EventDispatcherInterface, TYPO3\\\\CMS\\\\Core\\\\Site\\\\SiteSettingsFactory given\\.$#" + count: 1 + path: ../../../Tests/Functional/Hooks/TranslateHookTest.php + + - + message: "#^Parameter \\#3 \\$coreCache of class TYPO3\\\\CMS\\\\Core\\\\Configuration\\\\SiteConfiguration constructor expects TYPO3\\\\CMS\\\\Core\\\\Cache\\\\Frontend\\\\PhpFrontend\\|null, TYPO3\\\\CMS\\\\Core\\\\Site\\\\Set\\\\SetRegistry given\\.$#" + count: 1 + path: ../../../Tests/Functional/Hooks/TranslateHookTest.php + + - + message: "#^Class TYPO3\\\\CMS\\\\Core\\\\Configuration\\\\SiteConfiguration constructor invoked with 7 parameters, 2\\-3 required\\.$#" + count: 1 + path: ../../../Tests/Functional/Regression/LocalizationInlineRegressionTest.php + + - + message: "#^Class TYPO3\\\\CMS\\\\Core\\\\Site\\\\Set\\\\SetRegistry not found\\.$#" + count: 1 + path: ../../../Tests/Functional/Regression/LocalizationInlineRegressionTest.php + - message: "#^Method WebVision\\\\Deepltranslate\\\\Core\\\\Tests\\\\Functional\\\\Regression\\\\LocalizationInlineRegressionTest\\:\\:buildDefaultLanguageConfiguration\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -205,6 +240,26 @@ parameters: count: 1 path: ../../../Tests/Functional/Regression/LocalizationInlineRegressionTest.php + - + message: "#^Parameter \\#2 \\$eventDispatcher of class TYPO3\\\\CMS\\\\Core\\\\Configuration\\\\SiteConfiguration constructor expects Psr\\\\EventDispatcher\\\\EventDispatcherInterface, TYPO3\\\\CMS\\\\Core\\\\Site\\\\SiteSettingsFactory given\\.$#" + count: 1 + path: ../../../Tests/Functional/Regression/LocalizationInlineRegressionTest.php + + - + message: "#^Parameter \\#3 \\$coreCache of class TYPO3\\\\CMS\\\\Core\\\\Configuration\\\\SiteConfiguration constructor expects TYPO3\\\\CMS\\\\Core\\\\Cache\\\\Frontend\\\\PhpFrontend\\|null, TYPO3\\\\CMS\\\\Core\\\\Site\\\\Set\\\\SetRegistry given\\.$#" + count: 1 + path: ../../../Tests/Functional/Regression/LocalizationInlineRegressionTest.php + + - + message: "#^Class TYPO3\\\\CMS\\\\Core\\\\Configuration\\\\SiteConfiguration constructor invoked with 7 parameters, 2\\-3 required\\.$#" + count: 1 + path: ../../../Tests/Functional/Regression/PreviewTranslationInformationTest.php + + - + message: "#^Class TYPO3\\\\CMS\\\\Core\\\\Site\\\\Set\\\\SetRegistry not found\\.$#" + count: 1 + path: ../../../Tests/Functional/Regression/PreviewTranslationInformationTest.php + - message: "#^Method WebVision\\\\Deepltranslate\\\\Core\\\\Tests\\\\Functional\\\\Regression\\\\PreviewTranslationInformationTest\\:\\:buildDefaultLanguageConfiguration\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -255,11 +310,31 @@ parameters: count: 1 path: ../../../Tests/Functional/Regression/PreviewTranslationInformationTest.php + - + message: "#^Parameter \\#2 \\$eventDispatcher of class TYPO3\\\\CMS\\\\Core\\\\Configuration\\\\SiteConfiguration constructor expects Psr\\\\EventDispatcher\\\\EventDispatcherInterface, TYPO3\\\\CMS\\\\Core\\\\Site\\\\SiteSettingsFactory given\\.$#" + count: 1 + path: ../../../Tests/Functional/Regression/PreviewTranslationInformationTest.php + + - + message: "#^Parameter \\#3 \\$coreCache of class TYPO3\\\\CMS\\\\Core\\\\Configuration\\\\SiteConfiguration constructor expects TYPO3\\\\CMS\\\\Core\\\\Cache\\\\Frontend\\\\PhpFrontend\\|null, TYPO3\\\\CMS\\\\Core\\\\Site\\\\Set\\\\SetRegistry given\\.$#" + count: 1 + path: ../../../Tests/Functional/Regression/PreviewTranslationInformationTest.php + - message: "#^Cannot access property \\$code on DeepL\\\\Language\\|null\\.$#" count: 7 path: ../../../Tests/Functional/Services/DeeplServiceTest.php + - + message: "#^Class TYPO3\\\\CMS\\\\Core\\\\Configuration\\\\SiteConfiguration constructor invoked with 7 parameters, 2\\-3 required\\.$#" + count: 1 + path: ../../../Tests/Functional/Services/LanguageServiceTest.php + + - + message: "#^Class TYPO3\\\\CMS\\\\Core\\\\Site\\\\Set\\\\SetRegistry not found\\.$#" + count: 1 + path: ../../../Tests/Functional/Services/LanguageServiceTest.php + - message: "#^Method WebVision\\\\Deepltranslate\\\\Core\\\\Tests\\\\Functional\\\\Services\\\\LanguageServiceTest\\:\\:buildDefaultLanguageConfiguration\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -310,6 +385,26 @@ parameters: count: 1 path: ../../../Tests/Functional/Services/LanguageServiceTest.php + - + message: "#^Parameter \\#2 \\$eventDispatcher of class TYPO3\\\\CMS\\\\Core\\\\Configuration\\\\SiteConfiguration constructor expects Psr\\\\EventDispatcher\\\\EventDispatcherInterface, TYPO3\\\\CMS\\\\Core\\\\Site\\\\SiteSettingsFactory given\\.$#" + count: 1 + path: ../../../Tests/Functional/Services/LanguageServiceTest.php + + - + message: "#^Parameter \\#3 \\$coreCache of class TYPO3\\\\CMS\\\\Core\\\\Configuration\\\\SiteConfiguration constructor expects TYPO3\\\\CMS\\\\Core\\\\Cache\\\\Frontend\\\\PhpFrontend\\|null, TYPO3\\\\CMS\\\\Core\\\\Site\\\\Set\\\\SetRegistry given\\.$#" + count: 1 + path: ../../../Tests/Functional/Services/LanguageServiceTest.php + + - + message: "#^Class TYPO3\\\\CMS\\\\Core\\\\Configuration\\\\SiteConfiguration constructor invoked with 7 parameters, 2\\-3 required\\.$#" + count: 1 + path: ../../../Tests/Functional/Updates/FormalityUpgradeWizardTest.php + + - + message: "#^Class TYPO3\\\\CMS\\\\Core\\\\Site\\\\Set\\\\SetRegistry not found\\.$#" + count: 1 + path: ../../../Tests/Functional/Updates/FormalityUpgradeWizardTest.php + - message: "#^Method WebVision\\\\Deepltranslate\\\\Core\\\\Tests\\\\Functional\\\\Updates\\\\FormalityUpgradeWizardTest\\:\\:buildDefaultLanguageConfiguration\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -359,3 +454,28 @@ parameters: message: "#^Method WebVision\\\\Deepltranslate\\\\Core\\\\Tests\\\\Functional\\\\Updates\\\\FormalityUpgradeWizardTest\\:\\:writeSiteConfiguration\\(\\) has parameter \\$site with no value type specified in iterable type array\\.$#" count: 1 path: ../../../Tests/Functional/Updates/FormalityUpgradeWizardTest.php + + - + message: "#^Parameter \\#2 \\$eventDispatcher of class TYPO3\\\\CMS\\\\Core\\\\Configuration\\\\SiteConfiguration constructor expects Psr\\\\EventDispatcher\\\\EventDispatcherInterface, TYPO3\\\\CMS\\\\Core\\\\Site\\\\SiteSettingsFactory given\\.$#" + count: 1 + path: ../../../Tests/Functional/Updates/FormalityUpgradeWizardTest.php + + - + message: "#^Parameter \\#3 \\$coreCache of class TYPO3\\\\CMS\\\\Core\\\\Configuration\\\\SiteConfiguration constructor expects TYPO3\\\\CMS\\\\Core\\\\Cache\\\\Frontend\\\\PhpFrontend\\|null, TYPO3\\\\CMS\\\\Core\\\\Site\\\\Set\\\\SetRegistry given\\.$#" + count: 1 + path: ../../../Tests/Functional/Updates/FormalityUpgradeWizardTest.php + + - + message: "#^Call to method create\\(\\) on an unknown class TYPO3\\\\CMS\\\\Core\\\\View\\\\ViewFactoryInterface\\.$#" + count: 1 + path: ../../../Tests/Functional/ViewHelpers/ExtensionActiveViewHelperTest.php + + - + message: "#^Class TYPO3\\\\CMS\\\\Core\\\\View\\\\ViewFactoryInterface not found\\.$#" + count: 1 + path: ../../../Tests/Functional/ViewHelpers/ExtensionActiveViewHelperTest.php + + - + message: "#^Instantiated class TYPO3\\\\CMS\\\\Core\\\\View\\\\ViewFactoryData not found\\.$#" + count: 1 + path: ../../../Tests/Functional/ViewHelpers/ExtensionActiveViewHelperTest.php diff --git a/Build/phpstan/Core13/phpstan-baseline.neon b/Build/phpstan/Core13/phpstan-baseline.neon index 3bb73956..af3f7fa5 100644 --- a/Build/phpstan/Core13/phpstan-baseline.neon +++ b/Build/phpstan/Core13/phpstan-baseline.neon @@ -1,5 +1,10 @@ parameters: ignoreErrors: + - + message: "#^Call to an undefined method TYPO3\\\\CMS\\\\Frontend\\\\Controller\\\\TypoScriptFrontendController\\:\\:getContext\\(\\)\\.$#" + count: 1 + path: ../../../Classes/Event/Listener/RenderTranslatedFlagInFrontendPreviewMode.php + - message: "#^Method WebVision\\\\Deepltranslate\\\\Core\\\\Form\\\\Item\\\\SiteConfigSupportedLanguageItemsProcFunc\\:\\:getSupportedLanguageForField\\(\\) has parameter \\$configuration with no value type specified in iterable type array\\.$#" count: 1 @@ -105,6 +110,16 @@ parameters: count: 1 path: ../../../Tests/Functional/Fixtures/Frontend/PhpError.php + - + message: "#^Call to an undefined method TYPO3\\\\CMS\\\\Core\\\\Configuration\\\\SiteConfiguration\\:\\:write\\(\\)\\.$#" + count: 2 + path: ../../../Tests/Functional/Hooks/TranslateHookTest.php + + - + message: "#^Class TYPO3\\\\CMS\\\\Core\\\\Configuration\\\\SiteConfiguration constructor invoked with 3 parameters, 7 required\\.$#" + count: 1 + path: ../../../Tests/Functional/Hooks/TranslateHookTest.php + - message: "#^Method WebVision\\\\Deepltranslate\\\\Core\\\\Tests\\\\Functional\\\\Hooks\\\\TranslateHookTest\\:\\:buildDefaultLanguageConfiguration\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -155,6 +170,21 @@ parameters: count: 1 path: ../../../Tests/Functional/Hooks/TranslateHookTest.php + - + message: "#^Parameter \\#2 \\$siteSettingsFactory of class TYPO3\\\\CMS\\\\Core\\\\Configuration\\\\SiteConfiguration constructor expects TYPO3\\\\CMS\\\\Core\\\\Site\\\\SiteSettingsFactory, Psr\\\\EventDispatcher\\\\EventDispatcherInterface given\\.$#" + count: 1 + path: ../../../Tests/Functional/Hooks/TranslateHookTest.php + + - + message: "#^Call to an undefined method TYPO3\\\\CMS\\\\Core\\\\Configuration\\\\SiteConfiguration\\:\\:write\\(\\)\\.$#" + count: 2 + path: ../../../Tests/Functional/Regression/LocalizationInlineRegressionTest.php + + - + message: "#^Class TYPO3\\\\CMS\\\\Core\\\\Configuration\\\\SiteConfiguration constructor invoked with 3 parameters, 7 required\\.$#" + count: 1 + path: ../../../Tests/Functional/Regression/LocalizationInlineRegressionTest.php + - message: "#^Method WebVision\\\\Deepltranslate\\\\Core\\\\Tests\\\\Functional\\\\Regression\\\\LocalizationInlineRegressionTest\\:\\:buildDefaultLanguageConfiguration\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -205,6 +235,21 @@ parameters: count: 1 path: ../../../Tests/Functional/Regression/LocalizationInlineRegressionTest.php + - + message: "#^Parameter \\#2 \\$siteSettingsFactory of class TYPO3\\\\CMS\\\\Core\\\\Configuration\\\\SiteConfiguration constructor expects TYPO3\\\\CMS\\\\Core\\\\Site\\\\SiteSettingsFactory, Psr\\\\EventDispatcher\\\\EventDispatcherInterface given\\.$#" + count: 1 + path: ../../../Tests/Functional/Regression/LocalizationInlineRegressionTest.php + + - + message: "#^Call to an undefined method TYPO3\\\\CMS\\\\Core\\\\Configuration\\\\SiteConfiguration\\:\\:write\\(\\)\\.$#" + count: 2 + path: ../../../Tests/Functional/Regression/PreviewTranslationInformationTest.php + + - + message: "#^Class TYPO3\\\\CMS\\\\Core\\\\Configuration\\\\SiteConfiguration constructor invoked with 3 parameters, 7 required\\.$#" + count: 1 + path: ../../../Tests/Functional/Regression/PreviewTranslationInformationTest.php + - message: "#^Method WebVision\\\\Deepltranslate\\\\Core\\\\Tests\\\\Functional\\\\Regression\\\\PreviewTranslationInformationTest\\:\\:buildDefaultLanguageConfiguration\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -255,11 +300,26 @@ parameters: count: 1 path: ../../../Tests/Functional/Regression/PreviewTranslationInformationTest.php + - + message: "#^Parameter \\#2 \\$siteSettingsFactory of class TYPO3\\\\CMS\\\\Core\\\\Configuration\\\\SiteConfiguration constructor expects TYPO3\\\\CMS\\\\Core\\\\Site\\\\SiteSettingsFactory, Psr\\\\EventDispatcher\\\\EventDispatcherInterface given\\.$#" + count: 1 + path: ../../../Tests/Functional/Regression/PreviewTranslationInformationTest.php + - message: "#^Cannot access property \\$code on DeepL\\\\Language\\|null\\.$#" count: 7 path: ../../../Tests/Functional/Services/DeeplServiceTest.php + - + message: "#^Call to an undefined method TYPO3\\\\CMS\\\\Core\\\\Configuration\\\\SiteConfiguration\\:\\:write\\(\\)\\.$#" + count: 2 + path: ../../../Tests/Functional/Services/LanguageServiceTest.php + + - + message: "#^Class TYPO3\\\\CMS\\\\Core\\\\Configuration\\\\SiteConfiguration constructor invoked with 3 parameters, 7 required\\.$#" + count: 1 + path: ../../../Tests/Functional/Services/LanguageServiceTest.php + - message: "#^Method WebVision\\\\Deepltranslate\\\\Core\\\\Tests\\\\Functional\\\\Services\\\\LanguageServiceTest\\:\\:buildDefaultLanguageConfiguration\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -310,6 +370,21 @@ parameters: count: 1 path: ../../../Tests/Functional/Services/LanguageServiceTest.php + - + message: "#^Parameter \\#2 \\$siteSettingsFactory of class TYPO3\\\\CMS\\\\Core\\\\Configuration\\\\SiteConfiguration constructor expects TYPO3\\\\CMS\\\\Core\\\\Site\\\\SiteSettingsFactory, Psr\\\\EventDispatcher\\\\EventDispatcherInterface given\\.$#" + count: 1 + path: ../../../Tests/Functional/Services/LanguageServiceTest.php + + - + message: "#^Call to an undefined method TYPO3\\\\CMS\\\\Core\\\\Configuration\\\\SiteConfiguration\\:\\:write\\(\\)\\.$#" + count: 2 + path: ../../../Tests/Functional/Updates/FormalityUpgradeWizardTest.php + + - + message: "#^Class TYPO3\\\\CMS\\\\Core\\\\Configuration\\\\SiteConfiguration constructor invoked with 3 parameters, 7 required\\.$#" + count: 1 + path: ../../../Tests/Functional/Updates/FormalityUpgradeWizardTest.php + - message: "#^Method WebVision\\\\Deepltranslate\\\\Core\\\\Tests\\\\Functional\\\\Updates\\\\FormalityUpgradeWizardTest\\:\\:buildDefaultLanguageConfiguration\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -359,3 +434,13 @@ parameters: message: "#^Method WebVision\\\\Deepltranslate\\\\Core\\\\Tests\\\\Functional\\\\Updates\\\\FormalityUpgradeWizardTest\\:\\:writeSiteConfiguration\\(\\) has parameter \\$site with no value type specified in iterable type array\\.$#" count: 1 path: ../../../Tests/Functional/Updates/FormalityUpgradeWizardTest.php + + - + message: "#^Parameter \\#2 \\$siteSettingsFactory of class TYPO3\\\\CMS\\\\Core\\\\Configuration\\\\SiteConfiguration constructor expects TYPO3\\\\CMS\\\\Core\\\\Site\\\\SiteSettingsFactory, Psr\\\\EventDispatcher\\\\EventDispatcherInterface given\\.$#" + count: 1 + path: ../../../Tests/Functional/Updates/FormalityUpgradeWizardTest.php + + - + message: "#^Call to an undefined method TYPO3\\\\CMS\\\\Core\\\\View\\\\ViewInterface\\:\\:getRenderingContext\\(\\)\\.$#" + count: 3 + path: ../../../Tests/Functional/ViewHelpers/ExtensionActiveViewHelperTest.php diff --git a/Classes/Upgrades/FormalityUpgradeWizard.php b/Classes/Upgrades/FormalityUpgradeWizard.php index 32255675..ed737a13 100644 --- a/Classes/Upgrades/FormalityUpgradeWizard.php +++ b/Classes/Upgrades/FormalityUpgradeWizard.php @@ -10,7 +10,6 @@ use TYPO3\CMS\Core\Configuration\SiteConfiguration; use TYPO3\CMS\Core\Configuration\SiteWriter; use TYPO3\CMS\Core\Core\Environment; -use TYPO3\CMS\Core\Information\Typo3Version; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Install\Attribute\UpgradeWizard; use TYPO3\CMS\Install\Updates\ChattyInterface; @@ -50,9 +49,9 @@ public function updateNecessary(): bool public function executeUpdate(): bool { - $siteConfiguration = (((new Typo3Version())->getMajorVersion() < 13) - ? GeneralUtility::makeInstance(SiteConfiguration::class) - : GeneralUtility::makeInstance(SiteWriter::class)); + $siteConfiguration = (class_exists(SiteWriter::class)) + ? GeneralUtility::makeInstance(SiteWriter::class) + : GeneralUtility::makeInstance(SiteConfiguration::class); $deeplService = GeneralUtility::makeInstance(DeeplService::class); $globalFormality = 'default'; @@ -93,8 +92,11 @@ public function executeUpdate(): bool $explodedSiteConfigPath = explode(DIRECTORY_SEPARATOR, $file->getPath()); $siteIdentifier = array_pop($explodedSiteConfigPath); - - $siteConfiguration->write($siteIdentifier, $loadedSiteConfiguration); + if (method_exists($siteConfiguration, 'write')) { + $siteConfiguration->write($siteIdentifier, $loadedSiteConfiguration); + } else { + throw new \RuntimeException(__CLASS__ . ' does not implement write().', 1734624531); + } } return true;