I was thinking whether this is an opportunity to make all the hooks implement a class interface. From a code quality point of view it would be an improvement, with minimal code complexity cost due to it being wrappable inside the new API.
However, I don't like the performance implications. For each hook type we'd need to load up another file that defines the interface, then PHP would need to check interface rules at run-time. That's actually not at all trivial - if you consider a page using 20 hook types, that's 20 extra PHP files loaded. So I think it's best to leave that. It makes more sense for compiled languages.
0 guests and 0 members have recently viewed this.
Leader-board Top Weekly Earners
The top 2 point earners from 29th Mar 2026 to 5th Apr 2026.
However, I don't like the performance implications. For each hook type we'd need to load up another file that defines the interface, then PHP would need to check interface rules at run-time. That's actually not at all trivial - if you consider a page using 20 hook types, that's 20 extra PHP files loaded. So I think it's best to leave that. It makes more sense for compiled languages.