Hi,
For the past few weeks I've been working[1] on rewriting Linker::link() to be non-static, use LinkTarget/TitleValue and some of the other fancy new services stuff. Yay!
For the most part, you'd use it in similar ways: Linker::link( $title, $html, $attribs, $query ); is now: $linkRenderer = MediaWikiServices::getInstance() ->getHtmlPageLinkRenderer(); $linkRenderer->makeLink( $title, $html, $attribs, $query );
And there are makeKnownLink() and makeBrokenLink() entry points as well.
Unlike Linker::link(), there is no $options parameter to pass in every time a link needs to be made. Those options are set on the HtmlPageLinkRenderer instance, and then applied to all links made using it. MediaWikiServices has an instance using the default settings, but other classes like Parser will have their own that should be used[2].
I'm also deprecating the two hooks called by Linker::link(), LinkBegin and LinkEnd. They are being replaced by the mostly-equivalent HtmlPageLinkRendererBegin and HtmlPageLinkRendererEnd hooks. More details are in the commit message. [3] is an example conversion for Wikibase.
The commit is still a WIP because I haven't gotten around to writing specific tests for it (it passes all the pre-existing Linker and parser tests though!), and will be doing that in the next few days.
Regardless, reviews / comments / feedback on [1] is appreciated!
[1] https://gerrit.wikimedia.org/r/#/c/284750/ [2] https://gerrit.wikimedia.org/r/#/c/288572/ [3] https://gerrit.wikimedia.org/r/#/c/288674/
-- Legoktm