Review main Merged

74853[FEATURE] Introduce MailerInterface

Rudy Gnodde CR +2 V +2 Normal +139 −65 updated 10/12/22, 09:31

Commit message

In order to register your own mailer implementation,
a new interface has been introduced that makes registration
of your own mailer much easier.

Review

  • Code review CR +2 Done
    • Benni Mack +2
    • Oliver Klee +1
    • Kevin Appelt +1
    • Simon Schaufelberger +1
  • Verified V +2 Done
    • Benni Mack +2
    • Simon Schaufelberger +1
    • core-ci +1 CI

Issues 1

Files 21

Review log 92123

Show 7298 earlier messages
  1. Rudy Gnodde uploaded patch set 1 06/08/22, 09:10

  2. Rudy Gnodde updated the commit message in patch set 2 06/08/22, 09:12

  3. core-ci voted on patch set 1 V -1 06/08/22, 09:18 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27794

  4. Rudy Gnodde uploaded patch set 3 06/08/22, 09:20

  5. core-ci voted on patch set 2 V -1 06/08/22, 09:21 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27795

  6. core-ci voted on patch set 3 V -1 06/08/22, 09:27 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27796

  7. Rudy Gnodde uploaded patch set 4 06/08/22, 09:43

  8. Oliver Klee commented on patch set 4 06/08/22, 09:44

    EmailLoginNotification.php:24

    Shouldn't this be the mailer interface from core instead?

    EmailLoginNotificationTest.php:23

    Ditto.
  9. Rudy Gnodde uploaded patch set 5 06/08/22, 09:47

  10. Rudy Gnodde commented on patch set 5 06/08/22, 09:48

    EmailLoginNotification.php:24 Reply

    Done

    EmailLoginNotificationTest.php:23 Reply

    Done
  11. core-ci voted on patch set 4 V +1 06/08/22, 09:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27797

  12. core-ci voted on patch set 5 V +1 06/08/22, 09:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27798

  13. Oliver Klee commented on patch set 5 06/08/22, 10:43

    SendEmailCommand.php:88

    We can drop this line now as it only duplicates the native return type declaration.

    MailerInterface.php:8

    This interface deserves a short description about what it's purpose is and how/when it should be used.

    MailerInterface.php:14

    Do we know more about the array which we can put into a PHPDoc type annotation? And should/can the array be nullable?

    SendEmailCommandTest.php:46

    You don't need the disableOriginalConstructor call anymore when mocking the interface, which allows you to simplify this to using creatMock().
  14. Rudy Gnodde uploaded patch set 6 06/08/22, 11:34

  15. Rudy Gnodde commented on patch set 5 06/08/22, 11:34

    SendEmailCommand.php:88 Reply

    Done

    MailerInterface.php:8 Reply

    Done

    MailerInterface.php:14 Reply

    I checked and this method is only used in the Unit test for the Mailer class. So it can be removed from the interface.

    SendEmailCommandTest.php:46 Reply

    Done
  16. core-ci voted on patch set 6 V +1 06/08/22, 11:41 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27806

  17. Oliver Klee commented on patch set 6 06/08/22, 11:46

    MailerInterface.php:9

    As I understand it, it should also be used when instantiating the mailer with makeInstance.

    SendEmailCommandTest.php:45

    Probably this shorter version will also work: $mailer = $this->createMock(MailerInterface::class);
  18. Rudy Gnodde uploaded patch set 7 06/08/22, 11:55

  19. Rudy Gnodde commented on patch set 7 06/08/22, 11:56

    MailerInterface.php:9 Reply

    Done

    SendEmailCommandTest.php:45 Reply

    Done
  20. Jeroen Schutte uploaded patch set 8 06/08/22, 12:04

  21. core-ci voted on patch set 7 V +1 06/08/22, 12:04 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27811

  22. core-ci voted on patch set 8 V -1 06/08/22, 12:10 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27812

  23. Jeroen Schutte uploaded patch set 9 06/08/22, 12:35

  24. core-ci voted on patch set 9 V +1 06/08/22, 12:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27813

  25. Jeroen Schutte updated the commit message in patch set 10 06/08/22, 12:46

  26. Joey Bouten commented on patch set 9 06/08/22, 12:51

    Feature-97747-MailerInterfaceIntroduction.rst:14

    I think this should be capital cased.
  27. Jeroen Schutte uploaded patch set 11 06/08/22, 12:53

  28. core-ci voted on patch set 10 V +1 06/08/22, 12:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27814

  29. core-ci voted on patch set 11 V +1 06/08/22, 13:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27816

  30. Jeroen Schutte commented on patch set 11 06/08/22, 13:09

    Feature-97747-MailerInterfaceIntroduction.rst:14 Reply

    Done
  31. Oliver Klee commented on patch set 12 06/08/22, 15:28

    Published edit on patch set 11.
  32. Oliver Klee voted on patch set 12 CR +1 06/08/22, 15:29

  33. core-ci voted on patch set 12 V +1 06/08/22, 15:36 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27829

  34. Simon Schaufelberger commented on patch set 12 CR -1 06/09/22, 02:19

    MailerInterface.php:5

    license header missing

    Feature-97747-MailerInterfaceIntroduction.rst:25

    \ missing before TYPO3
  35. Rudy Gnodde uploaded patch set 13 06/09/22, 06:42

  36. Rudy Gnodde commented on patch set 12 06/09/22, 06:42

    MailerInterface.php:5 Reply

    Done

    Feature-97747-MailerInterfaceIntroduction.rst:25 Reply

    Done
  37. core-ci voted on patch set 13 V +1 06/09/22, 06:49 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27855

  38. Oliver Klee commented on patch set 13 06/09/22, 07:44

    MailerInterface.php:3

    Please let's make the file strict.
  39. Oliver Klee commented on patch set 14 06/09/22, 09:03

    Published edit on patch set 13.
  40. Oliver Klee commented on patch set 14 CR +1 06/09/22, 09:03

    MailerInterface.php:3 Reply

    Done
  41. core-ci voted on patch set 14 V +1 06/09/22, 09:10 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27865

  42. Simon Schaufelberger voted on patch set 14 CR +1 06/09/22, 09:50

  43. Simon Schaufelberger updated the commit message in patch set 15 06/09/22, 11:58

  44. Oliver Klee voted on patch set 15 CR +1 06/09/22, 12:01

  45. Simon Schaufelberger commented on patch set 15 06/09/22, 12:03

    Feature-97747-MailerInterfaceIntroduction.rst:30

    I'm thinking if it could be useful to roughly describe how an own Mailer class can be registered. That would also help the documentation team.
  46. core-ci voted on patch set 15 V +1 06/09/22, 12:06 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27885

  47. Oliver Klee voted on patch set 15 CR 0 06/09/22, 12:18

  48. Jeroen Schutte uploaded patch set 16 06/09/22, 19:21

  49. core-ci voted on patch set 16 V +1 06/09/22, 19:29 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27899

  50. Oliver Klee commented on patch set 16 CR -1 06/09/22, 19:38

    Jeroen, I think you accidentally uploaded patchset 11 again, overwriting all changes that have been uploaded after that.
  51. Jeroen Schutte uploaded patch set 17 06/09/22, 20:46

  52. Jeroen Schutte commented on patch set 17 06/09/22, 20:49

    Reply

    Thanks for noticing. I pushed a fix

    Feature-97747-MailerInterfaceIntroduction.rst:30 Reply

    Done
  53. core-ci voted on patch set 17 V +1 06/09/22, 20:53 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27900

  54. Simon Schaufelberger updated the commit message in patch set 18 06/09/22, 20:56

  55. Simon Schaufelberger commented on patch set 18 06/09/22, 21:00

    I've just updated the commit message a bit. Please always download the latest patch set before updating code. If you have your own branch, use the Download->Reset to link
  56. Simon Schaufelberger commented on patch set 18 V +1 CR +1 06/09/22, 21:00

    Well done, now I really like it!
  57. core-ci voted on patch set 18 V +1 06/09/22, 21:03 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27901

  58. Simon Schaufelberger commented on patch set 18 06/09/22, 21:04

    One more question: You defined this as TASK but in the REST file you define it as FEATURE. I'm not sure myself but do you consider this more like a feature or a task? I think a feature fits slightly more as you can now register your own mailer class which was not (or only with lots of effort) possible.
  59. Simon Schaufelberger commented on patch set 18 CR -1 06/09/22, 21:05

    Feature-97747-MailerInterfaceIntroduction.rst:6

    I would rephrase it to "Introduce MailerInterface" or someting like that so that it actually sounds like a feature.
  60. Andreas Kienast commented on patch set 18 06/10/22, 08:16

    Feature-97747-MailerInterfaceIntroduction.rst:6 Reply

    The patch is marked as [TASK], therefor I'd drop the rst file at all.
  61. Jeroen Schutte uploaded patch set 19 06/10/22, 08:45

  62. Jeroen Schutte commented on patch set 18 06/10/22, 08:46

    Reply

    We have also discussed this ourselves. The intention was not to add anything new, but to retain functionality and better apply design principles. Based on that, we chose to make it a Task. Since Task is not supported in REST and it is better to have definition equally on those, I changed this in Feature
  63. Jeroen Schutte commented on patch set 19 06/10/22, 08:48

    Feature-97747-MailerInterfaceIntroduction.rst:6 Reply

    Task > Feature
  64. core-ci voted on patch set 19 V +1 06/10/22, 08:52 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27909

  65. Rudy Gnodde voted on patch set 19 V +1 CR +1 06/10/22, 09:11

  66. Andreas Kienast commented on patch set 20 06/10/22, 10:11

    Published edit on patch set 19.
  67. core-ci voted on patch set 20 V +1 06/10/22, 10:19 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27911

  68. Oliver Klee voted on patch set 20 CR +1 06/10/22, 12:01

  69. Simon Schaufelberger updated the commit message in patch set 21 06/10/22, 12:53

  70. Simon Schaufelberger voted on patch set 21 V +1 CR +1 06/10/22, 12:53

  71. Simon Schaufelberger uploaded patch set 22 06/10/22, 12:56

  72. Simon Schaufelberger voted on patch set 22 V +1 CR +1 06/10/22, 12:56

  73. Oliver Klee voted on patch set 22 CR +1 06/10/22, 13:02

  74. core-ci voted on patch set 21 V -1 06/10/22, 13:02 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27922

  75. Rudy Gnodde rebased onto patch set 23 06/10/22, 13:03

  76. Jeroen Schutte commented on patch set 22 06/10/22, 13:03

    Feature-97747-MailerInterfaceIntroduction.rst:45

    I wonder why this was removed?
  77. core-ci voted on patch set 22 V +1 06/10/22, 13:05 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27923

  78. Simon Schaufelberger commented on patch set 23 06/10/22, 13:09

    Feature-97747-MailerInterfaceIntroduction.rst:45 Reply

    Because this link can change any time and is part of the documentation. No need to reference the documentation.
  79. core-ci voted on patch set 23 V +1 06/10/22, 13:12 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/27924

  80. Oliver Klee voted on patch set 23 CR +1 06/10/22, 13:19

  81. Simon Schaufelberger voted on patch set 23 V +1 CR +1 06/10/22, 13:34

  82. Mathias Brodala commented on patch set 23 CR -1 06/21/22, 09:16

    PasswordReset.php:197

    It is rather unusual (and actually unknown to the TYPO3 world) that one can make an instance of an interface. You should use DI instead to have the mailer injected.

    Services.yaml:367

    This can be dropped if DI is used everywhere instead.
  83. Guido Schmechel commented on patch set 23 06/21/22, 09:19

    Feature-97747-IntroduceMailerInterface.rst:30

    Can you add a concrete example here if necessary? Based on the RsT and the ticket, I lack the imagination of what this could be used for and what advantages it brings with it? The specific question: Why should I register my own mailer?
  84. Rudy Gnodde commented on patch set 23 06/21/22, 09:38

    PasswordReset.php:197 Reply

    Although I agree DI would probably be better (though wouldn't it be better performance wise like this if it is only needed in a single function that's not always called?), we wanted to keep this change as small as possible, so just replace `makeInstance(Mailer:class)` with `makeInstance(MailerInterface::class)`. I checked before making this change and it is done multiple times in core extensions (just do a regex search for `makeInstance\(.*?Interface`)
  85. Mathias Brodala commented on patch set 23 06/21/22, 09:45

    PasswordReset.php:197 Reply

    True, but many wrongs don't necessarily make something right. ;-) So I really urge to make it right here and don't get confused by the other places which need to be fixed sooner or later.
  86. Oli Bartsch commented on patch set 23 06/21/22, 09:47

    PasswordReset.php:197 Reply

    It's actually the same as for e.g. EventDispatcherInterface, which is also instantiated with makeInstance() at various places. It's unfortunately not easily possible in those classes to change to DI. IMO using makeInstance at those places is fine for now, especially because this is no DI refactoring but just replacing an actual implementation with an interface, similar to this one https://review.typo3.org/c/Packages/TYPO3.CMS/+/73186
  87. Mathias Brodala commented on patch set 23 CR 0 06/21/22, 09:55

    PasswordReset.php:197 Reply

    Yeah, looks similar. I'm not going to block this but will suggest to at least leave a TODO comment everywhere here so it is kept in mind for refactoring to DI at some point. This can be skipped if there are plans/strategies for this already.
  88. Simon Schaufelberger uploaded patch set 24 07/21/22, 02:17

  89. core-ci voted on patch set 24 V +1 07/21/22, 02:24 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/29388

  90. Oliver Klee voted on patch set 24 CR +1 07/21/22, 10:35

  91. Simon Schaufelberger rebased onto patch set 25 08/12/22, 12:08

  92. Simon Schaufelberger commented on patch set 25 08/12/22, 12:09

    @Mathias, can we move forward here or is anything still blocking?
  93. core-ci voted on patch set 25 V +1 08/12/22, 12:17 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30088

  94. Oliver Klee voted on patch set 25 CR +1 08/17/22, 16:53

  95. Simon Schaufelberger uploaded patch set 26 08/17/22, 21:02

  96. core-ci voted on patch set 26 V +1 08/17/22, 21:10 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30251

  97. Oliver Klee voted on patch set 26 CR +1 08/17/22, 21:13

  98. Simon Schaufelberger uploaded patch set 27 08/17/22, 21:41

  1. Simon Schaufelberger commented on patch set 26 08/17/22, 21:41

    PasswordReset.php:197 Reply

    Done

    Services.yaml:367 Reply

    Done
  2. core-ci voted on patch set 27 V -1 08/17/22, 21:50 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30253

  3. Simon Schaufelberger uploaded patch set 28 08/17/22, 22:08

  4. Simon Schaufelberger uploaded patch set 29 08/17/22, 22:13

  5. core-ci voted on patch set 28 V -1 08/17/22, 22:18 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30254

  6. core-ci voted on patch set 29 V -1 08/17/22, 22:22 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30255

  7. Simon Schaufelberger uploaded patch set 30 08/17/22, 22:30

  8. core-ci voted on patch set 30 V +1 08/17/22, 22:38 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/30256

  9. Oliver Klee voted on patch set 30 CR +1 08/18/22, 06:49

  10. Simon Schaufelberger voted on patch set 30 CR +1 08/18/22, 21:52

  11. Benni Mack uploaded patch set 31 10/01/22, 15:05

  12. core-ci voted on patch set 31 V +1 10/01/22, 15:14 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/31829

  13. Simon Schaufelberger voted on patch set 31 CR +1 10/01/22, 19:26

  14. Benni Mack commented on patch set 31 V +1 CR +1 10/01/22, 21:42

    Fine with the current implementation. If anyone wants to extend the RST, feel free!
  15. Oliver Klee voted on patch set 31 CR +1 10/01/22, 21:47

  16. Kevin Appelt voted on patch set 31 CR +1 10/02/22, 22:19

  17. Simon Schaufelberger commented on patch set 31 10/05/22, 04:34

    Feature-97747-IntroduceMailerInterface.rst:30 Reply

    A good example that I could think of are functional tests where you want to mock a mailer. Laravel has a great use case for it: https://laravel.com/docs/9.x/mocking#mail-fake
  18. Simon Schaufelberger commented on patch set 31 V +1 10/05/22, 04:35

    Feature-97747-IntroduceMailerInterface.rst:30 Reply

    Done
  19. Benni Mack voted on patch set 31 V +2 CR +2 10/11/22, 06:40

  20. Benni Mack merged patch set 32 10/11/22, 06:40

  21. Benni Mack commented on patch set 32 10/11/22, 06:41

    aaargh, this file should have been in 12.1
  22. Simon Schaufelberger commented on patch set 32 10/12/22, 07:21

    Benni, will you take care and move this file into the 12.1 directory?
  23. Christian Kuhn commented on patch set 32 10/12/22, 09:00

    Reply

    merged already.
  24. Simon Schaufelberger commented on patch set 32 10/12/22, 09:05

    Reply

    yes but someone can still move the file to the correct location.
  25. Benni Mack commented on patch set 32 10/12/22, 09:31

    Reply

    I did move the file, and this change was also merged already. https://github.com/TYPO3/typo3/commit/39a4d9c2ddb4d89c272db2e852d1dbe92133a467