From 4f661bfde729ed8b7c728d15d3aa92c58c35beb6 Mon Sep 17 00:00:00 2001 From: Umherirrender Date: Sat, 16 Sep 2023 22:01:20 +0200 Subject: [PATCH] Use HookHandlers for core hook Remove optional return value from hook handler Bug: T346497 Change-Id: I8c38733c5edebf7b3a49edd33474b7c1aa755659 --- extension.json | 9 ++++++--- includes/Hooks.php | 7 +++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/extension.json b/extension.json index 631bbfd..4d4fcf8 100644 --- a/extension.json +++ b/extension.json @@ -31,9 +31,12 @@ "MediaWiki\\Extension\\RSS\\": "includes/" }, "Hooks": { - "ParserFirstCallInit": [ - "MediaWiki\\Extension\\RSS\\Hooks::onParserFirstCallInit" - ] + "ParserFirstCallInit": "main" + }, + "HookHandlers": { + "main": { + "class": "MediaWiki\\Extension\\RSS\\Hooks" + } }, "TrackingCategories": [ "rss-tracking-category" diff --git a/includes/Hooks.php b/includes/Hooks.php index 9a77b5a..3fe9f65 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -2,22 +2,21 @@ namespace MediaWiki\Extension\RSS; +use MediaWiki\Hook\ParserFirstCallInitHook; use MWHttpRequest; use Parser; use PPFrame; use Status; -class Hooks { +class Hooks implements ParserFirstCallInitHook { /** * Tell the parser how to handle elements * @param Parser $parser Parser Object - * @return bool */ - public static function onParserFirstCallInit( $parser ) { + public function onParserFirstCallInit( $parser ) { // Install parser hook for tags $parser->setHook( 'rss', [ __CLASS__, 'renderRss' ] ); - return true; } /**