61303[FEATURE] Introduce PSR-14-based EventDispatcher as alternative for hooks
Commit message
Review
-
Code review CR +2 Done
- Benjamin Franzke +2
- Georg Ringer +1
- Andreas Kienast +1
- Benni Mack +1
-
Verified V +2 Done
- Benjamin Franzke +2
- Georg Ringer +1
Issues 1
Files 22
- typo3/sysext/core/Classes/Compatibility/Slot/PostInitializeMailer.phpnew+42 −0
- typo3/sysext/core/Classes/DependencyInjection/ListenerProviderPass.phpnew+88 −0
- typo3/sysext/core/Classes/EventDispatcher/EventDispatcher.php8new+57 −0
- typo3/sysext/core/Classes/EventDispatcher/ListenerProvider.phpnew+117 −0
- typo3/sysext/core/Classes/Mail/Event/AfterMailerInitializationEvent.phpnew+41 −0
- typo3/sysext/core/Classes/Mail/Mailer.php+6 −25
- typo3/sysext/core/Configuration/Services.php+1 −0
- typo3/sysext/core/Configuration/Services.yaml+14 −0
- typo3/sysext/core/Documentation/Changelog/master/Feature-88770-PSR-14BasedEventDispatcher.rst25new+129 −0
- typo3/sysext/core/Tests/Unit/DependencyInjection/Fixtures/Package1/Configuration/Services.yamlnew+17 −0
- typo3/sysext/core/Tests/Unit/DependencyInjection/Fixtures/Package2/Configuration/Services.yamlnew+10 −0
- typo3/sysext/core/Tests/Unit/DependencyInjection/Fixtures/Package3/Configuration/Services.yamlnew+10 −0
- typo3/sysext/core/Tests/Unit/DependencyInjection/Fixtures/Package4Cycle/Configuration/Services.yamlnew+10 −0
- typo3/sysext/core/Tests/Unit/DependencyInjection/ListenerProviderPassTest.phpnew+106 −0
- typo3/sysext/core/Tests/Unit/EventDispatcher/EventDispatcherTest.phpnew+206 −0
- typo3/sysext/core/Tests/Unit/EventDispatcher/ListenerProviderTest.phpnew+212 −0
- typo3/sysext/core/Tests/Unit/Mail/MailerTest.php+6 −1
- typo3/sysext/core/composer.json+1 −0
- typo3/sysext/lowlevel/Classes/Controller/ConfigurationController.php+10 −0
- typo3/sysext/lowlevel/Resources/Private/Language/locallang.xlf+3 −0
Show 2 more files
Review log 3146
Show 1321 earlier messages
-
Benni Mack uploaded patch set 1 07/15/19, 18:31
-
TYPO3com voted on patch set 1 V +1 07/15/19, 18:44 Completed build in 12m 06s on Mon, 15 Jul, 08:44 PM Test Summary: 46998 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-35054
-
Benjamin Franzke uploaded patch set 2 07/15/19, 19:26
-
TYPO3com voted on patch set 2 V -1 07/15/19, 19:26 Completed build in 11s on Mon, 15 Jul, 09:26 PM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-35056
-
Benni Mack uploaded patch set 3 07/15/19, 19:40
-
TYPO3com voted on patch set 3 V -1 07/15/19, 19:54 Completed build in 14m 04s on Mon, 15 Jul, 09:54 PM Test Summary: 1 of 47361 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-35057
-
Benjamin Franzke uploaded patch set 4 07/15/19, 20:10
-
Benjamin Franzke uploaded patch set 5 07/15/19, 20:20
-
TYPO3com voted on patch set 4 V +1 07/15/19, 20:33 Completed build in 17m 33s on Mon, 15 Jul, 10:33 PM Test Summary: 46998 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-35062
-
TYPO3com voted on patch set 5 V +1 07/15/19, 20:37 Completed build in 16m 17s on Mon, 15 Jul, 10:37 PM Test Summary: 46998 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-35063
-
Benni Mack uploaded patch set 6 07/15/19, 20:40
-
TYPO3com voted on patch set 6 V +1 07/15/19, 20:52 Completed build in 11m 23s on Mon, 15 Jul, 10:52 PM Test Summary: 46998 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-35065
-
Benjamin Franzke uploaded patch set 7 07/15/19, 22:22
-
TYPO3com voted on patch set 7 V +1 07/15/19, 22:32 Completed build in 09m 40s on Tue, 16 Jul, 12:32 AM Test Summary: 46998 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-35066
-
Benjamin Franzke uploaded patch set 8 07/16/19, 04:30
-
Benjamin Franzke commented on patch set 7 07/16/19, 04:30
EventDispatcher.php:53From https://www.php-fig.org/psr/psr-14/: > An Exception or Error thrown by a Listener MUST be allowed to propagate back up to the Emitter If we want to log here, we should `throw $e`. -
Benjamin Franzke commented on patch set 8 V +1 CR +1 07/16/19, 04:30
EventDispatcher.php:51ReplyDoneEventDispatcher.php:53ReplyDone -
TYPO3com voted on patch set 8 V +1 07/16/19, 04:46 Completed build in 12m 04s on Tue, 16 Jul, 06:46 AM Test Summary: 46998 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-35069
-
Georg Ringer commented on patch set 8 07/16/19, 06:33
objectEventDispatcher.php:53should we add a todo?Feature-88770-PSR-14BasedEventDispatcher.rst:122is this really true? don't we might have special edge cases where we hook into core on your own and don't want others to reuse that code? maybe add something like "unless commented with @internal"? -
Andreas Kienast commented on patch set 8 CR -1 07/16/19, 06:55
Feature-88770-PSR-14BasedEventDispatcher.rst:37informationFeature-88770-PSR-14BasedEventDispatcher.rst:44configuration -
Andreas Kienast uploaded patch set 9 07/16/19, 06:55
-
Mathias Brodala commented on patch set 8 07/16/19, 06:56
Feature-88770-PSR-14BasedEventDispatcher.rst:22Should be "An"Feature-88770-PSR-14BasedEventDispatcher.rst:24Here we should add the implied ... thus it is possible to extend/replace the event dispatcher with any implementation.Feature-88770-PSR-14BasedEventDispatcher.rst:36"... of other event listeners"Feature-88770-PSR-14BasedEventDispatcher.rst:37informationFeature-88770-PSR-14BasedEventDispatcher.rst:42"... are usually associated ..." It's up to the listener provider to fetch listeners for an event which does not have to happen based on the event object class/hierarchy.Feature-88770-PSR-14BasedEventDispatcher.rst:74I'd prefer the non-inline notation here for readability.Feature-88770-PSR-14BasedEventDispatcher.rst:105"... event, this listeners is called automatically."Feature-88770-PSR-14BasedEventDispatcher.rst:111What does this mean?Feature-88770-PSR-14BasedEventDispatcher.rst:118"... as ...", less Denglish. ;-) -
TYPO3com voted on patch set 9 V +1 07/16/19, 07:06 Completed build in 10m 58s on Tue, 16 Jul, 09:06 AM Test Summary: 46997 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-35071
-
Benjamin Franzke uploaded patch set 10 07/16/19, 08:26
-
Benjamin Franzke commented on patch set 10 07/16/19, 08:29
Feature-88770-PSR-14BasedEventDispatcher.rst:22ReplyDoneFeature-88770-PSR-14BasedEventDispatcher.rst:24ReplyDoneFeature-88770-PSR-14BasedEventDispatcher.rst:36ReplyDoneFeature-88770-PSR-14BasedEventDispatcher.rst:37ReplyDoneFeature-88770-PSR-14BasedEventDispatcher.rst:37ReplyDoneFeature-88770-PSR-14BasedEventDispatcher.rst:42ReplyAckFeature-88770-PSR-14BasedEventDispatcher.rst:44ReplyDoneFeature-88770-PSR-14BasedEventDispatcher.rst:74ReplyAckFeature-88770-PSR-14BasedEventDispatcher.rst:105ReplyDoneFeature-88770-PSR-14BasedEventDispatcher.rst:111ReplyHe meant it's easier to read/understand when… My\Namespace\Signal\Foo::class …is used (due to being an invokable class) instead of sth like: My\Namespace\Signal\Foo::class . '::onFoobarEvent'. That syntax was used in the first patchset. Now we still have the optional "method" attribute (which should be avoided for the sake of __invoke() as well). I have therefore rephrased to: When configuring Listeners, it is recommended to add one Listener class per Event type, and have it called via `__invoke()`.Feature-88770-PSR-14BasedEventDispatcher.rst:118ReplyAckFeature-88770-PSR-14BasedEventDispatcher.rst:122ReplyI personally agree with the statement as written in the rst. We should only add events that are worth being marked stable, and are generally useful. I think this limitation is quite good. If we've got a 1:1 relationship between two extensions in core and want these to be private but decoupled, we should rather use an interface and implementations overrides (in Services.yaml) instead of the event mechansim – which is really intended for being multiplexed. -
TYPO3com voted on patch set 10 V +1 07/16/19, 08:41 Completed build in 14m 41s on Tue, 16 Jul, 10:41 AM Test Summary: 46998 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-35073
-
Benjamin Franzke uploaded patch set 11 07/16/19, 09:49
-
TYPO3com voted on patch set 11 V +1 07/16/19, 10:00 Completed build in 10m 50s on Tue, 16 Jul, 12:00 PM Test Summary: 47106 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-35082
-
Benjamin Franzke uploaded patch set 12 07/16/19, 12:55
-
Benjamin Franzke commented on patch set 12 V +1 CR +1 07/16/19, 12:55
Reply
DoneEventDispatcher.php:53ReplyI would leave it as is for now. I'd assume this is rather a "if we want, we could add logging here" than a real todo. -
Benni Mack commented on patch set 13 07/16/19, 12:58
Published edit on patch set 12. -
TYPO3com voted on patch set 12 V +1 07/16/19, 13:09 Completed build in 14m 26s on Tue, 16 Jul, 03:09 PM Test Summary: 47118 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-35089
-
Benni Mack commented on patch set 13 07/16/19, 13:11
EventDispatcher.php:53ReplyPSR-14 states that something could be logged here. that's the purpose of catching it. but we don't have to. So we could also remove the try() catch block. -
TYPO3com voted on patch set 13 V +1 07/16/19, 13:12 Completed build in 14m 26s on Tue, 16 Jul, 03:12 PM Test Summary: 47118 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-35090
-
Benjamin Franzke uploaded patch set 14 07/16/19, 13:25
-
Benjamin Franzke voted on patch set 14 V +1 CR +1 07/16/19, 13:26
-
Benjamin Franzke commented on patch set 14 07/16/19, 13:27
EventDispatcher.php:53ReplyAck, we should remove it for now. Did so.Feature-88770-PSR-14BasedEventDispatcher.rst:122ReplyDone -
Benni Mack voted on patch set 14 CR +1 07/16/19, 13:35
-
Benni Mack commented on patch set 15 07/16/19, 13:38
Published edit on patch set 14. -
Benni Mack voted on patch set 15 CR +1 07/16/19, 13:39
-
Georg Ringer voted on patch set 15 V +1 CR +1 07/16/19, 13:39
-
TYPO3com voted on patch set 14 V +1 07/16/19, 13:41 Completed build in 13m 34s on Tue, 16 Jul, 03:41 PM Test Summary: 47118 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-35095
-
Andreas Kienast voted on patch set 15 CR +1 07/16/19, 13:45
-
Benjamin Franzke voted on patch set 15 V +2 CR +2 07/16/19, 13:48
-
Benjamin Franzke merged patch set 16 07/16/19, 13:48
-
TYPO3com voted on patch set 15 V +1 07/16/19, 13:50 Completed build in 11m 16s on Tue, 16 Jul, 03:50 PM Test Summary: 47118 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-35096
EventDispatcher.php:51