Review main Merged

90344[TASK] Inject service classes into ViewHelpers which use DI already

Simon Schaufelberger CR +2 V +2 Normal +93 −144 updated 08/14/25, 09:00

Commit message

This change was done with the help of TYPO3 Rector.
Additionally, the injected classes are now private and readonly.

Applied rules:
- InjectMethodToConstructorInjectionRector

Code style has been applied with ECS as there are no PHP-CS-Fixer rules
to format constructor properties.

Applied rules:
- StandaloneLineConstructorParamFixer
- StandaloneLinePromotedPropertyFixer

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Simon Praetorius +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Simon Praetorius +1
    • core-ci +1 CI

Issues 1

Files 17

Review log 1115

  1. Simon Schaufelberger uploaded patch set 1 08/12/25, 12:56

  2. core-ci voted on patch set 1 V -1 08/12/25, 13:04 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83202

  3. Simon Schaufelberger uploaded patch set 2 V -1 08/12/25, 13:36

  4. core-ci voted on patch set 2 V +1 08/12/25, 13:47 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83206

  5. Christian Kuhn commented on patch set 2 08/13/25, 18:33

    LoginLogoViewHelper.php:47

    good catch pageRenderer is actually not used in this case.

    LoginLogoViewHelper.php:49

    instead of injecting cacheManager, i prefer direcctly injecting the cache that is needed, in this case the assets cache.

    LoginLogoViewHelper.php:49

    matter of taste: in general, i prefer having an additional comma at in last line since adding another DI will then only change one line instead of two.

    DownloadExtensionViewHelper.php:43

    note there is an option (using a attribute) to directly inject the config parameter that is needed. iirc a v13 patch documented this.

    DownloadExtensionViewHelper.php:64

    note this one is kinda important, especially when uribuilder is injected: UriBuilder is stateful ...

    ProcessAvailableActionsViewHelper.php:34

    note @simon@praetorius.me : We should see if we could somehow get rid of __construct() in AbstractTagBasedViewHelper ...

    CssViewHelper.php:55

    Note: AssetCollector is designed as a stateful singleton (similar to PageRenderer), we should be careful when injecting it and at least keep that fact in mind. In this case, it "has always been like that", its ok, and we currently have no better solution. just saying here ...

    TableListViewHelper.php:63

    (self?)-note: it would be good to refactor this dependency away.

    DatePickerViewHelper.php:34

    outdated comment, right?

    UploadedResourceViewHelper.php:43

    another stateful singleton, btw ..

    CodeViewHelper.php:50

    and another (and rather stupid) stateful singleton.
  6. Simon Schaufelberger commented on patch set 2 08/13/25, 19:40

    DatePickerViewHelper.php:34 Reply

    Right but I would do some more cleanup in a followup patch as protected can also be private since almost all VHs are final
  7. Simon Schaufelberger commented on patch set 2 08/13/25, 20:33

    LoginLogoViewHelper.php:47 Reply

    Done

    LoginLogoViewHelper.php:49 Reply

    Done

    LoginLogoViewHelper.php:49 Reply

    Done

    DownloadExtensionViewHelper.php:43 Reply

    Done

    DatePickerViewHelper.php:34 Reply

    Done
  8. Simon Schaufelberger uploaded patch set 3 V +1 08/13/25, 20:40

  9. Simon Schaufelberger uploaded patch set 4 08/13/25, 20:48

  10. core-ci voted on patch set 3 V +1 08/13/25, 20:48 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83320

  11. core-ci voted on patch set 4 V +1 08/13/25, 20:55 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/83321

  12. Christian Kuhn voted on patch set 4 CR +1 V +1 08/14/25, 08:51

  13. Simon Praetorius voted on patch set 4 CR +1 V +1 08/14/25, 09:00

  14. Christian Kuhn voted on patch set 4 CR +2 V +2 08/14/25, 09:00

  15. Christian Kuhn merged patch set 5 08/14/25, 09:00