Review main Merged

71178[TASK] Do not use custom "getInstance()" methods on Singleton interfaces

Benni Mack CR +2 V +2 Normal +188 −51 updated 09/23/21, 10:59

Commit message

There was a time when new code for TYPO3 Core was introduced
by using "MyClass::getInstance()" to act as a factory for this
class, which _would_ be OK if these classes are actually prototypes
and not services (or singleton services), as GeneralUtility::makeInstance()
or DI via Services.yaml works as well.

This change deprecates all getInstance methods around such code
with GeneralUtility::makeInstance() calls. At a later point, proper DI
can be introduced in these cases.

* TYPO3\CMS\Core\Resource\Index\ExtractorRegistry::getInstance()
* TYPO3\CMS\Core\Resource\Index\FileIndexRepository::getInstance()
* TYPO3\CMS\Core\Resource\Index\MetaDataRepository::getInstance()
* TYPO3\CMS\Core\Resource\OnlineMedia\Helpers\OnlineMediaHelperRegistry::getInstance()
* TYPO3\CMS\Core\Resource\Rendering\RendererRegistry::getInstance()
* TYPO3\CMS\Core\Resource\TextExtraction\TextExtractorRegistry::getInstance()
* TYPO3\CMS\Form\Service\TranslationService::getInstance()
* TYPO3\CMS\T3editor\Registry\AddonRegistry::getInstance()
* TYPO3\CMS\T3editor\Registry\ModeRegistry::getInstance()

Review

  • Code review CR +2

    Imported before Forger kept the single votes, the next import adds them.

  • Verified V +2

    Imported before Forger kept the single votes, the next import adds them.

Issues 1

Files 40

Show 20 more files