mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-28 01:10:04 +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
|
* @param array &$prefs Preferences description array, to be fed to a HTMLForm object
|
||||||
*/
|
*/
|
||||||
public static function onGetPreferences( User $user, array &$prefs ) {
|
public static function onGetPreferences( User $user, array &$prefs ) {
|
||||||
|
/** @var PopupsContext $context */
|
||||||
$context = MediaWikiServices::getInstance()->getService( 'Popups.Context' );
|
$context = MediaWikiServices::getInstance()->getService( 'Popups.Context' );
|
||||||
|
|
||||||
if ( !$context->showPreviewsOptInOnPreferencesPage() ) {
|
if ( !$context->showPreviewsOptInOnPreferencesPage() ) {
|
||||||
|
@ -82,6 +83,7 @@ class PopupsHooks {
|
||||||
* @param Skin &$skin &Skin object that will be used to generate the page
|
* @param Skin &$skin &Skin object that will be used to generate the page
|
||||||
*/
|
*/
|
||||||
public static function onBeforePageDisplay( OutputPage &$out, Skin &$skin ) {
|
public static function onBeforePageDisplay( OutputPage &$out, Skin &$skin ) {
|
||||||
|
/** @var PopupsContext $context */
|
||||||
$context = MediaWikiServices::getInstance()->getService( 'Popups.Context' );
|
$context = MediaWikiServices::getInstance()->getService( 'Popups.Context' );
|
||||||
if ( $context->isTitleBlacklisted( $out->getTitle() ) ) {
|
if ( $context->isTitleBlacklisted( $out->getTitle() ) ) {
|
||||||
return;
|
return;
|
||||||
|
@ -104,6 +106,7 @@ class PopupsHooks {
|
||||||
* @param array &$vars Array of variables to be added into the output of the startup module
|
* @param array &$vars Array of variables to be added into the output of the startup module
|
||||||
*/
|
*/
|
||||||
public static function onResourceLoaderGetConfigVars( array &$vars ) {
|
public static function onResourceLoaderGetConfigVars( array &$vars ) {
|
||||||
|
/** @var \Config $conf */
|
||||||
$conf = MediaWikiServices::getInstance()->getService( 'Popups.Config' );
|
$conf = MediaWikiServices::getInstance()->getService( 'Popups.Config' );
|
||||||
$vars['wgPopupsVirtualPageViews'] = $conf->get( 'PopupsVirtualPageViews' );
|
$vars['wgPopupsVirtualPageViews'] = $conf->get( 'PopupsVirtualPageViews' );
|
||||||
$vars['wgPopupsGateway'] = $conf->get( 'PopupsGateway' );
|
$vars['wgPopupsGateway'] = $conf->get( 'PopupsGateway' );
|
||||||
|
@ -125,6 +128,7 @@ class PopupsHooks {
|
||||||
* @param OutputPage $out OutputPage instance calling the hook
|
* @param OutputPage $out OutputPage instance calling the hook
|
||||||
*/
|
*/
|
||||||
public static function onMakeGlobalVariablesScript( array &$vars, OutputPage $out ) {
|
public static function onMakeGlobalVariablesScript( array &$vars, OutputPage $out ) {
|
||||||
|
/** @var PopupsContext $context */
|
||||||
$context = MediaWikiServices::getInstance()->getService( 'Popups.Context' );
|
$context = MediaWikiServices::getInstance()->getService( 'Popups.Context' );
|
||||||
$user = $out->getUser();
|
$user = $out->getUser();
|
||||||
|
|
||||||
|
@ -139,6 +143,7 @@ class PopupsHooks {
|
||||||
* @param array &$wgDefaultUserOptions Reference to default options array
|
* @param array &$wgDefaultUserOptions Reference to default options array
|
||||||
*/
|
*/
|
||||||
public static function onUserGetDefaultOptions( &$wgDefaultUserOptions ) {
|
public static function onUserGetDefaultOptions( &$wgDefaultUserOptions ) {
|
||||||
|
/** @var \Config $config */
|
||||||
$config = MediaWikiServices::getInstance()->getService( 'Popups.Config' );
|
$config = MediaWikiServices::getInstance()->getService( 'Popups.Config' );
|
||||||
|
|
||||||
$wgDefaultUserOptions[ PopupsContext::PREVIEWS_OPTIN_PREFERENCE_NAME ] =
|
$wgDefaultUserOptions[ PopupsContext::PREVIEWS_OPTIN_PREFERENCE_NAME ] =
|
||||||
|
@ -153,6 +158,7 @@ class PopupsHooks {
|
||||||
*/
|
*/
|
||||||
public static function onLocalUserCreated( User $user, $autocreated ) {
|
public static function onLocalUserCreated( User $user, $autocreated ) {
|
||||||
// ignore the $autocreated flag, we always want to set PagePreviews visibility
|
// ignore the $autocreated flag, we always want to set PagePreviews visibility
|
||||||
|
/** @var \Config $config */
|
||||||
$config = MediaWikiServices::getInstance()->getService( 'Popups.Config' );
|
$config = MediaWikiServices::getInstance()->getService( 'Popups.Config' );
|
||||||
|
|
||||||
$user->setOption( PopupsContext::PREVIEWS_OPTIN_PREFERENCE_NAME,
|
$user->setOption( PopupsContext::PREVIEWS_OPTIN_PREFERENCE_NAME,
|
||||||
|
|
Loading…
Reference in a new issue