From 944153c15f053facd0ddda97efe0e8e087f7f106 Mon Sep 17 00:00:00 2001 From: Thiemo Kreuz Date: Wed, 16 Jan 2019 17:27:57 +0100 Subject: [PATCH] Add @var type hints to all MediaWikiServices::getService calls This makes the following code work much better in IDEs, e.g. it's now possible to click method names and actually go there. Change-Id: Iddbe838f1402c5017ffeb3bc03b4a017b05d8b02 --- includes/PopupsHooks.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/includes/PopupsHooks.php b/includes/PopupsHooks.php index 244b799ef..e04fea40c 100644 --- a/includes/PopupsHooks.php +++ b/includes/PopupsHooks.php @@ -40,6 +40,7 @@ class PopupsHooks { * @param array &$prefs Preferences description array, to be fed to a HTMLForm object */ public static function onGetPreferences( User $user, array &$prefs ) { + /** @var PopupsContext $context */ $context = MediaWikiServices::getInstance()->getService( 'Popups.Context' ); if ( !$context->showPreviewsOptInOnPreferencesPage() ) { @@ -82,6 +83,7 @@ class PopupsHooks { * @param Skin &$skin &Skin object that will be used to generate the page */ public static function onBeforePageDisplay( OutputPage &$out, Skin &$skin ) { + /** @var PopupsContext $context */ $context = MediaWikiServices::getInstance()->getService( 'Popups.Context' ); if ( $context->isTitleBlacklisted( $out->getTitle() ) ) { return; @@ -104,6 +106,7 @@ class PopupsHooks { * @param array &$vars Array of variables to be added into the output of the startup module */ public static function onResourceLoaderGetConfigVars( array &$vars ) { + /** @var \Config $conf */ $conf = MediaWikiServices::getInstance()->getService( 'Popups.Config' ); $vars['wgPopupsVirtualPageViews'] = $conf->get( 'PopupsVirtualPageViews' ); $vars['wgPopupsGateway'] = $conf->get( 'PopupsGateway' ); @@ -125,6 +128,7 @@ class PopupsHooks { * @param OutputPage $out OutputPage instance calling the hook */ public static function onMakeGlobalVariablesScript( array &$vars, OutputPage $out ) { + /** @var PopupsContext $context */ $context = MediaWikiServices::getInstance()->getService( 'Popups.Context' ); $user = $out->getUser(); @@ -139,6 +143,7 @@ class PopupsHooks { * @param array &$wgDefaultUserOptions Reference to default options array */ public static function onUserGetDefaultOptions( &$wgDefaultUserOptions ) { + /** @var \Config $config */ $config = MediaWikiServices::getInstance()->getService( 'Popups.Config' ); $wgDefaultUserOptions[ PopupsContext::PREVIEWS_OPTIN_PREFERENCE_NAME ] = @@ -153,6 +158,7 @@ class PopupsHooks { */ public static function onLocalUserCreated( User $user, $autocreated ) { // ignore the $autocreated flag, we always want to set PagePreviews visibility + /** @var \Config $config */ $config = MediaWikiServices::getInstance()->getService( 'Popups.Config' ); $user->setOption( PopupsContext::PREVIEWS_OPTIN_PREFERENCE_NAME,