Similar to OutputPageCheckLastModifiedHook,
which is also part of the ApiHookRunner
Follow-up: I5b41251ad95ea58153fb7e32dba62d407f0844ac
Change-Id: I439a208ea713e44b9603053987d9933ea6167c3a
Several important extensions (Disambiguator, ProofreadPage, and
SoftRedirector) use the GetLinkColours hook to add additional CSS
classes to links on article pages. Parsoid previously relied on
backdoor knowledge of the way Disambiguator used the page property
table to support these, but they should be exported properly from the
API.
Bug: T237538
Change-Id: I945940aa872541d7e01f1e543ca854231c857fe2
* Remove the mention of 'return true' being legal.
This is only allowed for compat with code from before MW 1.21,
when I added hook aborting as well as tolerance for null to
be the same as true.
Since then, there is no reason to return null or return true.
For early returns, an explicitly void 'return;' should be used
instead. Returning anything else like null/true serves no purpose
other than to confuse the reader.
* Mark the interfaces as natively 'void' with return type hints.
This means in core code that runs the hook, static analysis
like Phan and in IDEs, it will be known that these onFoo()s
never return a value, thus allowing them to detect if its
return value is assigned or used in a conditional for any
reason, which can be an easy mistake.
It also means that in the future when extensions start using
these interfaces in 'implements' statement, they will be
required to mark their hooks as void.
That migration is opt-in and still up ahead. This is not
a breaking change even for all existing extensions where
a return true/null may exist in an abortable hook since this
only applies to code directly typed against the interface.
The internal run() method doesn't care.
Change-Id: Ib79289bd486ac97cec492e72f9a8dee70cf2f6c2
These classes implement hook interfaces, providing implementations which
proxy calls to HookContainer::run().
To reduce the size of the HookRunner class, I split it into two parts:
one for the API and one for everything else. The API was the largest
identifiable component, and this matches the way we modularize i18n
files.
These two classes were originally generated by the hook interfaces
script. I've added abortable options for hooks that were
called with runWithAbort().
Bug: T240307
Change-Id: Id6789070bf830ecea271ddc74fa929e0bd39356d