I made this RFC: https://phabricator.wikimedia.org/T240307
TL;DR: we'll have one interface per hook, and that interface will be used for both calling and handling the hook.
It may seem like overkill, but on closer analysis, it actually seems to work pretty nicely. There will be a place for doc comments, arguments will be type-hinted, and smart code editors will be able to show the hook documentation when you call or handle it.
The main open questions are:
* Where to put the many core interfaces: together or grouped by module? * Should we split up the core HookRunner class by module? It contains one line of boilerplate code per hook.
Existing hook handling classes in extensions can be converted to the proposed system by:
* Changing all the handlers from static to non-static functions. * Adding the necessary "implements" clause. * Renaming any methods that do not already match the onHookName() pattern. * Tweaking extension.json slightly.
I'm going on vacation soon, so I'll be aiming to move this to last call early in the new year.
-- Tim Starling
wikitech-l@lists.wikimedia.org