From f3c4642fd5223dcfe415a52867e6b993e8311edc Mon Sep 17 00:00:00 2001 From: Umherirrender Date: Fri, 5 Jan 2024 22:41:45 +0100 Subject: [PATCH] Use namespaced classes Changes to the use statements done automatically via script Addition of missing use statement done manually Change-Id: Ib30da35841aadb558709dbbe6e30be2241048c87 --- includes/PopupsContext.php | 25 ++++++++++--------- includes/PopupsGadgetsIntegration.php | 11 ++++---- includes/PopupsHooks.php | 6 ++--- tests/phpunit/PopupsContextTest.php | 2 ++ tests/phpunit/PopupsContextTestWrapper.php | 1 + .../phpunit/PopupsGadgetsIntegrationTest.php | 2 ++ tests/phpunit/PopupsHooksTest.php | 3 +++ 7 files changed, 30 insertions(+), 20 deletions(-) diff --git a/includes/PopupsContext.php b/includes/PopupsContext.php index 41061cb8c..b97247f33 100644 --- a/includes/PopupsContext.php +++ b/includes/PopupsContext.php @@ -20,12 +20,13 @@ */ namespace Popups; -use Config; use ExtensionRegistry; +use MediaWiki\Config\Config; use MediaWiki\MediaWikiServices; use MediaWiki\SpecialPage\SpecialPageFactory; use MediaWiki\Title\Title; use MediaWiki\User\Options\UserOptionsLookup; +use MediaWiki\User\User; /** * Popups Module @@ -70,7 +71,7 @@ class PopupsContext { private const REFERENCE_PREVIEWS_ENABLED = 4; /** - * @var \Config + * @var Config */ private $config; @@ -123,18 +124,18 @@ class PopupsContext { } /** - * @param \User $user User whose gadgets settings are being checked + * @param User $user User whose gadgets settings are being checked * @return bool */ - public function conflictsWithNavPopupsGadget( \User $user ) { + public function conflictsWithNavPopupsGadget( User $user ) { return $this->gadgetsIntegration->conflictsWithNavPopupsGadget( $user ); } /** - * @param \User $user User whose gadgets settings are being checked + * @param User $user User whose gadgets settings are being checked * @return bool */ - public function conflictsWithRefTooltipsGadget( \User $user ) { + public function conflictsWithRefTooltipsGadget( User $user ) { return $this->gadgetsIntegration->conflictsWithRefTooltipsGadget( $user ); } @@ -148,10 +149,10 @@ class PopupsContext { } /** - * @param \User $user User whose preferences are checked + * @param User $user User whose preferences are checked * @return bool whether or not to show reference previews */ - public function isReferencePreviewsEnabled( \User $user ) { + public function isReferencePreviewsEnabled( User $user ) { if ( !$this->config->get( 'PopupsReferencePreviews' ) ) { return false; } @@ -162,20 +163,20 @@ class PopupsContext { } /** - * @param \User $user User whose preferences are checked + * @param User $user User whose preferences are checked * @return int */ - public function getConfigBitmaskFromUser( \User $user ) { + public function getConfigBitmaskFromUser( User $user ) { return ( $this->conflictsWithNavPopupsGadget( $user ) ? self::NAV_POPUPS_ENABLED : 0 ) | ( $this->conflictsWithRefTooltipsGadget( $user ) ? self::REF_TOOLTIPS_ENABLED : 0 ) | ( $this->isReferencePreviewsEnabled( $user ) ? self::REFERENCE_PREVIEWS_ENABLED : 0 ); } /** - * @param \User $user User whose preferences are checked + * @param User $user User whose preferences are checked * @return bool */ - public function shouldSendModuleToUser( \User $user ) { + public function shouldSendModuleToUser( User $user ) { if ( !$user->isNamed() ) { return true; } diff --git a/includes/PopupsGadgetsIntegration.php b/includes/PopupsGadgetsIntegration.php index 035b3b7ad..ca157eac7 100644 --- a/includes/PopupsGadgetsIntegration.php +++ b/includes/PopupsGadgetsIntegration.php @@ -19,9 +19,10 @@ */ namespace Popups; -use Config; use ExtensionRegistry; +use MediaWiki\Config\Config; use MediaWiki\Extension\Gadgets\GadgetRepo; +use MediaWiki\User\User; /** * Gadgets integration @@ -80,10 +81,10 @@ class PopupsGadgetsIntegration { * Check if Popups conflicts with Nav Popups Gadget * If user enabled Nav Popups, Popups is unavailable * - * @param \User $user User whose gadget settings are checked + * @param User $user User whose gadget settings are checked * @return bool */ - public function conflictsWithNavPopupsGadget( \User $user ) { + public function conflictsWithNavPopupsGadget( User $user ) { if ( $this->isGadgetExtensionEnabled() ) { $gadgetsRepo = GadgetRepo::singleton(); $match = array_search( $this->navPopupsGadgetName, $gadgetsRepo->getGadgetIds() ); @@ -103,10 +104,10 @@ class PopupsGadgetsIntegration { * Check if Popups conflicts with Ref Tooltips Gadget * If user enabled Ref Tooltip, Popups is unavailable * - * @param \User $user User whose gadget settings are checked + * @param User $user User whose gadget settings are checked * @return bool */ - public function conflictsWithRefTooltipsGadget( \User $user ) { + public function conflictsWithRefTooltipsGadget( User $user ) { if ( $this->isGadgetExtensionEnabled() ) { $gadgetsRepo = GadgetRepo::singleton(); $match = array_search( $this->refTooltipsGadgetName, $gadgetsRepo->getGadgetIds() ); diff --git a/includes/PopupsHooks.php b/includes/PopupsHooks.php index f2ccc7721..0876abc31 100644 --- a/includes/PopupsHooks.php +++ b/includes/PopupsHooks.php @@ -20,19 +20,19 @@ */ namespace Popups; -use Config; use ExtensionRegistry; use MediaWiki\Auth\Hook\LocalUserCreatedHook; +use MediaWiki\Config\Config; use MediaWiki\Hook\BeforePageDisplayHook; use MediaWiki\Hook\MakeGlobalVariablesScriptHook; use MediaWiki\MediaWikiServices; +use MediaWiki\Output\OutputPage; use MediaWiki\Preferences\Hook\GetPreferencesHook; use MediaWiki\ResourceLoader\Hook\ResourceLoaderGetConfigVarsHook; use MediaWiki\User\Hook\UserGetDefaultOptionsHook; use MediaWiki\User\Options\UserOptionsManager; -use OutputPage; +use MediaWiki\User\User; use Skin; -use User; /** * Hooks definitions for Popups extension diff --git a/tests/phpunit/PopupsContextTest.php b/tests/phpunit/PopupsContextTest.php index 8523e8ac9..4be56477d 100644 --- a/tests/phpunit/PopupsContextTest.php +++ b/tests/phpunit/PopupsContextTest.php @@ -19,8 +19,10 @@ * @ingroup extensions */ +use MediaWiki\Config\GlobalVarConfig; use MediaWiki\Title\Title; use MediaWiki\User\Options\UserOptionsLookup; +use MediaWiki\User\User; use PHPUnit\Framework\MockObject\Stub\ConsecutiveCalls; use Popups\PopupsContext; use Popups\PopupsGadgetsIntegration; diff --git a/tests/phpunit/PopupsContextTestWrapper.php b/tests/phpunit/PopupsContextTestWrapper.php index 4ae7462d1..5aaffd6f3 100644 --- a/tests/phpunit/PopupsContextTestWrapper.php +++ b/tests/phpunit/PopupsContextTestWrapper.php @@ -19,6 +19,7 @@ * @ingroup extensions */ +use MediaWiki\Config\Config; use MediaWiki\User\Options\UserOptionsLookup; use Popups\PopupsContext; use Popups\PopupsGadgetsIntegration; diff --git a/tests/phpunit/PopupsGadgetsIntegrationTest.php b/tests/phpunit/PopupsGadgetsIntegrationTest.php index 8b30c45bb..4a4cbff21 100644 --- a/tests/phpunit/PopupsGadgetsIntegrationTest.php +++ b/tests/phpunit/PopupsGadgetsIntegrationTest.php @@ -18,8 +18,10 @@ * @ingroup extensions */ +use MediaWiki\Config\Config; use MediaWiki\Extension\Gadgets\Gadget; use MediaWiki\Extension\Gadgets\GadgetRepo; +use MediaWiki\User\User; use PHPUnit\Framework\MockObject\MockObject; use Popups\PopupsGadgetsIntegration; diff --git a/tests/phpunit/PopupsHooksTest.php b/tests/phpunit/PopupsHooksTest.php index 03ab49eaa..050c6a748 100644 --- a/tests/phpunit/PopupsHooksTest.php +++ b/tests/phpunit/PopupsHooksTest.php @@ -19,7 +19,10 @@ * @ingroup extensions */ +use MediaWiki\Config\MultiConfig; +use MediaWiki\Output\OutputPage; use MediaWiki\User\Options\UserOptionsManager; +use MediaWiki\User\User; use Popups\PopupsContext; use Popups\PopupsHooks; use Psr\Log\LoggerInterface;