Skip to content

Latest commit

 

History

History
3420 lines (2493 loc) · 95.9 KB

all_rectors_overview.md

File metadata and controls

3420 lines (2493 loc) · 95.9 KB

175 Rules Overview

AddRenderTypeToSelectFieldRector

Add renderType for select fields

  • class: Ssch\TYPO3Rector\Rector\v7\v6\AddRenderTypeToSelectFieldRector
 return [
     'ctrl' => [
     ],
     'columns' => [
         'sys_language_uid' => [
             'config' => [
                 'type' => 'select',
                 'maxitems' => 1,
+                'renderType' => 'selectSingle',
             ],
         ],
     ],
 ];

AddTypeToColumnConfigRector

Add type to column config if not exists

  • class: Ssch\TYPO3Rector\Rector\v8\v6\AddTypeToColumnConfigRector
 return [
     'columns' => [
-        'bar' => []
+        'bar' => [
+            'config' => [
+                'type' => 'none'
+            ]
+        ]
     ]
 ];

Array2XmlCsToArray2XmlRector

array2xml_cs to array2xml

  • class: Ssch\TYPO3Rector\Rector\v8\v1\Array2XmlCsToArray2XmlRector
 use TYPO3\CMS\Core\Utility\GeneralUtility;

-GeneralUtility::array2xml_cs();
+GeneralUtility::array2xml();

ArrayUtilityInArrayToFuncInArrayRector

Method inArray from ArrayUtility to in_array

  • class: Ssch\TYPO3Rector\Rector\v8\v6\ArrayUtilityInArrayToFuncInArrayRector
-ArrayUtility::inArray()
+in_array

BackendUserAuthenticationSimplelogRector

Migrate the method BackendUserAuthentication->simplelog() to BackendUserAuthentication->writelog()

  • class: Ssch\TYPO3Rector\Rector\v9\v3\BackendUserAuthenticationSimplelogRector
 $someObject = GeneralUtility::makeInstance(TYPO3\CMS\Core\Authentication\BackendUserAuthentication::class);
-$someObject->simplelog($message, $extKey, $error);
+$someObject->writelog(4, 0, $error, 0, ($extKey ? '[' . $extKey . '] ' : '') . $message, []);

BackendUtilityEditOnClickRector

Migrate the method BackendUtility::editOnClick() to use UriBuilder API

  • class: Ssch\TYPO3Rector\Rector\v10\v1\BackendUtilityEditOnClickRector
 $pid = 2;
 $params = '&edit[pages][' . $pid . ']=new&returnNewPageId=1';
-$url = BackendUtility::editOnClick($params);
+$url = GeneralUtility::makeInstance(UriBuilder::class)->buildUriFromRoute('record_edit') . $params . '&returnUrl=' . rawurlencode(GeneralUtility::getIndpEnv('REQUEST_URI'));;

BackendUtilityGetModuleUrlRector

Migrate the method BackendUtility::getModuleUrl() to use UriBuilder API

  • class: Ssch\TYPO3Rector\Rector\v9\v3\BackendUtilityGetModuleUrlRector
 $moduleName = 'record_edit';
 $params = ['pid' => 2];
-$url = BackendUtility::getModuleUrl($moduleName, $params);
+$url = GeneralUtility::makeInstance(UriBuilder::class)->buildUriFromRoute($moduleName, $params);

BackendUtilityGetRecordRawRector

Migrate the method BackendUtility::editOnClick() to use UriBuilder API

  • class: Ssch\TYPO3Rector\Rector\v8\v7\BackendUtilityGetRecordRawRector
 $table = 'fe_users';
 $where = 'uid > 5';
 $fields = ['uid', 'pid'];
-$record = BackendUtility::getRecordRaw($table, $where, $fields);
+
+$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($table);
+$queryBuilder->getRestrictions()->removeAll();
+
+$record = $queryBuilder->select(GeneralUtility::trimExplode(',', $fields, true))
+    ->from($table)
+    ->where(QueryHelper::stripLogicalOperatorPrefix($where))
+    ->execute()
+    ->fetch();

BackendUtilityGetRecordsByFieldToQueryBuilderRector

BackendUtility::getRecordsByField to QueryBuilder

  • class: Ssch\TYPO3Rector\Rector\v8\v7\BackendUtilityGetRecordsByFieldToQueryBuilderRector
-use TYPO3\CMS\Backend\Utility\BackendUtility;
-$rows = BackendUtility::getRecordsByField('table', 'uid', 3);
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Database\ConnectionPool;
+use TYPO3\CMS\Core\Database\Query\Restriction\BackendWorkspaceRestriction;
+use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
+$queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('table');
+$queryBuilder->getRestrictions()->removeAll()->add(GeneralUtility::makeInstance(BackendWorkspaceRestriction::class));
+$queryBuilder->getRestrictions()->add(GeneralUtility::makeInstance(DeletedRestriction::class));
+$queryBuilder->select('*')->from('table')->where($queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter(3)));
+$rows = $queryBuilder->execute()->fetchAll();

BackendUtilityGetViewDomainToPageRouterRector

Refactor method call BackendUtility::getViewDomain() to PageRouter

  • class: Ssch\TYPO3Rector\Rector\v10\v0\BackendUtilityGetViewDomainToPageRouterRector
-use TYPO3\CMS\Backend\Utility\BackendUtility;
-$domain1 = BackendUtility::getViewDomain(1);
+use TYPO3\CMS\Core\Site\SiteFinder;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+$site = GeneralUtility::makeInstance(SiteFinder::class)->getSiteByPageId(1);
+$domain1 = $site->getRouter()->generateUri(1);

BackendUtilityShortcutExistsRector

shortcutExists Static call replaced by method call of ShortcutRepository

  • class: Ssch\TYPO3Rector\Rector\v9\v4\BackendUtilityShortcutExistsRector
-TYPO3\CMS\Backend\Utility\BackendUtility::shortcutExists($url);
+GeneralUtility::makeInstance(ShortcutRepository::class)->shortcutExists($url);

CallEnableFieldsFromPageRepositoryRector

Call enable fields from PageRepository instead of ContentObjectRenderer

  • class: Ssch\TYPO3Rector\Rector\v9\v4\CallEnableFieldsFromPageRepositoryRector
 $contentObjectRenderer = GeneralUtility::makeInstance(ContentObjectRenderer::class);
-$contentObjectRenderer->enableFields('pages', false, []);
+GeneralUtility::makeInstance(PageRepository::class)->enableFields('pages', -1, []);

ChangeAttemptsParameterConsoleOutputRector

Turns old default value to parameter in ConsoleOutput->askAndValidate() and/or ConsoleOutput->select() method

  • class: Ssch\TYPO3Rector\Rector\v8\v7\ChangeAttemptsParameterConsoleOutputRector
-$this->output->select('The question', [1, 2, 3], null, false, false);
+$this->output->select('The question', [1, 2, 3], null, false, null);

ChangeDefaultCachingFrameworkNamesRector

Use new default cache names like core instead of cache_core)

  • class: Ssch\TYPO3Rector\Rector\v10\v0\ChangeDefaultCachingFrameworkNamesRector
 $cacheManager = GeneralUtility::makeInstance(CacheManager::class);
-$cacheManager->getCache('cache_core');
-$cacheManager->getCache('cache_hash');
-$cacheManager->getCache('cache_pages');
-$cacheManager->getCache('cache_pagesection');
-$cacheManager->getCache('cache_runtime');
-$cacheManager->getCache('cache_rootline');
-$cacheManager->getCache('cache_imagesizes');
+$cacheManager->getCache('core');
+$cacheManager->getCache('hash');
+$cacheManager->getCache('pages');
+$cacheManager->getCache('pagesection');
+$cacheManager->getCache('runtime');
+$cacheManager->getCache('rootline');
+$cacheManager->getCache('imagesizes');

ChangeMethodCallsForStandaloneViewRector

Turns method call names to new ones.

  • class: Ssch\TYPO3Rector\Rector\v8\v0\ChangeMethodCallsForStandaloneViewRector
 $someObject = new StandaloneView();
-$someObject->setLayoutRootPath();
-$someObject->getLayoutRootPath();
-$someObject->setPartialRootPath();
-$someObject->getPartialRootPath();
+$someObject->setLayoutRootPaths();
+$someObject->getLayoutRootPaths();
+$someObject->setPartialRootPaths();
+$someObject->getPartialRootPaths();

CharsetConverterToMultiByteFunctionsRector

Move from CharsetConverter methods to mb_string functions

  • class: Ssch\TYPO3Rector\Rector\v8\v5\CharsetConverterToMultiByteFunctionsRector
-        use TYPO3\CMS\Core\Charset\CharsetConverter;
-        use TYPO3\CMS\Core\Utility\GeneralUtility;
-        $charsetConverter = GeneralUtility::makeInstance(CharsetConverter::class);
-        $charsetConverter->strlen('utf-8', 'string');
+mb_strlen('string', 'utf-8');

CheckForExtensionInfoRector

Change the extensions to check for info instead of info_pagetsconfig.

  • class: Ssch\TYPO3Rector\Rector\v9\v0\CheckForExtensionInfoRector
-if(ExtensionManagementUtility::isLoaded('info_pagetsconfig')) {

+if(ExtensionManagementUtility::isLoaded('info')) {
+
 }

 $packageManager = GeneralUtility::makeInstance(PackageManager::class);
-if($packageManager->isActive('info_pagetsconfig')) {
+if($packageManager->isActive('info')) {

 }

CheckForExtensionVersionRector

Change the extensions to check for workspaces instead of version.

  • class: Ssch\TYPO3Rector\Rector\v9\v0\CheckForExtensionVersionRector
-if (ExtensionManagementUtility::isLoaded('version')) {
+if (ExtensionManagementUtility::isLoaded('workspaces')) {
 }

 $packageManager = GeneralUtility::makeInstance(PackageManager::class);
-if ($packageManager->isActive('version')) {
+if ($packageManager->isActive('workspaces')) {
 }

ConfigurationManagerAddControllerConfigurationMethodRector

Add additional method getControllerConfiguration for AbstractConfigurationManager

  • class: Ssch\TYPO3Rector\Rector\v10\v0\ConfigurationManagerAddControllerConfigurationMethodRector
 final class MyExtbaseConfigurationManager extends AbstractConfigurationManager
 {
     protected function getSwitchableControllerActions($extensionName, $pluginName)
     {
         $switchableControllerActions = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions'][$extensionName]['modules'][$pluginName]['controllers'] ?? false;
         if ( ! is_array($switchableControllerActions)) {
             $switchableControllerActions = [];
         }

         return $switchableControllerActions;
     }
+
+    protected function getControllerConfiguration($extensionName, $pluginName): array
+    {
+        return $this->getSwitchableControllerActions($extensionName, $pluginName);
+    }
 }

ConstantToEnvironmentCallRector

Turns defined constant to static method call of new Environment API.

  • class: Ssch\TYPO3Rector\Rector\v9\v4\ConstantToEnvironmentCallRector
-PATH_thisScript;
+Environment::getCurrentScript();

ContentObjectRendererFileResourceRector

Migrate fileResource method of class ContentObjectRenderer

  • class: Ssch\TYPO3Rector\Rector\v8\v5\ContentObjectRendererFileResourceRector
-$template = $this->cObj->fileResource('EXT:vendor/Resources/Private/Templates/Template.html');
+$path = $GLOBALS['TSFE']->tmpl->getFileName('EXT:vendor/Resources/Private/Templates/Template.html');
+if ($path !== null && file_exists($path)) {
+    $template = file_get_contents($path);
+}

CopyMethodGetPidForModTSconfigRector

Copy method getPidForModTSconfig of class BackendUtility over

  • class: Ssch\TYPO3Rector\Rector\v9\v3\CopyMethodGetPidForModTSconfigRector
-use TYPO3\CMS\Backend\Utility\BackendUtility;BackendUtility::getPidForModTSconfig('pages', 1, 2);
+use TYPO3\CMS\Core\Utility\MathUtility;
+
+$table = 'pages';
+$uid = 1;
+$pid = 2;
+$table === 'pages' && MathUtility::canBeInterpretedAsInteger($uid) ? $uid : $pid;

DataHandlerRmCommaRector

Migrate the method DataHandler::rmComma() to use rtrim()

  • class: Ssch\TYPO3Rector\Rector\v8\v7\DataHandlerRmCommaRector
 $inList = '1,2,3,';
 $dataHandler = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\DataHandling\DataHandler::class);
-$inList = $dataHandler->rmComma(trim($inList));
+$inList = rtrim(trim($inList), ',');

DataHandlerVariousMethodsAndMethodArgumentsRector

Remove CharsetConvertParameters

  • class: Ssch\TYPO3Rector\Rector\v8\v7\DataHandlerVariousMethodsAndMethodArgumentsRector
 $dataHandler = GeneralUtility::makeInstance(DataHandler::class);
-$dest = $dataHandler->destPathFromUploadFolder('uploadFolder');
-$dataHandler->extFileFunctions('table', 'field', 'theField', 'deleteAll');
+$dest = PATH_site . 'uploadFolder';
+$dataHandler->extFileFunctions('table', 'field', 'theField');

DatabaseConnectionToDbalRector

Refactor legacy calls of DatabaseConnection to Dbal

  • class: Ssch\TYPO3Rector\Rector\v9\v0\DatabaseConnectionToDbalRector
-$GLOBALS['TYPO3_DB']->exec_INSERTquery(
+$connectionPool = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\ConnectionPool::class);
+        $databaseConnectionForPages = $connectionPool->getConnectionForTable('pages');
+        $databaseConnectionForPages->insert(
             'pages',
             [
                 'pid' => 0,
                 'title' => 'Home',
             ]
         );

DateTimeAspectInsteadOfGlobalsExecTimeRector

Use DateTimeAspect instead of superglobals like $GLOBALS['EXEC_TIME']

  • class: Ssch\TYPO3Rector\Rector\v11\v0\DateTimeAspectInsteadOfGlobalsExecTimeRector
-$currentTimestamp = $GLOBALS['EXEC_TIME'];
+use TYPO3\CMS\Core\Context\Context;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+$currentTimestamp = GeneralUtility::makeInstance(Context::class)->getPropertyFromAspect('date', 'timestamp');

DocumentTemplateAddStyleSheetRector

Use PageRenderer::addCssFile instead of DocumentTemplate::addStyleSheet()

  • class: Ssch\TYPO3Rector\Rector\v9\v4\DocumentTemplateAddStyleSheetRector
-$documentTemplate = GeneralUtility::makeInstance(DocumentTemplate::class);
-$documentTemplate->addStyleSheet('foo', 'foo.css');
+GeneralUtility::makeInstance(PageRenderer::class)->addCssFile('foo.css', 'stylesheet', 'screen', '');

DropAdditionalPaletteRector

TCA: Drop additional palette

  • class: Ssch\TYPO3Rector\Rector\v7\v4\DropAdditionalPaletteRector
 return [
     'types' => [
         'aType' => [
-            'showitem' => 'aField;aLabel;anAdditionalPaletteName',
+            'showitem' => 'aField;aLabel, --palette--;;anAdditionalPaletteName',
         ],
      ],
 ];

ExcludeServiceKeysToArrayRector

Change parameter $excludeServiceKeys explicity to an array

  • class: Ssch\TYPO3Rector\Rector\v10\v2\ExcludeServiceKeysToArrayRector
-GeneralUtility::makeInstanceService('serviceType', 'serviceSubType', 'key1, key2');
-ExtensionManagementUtility::findService('serviceType', 'serviceSubType', 'key1, key2');
+GeneralUtility::makeInstanceService('serviceType', 'serviceSubType', ['key1', 'key2']);
+ExtensionManagementUtility::findService('serviceType', 'serviceSubType', ['key1', 'key2']);

ExtbaseControllerActionsMustReturnResponseInterfaceRector

Extbase controller actions must return ResponseInterface

  • class: Ssch\TYPO3Rector\Rector\v11\v0\ExtbaseControllerActionsMustReturnResponseInterfaceRector
+use Psr\Http\Message\ResponseInterface;
 use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
 class MyController extends ActionController
 {
-    public function someAction()
+    public function someAction(): ResponseInterface
     {
         $this->view->assign('foo', 'bar');
+        return $this->htmlResponse();
     }
 }

FindByPidsAndAuthorIdRector

Use findByPidsAndAuthorId instead of findByPidsAndAuthor

  • class: Ssch\TYPO3Rector\Rector\v9\v0\FindByPidsAndAuthorIdRector
 $sysNoteRepository = GeneralUtility::makeInstance(SysNoteRepository::class);
 $backendUser = new BackendUser();
-$sysNoteRepository->findByPidsAndAuthor('1,2,3', $backendUser);
+$sysNoteRepository->findByPidsAndAuthorId('1,2,3', $backendUser->getUid());

ForceTemplateParsingInTsfeAndTemplateServiceRector

Force template parsing in tsfe is replaced with context api and aspects

  • class: Ssch\TYPO3Rector\Rector\v10\v0\ForceTemplateParsingInTsfeAndTemplateServiceRector
-$myvariable = $GLOBALS['TSFE']->forceTemplateParsing;
-$myvariable2 = $GLOBALS['TSFE']->tmpl->forceTemplateParsing;
+$myvariable = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Context\Context::class)->getPropertyFromAspect('typoscript', 'forcedTemplateParsing');
+$myvariable2 = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Context\Context::class)->getPropertyFromAspect('typoscript', 'forcedTemplateParsing');

-$GLOBALS['TSFE']->forceTemplateParsing = true;
-$GLOBALS['TSFE']->tmpl->forceTemplateParsing = true;
+\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Context\Context::class)->setAspect('typoscript', \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Context\TypoScriptAspect::class, true));
+\TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Context\Context::class)->setAspect('typoscript', \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Context\TypoScriptAspect::class, true));

ForwardResponseInsteadOfForwardMethodRector

Return TYPO3\CMS\Extbase\Http\ForwardResponse instead of TYPO3\CMS\Extbase\Mvc\Controller\ActionController::forward()

  • class: Ssch\TYPO3Rector\Rector\v11\v0\ForwardResponseInsteadOfForwardMethodRector
+use Psr\Http\Message\ResponseInterface;
 use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
+use TYPO3\CMS\Extbase\Http\ForwardResponse;
+
 class FooController extends ActionController
 {
-   public function listAction()
+   public function listAction(): ResponseInterface
    {
-        $this->forward('show');
+        return new ForwardResponse('show');
    }
 }

GeneralUtilityGetUrlRequestHeadersRector

Refactor GeneralUtility::getUrl() request headers in a associative way

  • class: Ssch\TYPO3Rector\Rector\v9\v2\GeneralUtilityGetUrlRequestHeadersRector
-GeneralUtility::getUrl('https://typo3.org', 1, ['Content-Language: de-DE']);
+GeneralUtility::getUrl('https://typo3.org', 1, ['Content-Language' => 'de-DE']);

GeneralUtilityToUpperAndLowerRector

Use mb_strtolower and mb_strtoupper

  • class: Ssch\TYPO3Rector\Rector\v8\v1\GeneralUtilityToUpperAndLowerRector
-use TYPO3\CMS\Core\Utility\GeneralUtility;
-
-$toUpper = GeneralUtility::strtoupper('foo');
-$toLower = GeneralUtility::strtolower('FOO');
+$toUpper = mb_strtoupper('foo', 'utf-8');
+$toLower = mb_strtolower('FOO', 'utf-8');

GeneratePageTitleRector

Use generatePageTitle of TSFE instead of class PageGenerator

  • class: Ssch\TYPO3Rector\Rector\v9\v0\GeneratePageTitleRector
 use TYPO3\CMS\Frontend\Page\PageGenerator;

-PageGenerator::generatePageTitle();
+$GLOBALS['TSFE']->generatePageTitle();

GetClickMenuOnIconTagParametersRector

Use BackendUtility::getClickMenuOnIconTagParameters() instead BackendUtility::wrapClickMenuOnIcon() if needed

  • class: Ssch\TYPO3Rector\Rector\v11\v0\GetClickMenuOnIconTagParametersRector
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 $returnTagParameters = true;
-BackendUtility::wrapClickMenuOnIcon('pages', 1, 'foo', '', '', '', $returnTagParameters);
+BackendUtility::getClickMenuOnIconTagParameters('pages', 1, 'foo');

GetFileAbsFileNameRemoveDeprecatedArgumentsRector

Remove second and third argument of GeneralUtility::getFileAbsFileName()

  • class: Ssch\TYPO3Rector\Rector\v8\v0\GetFileAbsFileNameRemoveDeprecatedArgumentsRector
 use TYPO3\CMS\Core\Utility\GeneralUtility;
-GeneralUtility::getFileAbsFileName('foo.txt', false, true);
+GeneralUtility::getFileAbsFileName('foo.txt');

GetPreferredClientLanguageRector

Use Locales->getPreferredClientLanguage() instead of CharsetConverter::getPreferredClientLanguage()

  • class: Ssch\TYPO3Rector\Rector\v8\v0\GetPreferredClientLanguageRector
+use TYPO3\CMS\Core\Localization\Locales;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
-$preferredLanguage = $GLOBALS['TSFE']->csConvObj->getPreferredClientLanguage(GeneralUtility::getIndpEnv('HTTP_ACCEPT_LANGUAGE'));
+$preferredLanguage = GeneralUtility::makeInstance(Locales::class)->getPreferredClientLanguage(GeneralUtility::getIndpEnv('HTTP_ACCEPT_LANGUAGE'));

GetTemporaryImageWithTextRector

Use GraphicalFunctions->getTemporaryImageWithText instead of LocalImageProcessor->getTemporaryImageWithText

  • class: Ssch\TYPO3Rector\Rector\v7\v1\GetTemporaryImageWithTextRector
-GeneralUtility::makeInstance(LocalImageProcessor::class)->getTemporaryImageWithText("foo", "bar", "baz", "foo")
+GeneralUtility::makeInstance(GraphicalFunctions::class)->getTemporaryImageWithText("foo", "bar", "baz", "foo")

IgnoreValidationAnnotationRector

Turns properties with @ignorevalidation to properties with @TYPO3\CMS\Extbase\Annotation\IgnoreValidation

  • class: Ssch\TYPO3Rector\Rector\v9\v0\IgnoreValidationAnnotationRector
 /**
- * @ignorevalidation $param
+ * @TYPO3\CMS\Extbase\Annotation\IgnoreValidation("param")
  */
 public function method($param)
 {
 }

InjectAnnotationRector

Turns properties with @inject to setter injection

  • class: Ssch\TYPO3Rector\Rector\v9\v0\InjectAnnotationRector
 /**
  * @var SomeService
- * @inject
  */
-private $someService;
+private $someService;
+
+public function injectSomeService(SomeService $someService)
+{
+    $this->someService = $someService;
+}

InjectEnvironmentServiceIfNeededInResponseRector

Inject EnvironmentService if needed in subclass of Response

  • class: Ssch\TYPO3Rector\Rector\v10\v2\InjectEnvironmentServiceIfNeededInResponseRector
 class MyResponse extends Response
 {
+    /**
+     * @var \TYPO3\CMS\Extbase\Service\EnvironmentService
+     */
+    protected $environmentService;
+
     public function myMethod()
     {
         if ($this->environmentService->isEnvironmentInCliMode()) {

         }
+    }
+
+    public function injectEnvironmentService(\TYPO3\CMS\Extbase\Service\EnvironmentService $environmentService)
+    {
+        $this->environmentService = $environmentService;
     }
 }

 class MyOtherResponse extends Response
 {
     public function myMethod()
     {

     }
 }

InstantiatePageRendererExplicitlyRector

Instantiate PageRenderer explicitly

  • class: Ssch\TYPO3Rector\Rector\v7\v4\InstantiatePageRendererExplicitlyRector
-$pageRenderer = $GLOBALS['TSFE']->getPageRenderer();
+$pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);

MetaTagManagementRector

Use setMetaTag method from PageRenderer class

  • class: Ssch\TYPO3Rector\Rector\v9\v0\MetaTagManagementRector
 use TYPO3\CMS\Core\Page\PageRenderer;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
-$pageRenderer->addMetaTag('<meta name="keywords" content="seo, search engine optimisation, search engine optimization, search engine ranking">');
+$pageRenderer->setMetaTag('name', 'keywords', 'seo, search engine optimisation, search engine optimization, search engine ranking');

MethodReadLLFileToLocalizationFactoryRector

Use LocalizationFactory->getParsedData instead of GeneralUtility::readLLfile

  • class: Ssch\TYPO3Rector\Rector\v7\v4\MethodReadLLFileToLocalizationFactoryRector
+use TYPO3\CMS\Core\Localization\LocalizationFactory;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
-$locallangs = GeneralUtility::readLLfile('EXT:foo/locallang.xml', 'de');
+$locallangs = GeneralUtility::makeInstance(LocalizationFactory::class)->getParsedData('EXT:foo/locallang.xml', 'de');

MigrateOptionsOfTypeGroupRector

Migrate options if type group in TCA

  • class: Ssch\TYPO3Rector\Rector\v8\v6\MigrateOptionsOfTypeGroupRector
 return [
     'ctrl' => [],
     'columns' => [
         'image2' => [
             'config' => [
-                'selectedListStyle' => 'foo',
                 'type' => 'group',
                 'internal_type' => 'file',
-                'show_thumbs' => '0',
-                'disable_controls' => 'browser'
+                'fieldControl' => [
+                    'elementBrowser' => ['disabled' => true]
+                ],
+                'fieldWizard' => [
+                    'fileThumbnails' => ['disabled' => true]
+                ]
             ],
         ],
     ],
 ];

MigrateSelectShowIconTableRector

Migrate select showIconTable

  • class: Ssch\TYPO3Rector\Rector\v8\v6\MigrateSelectShowIconTableRector
 return [
     'ctrl' => [
     ],
     'columns' => [
         'foo' => [
             'config' => [
                 'type' => 'select',
                 'items' => [
                     ['foo 1', 'foo1', 'EXT:styleguide/Resources/Public/Icons/tx_styleguide.svg'],
                     ['foo 2', 'foo2', 'EXT:styleguide/Resources/Public/Icons/tx_styleguide.svg'],
                 ],
                 'renderType' => 'selectSingle',
-                'selicon_cols' => 16,
-                'showIconTable' => true
+                'fieldWizard' => [
+                    'selectIcons' => [
+                        'disabled' => false,
+                    ],
+                ],
             ],
         ],
     ],
 ];

MigrateT3editorWizardToRenderTypeT3editorRector

t3editor is no longer configured and enabled as wizard

  • class: Ssch\TYPO3Rector\Rector\v7\v6\MigrateT3editorWizardToRenderTypeT3editorRector
 return [
     'ctrl' => [
     ],
     'columns' => [
         'bodytext' => [
             'config' => [
                 'type' => 'text',
                 'rows' => '42',
-                'wizards' => [
-                    't3editor' => [
-                        'type' => 'userFunc',
-                        'userFunc' => 'TYPO3\CMS\T3editor\FormWizard->main',
-                        'title' => 't3editor',
-                        'icon' => 'wizard_table.gif',
-                        'module' => [
-                            'name' => 'wizard_table'
-                        ],
-                        'params' => [
-                            'format' => 'html',
-                            'style' => 'width:98%; height: 60%;'
-                        ],
-                    ],
-                ],
+                'renderType' => 't3editor',
+                'format' => 'html',
             ],
         ],
     ],
 ];

MoveApplicationContextToEnvironmentApiRector

Use Environment API to fetch application context

  • class: Ssch\TYPO3Rector\Rector\v10\v2\MoveApplicationContextToEnvironmentApiRector
-GeneralUtility::getApplicationContext();
+Environment::getContext();

MoveForeignTypesToOverrideChildTcaRector

TCA InlineOverrideChildTca

  • class: Ssch\TYPO3Rector\Rector\v8\v7\MoveForeignTypesToOverrideChildTcaRector
 return [
     'columns' => [
         'aField' => [
             'config' => [
                 'type' => 'inline',
-                'foreign_types' => [
-                    'aForeignType' => [
-                        'showitem' => 'aChildField',
+                'overrideChildTca' => [
+                    'types' => [
+                        'aForeignType' => [
+                            'showitem' => 'aChildField',
+                        ],
                     ],
                 ],
             ],
         ],
     ],
 ];

MoveLanguageFilesFromExtensionLangRector

Move language resources from ext:lang to their new locations

  • class: Ssch\TYPO3Rector\Rector\v9\v3\MoveLanguageFilesFromExtensionLangRector
 use TYPO3\CMS\Core\Localization\LanguageService;
 $languageService = new LanguageService();
-$languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.no_title');
+$languageService->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.no_title');

MoveLanguageFilesFromLocallangToResourcesRector

Move language files from EXT:lang/locallang_* to Resources/Private/Language

  • class: Ssch\TYPO3Rector\Rector\v8\v5\MoveLanguageFilesFromLocallangToResourcesRector
 use TYPO3\CMS\Core\Localization\LanguageService;
 $languageService = new LanguageService();
-$languageService->sL('LLL:EXT:lang/locallang_alt_doc.xlf:label.confirm.delete_record.title');
+$languageService->sL('LLL:EXT:lang/Resources/Private/Language/locallang_alt_doc.xlf:label.confirm.delete_record.title');

MoveLanguageFilesFromRemovedCmsExtensionRector

Move language files of removed cms to new location

  • class: Ssch\TYPO3Rector\Rector\v7\v4\MoveLanguageFilesFromRemovedCmsExtensionRector
 use TYPO3\CMS\Core\Localization\LanguageService;
 $languageService = new LanguageService();
-$languageService->sL('LLL:EXT:cms/web_info/locallang.xlf:pages_1');
+$languageService->sL('LLL:EXT:frontend/Resources/Private/Language/locallang_webinfo.xlf:pages_1');

MoveRenderArgumentsToInitializeArgumentsMethodRector

Move render method arguments to initializeArguments method

  • class: Ssch\TYPO3Rector\Rector\v9\v0\MoveRenderArgumentsToInitializeArgumentsMethodRector
 class MyViewHelper implements ViewHelperInterface
 {
-    public function render(array $firstParameter, string $secondParameter = null)
+    public function initializeArguments()
     {
+        $this->registerArgument('firstParameter', 'array', '', true);
+        $this->registerArgument('secondParameter', 'string', '', false, null);
+    }
+
+    public function render()
+    {
+        $firstParameter = $this->arguments['firstParameter'];
+        $secondParameter = $this->arguments['secondParameter'];
     }
 }

MoveRequestUpdateOptionFromControlToColumnsRector

TCA ctrl field requestUpdate dropped

  • class: Ssch\TYPO3Rector\Rector\v8\v6\MoveRequestUpdateOptionFromControlToColumnsRector
 return [
     'ctrl' => [
-        'requestUpdate' => 'foo',
     ],
     'columns' => [
-        'foo' => []
+        'foo' => [
+            'onChange' => 'reload'
+        ]
     ]
 ];

OptionalConstructorToHardRequirementRector

Option constructor arguments to hard requirement

  • class: Ssch\TYPO3Rector\Rector\Experimental\OptionalConstructorToHardRequirementRector
 use TYPO3\CMS\Backend\Utility\BackendUtility;
-use TYPO3\CMS\Core\Utility\GeneralUtility;
-use TYPO3\CMS\Extbase\Object\ObjectManager;
 use TYPO3\CMS\Extbase\SignalSlot\Dispatcher;
 use TYPO3\CMS\Fluid\View\StandaloneView;
 class MyClass
 {
-public function __construct(Dispatcher $dispatcher = null, StandaloneView $view = null, BackendUtility $backendUtility = null, string $test = null)
+public function __construct(Dispatcher $dispatcher, StandaloneView $view, BackendUtility $backendUtility, string $test = null)
     {
-        $dispatcher = $dispatcher ?? GeneralUtility::makeInstance(ObjectManager::class)->get(Dispatcher::class);
-        $view = $view ?? GeneralUtility::makeInstance(StandaloneView::class);
-        $backendUtility = $backendUtility ?? GeneralUtility::makeInstance(BackendUtility::class);
+        $dispatcher = $dispatcher;
+        $view = $view;
+        $backendUtility = $backendUtility;
     }
 }

PageNotFoundAndErrorHandlingRector

Page Not Found And Error handling in Frontend

  • class: Ssch\TYPO3Rector\Rector\v9\v2\PageNotFoundAndErrorHandlingRector
+use TYPO3\CMS\Core\Http\ImmediateResponseException;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
+use TYPO3\CMS\Frontend\Controller\ErrorController;
 class SomeController extends ActionController
 {
     public function unavailableAction(): void
     {
         $message = 'No entry found.';
-        $GLOBALS['TSFE']->pageUnavailableAndExit($message);
+        $response = GeneralUtility::makeInstance(ErrorController::class)->unavailableAction($GLOBALS['TYPO3_REQUEST'], $message);
+        throw new ImmediateResponseException($response);
     }
 }

PhpOptionsUtilityRector

Refactor methods from PhpOptionsUtility

  • class: Ssch\TYPO3Rector\Rector\v9\v3\PhpOptionsUtilityRector
-PhpOptionsUtility::isSessionAutoStartEnabled()
+filter_var(ini_get('session.auto_start'), FILTER_VALIDATE_BOOLEAN, [FILTER_REQUIRE_SCALAR, FILTER_NULL_ON_FAILURE])

PrependAbsolutePathToGetFileAbsFileNameRector

Use GeneralUtility::getFileAbsFileName() instead of GraphicalFunctions->prependAbsolutePath()

  • class: Ssch\TYPO3Rector\Rector\v8\v0\PrependAbsolutePathToGetFileAbsFileNameRector
+use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Imaging\GraphicalFunctions;

 class SomeFooBar
 {
     private $graphicalFunctions;

     public function __construct(GraphicalFunctions $graphicalFunctions)
     {
         $this->graphicalFunctions = $graphicalFunctions;
-        $this->graphicalFunctions->prependAbsolutePath('some.font');
+        GeneralUtility::getFileAbsFileName('some.font');
     }
 }

PropertyUserTsToMethodGetTsConfigOfBackendUserAuthenticationRector

Use method getTSConfig instead of property userTS

  • class: Ssch\TYPO3Rector\Rector\v9\v3\PropertyUserTsToMethodGetTsConfigOfBackendUserAuthenticationRector
-if(is_array($GLOBALS['BE_USER']->userTS['tx_news.']) && $GLOBALS['BE_USER']->userTS['tx_news.']['singleCategoryAcl'] === '1') {
+if(is_array($GLOBALS['BE_USER']->getTSConfig()['tx_news.']) && $GLOBALS['BE_USER']->getTSConfig()['tx_news.']['singleCategoryAcl'] === '1') {
     return true;
 }

RandomMethodsToRandomClassRector

Deprecated random generator methods in GeneralUtility

  • class: Ssch\TYPO3Rector\Rector\v8\v0\RandomMethodsToRandomClassRector
+use TYPO3\CMS\Core\Crypto\Random;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
-
-$randomBytes = GeneralUtility::generateRandomBytes();
-$randomHex = GeneralUtility::getRandomHexString();
+$randomBytes = GeneralUtility::makeInstance(Random::class)->generateRandomBytes();
+$randomHex = GeneralUtility::makeInstance(Random::class)->generateRandomHexString();

RefactorArrayBrowserWrapValueRector

Migrate the method ArrayBrowser->wrapValue() to use htmlspecialchars()

  • class: Ssch\TYPO3Rector\Rector\v8\v7\RefactorArrayBrowserWrapValueRector
 $arrayBrowser = GeneralUtility::makeInstance(ArrayBrowser::class);
-$arrayBrowser->wrapValue('value');
+htmlspecialchars('value');

RefactorBackendUtilityGetPagesTSconfigRector

Refactor method getPagesTSconfig of class BackendUtility if possible

  • class: Ssch\TYPO3Rector\Rector\v9\v0\RefactorBackendUtilityGetPagesTSconfigRector
 use TYPO3\CMS\Backend\Utility\BackendUtility;
-$pagesTsConfig = BackendUtility::getPagesTSconfig(1, $rootLine = null, $returnPartArray = true);
+$pagesTsConfig = BackendUtility::getRawPagesTSconfig(1, $rootLine = null);

RefactorDbConstantsRector

Changes TYPO3_db constants to $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default'].

  • class: Ssch\TYPO3Rector\Rector\v8\v1\RefactorDbConstantsRector
-$database = TYPO3_db;
-$username = TYPO3_db_username;
-$password = TYPO3_db_password;
-$host = TYPO3_db_host;
+$database = $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['dbname'];
+$username = $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['user'];
+$password = $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['password'];
+$host = $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['host'];

RefactorDeprecatedConcatenateMethodsPageRendererRector

Turns method call names to new ones.

  • class: Ssch\TYPO3Rector\Rector\v9\v4\RefactorDeprecatedConcatenateMethodsPageRendererRector
 $pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
-$files = $someObject->getConcatenateFiles();
+$files = array_merge($this->getConcatenateCss(), $this->getConcatenateJavascript());

RefactorDeprecationLogRector

Refactor GeneralUtility deprecationLog methods

  • class: Ssch\TYPO3Rector\Rector\v9\v0\RefactorDeprecationLogRector
-GeneralUtility::logDeprecatedFunction();
-GeneralUtility::logDeprecatedViewHelperAttribute();
-GeneralUtility::deprecationLog('Message');
-GeneralUtility::getDeprecationLogFileName();
+trigger_error('A useful message', E_USER_DEPRECATED);

RefactorExplodeUrl2ArrayFromGeneralUtilityRector

Remove second argument of GeneralUtility::explodeUrl2Array if it is false or just use function parse_str if it is true

  • class: Ssch\TYPO3Rector\Rector\v9\v4\RefactorExplodeUrl2ArrayFromGeneralUtilityRector
-$variable = GeneralUtility::explodeUrl2Array('https://www.domain.com', true);
-$variable2 = GeneralUtility::explodeUrl2Array('https://www.domain.com', false);
+parse_str('https://www.domain.com', $variable);
+$variable2 = GeneralUtility::explodeUrl2Array('https://www.domain.com');

RefactorGraphicalFunctionsTempPathAndCreateTemSubDirRector

Refactor tempPath() and createTempSubDir on GraphicalFunctions

  • class: Ssch\TYPO3Rector\Rector\v8\v7\RefactorGraphicalFunctionsTempPathAndCreateTemSubDirRector
 $graphicalFunctions = GeneralUtility::makeInstance(GraphicalFunctions::class);
-$graphicalFunctions->createTempSubDir('var/transient/');
-return $graphicalFunctions->tempPath . 'var/transient/';
+GeneralUtility::mkdir_deep(PATH_site . 'typo3temp/var/transient/');
+return 'typo3temp/' . 'var/transient/';

RefactorIdnaEncodeMethodToNativeFunctionRector

Use native function idn_to_ascii instead of GeneralUtility::idnaEncode

  • class: Ssch\TYPO3Rector\Rector\v10\v0\RefactorIdnaEncodeMethodToNativeFunctionRector
-$domain = GeneralUtility::idnaEncode('domain.com');
-$email = GeneralUtility::idnaEncode('[email protected]');
+$domain = idn_to_ascii('domain.com', IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46);
+$email = 'email@' . idn_to_ascii('domain.com', IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46);

RefactorInternalPropertiesOfTSFERector

Refactor Internal public TSFE properties

  • class: Ssch\TYPO3Rector\Rector\v10\v1\RefactorInternalPropertiesOfTSFERector
-$domainStartPage = $GLOBALS['TSFE']->domainStartPage;
+$cHash = $GLOBALS['REQUEST']->getAttribute('routing')->getArguments()['cHash'];

RefactorMethodFileContentRector

Refactor method fileContent of class TemplateService

  • class: Ssch\TYPO3Rector\Rector\v8\v3\RefactorMethodFileContentRector
-$content = $GLOBALS['TSFE']->tmpl->fileContent('foo.txt');
+$content = $GLOBALS['TSFE']->tmpl->getFileName('foo.txt') ? file_get_contents('foo.txt') : null;

RefactorMethodsFromExtensionManagementUtilityRector

Refactor deprecated methods from ExtensionManagementUtility.

  • class: Ssch\TYPO3Rector\Rector\v9\v0\RefactorMethodsFromExtensionManagementUtilityRector
-ExtensionManagementUtility::removeCacheFiles();
+GeneralUtility::makeInstance(\TYPO3\CMS\Core\Cache\CacheManager::class)->flushCachesInGroup('system');

RefactorPrintContentMethodsRector

Refactor printContent methods of classes TaskModuleController and PageLayoutController

  • class: Ssch\TYPO3Rector\Rector\v8\v7\RefactorPrintContentMethodsRector
 use TYPO3\CMS\Backend\Controller\PageLayoutController;
-use TYPO3\CMS\Core\Utility\GeneralUtility;
-use TYPO3\CMS\Taskcenter\Controller\TaskModuleController;
+use TYPO3\CMS\Core\Utility\GeneralUtility;use TYPO3\CMS\Taskcenter\Controller\TaskModuleController;
 $pageLayoutController = GeneralUtility::makeInstance(PageLayoutController::class);
-$pageLayoutController->printContent();
-
+echo $pageLayoutController->getModuleTemplate()->renderContent();
 $taskLayoutController = GeneralUtility::makeInstance(TaskModuleController::class);
-$taskLayoutController->printContent();
+echo $taskLayoutController->content;

RefactorProcessOutputRector

TypoScriptFrontendController->processOutput() to TypoScriptFrontendController->applyHttpHeadersToResponse() and TypoScriptFrontendController->processContentForOutput()

  • class: Ssch\TYPO3Rector\Rector\v9\v5\RefactorProcessOutputRector
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;

 $tsfe = GeneralUtility::makeInstance(TypoScriptFrontendController::class);
-$tsfe->processOutput();
+$tsfe->applyHttpHeadersToResponse();
+$tsfe->processContentForOutput();

RefactorPropertiesOfTypoScriptFrontendControllerRector

Refactor some properties of TypoScriptFrontendController

  • class: Ssch\TYPO3Rector\Rector\v9\v5\RefactorPropertiesOfTypoScriptFrontendControllerRector
-$previewBeUserUid = $GLOBALS['TSFE']->ADMCMD_preview_BEUSER_uid;
-$workspacePreview = $GLOBALS['TSFE']->workspacePreview;
-$loginAllowedInBranch = $GLOBALS['TSFE']->loginAllowedInBranch;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Context\Context;
+$previewBeUserUid = GeneralUtility::makeInstance(Context::class)->getPropertyFromAspect('backend.user', 'id', 0);
+$workspacePreview = GeneralUtility::makeInstance(Context::class)->getPropertyFromAspect('workspace', 'id', 0);
+$loginAllowedInBranch = $GLOBALS['TSFE']->checkIfLoginAllowedInBranch();

RefactorQueryViewTableWrapRector

Migrate the method QueryView->tableWrap() to use pre-Tag

  • class: Ssch\TYPO3Rector\Rector\v8\v3\RefactorQueryViewTableWrapRector
 $queryView = GeneralUtility::makeInstance(QueryView::class);
-$output = $queryView->tableWrap('value');
+$output = '<pre>' . 'value' . '</pre>';

RefactorRemovedMarkerMethodsFromContentObjectRendererRector

Refactor removed Marker-related methods from ContentObjectRenderer.

  • class: Ssch\TYPO3Rector\Rector\v8\v7\RefactorRemovedMarkerMethodsFromContentObjectRendererRector
 // build template
-$template = $this->cObj->getSubpart($this->config['templateFile'], '###TEMPLATE###');
-$html = $this->cObj->substituteSubpart($html, '###ADDITONAL_KEYWORD###', '');
-$html2 = $this->cObj->substituteSubpartArray($html2, []);
-$content .= $this->cObj->substituteMarker($content, $marker, $markContent);
-$content .= $this->cObj->substituteMarkerArrayCached($template, $markerArray, $subpartArray, []);
-$content .= $this->cObj->substituteMarkerArray($content, $markContentArray, $wrap, $uppercase, $deleteUnused);
-$content .= $this->cObj->substituteMarkerInObject($tree, $markContentArray);
-$content .= $this->cObj->substituteMarkerAndSubpartArrayRecursive($content, $markersAndSubparts, $wrap, $uppercase, $deleteUnused);
-$content .= $this->cObj->fillInMarkerArray($markContentArray, $row, $fieldList, $nl2br, $prefix, $HSC);
+use TYPO3\CMS\Core\Service\MarkerBasedTemplateService;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+$template = GeneralUtility::makeInstance(MarkerBasedTemplateService::class)->getSubpart($this->config['templateFile'], '###TEMPLATE###');
+$html = GeneralUtility::makeInstance(MarkerBasedTemplateService::class)->substituteSubpart($html, '###ADDITONAL_KEYWORD###', '');
+$html2 = GeneralUtility::makeInstance(MarkerBasedTemplateService::class)->substituteSubpartArray($html2, []);
+$content .= GeneralUtility::makeInstance(MarkerBasedTemplateService::class)->substituteMarker($content, $marker, $markContent);
+$content .= GeneralUtility::makeInstance(MarkerBasedTemplateService::class)->substituteMarkerArrayCached($template, $markerArray, $subpartArray, []);
+$content .= GeneralUtility::makeInstance(MarkerBasedTemplateService::class)->substituteMarkerArray($content, $markContentArray, $wrap, $uppercase, $deleteUnused);
+$content .= GeneralUtility::makeInstance(MarkerBasedTemplateService::class)->substituteMarkerInObject($tree, $markContentArray);
+$content .= GeneralUtility::makeInstance(MarkerBasedTemplateService::class)->substituteMarkerAndSubpartArrayRecursive($content, $markersAndSubparts, $wrap, $uppercase, $deleteUnused);
+$content .= GeneralUtility::makeInstance(MarkerBasedTemplateService::class)->fillInMarkerArray($markContentArray, $row, $fieldList, $nl2br, $prefix, $HSC, !empty($GLOBALS['TSFE']->xhtmlDoctype));

RefactorRemovedMarkerMethodsFromHtmlParserRector

Refactor removed Marker-related methods from HtmlParser.

  • class: Ssch\TYPO3Rector\Rector\v8\v0\RefactorRemovedMarkerMethodsFromHtmlParserRector
 use TYPO3\CMS\Core\Html\HtmlParser;

 final class HtmlParserMarkerRendererMethods
 {

     public function doSomething(): void
     {
         $template = '';
         $markerArray = [];
         $subpartArray = [];
         $htmlparser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(HtmlParser::class);
-        $template = $htmlparser->getSubpart($this->config['templateFile'], '###TEMPLATE###');
-        $html = $htmlparser->substituteSubpart($html, '###ADDITONAL_KEYWORD###', '');
-        $html2 = $htmlparser->substituteSubpartArray($html2, []);
+        $template = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Service\MarkerBasedTemplateService::class)->getSubpart($this->config['templateFile'], '###TEMPLATE###');
+        $html = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Service\MarkerBasedTemplateService::class)->substituteSubpart($html, '###ADDITONAL_KEYWORD###', '');
+        $html2 = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Service\MarkerBasedTemplateService::class)->substituteSubpartArray($html2, []);

-        $html3 = $htmlparser->processTag($value, $conf, $endTag, $protected = 0);
-        $html4 = $htmlparser->processContent($value, $dir, $conf);
-
-        $content = $htmlparser->substituteMarker($content, $marker, $markContent);
-        $content .= $htmlparser->substituteMarkerArray($content, $markContentArray, $wrap, $uppercase, $deleteUnused);
-        $content .= $htmlparser->substituteMarkerAndSubpartArrayRecursive($content, $markersAndSubparts, $wrap, $uppercase, $deleteUnused);
-        $content = $htmlparser->XHTML_clean($content);
+        $content = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Service\MarkerBasedTemplateService::class)->substituteMarker($content, $marker, $markContent);
+        $content .= \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Service\MarkerBasedTemplateService::class)->substituteMarkerArray($content, $markContentArray, $wrap, $uppercase, $deleteUnused);
+        $content .= \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Service\MarkerBasedTemplateService::class)->substituteMarkerAndSubpartArrayRecursive($content, $markersAndSubparts, $wrap, $uppercase, $deleteUnused);
+        $content = $htmlparser->HTMLcleaner($content);
     }


 }

RefactorRemovedMethodsFromContentObjectRendererRector

Refactor removed methods from ContentObjectRenderer.

  • class: Ssch\TYPO3Rector\Rector\v8\v0\RefactorRemovedMethodsFromContentObjectRendererRector
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
 $cObj = GeneralUtility::makeInstance(ContentObjectRenderer::class);
-$cObj->RECORDS(['tables' => 'tt_content', 'source' => '1,2,3']);
+$cObj->cObjGetSingle('RECORDS', ['tables' => 'tt_content', 'source' => '1,2,3']);

RefactorRemovedMethodsFromGeneralUtilityRector

Refactor removed methods from GeneralUtility.

  • class: Ssch\TYPO3Rector\Rector\v8\v0\RefactorRemovedMethodsFromGeneralUtilityRector
-GeneralUtility::gif_compress();
+TYPO3\CMS\Core\Imaging\GraphicalFunctions::gifCompress();

RefactorTCARector

A lot of different TCA changes

  • class: Ssch\TYPO3Rector\Rector\v8\v6\RefactorTCARector
 return [
     'ctrl' => [
     ],
     'columns' => [
         'text_17' => [
             'label' => 'text_17',
             'config' => [
                 'type' => 'text',
                 'cols' => '40',
                 'rows' => '5',
-                'wizards' => [
-                    'table' => [
-                        'notNewRecords' => 1,
-                        'type' => 'script',
-                        'title' => 'LLL:EXT:cms/locallang_ttc.xlf:bodytext.W.table',
-                        'icon' => 'content-table',
-                        'module' => [
-                            'name' => 'wizard_table'
-                        ],
-                        'params' => [
-                            'xmlOutput' => 0
-                        ]
-                    ],
-                ],
+                'renderType' => 'textTable',
             ],
         ],
     ],
 ];

RefactorTsConfigRelatedMethodsRector

Refactor TSconfig related methods

  • class: Ssch\TYPO3Rector\Rector\v9\v3\RefactorTsConfigRelatedMethodsRector
-$hasFilterBox = !$GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.hideFilter');
+$hasFilterBox = !($GLOBALS['BE_USER']->getTSConfig()['options.']['pageTree.']['hideFilter.'] ?? null);

RefactorVariousGeneralUtilityMethodsRector

Refactor various deprecated methods of class GeneralUtility

  • class: Ssch\TYPO3Rector\Rector\v8\v1\RefactorVariousGeneralUtilityMethodsRector
-use TYPO3\CMS\Core\Utility\GeneralUtility;
 $url = 'https://www.domain.com/';
-$url = GeneralUtility::rawUrlEncodeFP($url);
+$url = str_replace('%2F', '/', rawurlencode($url));

RegisterPluginWithVendorNameRector

Remove vendor name from registerPlugin call

  • class: Ssch\TYPO3Rector\Rector\v10\v1\RegisterPluginWithVendorNameRector
 TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
-   'TYPO3.CMS.Form',
+   'Form',
    'Formframework',
    'Form',
    'content-form',
 );

RemoveAddQueryStringMethodRector

Remove TypoScript option addQueryString.method

  • class: Ssch\TYPO3Rector\Rector\v11\v0\RemoveAddQueryStringMethodRector
 $this->uriBuilder->setUseCacheHash(true)
                          ->setCreateAbsoluteUri(true)
                          ->setAddQueryString(true)
-                         ->setAddQueryStringMethod('GET')
                          ->build();

RemoveCharsetConverterParametersRector

Remove CharsetConvertParameters

  • class: Ssch\TYPO3Rector\Rector\v8\v0\RemoveCharsetConverterParametersRector
 $charsetConvert = GeneralUtility::makeInstance(CharsetConverter::class);
-$charsetConvert->entities_to_utf8('string', false);
-$charsetConvert->utf8_to_numberarray('string', false, false);
+$charsetConvert->entities_to_utf8('string');
+$charsetConvert->utf8_to_numberarray('string');

RemoveColPosParameterRector

Remove parameter colPos from methods.

  • class: Ssch\TYPO3Rector\Rector\v9\v3\RemoveColPosParameterRector
 $someObject = GeneralUtility::makeInstance(LocalizationRepository::class);
-$someObject->fetchOriginLanguage($pageId, $colPos, $localizedLanguage);
+$someObject->fetchOriginLanguage($pageId, $localizedLanguage);

RemoveConfigMaxFromInputDateTimeFieldsRector

Remove TCA config 'max' on inputDateTime fields

  • class: Ssch\TYPO3Rector\Rector\v8\v7\RemoveConfigMaxFromInputDateTimeFieldsRector
 return [
     'ctrl' => [
     ],
     'columns' => [
         'date' => [
             'exclude' => false,
             'label' => 'Date',
             'config' => [
                 'renderType' => 'inputDateTime',
-                'max' => 1,
             ],
         ],
     ],
 ];

RemoveDivider2TabsConfigurationRector

Removed dividers2tabs functionality

  • class: Ssch\TYPO3Rector\Rector\v7\v0\RemoveDivider2TabsConfigurationRector
 return [
     'ctrl' => [
-        'dividers2tabs' => true,
         'label' => 'complete_identifier',
         'tstamp' => 'tstamp',
         'crdate' => 'crdate',
     ],
     'columns' => [
     ],
 ];

RemoveExcludeOnTransOrigPointerFieldRector

transOrigPointerField is not longer allowed to be excluded

  • class: Ssch\TYPO3Rector\Rector\v10\v3\RemoveExcludeOnTransOrigPointerFieldRector
 return [
     'ctrl' => [
         'transOrigPointerField' => 'l10n_parent',
     ],
     'columns' => [
         'l10n_parent' => [
-            'exclude' => true,
             'config' => [
                 'type' => 'select',
             ],
         ],
     ],
 ];

RemoveFlushCachesRector

Remove @flushesCaches annotation

  • class: Ssch\TYPO3Rector\Rector\v9\v5\RemoveFlushCachesRector
 /**
- * My command
- *
- * @flushesCaches
+ * My Command
  */
 public function myCommand()
 {
-}
+}

RemoveFormatConstantsEmailFinisherRector

Remove constants FORMAT_PLAINTEXT and FORMAT_HTML of class TYPO3\CMS\Form\Domain\Finishers\EmailFinisher

  • class: Ssch\TYPO3Rector\Rector\v10\v0\RemoveFormatConstantsEmailFinisherRector
-$this->setOption(self::FORMAT, EmailFinisher::FORMAT_HTML);
+$this->setOption('addHtmlPart', true);

RemoveIconOptionForRenderTypeSelectRector

TCA icon options have been removed

  • class: Ssch\TYPO3Rector\Rector\v7\v6\RemoveIconOptionForRenderTypeSelectRector
 return [
     'columns' => [
         'foo' => [
             'config' => [
                 'type' => 'select',
                 'renderType' => 'selectSingle',
-                'noIconsBelowSelect' => false,
+                'showIconTable' => true,
             ],
         ],
     ],
 ];

RemoveIconsInOptionTagsRector

Select option iconsInOptionTags removed

  • class: Ssch\TYPO3Rector\Rector\v7\v5\RemoveIconsInOptionTagsRector
 return [
     'columns' => [
         'foo' => [
             'label' => 'Label',
             'config' => [
                 'type' => 'select',
                 'maxitems' => 25,
                 'autoSizeMax' => 10,
-                'iconsInOptionTags' => 1,
             ],
         ],
     ],
 ];

RemoveInitMethodFromPageRepositoryRector

Remove method call init from PageRepository

  • class: Ssch\TYPO3Rector\Rector\v9\v5\RemoveInitMethodFromPageRepositoryRector
-$repository = GeneralUtility::makeInstance(PageRepository::class);
-$repository->init(true);
+$repository = GeneralUtility::makeInstance(PageRepository::class);

RemoveInitMethodGraphicalFunctionsRector

Remove method call init of class GraphicalFunctions

  • class: Ssch\TYPO3Rector\Rector\v9\v4\RemoveInitMethodGraphicalFunctionsRector
 use TYPO3\CMS\Core\Imaging\GraphicalFunctions;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
-$graphicalFunctions = GeneralUtility::makeInstance(GraphicalFunctions::class);
-$graphicalFunctions->init();
+$graphicalFunctions = GeneralUtility::makeInstance(GraphicalFunctions::class);

RemoveInitMethodTemplateServiceRector

Remove method call init of class TemplateService

  • class: Ssch\TYPO3Rector\Rector\v9\v4\RemoveInitMethodTemplateServiceRector
 use TYPO3\CMS\Core\TypoScript\TemplateService;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
-$templateService = GeneralUtility::makeInstance(TemplateService::class);
-$templateService->init();
+$templateService = GeneralUtility::makeInstance(TemplateService::class);

RemoveInitTemplateMethodCallRector

Remove method call initTemplate from TypoScriptFrontendController

  • class: Ssch\TYPO3Rector\Rector\v9\v4\RemoveInitTemplateMethodCallRector
-$tsfe = GeneralUtility::makeInstance(TypoScriptFrontendController::class);
-$tsfe->initTemplate();
+$tsfe = GeneralUtility::makeInstance(TypoScriptFrontendController::class);

RemoveInternalAnnotationRector

Remove @internal annotation from classes extending \TYPO3\CMS\Extbase\Mvc\Controller\CommandController

  • class: Ssch\TYPO3Rector\Rector\v9\v5\RemoveInternalAnnotationRector
-/**
- * @internal
- */
 class MyCommandController extends CommandController
 {
 }

RemoveL10nModeNoCopyRector

Remove l10n_mode noCopy

  • class: Ssch\TYPO3Rector\Rector\v8\v6\RemoveL10nModeNoCopyRector
 return [
     'ctrl' => [],
     'columns' => [
         'foo' => [
             'exclude' => 1,
-            'l10n_mode' => 'mergeIfNotBlank',
             'label' => 'Bar',
+            'config' => [
+                'behaviour' => [
+                    'allowLanguageSynchronization' => true
+                ]
+            ],
         ],
     ],
 ];

RemoveLangCsConvObjAndParserFactoryRector

Remove CsConvObj and ParserFactory from LanguageService::class and $GLOBALS['lang']

  • class: Ssch\TYPO3Rector\Rector\v8\v0\RemoveLangCsConvObjAndParserFactoryRector
 $languageService = GeneralUtility::makeInstance(LanguageService::class);
-$charsetConverter = $languageService->csConvObj;
-$Localization = $languageService->parserFactory();
-$charsetConverterGlobals = $GLOBALS['LANG']->csConvObj;
-$LocalizationGlobals = $GLOBALS['LANG']->parserFactory();
+$charsetConverter = GeneralUtility::makeInstance(CharsetConverter::class);
+$Localization = GeneralUtility::makeInstance(LocalizationFactory::class);
+$charsetConverterGlobals = GeneralUtility::makeInstance(CharsetConverter::class);
+$LocalizationGlobals = GeneralUtility::makeInstance(LocalizationFactory::class);

RemoveLocalizationModeKeepIfNeededRector

Remove localizationMode keep if allowLanguageSynchronization is enabled

  • class: Ssch\TYPO3Rector\Rector\v8\v7\RemoveLocalizationModeKeepIfNeededRector
 return [
     'columns' => [
         'foo' => [
             'label' => 'Bar',
             'config' => [
                 'type' => 'inline',
                 'appearance' => [
                     'behaviour' => [
-                        'localizationMode' => 'keep',
                         'allowLanguageSynchronization' => true,
                     ],
                 ],
             ],
         ],
     ],
 ];

RemoveMethodCallConnectDbRector

Remove EidUtility::connectDB() call

  • class: Ssch\TYPO3Rector\Rector\v7\v0\RemoveMethodCallConnectDbRector
-EidUtility::connectDB()

RemoveMethodCallLoadTcaRector

Remove GeneralUtility::loadTCA() call

  • class: Ssch\TYPO3Rector\Rector\v7\v0\RemoveMethodCallLoadTcaRector
-GeneralUtility::loadTCA()

RemoveMethodInitTCARector

Remove superfluous EidUtility::initTCA call

  • class: Ssch\TYPO3Rector\Rector\v9\v0\RemoveMethodInitTCARector
-use TYPO3\CMS\Frontend\Utility\EidUtility;
-EidUtility::initTCA();

RemoveOptionLocalizeChildrenAtParentLocalizationRector

Remove option localizeChildrenAtParentLocalization

  • class: Ssch\TYPO3Rector\Rector\v9\v0\RemoveOptionLocalizeChildrenAtParentLocalizationRector
 return [
     'ctrl' => [],
     'columns' => [
         'foo' => [
             'config' =>
                 [
                     'type' => 'inline',
-                    'behaviour' => [
-                        'localizeChildrenAtParentLocalization' => '1',
-                    ],
+                    'behaviour' => [],
                 ],
         ],
     ],
 ];

RemoveOptionShowIfRteRector

Dropped TCA option showIfRTE in type=check

  • class: Ssch\TYPO3Rector\Rector\v8\v4\RemoveOptionShowIfRteRector
 return [
     'ctrl' => [
     ],
     'columns' => [
         'rte_enabled' => [
             'exclude' => 1,
             'label' => 'LLL:EXT:lang/locallang_general.php:LGL.disableRTE',
             'config' => [
                 'type' => 'check',
-                'showIfRTE' => 1
             ]
         ],
     ],
 ];

RemoveOptionVersioningFollowPagesRector

TCA option versioning_followPages removed

  • class: Ssch\TYPO3Rector\Rector\v8\v5\RemoveOptionVersioningFollowPagesRector
 return [
     'ctrl' => [
-        'versioningWS' => 2,
-        'versioning_followPages' => TRUE,
+        'versioningWS' => true,
     ],
     'columns' => [
     ]
 ];

RemovePropertiesFromSimpleDataHandlerControllerRector

Remove assignments or accessing of properties prErr and uPT from class SimpleDataHandlerController

  • class: Ssch\TYPO3Rector\Rector\v9\v0\RemovePropertiesFromSimpleDataHandlerControllerRector
 final class MySimpleDataHandlerController extends SimpleDataHandlerController
 {
     public function myMethod()
     {
-        $pErr = $this->prErr;
-        $this->prErr = true;
-        $this->uPT = true;
     }
 }

RemovePropertyExtensionNameRector

Use method getControllerExtensionName from $request property instead of removed property $extensionName

  • class: Ssch\TYPO3Rector\Rector\v10\v0\RemovePropertyExtensionNameRector
 class MyCommandController extends CommandController
 {
     public function myMethod()
     {
-        if($this->extensionName === 'whatever') {
+        if($this->request->getControllerExtensionName() === 'whatever') {

         }

-        $extensionName = $this->extensionName;
+        $extensionName = $this->request->getControllerExtensionName();
     }
 }

RemovePropertyUserAuthenticationRector

Use method getBackendUserAuthentication instead of removed property $userAuthentication

  • class: Ssch\TYPO3Rector\Rector\v8\v0\RemovePropertyUserAuthenticationRector
 class MyCommandController extends CommandController
 {
     public function myMethod()
     {
-        if($this->userAuthentication !== null) {
+        if($this->getBackendUserAuthentication() !== null) {

         }
     }
 }

RemoveRteHtmlParserEvalWriteFileRector

remove evalWriteFile method from RteHtmlparser.

  • class: Ssch\TYPO3Rector\Rector\v8\v0\RemoveRteHtmlParserEvalWriteFileRector
 use TYPO3\CMS\Core\Html\RteHtmlParser;

 final class RteHtmlParserRemovedMethods
 {

     public function doSomething(): void
     {
         $rtehtmlparser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(RteHtmlParser::class);
-        $rtehtmlparser->evalWriteFile();
     }

 }

RemoveSecondArgumentGeneralUtilityMkdirDeepRector

Remove second argument of GeneralUtility::mkdir_deep()

  • class: Ssch\TYPO3Rector\Rector\v9\v0\RemoveSecondArgumentGeneralUtilityMkdirDeepRector
-GeneralUtility::mkdir_deep(PATH_site . 'typo3temp/', 'myfolder');
+GeneralUtility::mkdir_deep(PATH_site . 'typo3temp/' . 'myfolder');

RemoveSeliconFieldPathRector

TCA option "selicon_field_path" removed

  • class: Ssch\TYPO3Rector\Rector\v10\v0\RemoveSeliconFieldPathRector
 return [
     'ctrl' => [
         'selicon_field' => 'icon',
-        'selicon_field_path' => 'uploads/media'
     ],
 ];

RemoveShowRecordFieldListInsideInterfaceSectionRector

Remove showRecordFieldList inside section interface

  • class: Ssch\TYPO3Rector\Rector\v10\v3\RemoveShowRecordFieldListInsideInterfaceSectionRector
 return [
     'ctrl' => [
     ],
-    'interface' => [
-        'showRecordFieldList' => 'foo,bar,baz',
-    ],
     'columns' => [
     ],
 ];

RemoveSupportForTransForeignTableRector

Remove support for transForeignTable in TCA

  • class: Ssch\TYPO3Rector\Rector\v8\v5\RemoveSupportForTransForeignTableRector
 return [
-    'ctrl' => [
-        'transForeignTable' => 'l10n_parent',
-        'transOrigPointerTable' => 'l10n_parent',
-    ],
+    'ctrl' => [],
 ];

RemoveTcaOptionSetToDefaultOnCopyRector

TCA option setToDefaultOnCopy removed

  • class: Ssch\TYPO3Rector\Rector\v10\v0\RemoveTcaOptionSetToDefaultOnCopyRector
 return [
     'ctrl' => [
-        'selicon_field' => 'icon',
-        'setToDefaultOnCopy' => 'foo'
+        'selicon_field' => 'icon'
     ],
     'columns' => [
     ],
 ];

RemoveWakeupCallFromEntityRector

Remove __wakeup call for AbstractDomainObject

  • class: Ssch\TYPO3Rector\Rector\v8\v0\RemoveWakeupCallFromEntityRector
 use TYPO3\CMS\Extbase\DomainObject\AbstractDomainObject;

 class MyWakeupCallerClass extends AbstractDomainObject
 {
     private $mySpecialResourceAfterWakeUp;

     public function __wakeup()
     {
         $this->mySpecialResourceAfterWakeUp = fopen(__FILE__, 'wb');
-        parent::__wakeup();
     }
 }

RemovedTcaSelectTreeOptionsRector

Removed TCA tree options: width, allowRecursiveMode, autoSizeMax

  • class: Ssch\TYPO3Rector\Rector\v8\v3\RemovedTcaSelectTreeOptionsRector
 return [
     'ctrl' => [
     ],
     'columns' => [
         'categories' => [
             'config' => [
                 'type' => 'input',
                 'renderType' => 'selectTree',
-                'autoSizeMax' => 5,
+                'size' => 5,
                 'treeConfig' => [
-                    'appearance' => [
-                        'width' => 100,
-                        'allowRecursiveMode' => true
-                    ]
+                    'appearance' => []
                 ]
             ],
         ],
     ],
 ];

RenameClassMapAliasRector

Replaces defined classes by new ones.

🔧 configure it!

  • class: Ssch\TYPO3Rector\Rector\Migrations\RenameClassMapAliasRector
<?php

declare(strict_types=1);

use Ssch\TYPO3Rector\Rector\Migrations\RenameClassMapAliasRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
    $services = $containerConfigurator->services();

    $services->set(RenameClassMapAliasRector::class)
        ->call('configure', [[RenameClassMapAliasRector::CLASS_ALIAS_MAPS => 'config/Migrations/Code/ClassAliasMap.php']]);
};

 namespace App;

-use t3lib_div;
+use TYPO3\CMS\Core\Utility\GeneralUtility;

 function someFunction()
 {
-    t3lib_div::makeInstance(\tx_cms_BackendLayout::class);
+    GeneralUtility::makeInstance(\TYPO3\CMS\Backend\View\BackendLayoutView::class);
 }

RenameMethodCallToEnvironmentMethodCallRector

Turns method call names to new ones from new Environment API.

  • class: Ssch\TYPO3Rector\Rector\v9\v2\RenameMethodCallToEnvironmentMethodCallRector
-Bootstrap::usesComposerClassLoading();
-GeneralUtility::getApplicationContext();
-EnvironmentService::isEnvironmentInCliMode();
+Environment::isComposerMode();
+Environment::getContext();
+Environment::isCli();

RenamePiListBrowserResultsRector

Rename pi_list_browseresults calls to renderPagination

  • class: Ssch\TYPO3Rector\Rector\v7\v6\RenamePiListBrowserResultsRector
-$this->pi_list_browseresults
+$this->renderPagination

ReplaceAnnotationRector

Replace old annotation by new one

🔧 configure it!

  • class: Ssch\TYPO3Rector\Rector\v9\v0\ReplaceAnnotationRector
<?php

declare(strict_types=1);

use Ssch\TYPO3Rector\Rector\v9\v0\ReplaceAnnotationRector;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
    $services = $containerConfigurator->services();

    $services->set(ReplaceAnnotationRector::class)
        ->call('configure', [[ReplaceAnnotationRector::OLD_TO_NEW_ANNOTATIONS => ['transient' => 'TYPO3\CMS\Extbase\Annotation\ORM\Transient']]]);
};

 /**
- * @transient
+ * @TYPO3\CMS\Extbase\Annotation\ORM\Transient
  */
-private $someProperty;
+private $someProperty;

ReplaceExtKeyWithExtensionKeyRector

Replace $_EXTKEY with extension key

  • class: Ssch\TYPO3Rector\Rector\v9\v0\ReplaceExtKeyWithExtensionKeyRector
 ExtensionUtility::configurePlugin(
-    'Foo.'.$_EXTKEY,
+    'Foo.'.'bar',
     'ArticleTeaser',
     [
         'FooBar' => 'baz',
     ]
 );

RequireMethodsToNativeFunctionsRector

Refactor GeneralUtility::requireOnce and GeneralUtility::requireFile

  • class: Ssch\TYPO3Rector\Rector\v8\v0\RequireMethodsToNativeFunctionsRector
-use TYPO3\CMS\Core\Utility\GeneralUtility;
-
-GeneralUtility::requireOnce('somefile.php');
-GeneralUtility::requireFile('some_other_file.php');
+require_once 'somefile.php';
+require 'some_other_file.php';

RichtextFromDefaultExtrasToEnableRichtextRector

TCA richtext configuration in defaultExtras dropped

  • class: Ssch\TYPO3Rector\Rector\v8\v6\RichtextFromDefaultExtrasToEnableRichtextRector
 [
     'columns' => [
         'content' => [
             'config' => [
                 'type' => 'text',
+                'enableRichtext' => true,
             ],
-            'defaultExtras' => 'richtext:rte_transform',
         ],
     ],
 ];

RteHtmlParserRector

Remove second argument of HTMLcleaner_db getKeepTags. Substitute calls for siteUrl getUrl

  • class: Ssch\TYPO3Rector\Rector\v8\v0\RteHtmlParserRector
             use TYPO3\CMS\Core\Html\RteHtmlParser;
-
             $rteHtmlParser = new RteHtmlParser();
-            $rteHtmlParser->HTMLcleaner_db('arg1', 'arg2');
-            $rteHtmlParser->getKeepTags('arg1', 'arg2');
-            $rteHtmlParser->getUrl('http://domain.com');
-            $rteHtmlParser->siteUrl();
+            $rteHtmlParser->HTMLcleaner_db('arg1');
+            $rteHtmlParser->getKeepTags('arg1');
+            \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl('http://domain.com');
+             \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL');

SendNotifyEmailToMailApiRector

Refactor ContentObjectRenderer::sendNotifyEmail to MailMessage-API

  • class: Ssch\TYPO3Rector\Rector\v10\v1\SendNotifyEmailToMailApiRector
-$GLOBALS['TSFE']->cObj->sendNotifyEmail("Subject\nMessage", '[email protected]', '[email protected]', '[email protected]');
+use Symfony\Component\Mime\Address;
+use TYPO3\CMS\Core\Mail\MailMessage;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\MailUtility;$success = false;
+$mail = GeneralUtility::makeInstance(MailMessage::class);
+$message = trim("Subject\nMessage");
+$senderName = trim(null);
+$senderAddress = trim('[email protected]');
+if ($senderAddress !== '') {
+    $mail->from(new Address($senderAddress, $senderName));
+}
+if ($message !== '') {
+    $messageParts = explode(LF, $message, 2);
+    $subject = trim($messageParts[0]);
+    $plainMessage = trim($messageParts[1]);
+    $parsedRecipients = MailUtility::parseAddresses('[email protected]');
+    if (!empty($parsedRecipients)) {
+        $mail->to(...$parsedRecipients)->subject($subject)->text($plainMessage);
+        $mail->send();
+    }
+    $success = true;
+}

SetSystemLocaleFromSiteLanguageRector

Refactor TypoScriptFrontendController->settingLocale() to Locales::setSystemLocaleFromSiteLanguage()

  • class: Ssch\TYPO3Rector\Rector\v10\v0\SetSystemLocaleFromSiteLanguageRector
-
+use TYPO3\CMS\Core\Localization\Locales;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;

 $controller = GeneralUtility::makeInstance(TypoScriptFrontendController::class, null, 0, 0);
-$controller->settingLocale();
+Locales::setSystemLocaleFromSiteLanguage($controller->getLanguage());

SoftReferencesFunctionalityRemovedRector

TSconfig and TStemplate soft references functionality removed

  • class: Ssch\TYPO3Rector\Rector\v8\v3\SoftReferencesFunctionalityRemovedRector
 return [
     'ctrl' => [
     ],
     'columns' => [
         'TSconfig' => [
             'label' => 'TSconfig:',
             'config' => [
                 'type' => 'text',
                 'cols' => '40',
                 'rows' => '5',
-                'softref' => 'TSconfig',
             ],
             'defaultExtras' => 'fixed-font : enable-tab',
         ],
     ],
 ];

SubstituteCacheWrapperMethodsRector

Caching framework wrapper methods in BackendUtility

  • class: Ssch\TYPO3Rector\Rector\v9\v0\SubstituteCacheWrapperMethodsRector
-use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Core\Cache\CacheManager;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
 $hash = 'foo';
-$content = BackendUtility::getHash($hash);
+$cacheManager = GeneralUtility::makeInstance(CacheManager::class);
+$cacheEntry = $cacheManager->getCache('cache_hash')->get($hash);
+$hashContent = null;
+if ($cacheEntry) {
+    $hashContent = $cacheEntry;
+}
+$content = $hashContent;

SubstituteConstantParsetimeStartRector

Substitute $GLOBALS['PARSETIME_START'] with round($GLOBALS['TYPO3_MISC']['microtime_start'] * 1000)

  • class: Ssch\TYPO3Rector\Rector\v9\v0\SubstituteConstantParsetimeStartRector
-$parseTime = $GLOBALS['PARSETIME_START'];
+$parseTime = round($GLOBALS['TYPO3_MISC']['microtime_start'] * 1000);

SubstituteConstantsModeAndRequestTypeRector

Substitute TYPO3_MODE and TYPO3_REQUESTTYPE constants

  • class: Ssch\TYPO3Rector\Rector\v11\v0\SubstituteConstantsModeAndRequestTypeRector
-defined('TYPO3_MODE') or die();
+defined('TYPO3') or die();

SubstituteGeneralUtilityMethodsWithNativePhpFunctionsRector

Substitute deprecated method calls of class GeneralUtility

  • class: Ssch\TYPO3Rector\Rector\v10\v4\SubstituteGeneralUtilityMethodsWithNativePhpFunctionsRector
 use TYPO3\CMS\Core\Utility\GeneralUtility;

 $hex = '127.0.0.1';
-GeneralUtility::IPv6Hex2Bin($hex);
+inet_pton($hex);
 $bin = $packed = chr(127) . chr(0) . chr(0) . chr(1);
-GeneralUtility::IPv6Bin2Hex($bin);
+inet_ntop($bin);
 $address = '127.0.0.1';
-GeneralUtility::compressIPv6($address);
-GeneralUtility::milliseconds();
+inet_ntop(inet_pton($address));
+round(microtime(true) * 1000);

SubstituteOldWizardIconsRector

The TCA migration migrates the icon calls to the new output if used as wizard icon

  • class: Ssch\TYPO3Rector\Rector\v8\v4\SubstituteOldWizardIconsRector
 return [
     'ctrl' => [
     ],
     'columns' => [
         'bodytext' => [
             'config' => [
                 'type' => 'text',
                 'wizards' => [
                     't3editorHtml' => [
-                        'icon' => 'wizard_table.gif',
+                        'icon' => 'content-table',
                     ],
                 ],
             ],
         ],
     ],
 ];

SubstituteResourceFactoryRector

Substitue ResourceFactory::getInstance() through GeneralUtility::makeInstance(ResourceFactory::class)

  • class: Ssch\TYPO3Rector\Rector\v10\v3\SubstituteResourceFactoryRector
-$resourceFactory = ResourceFactory::getInstance();
+$resourceFactory = GeneralUtility::makeInstance(ResourceFactory::class);

SystemEnvironmentBuilderConstantsRector

GeneralUtility::verifyFilenameAgainstDenyPattern GeneralUtility::makeInstance(FileNameValidator::class)->isValid($filename)

  • class: Ssch\TYPO3Rector\Rector\v9\v4\SystemEnvironmentBuilderConstantsRector
-$var1 = TYPO3_URL_MAILINGLISTS;
-$var2 = TYPO3_URL_DOCUMENTATION;
-$var3 = TYPO3_URL_DOCUMENTATION_TSREF;
-$var4 = TYPO3_URL_DOCUMENTATION_TSCONFIG;
-$var5 = TYPO3_URL_CONSULTANCY;
-$var6 = TYPO3_URL_CONTRIBUTE;
-$var7 = TYPO3_URL_SECURITY;
-$var8 = TYPO3_URL_DOWNLOAD;
-$var9 = TYPO3_URL_SYSTEMREQUIREMENTS;
-$nul = NUL;
-$tab = TAB;
-$sub = SUB;
+use TYPO3\CMS\Core\Service\AbstractService;
+$var1 = 'http://lists.typo3.org/cgi-bin/mailman/listinfo';
+$var2 = 'https://typo3.org/documentation/';
+$var3 = 'https://docs.typo3.org/typo3cms/TyposcriptReference/';
+$var4 = 'https://docs.typo3.org/typo3cms/TSconfigReference/';
+$var5 = 'https://typo3.org/support/professional-services/';
+$var6 = 'https://typo3.org/contribute/';
+$var7 = 'https://typo3.org/teams/security/';
+$var8 = 'https://typo3.org/download/';
+$var9 = 'https://typo3.org/typo3-cms/overview/requirements/';
+$nul = "\0";
+$tab = "\t";
+$sub = chr(26);

-$var10 = T3_ERR_SV_GENERAL;
-$var11 = T3_ERR_SV_NOT_AVAIL;
-$var12 = T3_ERR_SV_WRONG_SUBTYPE;
-$var13 = T3_ERR_SV_NO_INPUT;
-$var14 = T3_ERR_SV_FILE_NOT_FOUND;
-$var15 = T3_ERR_SV_FILE_READ;
-$var16 = T3_ERR_SV_FILE_WRITE;
-$var17 = T3_ERR_SV_PROG_NOT_FOUND;
-$var18 = T3_ERR_SV_PROG_FAILED;
+$var10 = AbstractService::ERROR_GENERAL;
+$var11 = AbstractService::ERROR_SERVICE_NOT_AVAILABLE;
+$var12 = AbstractService::ERROR_WRONG_SUBTYPE;
+$var13 = AbstractService::ERROR_NO_INPUT;
+$var14 = AbstractService::ERROR_FILE_NOT_FOUND;
+$var15 = AbstractService::ERROR_FILE_NOT_READABLE;
+$var16 = AbstractService::ERROR_FILE_NOT_WRITEABLE;
+$var17 = AbstractService::ERROR_PROGRAM_NOT_FOUND;
+$var18 = AbstractService::ERROR_PROGRAM_FAILED;

TemplateGetFileNameToFilePathSanitizerRector

Use FilePathSanitizer->sanitize() instead of TemplateService->getFileName()

  • class: Ssch\TYPO3Rector\Rector\v9\v4\TemplateGetFileNameToFilePathSanitizerRector
-$fileName = $GLOBALS['TSFE']->tmpl->getFileName('foo.text');
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Frontend\Resource\FilePathSanitizer;
+use TYPO3\CMS\Core\Resource\Exception\InvalidFileNameException;
+use TYPO3\CMS\Core\Resource\Exception\InvalidPathException;
+use TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException;
+use TYPO3\CMS\Core\Resource\Exception\InvalidFileException;
+use TYPO3\CMS\Core\TimeTracker\TimeTracker;
+try {
+    $fileName = GeneralUtility::makeInstance(FilePathSanitizer::class)->sanitize((string) 'foo.text');
+} catch (InvalidFileNameException $e) {
+    $fileName = null;
+} catch (InvalidPathException|FileDoesNotExistException|InvalidFileException $e) {
+    $fileName = null;
+    if ($GLOBALS['TSFE']->tmpl->tt_track) {
+        GeneralUtility::makeInstance(TimeTracker::class)->setTSlogMessage($e->getMessage(), 3);
+    }
+}

TemplateServiceSplitConfArrayRector

Substitute TemplateService->splitConfArray() with TypoScriptService->explodeConfigurationForOptionSplit()

  • class: Ssch\TYPO3Rector\Rector\v8\v7\TemplateServiceSplitConfArrayRector
-$splitConfig = GeneralUtility::makeInstance(TemplateService::class)->splitConfArray($conf, $splitCount);
+$splitConfig = GeneralUtility::makeInstance(TypoScriptService::class)->explodeConfigurationForOptionSplit($conf, $splitCount);

TimeTrackerGlobalsToSingletonRector

Substitute $GLOBALS['TT'] method calls

  • class: Ssch\TYPO3Rector\Rector\v8\v0\TimeTrackerGlobalsToSingletonRector
-$GLOBALS['TT']->setTSlogMessage('content');
+GeneralUtility::makeInstance(TimeTracker::class)->setTSlogMessage('content');

TimeTrackerInsteadOfNullTimeTrackerRector

Use class TimeTracker instead of NullTimeTracker

  • class: Ssch\TYPO3Rector\Rector\v8\v0\TimeTrackerInsteadOfNullTimeTrackerRector
-use TYPO3\CMS\Core\TimeTracker\NullTimeTracker;
+use TYPO3\CMS\Core\TimeTracker\TimeTracker;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
-$timeTracker1 = new NullTimeTracker();
-$timeTracker2 = GeneralUtility::makeInstance(NullTimeTracker::class);
+$timeTracker1 = new TimeTracker(false);
+$timeTracker2 = GeneralUtility::makeInstance(TimeTracker::class, false);

TypeHandlingServiceToTypeHandlingUtilityRector

Use TypeHandlingUtility instead of TypeHandlingService

  • class: Ssch\TYPO3Rector\Rector\v7\v0\TypeHandlingServiceToTypeHandlingUtilityRector
-use TYPO3\CMS\Core\Utility\GeneralUtility;
-use TYPO3\CMS\Extbase\Service\TypeHandlingService;
-GeneralUtility::makeInstance(TypeHandlingService::class)->isSimpleType('string');
+use TYPO3\CMS\Extbase\Utility\TypeHandlingUtility;
+TypeHandlingUtility::isSimpleType('string');

TypoScriptFrontendControllerCharsetConverterRector

Refactor $TSFE->csConvObj and $TSFE->csConv()

  • class: Ssch\TYPO3Rector\Rector\v8\v1\TypoScriptFrontendControllerCharsetConverterRector
-$output = $GLOBALS['TSFE']->csConvObj->conv_case('utf-8', 'foobar', 'lower');
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Charset\CharsetConverter;
+$charsetConverter = GeneralUtility::makeInstance(CharsetConverter::class);
+$output = $charsetConverter->conv_case('utf-8', 'foobar', 'lower');

UnifiedFileNameValidatorRector

GeneralUtility::verifyFilenameAgainstDenyPattern GeneralUtility::makeInstance(FileNameValidator::class)->isValid($filename)

  • class: Ssch\TYPO3Rector\Rector\v10\v4\UnifiedFileNameValidatorRector
+use TYPO3\CMS\Core\Resource\Security\FileNameValidator;
 use TYPO3\CMS\Core\Utility\GeneralUtility;

 $filename = 'somefile.php';
-if(!GeneralUtility::verifyFilenameAgainstDenyPattern($filename)) {
+if(!GeneralUtility::makeInstance(FileNameValidator::class)->isValid($filename)) {
 }

-if ($GLOBALS['TYPO3_CONF_VARS']['BE']['fileDenyPattern'] != FILE_DENY_PATTERN_DEFAULT)
+if ($GLOBALS['TYPO3_CONF_VARS']['BE']['fileDenyPattern'] != FileNameValidator::DEFAULT_FILE_DENY_PATTERN)
 {
 }

UniqueListFromStringUtilityRector

Use StringUtility::uniqueList() instead of GeneralUtility::uniqueList

  • class: Ssch\TYPO3Rector\Rector\v11\v0\UniqueListFromStringUtilityRector
-use TYPO3\CMS\Core\Utility\GeneralUtility;
-GeneralUtility::uniqueList('1,2,2,3');
+use TYPO3\CMS\Core\Utility\StringUtility;
+StringUtility::uniqueList('1,2,2,3');

UseActionControllerRector

Use ActionController class instead of AbstractController if used

  • class: Ssch\TYPO3Rector\Rector\v10\v2\UseActionControllerRector
-class MyController extends AbstractController
+use Symfony\Component\HttpFoundation\Response;
+use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
+
+class MyController extends ActionController
 {
 }

UseAddJsFileInsteadOfLoadJavascriptLibRector

Use method addJsFile of class PageRenderer instead of method loadJavascriptLib of class ModuleTemplate

  • class: Ssch\TYPO3Rector\Rector\v9\v4\UseAddJsFileInsteadOfLoadJavascriptLibRector
 use TYPO3\CMS\Backend\Template\ModuleTemplate;
+use TYPO3\CMS\Core\Page\PageRenderer;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 $moduleTemplate = GeneralUtility::makeInstance(ModuleTemplate::class);
-$moduleTemplate->loadJavascriptLib('sysext/backend/Resources/Public/JavaScript/md5.js');
+GeneralUtility::makeInstance(PageRenderer::class)->addJsFile('sysext/backend/Resources/Public/JavaScript/md5.js');

UseCachingFrameworkInsteadGetAndStoreHashRector

Use the Caching Framework directly instead of methods PageRepository::getHash and PageRepository::storeHash

  • class: Ssch\TYPO3Rector\Rector\v8\v7\UseCachingFrameworkInsteadGetAndStoreHashRector
-$GLOBALS['TSFE']->sys_page->storeHash('hash', ['foo', 'bar', 'baz'], 'ident');
-$hashContent2 = $GLOBALS['TSFE']->sys_page->getHash('hash');
+use TYPO3\CMS\Core\Cache\CacheManager;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+GeneralUtility::makeInstance(CacheManager::class)->getCache('cache_hash')->set('hash', ['foo', 'bar', 'baz'], ['ident_' . 'ident'], 0);
+$hashContent = GeneralUtility::makeInstance(CacheManager::class)->getCache('cache_hash')->get('hash');

UseClassSchemaInsteadReflectionServiceMethodsRector

Instead of fetching reflection data via ReflectionService use ClassSchema directly

  • class: Ssch\TYPO3Rector\Rector\v9\v4\UseClassSchemaInsteadReflectionServiceMethodsRector
 use TYPO3\CMS\Extbase\Reflection\ReflectionService;
 class MyService
 {
     /**
      * @var ReflectionService
      * @inject
      */
     protected $reflectionService;

     public function init(): void
     {
-        $properties = $this->reflectionService->getClassPropertyNames(\stdClass::class);
+        $properties = array_keys($this->reflectionService->getClassSchema(stdClass::class)->getProperties());
     }
 }

UseClassTypo3InformationRector

Use class Typo3Information

  • class: Ssch\TYPO3Rector\Rector\v10\v3\UseClassTypo3InformationRector
-$urlGeneral = TYPO3_URL_GENERAL;
-$urlLicense = TYPO3_URL_LICENSE;
-$urlException = TYPO3_URL_EXCEPTION;
-$urlDonate = TYPO3_URL_DONATE;
-$urlOpcache = TYPO3_URL_WIKI_OPCODECACHE;
+use TYPO3\CMS\Core\Information\Typo3Information;
+$urlGeneral = Typo3Information::TYPO3_URL_GENERAL;
+$urlLicense = Typo3Information::TYPO3_URL_LICENSE;
+$urlException = Typo3Information::TYPO3_URL_EXCEPTION;
+$urlDonate = Typo3Information::TYPO3_URL_DONATE;
+$urlOpcache = Typo3Information::TYPO3_URL_WIKI_OPCODECACHE;

UseClassTypo3VersionRector

Use class Typo3Version instead of the constants

  • class: Ssch\TYPO3Rector\Rector\v10\v3\UseClassTypo3VersionRector
-$typo3Version = TYPO3_version;
-$typo3Branch = TYPO3_branch;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Information\Typo3Version;
+$typo3Version = GeneralUtility::makeInstance(Typo3Version::class)->getVersion();
+$typo3Branch = GeneralUtility::makeInstance(Typo3Version::class)->getBranch();

UseContextApiForVersioningWorkspaceIdRector

Use context API instead of versioningWorkspaceId

  • class: Ssch\TYPO3Rector\Rector\v9\v4\UseContextApiForVersioningWorkspaceIdRector
+use TYPO3\CMS\Core\Context\Context;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
 $workspaceId = null;
-$workspaceId = $workspaceId ?? $GLOBALS['TSFE']->sys_page->versioningWorkspaceId;
+$workspaceId = $workspaceId ?? GeneralUtility::makeInstance(Context::class)->getPropertyFromAspect('workspace', 'id', 0);

 $GLOBALS['TSFE']->sys_page->versioningWorkspaceId = 1;

UseContextApiRector

Various public properties in favor of Context API

  • class: Ssch\TYPO3Rector\Rector\v9\v4\UseContextApiRector
-$frontendUserIsLoggedIn = $GLOBALS['TSFE']->loginUser;
-$groupList = $GLOBALS['TSFE']->gr_list;
-$backendUserIsLoggedIn = $GLOBALS['TSFE']->beUserLogin;
-$showHiddenPage = $GLOBALS['TSFE']->showHiddenPage;
-$showHiddenRecords = $GLOBALS['TSFE']->showHiddenRecords;
+$frontendUserIsLoggedIn = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Context\Context::class)->getPropertyFromAspect('frontend.user', 'isLoggedIn');
+$groupList = implode(',', \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Context\Context::class)->getPropertyFromAspect('frontend.user', 'groupIds'));
+$backendUserIsLoggedIn = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Context\Context::class)->getPropertyFromAspect('backend.user', 'isLoggedIn');
+$showHiddenPage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Context\Context::class)->getPropertyFromAspect('visibility', 'includeHiddenPages');
+$showHiddenRecords = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Context\Context::class)->getPropertyFromAspect('visibility', 'includeHiddenContent');

UseControllerClassesInExtbasePluginsAndModulesRector

Use controller classes when registering extbase plugins/modules

  • class: Ssch\TYPO3Rector\Rector\v10\v0\UseControllerClassesInExtbasePluginsAndModulesRector
-use TYPO3\CMS\Extbase\Utility\ExtensionUtility;
-ExtensionUtility::configurePlugin(
-    'TYPO3.CMS.Form',
+use TYPO3\CMS\Extbase\Utility\ExtensionUtility;ExtensionUtility::configurePlugin(
+    'Form',
     'Formframework',
-    ['FormFrontend' => 'render, perform'],
-    ['FormFrontend' => 'perform'],
+    [\TYPO3\CMS\Form\Controller\FormFrontendController::class => 'render, perform'],
+    [\TYPO3\CMS\Form\Controller\FormFrontendController::class => 'perform'],
     ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT
 );

UseExtPrefixForTcaIconFileRector

Deprecate relative path to extension directory and using filename only in TCA ctrl iconfile

  • class: Ssch\TYPO3Rector\Rector\v7\v5\UseExtPrefixForTcaIconFileRector
 [
     'ctrl' => [
-        'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('my_extension') . 'Resources/Public/Icons/image.png'
+        'iconfile' => 'EXT:my_extension/Resources/Public/Icons/image.png'
     ]
 ];

UseExtensionConfigurationApiRector

Use the new ExtensionConfiguration API instead of $GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['foo']

  • class: Ssch\TYPO3Rector\Rector\v9\v0\UseExtensionConfigurationApiRector
-$extensionConfiguration2 = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['foo'], ['allowed_classes' => false]);
+use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+$extensionConfiguration2 = GeneralUtility::makeInstance(ExtensionConfiguration::class)->get('foo');

UseFileGetContentsForGetUrlRector

Rewirte Method Calls of GeneralUtility::getUrl("somefile.csv") to @file_get_contents

  • class: Ssch\TYPO3Rector\Rector\v10\v4\UseFileGetContentsForGetUrlRector
-use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Http\RequestFactory;

-GeneralUtility::getUrl('some.csv');
+@file_get_contents('some.csv');
 $externalUrl = 'https://domain.com';
-GeneralUtility::getUrl($externalUrl);
+GeneralUtility::makeInstance(RequestFactory::class)->request($externalUrl)->getBody()->getContents();

UseGetMenuInsteadOfGetFirstWebPageRector

Use method getMenu instead of getFirstWebPage

  • class: Ssch\TYPO3Rector\Rector\v9\v4\UseGetMenuInsteadOfGetFirstWebPageRector
-$theFirstPage = $GLOBALS['TSFE']->sys_page->getFirstWebPage(0);
+$rootLevelPages = $GLOBALS['TSFE']->sys_page->getMenu(0, 'uid', 'sorting', '', false);
+if (!empty($rootLevelPages)) {
+    $theFirstPage = reset($rootLevelPages);
+}

UseHtmlSpecialCharsDirectlyForTranslationRector

htmlspecialchars directly to properly escape the content.

  • class: Ssch\TYPO3Rector\Rector\v8\v2\UseHtmlSpecialCharsDirectlyForTranslationRector
 use TYPO3\CMS\Frontend\Plugin\AbstractPlugin;
 class MyPlugin extends AbstractPlugin
 {
     public function translate($hsc): void
     {
-        $translation = $this->pi_getLL('label', '', true);
-        $translation2 = $this->pi_getLL('label', '', false);
+        $translation = htmlspecialchars($this->pi_getLL('label', ''));
+        $translation2 = $this->pi_getLL('label', '');
         $translation3 = $this->pi_getLL('label', '', $hsc);
-        $translation9 = $GLOBALS['LANG']->sL('foobar', true);
-        $translation10 = $GLOBALS['LANG']->sL('foobar', false);
+        $translation9 = htmlspecialchars($GLOBALS['LANG']->sL('foobar'));
+        $translation10 = $GLOBALS['LANG']->sL('foobar');
     }
 }

UseLanguageAspectForTsfeLanguagePropertiesRector

Use LanguageAspect instead of language properties of TSFE

  • class: Ssch\TYPO3Rector\Rector\v9\v4\UseLanguageAspectForTsfeLanguagePropertiesRector
-$languageUid = $GLOBALS['TSFE']->sys_language_uid;
+use TYPO3\CMS\Core\Context\Context;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+$languageUid = GeneralUtility::makeInstance(Context::class)->getAspect('language')->getId();

UseLogMethodInsteadOfNewLog2Rector

Use log method instead of newlog2 from class DataHandler

  • class: Ssch\TYPO3Rector\Rector\v9\v0\UseLogMethodInsteadOfNewLog2Rector
 use TYPO3\CMS\Core\DataHandling\DataHandler;
 use TYPO3\CMS\Core\Utility\GeneralUtility;

 $dataHandler = GeneralUtility::makeInstance(DataHandler::class);
-$logEntryUid1 = $dataHandler->newlog2('Foo', 'pages', 1, null, 0);
-$logEntryUid2 = $dataHandler->newlog2('Foo', 'tt_content', 1, 2, 1);
-$logEntryUid3 = $dataHandler->newlog2('Foo', 'tt_content', 1);
+$propArr = $dataHandler->getRecordProperties('pages', 1);
+$pid = $propArr['pid'];
+
+$logEntryUid1 = $dataHandler->log('pages', 1, 0, 0, 0, 'Foo', -1, [], $dataHandler->eventPid('pages', 1, $pid));
+$logEntryUid2 = $dataHandler->log('tt_content', 1, 0, 0, 1, 'Foo', -1, [], $dataHandler->eventPid('tt_content', 1, 2));
+$propArr = $dataHandler->getRecordProperties('tt_content', 1);
+$pid = $propArr['pid'];
+
+$logEntryUid3 = $dataHandler->log('tt_content', 1, 0, 0, 0, 'Foo', -1, [], $dataHandler->eventPid('tt_content', 1, $pid));

UseMetaDataAspectRector

Use $fileObject->getMetaData()->get() instead of $fileObject->_getMetaData()

  • class: Ssch\TYPO3Rector\Rector\v10\v0\UseMetaDataAspectRector
 $fileObject = new File();
-$fileObject->_getMetaData();
+$fileObject->getMetaData()->get();

UseMethodGetPageShortcutDirectlyFromSysPageRector

Use method getPageShortcut directly from PageRepository

  • class: Ssch\TYPO3Rector\Rector\v9\v3\UseMethodGetPageShortcutDirectlyFromSysPageRector
-$GLOBALS['TSFE']->getPageShortcut('shortcut', 1, 1);
+$GLOBALS['TSFE']->sys_page->getPageShortcut('shortcut', 1, 1);

UseNativePhpHex2binMethodRector

Turns \TYPO3\CMS\Extbase\Utility\TypeHandlingUtility::hex2bin calls to native php hex2bin

  • class: Ssch\TYPO3Rector\Rector\v10\v0\UseNativePhpHex2binMethodRector
-TYPO3\CMS\Extbase\Utility\TypeHandlingUtility::hex2bin("6578616d706c65206865782064617461");
+hex2bin("6578616d706c65206865782064617461");

UseNewComponentIdForPageTreeRector

Use TYPO3/CMS/Backend/PageTree/PageTreeElement instead of typo3-pagetree

  • class: Ssch\TYPO3Rector\Rector\v9\v0\UseNewComponentIdForPageTreeRector
 TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
       'TYPO3.CMS.Workspaces',
       'web',
       'workspaces',
       'before:info',
       [
           // An array holding the controller-action-combinations that are accessible
           'Review' => 'index,fullIndex,singleIndex',
           'Preview' => 'index,newPage'
       ],
       [
           'access' => 'user,group',
           'icon' => 'EXT:workspaces/Resources/Public/Icons/module-workspaces.svg',
           'labels' => 'LLL:EXT:workspaces/Resources/Private/Language/locallang_mod.xlf',
-          'navigationComponentId' => 'typo3-pagetree'
+          'navigationComponentId' => 'TYPO3/CMS/Backend/PageTree/PageTreeElement'
       ]
   );

UsePackageManagerActivePackagesRector

Use PackageManager API instead of $GLOBALS['TYPO3_LOADED_EXT']

  • class: Ssch\TYPO3Rector\Rector\v9\v5\UsePackageManagerActivePackagesRector
-$extensionList = $GLOBALS['TYPO3_LOADED_EXT'];
+$extensionList = GeneralUtility::makeInstance(PackageManager::class)->getActivePackages();

UseRenderingContextGetControllerContextRector

Get controllerContext from renderingContext

  • class: Ssch\TYPO3Rector\Rector\v9\v0\UseRenderingContextGetControllerContextRector
 class MyViewHelperAccessingControllerContext extends AbstractViewHelper
 {
-    protected $controllerContext;
-
     public function render()
     {
-        $controllerContext = $this->controllerContext;
+        $controllerContext = $this->renderingContext->getControllerContext();
     }
 }

UseRootlineUtilityInsteadOfGetRootlineMethodRector

Use class RootlineUtility instead of method getRootLine

  • class: Ssch\TYPO3Rector\Rector\v9\v4\UseRootlineUtilityInsteadOfGetRootlineMethodRector
-$rootline = $GLOBALS['TSFE']->sys_page->getRootLine(1);
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\RootlineUtility;
+$rootline = GeneralUtility::makeInstance(RootlineUtility::class, 1)->get();

UseSignalAfterExtensionInstallInsteadOfHasInstalledExtensionsRector

Use the signal afterExtensionInstall of class InstallUtility

  • class: Ssch\TYPO3Rector\Rector\v9\v4\UseSignalAfterExtensionInstallInsteadOfHasInstalledExtensionsRector
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Extbase\SignalSlot\Dispatcher;
-use TYPO3\CMS\Extensionmanager\Service\ExtensionManagementService;
+use TYPO3\CMS\Extensionmanager\Utility\InstallUtility;
 $signalSlotDispatcher = GeneralUtility::makeInstance(Dispatcher::class);
-$signalSlotDispatcher->connect(
-        ExtensionManagementService::class,
-        'hasInstalledExtensions',
+    $signalSlotDispatcher->connect(
+        InstallUtility::class,
+        'afterExtensionInstall',
         \stdClass::class,
         'foo'
     );

UseSignalTablesDefinitionIsBeingBuiltSqlExpectedSchemaServiceRector

Use the signal tablesDefinitionIsBeingBuilt of class SqlExpectedSchemaService

  • class: Ssch\TYPO3Rector\Rector\v9\v4\UseSignalTablesDefinitionIsBeingBuiltSqlExpectedSchemaServiceRector
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Extbase\SignalSlot\Dispatcher;
-use TYPO3\CMS\Extensionmanager\Utility\InstallUtility;
+use TYPO3\CMS\Install\Service\SqlExpectedSchemaService;
 $signalSlotDispatcher = GeneralUtility::makeInstance(Dispatcher::class);
-$signalSlotDispatcher->connect(
-        InstallUtility::class,
+    $signalSlotDispatcher->connect(
+        SqlExpectedSchemaService::class,
         'tablesDefinitionIsBeingBuilt',
         \stdClass::class,
         'foo'
     );

UseTwoLetterIsoCodeFromSiteLanguageRector

The usage of the propery sys_language_isocode is deprecated. Use method getTwoLetterIsoCode of SiteLanguage

  • class: Ssch\TYPO3Rector\Rector\v10\v0\UseTwoLetterIsoCodeFromSiteLanguageRector
-if ($GLOBALS['TSFE']->sys_language_isocode) {
-    $GLOBALS['LANG']->init($GLOBALS['TSFE']->sys_language_isocode);
+if ($GLOBALS['TSFE']->getLanguage()->getTwoLetterIsoCode()) {
+    $GLOBALS['LANG']->init($GLOBALS['TSFE']->getLanguage()->getTwoLetterIsoCode());
 }

UseTypo3InformationForCopyRightNoticeRector

Migrate the method BackendUtility::TYPO3_copyRightNotice() to use Typo3Information API

  • class: Ssch\TYPO3Rector\Rector\v10\v2\UseTypo3InformationForCopyRightNoticeRector
-$copyright = BackendUtility::TYPO3_copyRightNotice();
+$copyright = GeneralUtility::makeInstance(Typo3Information::class)->getCopyrightNotice();

ValidateAnnotationRector

Turns properties with @validate to properties with @TYPO3\CMS\Extbase\Annotation\Validate

  • class: Ssch\TYPO3Rector\Rector\v9\v3\ValidateAnnotationRector
 /**
- * @validate NotEmpty
- * @validate StringLength(minimum=0, maximum=255)
+ * @TYPO3\CMS\Extbase\Annotation\Validate("NotEmpty")
+ * @TYPO3\CMS\Extbase\Annotation\Validate("StringLength", options={"minimum": 3, "maximum": 50})
  */
 private $someProperty;

WrapClickMenuOnIconRector

Use method wrapClickMenuOnIcon of class BackendUtility

  • class: Ssch\TYPO3Rector\Rector\v7\v6\WrapClickMenuOnIconRector
-DocumentTemplate->wrapClickMenuOnIcon
+BackendUtility::wrapClickMenuOnIcon()