Review main Merged

73271[TASK] Move GuzzleClientFactory into the container

crell CR +2 V +2 Normal +37 −25 updated 02/04/22, 16:22

Commit message

This is just a small clean up to make more things injectable.
Enables further work.

Review

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

Issues 1

Files 9

Review log 1521

  1. crell uploaded patch set 1 02/03/22, 20:46

  2. crell updated the commit message in patch set 2 02/03/22, 20:46

  3. core-ci voted on patch set 1 V -1 02/03/22, 21:03 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22973

  4. core-ci voted on patch set 2 V -1 02/03/22, 21:09 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22974

  5. Benjamin Franzke commented on patch set 2 02/03/22, 21:22

    ServiceProvider.php:490

    RequestFactory is defined in ServiceProvider.php as it's used InstallTool, to be specific, in: typo3/sysext/install/Classes/Service/LanguagePackService.php That means GuzzleClientFactory would need to be defined in here as well (in other words: add a method `getGuzzleClientFactory()` and add a respective entry in getFactories(). And as you are probably doing this change in order to inject config at some point, you may (now) notice: config needs to be injectable in installtool as well, without full blown symfony DI, only with FailsafeContainer and ServiceProviders.

    Services.yaml:354

    This entry is superfluous, as we use a `resource` directive that scans the directories and class is resolved automatically.
  6. crell uploaded patch set 3 02/03/22, 21:33

  7. Benjamin Franzke commented on patch set 2 02/03/22, 21:36

    RequestFactory.php:44

    The GuzzleFactory was static on purpose, as we did two distinct things in this class: * Guzzle-request-invocation * PSR-7 factopry for requests I've added the latter because I wanted to avoid adding a separate (ugly) class name like PsrRequestFactory and I hoped that we may deprecated RequestFactory::request at some point. But it turns out PSR-18 HTTP-Client is often too much boilerplate for things like redirect handling and so on, so I noticed that no-one really migrated to PSR-18 and rather kept using the ::request() method.. Anyway, that's the history. If we really need the guzzleFactory injected, then we should move createRequest to a new class and alias PSR-17 RequestFactoryInterface to that new class in our Services.yaml
  8. Benjamin Franzke wrote 02/03/22, 21:37

    Topic set to di
  9. core-ci voted on patch set 3 V -1 02/03/22, 21:49 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22976

  10. Benjamin Franzke uploaded patch set 4 02/03/22, 22:31

  11. core-ci voted on patch set 4 V -1 02/03/22, 22:42 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22981

  12. Benjamin Franzke commented on patch set 4 02/03/22, 22:44

    RequestFactory.php:44 Reply

    Hm.. fine for now. RequestFactory is actually mostly used together with a ClientFactory, so the GuzzleClientFactory is initialized anyway. So let's just keep it as you've done right now.

    ServiceProvider.php:490 Reply

    Done

    Services.yaml:354 Reply

    Done
  13. crell commented on patch set 4 02/03/22, 22:56

    RequestFactory.php:44 Reply

    Done

    ServiceProvider.php:490 Reply

    Yeah, that's going to be a PITA, I'm realizing... :-/ We'd need at minimum some kind of dynamic pass to register classes with their default values. Manually itemizing them all would likely be impractical. The extra factory method has been added for now.

    Services.yaml:354 Reply

    Ack
  14. crell uploaded patch set 5 02/03/22, 22:57

  15. core-ci voted on patch set 5 V -1 02/03/22, 23:08 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22982

  16. Benjamin Franzke uploaded patch set 6 02/03/22, 23:15

  17. core-ci voted on patch set 6 V +1 02/03/22, 23:23 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/22983

  18. crell voted on patch set 6 CR +1 02/03/22, 23:28

  19. Christian Kuhn voted on patch set 6 V +1 CR +1 02/04/22, 16:03

  20. Benjamin Franzke voted on patch set 6 V +2 CR +2 02/04/22, 16:22

  21. Benjamin Franzke merged patch set 7 02/04/22, 16:22