Review main Merged

70831[TASK] Implement interface for ViewHelperResolverFactory

Benjamin Tammling CR +2 V +2 Normal +43 −8 updated 09/02/21, 18:06

Commit message

Add ViewHelperResolverFactoryInterface and use it for
dependency injection.

ViewHelperResolverFactoryInterface is specified via
ServiceProvider.php since it is needed in FailsafeContainer
(install tool). Since ServiceProdiver.php itself is not API,
ViewHelperResolverFactoryInterface isn't either. This will
evolve over time in core. For now, we still need this
interface already for some extensions edge cases, though.

ServiceProviderCompilationPass is adapted to avoid
alias resolution when providing factories for interfaces.
Otherwise the aliased service is configured instead of
the interface itself.

Review

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

Issues 1

Files 5

Review log 1924

  1. Benjamin Tammling uploaded patch set 1 08/31/21, 09:07

  2. Benjamin Franzke commented on patch set 1 08/31/21, 09:15

    Hey, how do you want to use this interface? The ViewHelperResolverFactory is injected statically in typo3/sysext/fluid/Classes/ServiceProvider.php (required because of installtool compatibility). So, what is the intended goal of your change? This factory is internal and may change after the ObjectManager removal in v12, therefore we would not like to add a public interface right now.
  3. Benjamin Franzke commented on patch set 1 08/31/21, 09:16

    Reply

    > The ViewHelperResolverFactory is injected statically in typo3/sysext/fluid/Classes/ServiceProvider.php (required because of installtool compatibility). Forgot to mention: …and that means that you cannot change the implementation via Services.yaml.
  4. core-ci voted on patch set 1 V +1 08/31/21, 09:21 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/15915

  5. Benjamin Tammling commented on patch set 1 08/31/21, 11:42

    Reply

    The overall goal is to extend the ViewHelperResolver. With this change we could use a ServiceProvider to return a custom factory which will then return our custom Resolver.
  6. Benjamin Franzke commented on patch set 1 08/31/21, 12:04

    Reply

    Ok, thanks for the clarification. Issue is: also service providers are internal and we can't provide ViewHelperResolverFactoryInterface as public api, if there is no public api to be able to provide an implementation. @Christian Kuhn: maybe we could just drop "final" from the class, so this internal(!) class could be overwritten by extending the class by using an internal(!) service provider – for users that *really* need that. I mean, we used "final" to stress that these objects are subjects to change and users would really likely run into "breaking" changes here…
  7. Benjamin Franzke commented on patch set 1 08/31/21, 12:20

    Reply

    Another option would be to introduce the interface as an internal implementation. So simply mark it: /** * @internal May change / vanish any time */ Then you can provide the implementation using internal API (service provider).
  8. Christian Kuhn commented on patch set 1 08/31/21, 12:23

    Reply Unresolved

    had a chat with benjamin franzke about this patch and we're fine in general when adding some internal comments. will outline details in a new patch set. i'll review and take care soon ...
  9. Christian Kuhn commented on patch set 1 CR -1 08/31/21, 12:34

    -1 for now. will coordinate.
  10. Simon Praetorius voted on patch set 1 V +1 CR +1 09/01/21, 11:32

  11. Christian Kuhn uploaded patch set 2 09/02/21, 08:23

  12. Benjamin Franzke uploaded patch set 3 09/02/21, 08:46

  13. core-ci voted on patch set 3 V +1 09/02/21, 09:06 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/16057

  14. Christian Kuhn uploaded patch set 4 09/02/21, 09:10

  15. Benjamin Franzke uploaded patch set 5 09/02/21, 09:18

  16. Benjamin Franzke voted on patch set 5 V +1 CR +1 09/02/21, 09:20

  17. core-ci voted on patch set 4 V +1 09/02/21, 09:25 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/16060

  18. core-ci voted on patch set 5 V +1 09/02/21, 09:34 Core CI is happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/16061

  19. Christian Kuhn commented on patch set 5 V +1 CR +1 09/02/21, 09:34

    ServiceProvider.php:39 Unresolved

    note we specify both factory and factoryInterface to make sure that only *one* instance is created if anyone injects ViewHelperResolverFactory directly.
  20. core-ci voted on patch set 2 V -1 09/02/21, 10:27 Core CI is not happy: https://gitlab.typo3.org/typo3/CI/cms/-/pipelines/16055

  21. Simon Praetorius voted on patch set 5 V +1 CR +1 09/02/21, 13:22

  22. Benjamin Tammling voted on patch set 5 V +1 CR +1 09/02/21, 13:27

  23. Christian Kuhn voted on patch set 5 V +2 CR +2 09/02/21, 18:06

  24. Christian Kuhn merged patch set 6 09/02/21, 18:06