From 0739abc3728fb6c2fdd4bfcc14ddae1b075669d8 Mon Sep 17 00:00:00 2001 From: Daimona Eaytoy Date: Sun, 4 Oct 2020 17:25:40 +0200 Subject: [PATCH] Add typehints to three hooks The handlers for these have been typehinted in AbuseFilter for quite a long time, but switching to the new system requires removing them, see If699917c3d2e9e22525c7d0495554e25f6b45125. Note that this change preserves BC. Change-Id: I95bb47104ad3dc0a69c812c627ffa631c5dc6ace --- includes/HookContainer/HookRunner.php | 10 +++++++--- includes/actions/Hook/HistoryPageToolLinksHook.php | 2 +- includes/skins/Hook/UndeletePageToolLinksHook.php | 2 +- includes/specials/Hook/ContributionsToolLinksHook.php | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/includes/HookContainer/HookRunner.php b/includes/HookContainer/HookRunner.php index 5fb633dfc93..036e0dd518f 100644 --- a/includes/HookContainer/HookRunner.php +++ b/includes/HookContainer/HookRunner.php @@ -3,8 +3,12 @@ namespace MediaWiki\HookContainer; use Config; +use IContextSource; +use MediaWiki\Linker\LinkRenderer; use ResourceLoaderContext; use Skin; +use SpecialPage; +use Title; /** * This class provides an implementation of the core hook interfaces, @@ -1332,7 +1336,7 @@ class HookRunner implements ); } - public function onContributionsToolLinks( $id, $title, &$tools, $specialPage ) { + public function onContributionsToolLinks( $id, Title $title, array &$tools, SpecialPage $specialPage ) { return $this->container->run( 'ContributionsToolLinks', [ $id, $title, &$tools, $specialPage ] @@ -2014,7 +2018,7 @@ class HookRunner implements ); } - public function onHistoryPageToolLinks( $context, $linkRenderer, &$links ) { + public function onHistoryPageToolLinks( IContextSource $context, LinkRenderer $linkRenderer, array &$links ) { return $this->container->run( 'HistoryPageToolLinks', [ $context, $linkRenderer, &$links ] @@ -4039,7 +4043,7 @@ class HookRunner implements ); } - public function onUndeletePageToolLinks( $context, $linkRenderer, &$links ) { + public function onUndeletePageToolLinks( IContextSource $context, LinkRenderer $linkRenderer, array &$links ) { return $this->container->run( 'UndeletePageToolLinks', [ $context, $linkRenderer, &$links ] diff --git a/includes/actions/Hook/HistoryPageToolLinksHook.php b/includes/actions/Hook/HistoryPageToolLinksHook.php index ba0de65b30b..dcd4bc90f1d 100644 --- a/includes/actions/Hook/HistoryPageToolLinksHook.php +++ b/includes/actions/Hook/HistoryPageToolLinksHook.php @@ -23,5 +23,5 @@ interface HistoryPageToolLinksHook { * @param string[] &$links Array of HTML strings * @return bool|void True or no return value to continue or false to abort */ - public function onHistoryPageToolLinks( $context, $linkRenderer, &$links ); + public function onHistoryPageToolLinks( IContextSource $context, LinkRenderer $linkRenderer, array &$links ); } diff --git a/includes/skins/Hook/UndeletePageToolLinksHook.php b/includes/skins/Hook/UndeletePageToolLinksHook.php index d465d113f4f..57f1416c338 100644 --- a/includes/skins/Hook/UndeletePageToolLinksHook.php +++ b/includes/skins/Hook/UndeletePageToolLinksHook.php @@ -24,5 +24,5 @@ interface UndeletePageToolLinksHook { * @param string[] &$links Array of HTML strings * @return bool|void True or no return value to continue or false to abort */ - public function onUndeletePageToolLinks( $context, $linkRenderer, &$links ); + public function onUndeletePageToolLinks( IContextSource $context, LinkRenderer $linkRenderer, array &$links ); } diff --git a/includes/specials/Hook/ContributionsToolLinksHook.php b/includes/specials/Hook/ContributionsToolLinksHook.php index 3db9765cc21..c0c4df17fb4 100644 --- a/includes/specials/Hook/ContributionsToolLinksHook.php +++ b/includes/specials/Hook/ContributionsToolLinksHook.php @@ -26,5 +26,5 @@ interface ContributionsToolLinksHook { * hint against a generic SpecialPage though. * @return bool|void True or no return value to continue or false to abort */ - public function onContributionsToolLinks( $id, $title, &$tools, $specialPage ); + public function onContributionsToolLinks( $id, Title $title, array &$tools, SpecialPage $specialPage ); }