Follow-up from https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/WikimediaEvents/+/571565/2/includes/PrefUpdateInstrumentation.php@40.
This is fairly common pattern. While it's hard to statically detect this scenario with absolute certainty, perhaps we can develop something simple with no realistic false positive and yet still catch more of the problem.
The objective being that we flag any definitions hook functions that are known to be non-abortable and disallow use of @return bool or @return true in their doc comment, and disallow return true; in their function bodies.
In terms of heuristics, I'm not sure what the best approach will me. Maybe something as basic as static on* functions in *Hooks class, where the function name is compared against a list of known non-abortable hooks (the same way we do for discouraged/deprecated functions etc.).
Or perhaps instead of a stateless heuristic, we could read extension.json which get us wider range of possible ways to define hooks in favour of something a little less neat code-wise?