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 Done
    • Benni Mack +2
    • Oli Bartsch +1
    • Wouter Wolters +1
  • Verified V +2 Done
    • Benni Mack +2
    • Oli Bartsch +1
    • Wouter Wolters +1
    • core-ci +1 CI

Issues 1

Files 40

Show 20 more files

Review log 710

  1. Benni Mack uploaded patch set 1 09/22/21, 14:08

  2. core-ci voted on patch set 1 V +1 09/22/21, 14:32 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/17036

  3. Benni Mack uploaded patch set 2 09/23/21, 07:24

  4. Benni Mack uploaded patch set 3 09/23/21, 07:31

  5. core-ci voted on patch set 2 V +1 09/23/21, 07:37 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/17094

  6. core-ci voted on patch set 3 V +1 09/23/21, 07:45 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/17095

  7. Wouter Wolters voted on patch set 3 V +1 CR +1 09/23/21, 08:08

  8. Oli Bartsch voted on patch set 3 V +1 CR +1 09/23/21, 10:43

  9. Benni Mack voted on patch set 3 V +2 CR +2 09/23/21, 10:59

  10. Benni Mack merged patch set 4 09/23/21, 10:59