69495[FEATURE] Auto-detect event types on listener services
Commit message
Review
-
Code review CR +2 Done
- Benjamin Franzke +2
- Christian Kuhn +1
-
Verified V +2 Done
- Benjamin Franzke +2
- Christian Kuhn +1
- core-ci +1 CI
Issues 1
Files 15
- typo3/sysext/backend/Configuration/Services.yaml+0 −2
- typo3/sysext/belog/Configuration/Services.yaml+0 −1
- typo3/sysext/core/Classes/DependencyInjection/ListenerProviderPass.php8+92 −20
- typo3/sysext/core/Configuration/Services.yaml+0 −10
- typo3/sysext/core/Documentation/Changelog/master/Feature-94345-AutoDetectEventTypes.rstnew+59 −0
- typo3/sysext/form/Configuration/Services.yaml+0 −7
- typo3/sysext/frontend/Configuration/Services.yaml+0 −1
- typo3/sysext/indexed_search/Configuration/Services.yaml+0 −1
- typo3/sysext/linkvalidator/Configuration/Services.yaml+0 −3
- typo3/sysext/recordlist/Configuration/Services.yaml+0 −1
- typo3/sysext/redirects/Classes/EventListener/RecordHistoryRollbackEventsListener.php2+4 −2
- typo3/sysext/redirects/Configuration/Services.yaml+0 −2
- typo3/sysext/scheduler/Configuration/Services.yaml+0 −1
- typo3/sysext/seo/Configuration/Services.yaml+0 −1
- typo3/sysext/sys_note/Configuration/Services.yaml+0 −1
Review log 2436
Show 611 earlier messages
-
crell uploaded patch set 1 06/14/21, 21:24
-
core-ci voted on patch set 1 V -1 06/14/21, 21:27 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12433
-
crell uploaded patch set 2 06/14/21, 21:35
-
core-ci voted on patch set 2 V -1 06/14/21, 21:43 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12434
-
crell uploaded patch set 3 06/14/21, 21:51
-
core-ci voted on patch set 3 V -1 06/14/21, 22:00 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12435
-
crell uploaded patch set 4 06/15/21, 14:51
-
core-ci voted on patch set 4 V -1 06/15/21, 14:59 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12451
-
crell uploaded patch set 5 06/15/21, 15:57
-
core-ci voted on patch set 5 V +1 06/15/21, 16:09 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12452
-
Christian Kuhn uploaded patch set 6 06/16/21, 19:44
-
Christian Kuhn commented on patch set 6 CR -1 06/16/21, 19:46
Fine with me in general (didn't test yet, but that should be easy). One thing left: All core-registered listeners should be adapted. A helper: find . -name \*Services.yaml* -print -exec grep event {} \; And please verify all listeners actually have the correct signature along the way. -
core-ci voted on patch set 6 V +1 06/16/21, 19:55 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12507
-
Benjamin Franzke wrote 06/16/21, 20:15
Topic set to di -
crell commented on patch set 6 06/16/21, 20:54
Reply
Cool. I wanted to verify everything else was good before I went through and converted everything, so that's the next proper step. -
Benjamin Franzke commented on patch set 6 CR -1 06/16/21, 20:56
Hey, I don't really like that the descriptiveness of the configuration decreases, but the removed redundancy and static analysis kinda outweighs this. So fine with me in general, so just some remarks..ListenerProviderPass.php:61This is an invalid state, so we should either don't check at all, or throw a RuntimeException instead of a silent continue. Goes inline with code in vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php::getReflectionMethod which throws an exception as well.ListenerProviderPass.php:64I would consider reflection as autowiring, therefore we should only do this if the Definition has `autowire: true` (which is what we usually define in _defaults). So additionally check for $service->isAutowired().ListenerProviderPass.php:108Now that we autodetect the type (with the intention to decrease programming errors, right?) we should also check if the method a) is available and b) public, So similar as done in vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php::getReflectionMethod Wonder if we should simply extend from AbstractRecursivePass (without using it's process() method) in order to use the existing getReflectionMethod() method from symfony/dependnecy-injection, which does most things we "want". -
crell commented on patch set 6 06/16/21, 22:41
Reply
DoneListenerProviderPass.php:61ReplyThis was left over from trying to get PHPStan to not whine about passing a string instead of a class-string to reflection. Will remove.ListenerProviderPass.php:64ReplyI am not convinced of this, personally, but if that's generally defaulted to on anyway I am not going to make a fuss about it. :-)ListenerProviderPass.php:108ReplyI looked at that method, and it isn't quite usable as is. It's too tied into the recursion logic. So I stole^W borrowed the code and tweaked it as needed. I also filed an issue with Symfony to maybe split them off to be more useful later (https://github.com/symfony/symfony/issues/41726), though now that I've done it I don't know if reusable versions would actually be reusable. I also did some other cleanup and refactoring while I was at it, so I think the code is cleaner now, with more error bail outs. -
crell uploaded patch set 7 06/16/21, 22:42
-
core-ci voted on patch set 7 V -1 06/16/21, 22:44 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12518
-
crell uploaded patch set 8 06/17/21, 14:14
-
core-ci voted on patch set 8 V -1 06/17/21, 14:17 Core CI is not happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12543
-
crell uploaded patch set 9 06/17/21, 14:26
-
core-ci voted on patch set 9 V +1 06/17/21, 14:39 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12544
-
Christian Kuhn uploaded patch set 10 06/17/21, 16:49
-
Christian Kuhn uploaded patch set 11 06/17/21, 16:53
-
Christian Kuhn voted on patch set 11 V +1 CR +1 06/17/21, 16:55
-
core-ci voted on patch set 10 V +1 06/17/21, 17:00 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12556
-
core-ci voted on patch set 11 V +1 06/17/21, 17:03 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12557
-
Benjamin Franzke commented on patch set 11 V -1 CR -1 06/17/21, 19:11
Comparing the DependencyInjection cache with and without this patch applied reveals that the we got one event-changed (because a typo in RecordHistoryRollbackEventsListener.php in this patch): diff /tmp/DependencyInjectionContainer_d6e10681ce15b967e133872f13c191a17cf393f0.php typo3temp/var/cache/code/di/DependencyInjectionContainer_d6e10681ce15b967e133872f13c191a17cf393f0.php 5066,5067c5066,5067 < $a->addListener('TYPO3\\CMS\\Backend\\History\\Event\\BeforeHistoryRollbackStartEvent', 'TYPO3\\CMS\\Redirects\\EventListener\\RecordHistoryRollbackEventsListener', 'beforeHistoryRollbackStartEvent'); < $a->addListener('TYPO3\\CMS\\Backend\\History\\Event\\AfterHistoryRollbackFinishedEvent', 'TYPO3\\CMS\\Redirects\\EventListener\\RecordHistoryRollbackEventsListener', 'afterHistoryRollbackFinishedEvent'); --- > $a->addListener('TYPO3\\CMS\\Backend\\History\\Event\\AfterHistoryRollbackFinishedEvent', 'TYPO3\\CMS\\Redirects\\EventListener\\RecordHistoryRollbackEventsListener', 'beforeHistoryRollbackStartEvent'); > $a->addListener('TYPO3\\CMS\\Backend\\History\\Event\\BeforeHistoryRollbackStartEvent', 'TYPO3\\CMS\\Redirects\\EventListener\\RecordHistoryRollbackEventsListener', 'afterHistoryRollbackFinishedEvent'); Will fix.RecordHistoryRollbackEventsListener.php:26Event types are swapped in here and the following method. -
Benjamin Franzke uploaded patch set 12 06/17/21, 19:13
-
Benjamin Franzke commented on patch set 12 06/17/21, 19:13
RecordHistoryRollbackEventsListener.php:26ReplyDone -
Benjamin Franzke commented on patch set 12 CR +1 06/17/21, 19:25
ListenerProviderPass.php:64ReplyThanks.ListenerProviderPass.php:108ReplyThanks, yea, good approach. Copying that is good as well, for now… -
Christian Kuhn voted on patch set 12 V +1 CR +1 06/17/21, 19:25
-
core-ci voted on patch set 12 V +1 06/17/21, 19:25 Core CI is happy: https://gitlab.typo3.org/TYPO3/CI/cms/-/pipelines/12561
-
Benjamin Franzke voted on patch set 12 V +2 CR +2 06/17/21, 19:25
-
Benjamin Franzke merged patch set 13 06/17/21, 19:25