mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-23 23:24:39 +00:00
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
This commit is contained in:
parent
20327ab718
commit
944153c15f
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue