From a51c9445671437d12be96cf17119772336568474 Mon Sep 17 00:00:00 2001 From: Umherirrender Date: Wed, 12 Jun 2024 20:31:47 +0200 Subject: [PATCH] Use namespaced classes Changes to the use statements done automatically via script Addition of missing use statement done manually Change-Id: I3d7a1ffe167b69d3f4ce51d0c248c758e1cdd70c --- includes/DataOutputFormatter.php | 2 +- includes/DiscussionParser.php | 4 ++-- includes/ForeignWikiRequest.php | 2 +- .../EchoEditUserPagePresentationModel.php | 2 +- includes/Formatters/EchoEventDigestFormatter.php | 2 +- includes/Formatters/EchoEventFormatter.php | 2 +- includes/Formatters/EchoEventPresentationModel.php | 2 +- .../Formatters/EchoPresentationModelSection.php | 2 +- includes/Hooks.php | 14 ++++++-------- includes/SchemaHooks.php | 2 +- includes/Special/NotificationPager.php | 2 +- .../SpecialDisplayNotificationsConfiguration.php | 2 +- includes/Special/SpecialNotificationsMarkRead.php | 2 +- tests/phpunit/Api/ApiEchoCreateEventTest.php | 1 + tests/phpunit/Api/ApiEchoMarkReadTest.php | 2 ++ tests/phpunit/Api/ApiEchoNotificationsTest.php | 2 ++ .../Push/ApiEchoPushSubscriptionsCreateTest.php | 1 + .../Push/ApiEchoPushSubscriptionsDeleteTest.php | 1 + .../Api/Push/ApiEchoPushSubscriptionsTest.php | 2 ++ tests/phpunit/NotificationsTest.php | 2 ++ tests/phpunit/TalkPageFunctionalTest.php | 1 + tests/phpunit/UserLocatorTest.php | 5 ++--- 22 files changed, 33 insertions(+), 24 deletions(-) diff --git a/includes/DataOutputFormatter.php b/includes/DataOutputFormatter.php index 45cde1f44..d82508e78 100644 --- a/includes/DataOutputFormatter.php +++ b/includes/DataOutputFormatter.php @@ -3,6 +3,7 @@ namespace MediaWiki\Extension\Notifications; use Language; +use MediaWiki\Context\RequestContext; use MediaWiki\Extension\Notifications\Formatters\EchoEventFormatter; use MediaWiki\Extension\Notifications\Formatters\EchoFlyoutFormatter; use MediaWiki\Extension\Notifications\Formatters\EchoModelFormatter; @@ -14,7 +15,6 @@ use MediaWiki\User\User; use MediaWiki\User\UserIdentity; use MediaWiki\Utils\MWTimestamp; use MediaWiki\WikiMap\WikiMap; -use RequestContext; /** * Utility class that formats a notification in the format specified diff --git a/includes/DiscussionParser.php b/includes/DiscussionParser.php index 0f41ae1b0..febc82acc 100644 --- a/includes/DiscussionParser.php +++ b/includes/DiscussionParser.php @@ -5,9 +5,11 @@ namespace MediaWiki\Extension\Notifications; use Article; use IDBAccessObject; use Language; +use MediaWiki\Context\RequestContext; use MediaWiki\Extension\Notifications\Hooks\HookRunner; use MediaWiki\Extension\Notifications\Model\Event; use MediaWiki\MediaWikiServices; +use MediaWiki\Parser\ParserOutput; use MediaWiki\Parser\Sanitizer; use MediaWiki\Revision\RevisionRecord; use MediaWiki\Revision\SlotRecord; @@ -15,8 +17,6 @@ use MediaWiki\Title\Title; use MediaWiki\User\User; use MediaWiki\User\UserNameUtils; use ParserOptions; -use ParserOutput; -use RequestContext; use RuntimeException; use TextContent; diff --git a/includes/ForeignWikiRequest.php b/includes/ForeignWikiRequest.php index dbd3d958a..00a2850a2 100644 --- a/includes/ForeignWikiRequest.php +++ b/includes/ForeignWikiRequest.php @@ -5,6 +5,7 @@ namespace MediaWiki\Extension\Notifications; use ApiMain; use CentralAuthSessionProvider; use Exception; +use MediaWiki\Context\RequestContext; use MediaWiki\Logger\LoggerFactory; use MediaWiki\MediaWikiServices; use MediaWiki\Request\FauxRequest; @@ -15,7 +16,6 @@ use MediaWiki\User\User; use MediaWiki\User\UserIdentity; use MediaWiki\WikiMap\WikiMap; use MWExceptionHandler; -use RequestContext; class ForeignWikiRequest { diff --git a/includes/Formatters/EchoEditUserPagePresentationModel.php b/includes/Formatters/EchoEditUserPagePresentationModel.php index d2c2e4939..54badbc74 100644 --- a/includes/Formatters/EchoEditUserPagePresentationModel.php +++ b/includes/Formatters/EchoEditUserPagePresentationModel.php @@ -4,9 +4,9 @@ namespace MediaWiki\Extension\Notifications\Formatters; use MediaWiki\Language\RawMessage; use MediaWiki\MediaWikiServices; +use MediaWiki\Message\Message; use MediaWiki\Parser\Sanitizer; use MediaWiki\Revision\RevisionRecord; -use Message; class EchoEditUserPagePresentationModel extends EchoEventPresentationModel { diff --git a/includes/Formatters/EchoEventDigestFormatter.php b/includes/Formatters/EchoEventDigestFormatter.php index c58266fc7..38f7933f8 100644 --- a/includes/Formatters/EchoEventDigestFormatter.php +++ b/includes/Formatters/EchoEventDigestFormatter.php @@ -4,8 +4,8 @@ namespace MediaWiki\Extension\Notifications\Formatters; use Language; use MediaWiki\Extension\Notifications\Model\Event; +use MediaWiki\Message\Message; use MediaWiki\User\User; -use Message; /** * Abstract class for formatters that process multiple events. diff --git a/includes/Formatters/EchoEventFormatter.php b/includes/Formatters/EchoEventFormatter.php index 7187dd72a..987af68d3 100644 --- a/includes/Formatters/EchoEventFormatter.php +++ b/includes/Formatters/EchoEventFormatter.php @@ -5,8 +5,8 @@ namespace MediaWiki\Extension\Notifications\Formatters; use Language; use MediaWiki\Extension\Notifications\Model\Event; use MediaWiki\Logger\LoggerFactory; +use MediaWiki\Message\Message; use MediaWiki\User\User; -use Message; /** * Abstract class that each "formatter" should implement. diff --git a/includes/Formatters/EchoEventPresentationModel.php b/includes/Formatters/EchoEventPresentationModel.php index 959cc3494..6547618f0 100644 --- a/includes/Formatters/EchoEventPresentationModel.php +++ b/includes/Formatters/EchoEventPresentationModel.php @@ -8,13 +8,13 @@ use Language; use MediaWiki\Extension\Notifications\Controller\NotificationController; use MediaWiki\Extension\Notifications\Model\Event; use MediaWiki\MediaWikiServices; +use MediaWiki\Message\Message; use MediaWiki\Revision\RevisionRecord; use MediaWiki\SpecialPage\SpecialPage; use MediaWiki\Title\Title; use MediaWiki\User\User; use MediaWiki\User\UserIdentity; use MediaWiki\WikiMap\WikiMap; -use Message; use MessageLocalizer; use MessageSpecifier; use Wikimedia\Timestamp\TimestampException; diff --git a/includes/Formatters/EchoPresentationModelSection.php b/includes/Formatters/EchoPresentationModelSection.php index d210b8896..965ac60fe 100644 --- a/includes/Formatters/EchoPresentationModelSection.php +++ b/includes/Formatters/EchoPresentationModelSection.php @@ -6,10 +6,10 @@ use BadMethodCallException; use Language; use MediaWiki\Extension\Notifications\DiscussionParser; use MediaWiki\Extension\Notifications\Model\Event; +use MediaWiki\Parser\Parser; use MediaWiki\Revision\RevisionRecord; use MediaWiki\Title\Title; use MediaWiki\User\User; -use Parser; /** * Component that represents a section of a page to be used from EchoEventPresentationModel subclass. diff --git a/includes/Hooks.php b/includes/Hooks.php index 0cc6b617a..241ce11b6 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -4,11 +4,8 @@ namespace MediaWiki\Extension\Notifications; use ApiModuleManager; use Content; -use EchoAttributeManager; -use EchoUserLocator; use EmailNotification; use ExtensionRegistry; -use HTMLCheckMatrix; use Language; use LogEntry; use LogicException; @@ -30,22 +27,23 @@ use MediaWiki\Extension\Notifications\Model\Event; use MediaWiki\Extension\Notifications\Model\Notification; use MediaWiki\Extension\Notifications\Push\Api\ApiEchoPushSubscriptions; use MediaWiki\Hook\AbortTalkPageEmailNotificationHook; -use MediaWiki\Hook\BeforePageDisplayHook; use MediaWiki\Hook\EmailUserCompleteHook; use MediaWiki\Hook\GetNewMessagesAlertHook; use MediaWiki\Hook\LinksUpdateCompleteHook; use MediaWiki\Hook\LoginFormValidErrorMessagesHook; -use MediaWiki\Hook\OutputPageCheckLastModifiedHook; use MediaWiki\Hook\PreferencesGetIconHook; use MediaWiki\Hook\RecentChange_saveHook; use MediaWiki\Hook\SendWatchlistEmailNotificationHook; use MediaWiki\Hook\SkinTemplateNavigation__UniversalHook; use MediaWiki\Hook\SpecialMuteModifyFormFieldsHook; use MediaWiki\HookContainer\HookContainer; +use MediaWiki\HTMLForm\Field\HTMLCheckMatrix; use MediaWiki\Linker\LinkRenderer; use MediaWiki\Logger\LoggerFactory; use MediaWiki\MainConfigNames; use MediaWiki\MediaWikiServices; +use MediaWiki\Output\Hook\BeforePageDisplayHook; +use MediaWiki\Output\Hook\OutputPageCheckLastModifiedHook; use MediaWiki\Output\OutputPage; use MediaWiki\Page\Hook\ArticleDeleteCompleteHook; use MediaWiki\Page\Hook\ArticleUndeleteHook; @@ -116,7 +114,7 @@ class Hooks implements private AuthManager $authManager; private CentralIdLookup $centralIdLookup; private Config $config; - private EchoAttributeManager $attributeManager; + private AttributeManager $attributeManager; private HookContainer $hookContainer; private Language $contentLanguage; private LinkRenderer $linkRenderer; @@ -135,7 +133,7 @@ class Hooks implements AuthManager $authManager, CentralIdLookup $centralIdLookup, Config $config, - EchoAttributeManager $attributeManager, + AttributeManager $attributeManager, HookContainer $hookContainer, Language $contentLanguage, LinkRenderer $linkRenderer, @@ -816,7 +814,7 @@ class Hooks implements $linkFromPageId = $linksUpdate->getTitle()->getArticleID(); // T318523: Don't send page-linked notifications for pages created by bot users. - $articleAuthor = EchoUserLocator::getArticleAuthorByArticleId( $title->getArticleID() ); + $articleAuthor = UserLocator::getArticleAuthorByArticleId( $title->getArticleID() ); if ( $articleAuthor && $articleAuthor->isBot() ) { continue; } diff --git a/includes/SchemaHooks.php b/includes/SchemaHooks.php index d3d7c4f21..a4a3fb409 100644 --- a/includes/SchemaHooks.php +++ b/includes/SchemaHooks.php @@ -2,7 +2,7 @@ namespace MediaWiki\Extension\Notifications; -use DatabaseUpdater; +use MediaWiki\Installer\DatabaseUpdater; use MediaWiki\Installer\Hook\LoadExtensionSchemaUpdatesHook; class SchemaHooks implements LoadExtensionSchemaUpdatesHook { diff --git a/includes/Special/NotificationPager.php b/includes/Special/NotificationPager.php index 623b4c5f9..50555f4c5 100644 --- a/includes/Special/NotificationPager.php +++ b/includes/Special/NotificationPager.php @@ -2,8 +2,8 @@ namespace MediaWiki\Extension\Notifications\Special; -use IContextSource; use LogicException; +use MediaWiki\Context\IContextSource; use MediaWiki\Extension\Notifications\DbFactory; use MediaWiki\Extension\Notifications\Model\Notification; use MediaWiki\Extension\Notifications\Services; diff --git a/includes/Special/SpecialDisplayNotificationsConfiguration.php b/includes/Special/SpecialDisplayNotificationsConfiguration.php index 8be1c4cc8..4e76e72c1 100644 --- a/includes/Special/SpecialDisplayNotificationsConfiguration.php +++ b/includes/Special/SpecialDisplayNotificationsConfiguration.php @@ -5,10 +5,10 @@ namespace MediaWiki\Extension\Notifications\Special; use MediaWiki\Extension\Notifications\AttributeManager; use MediaWiki\Extension\Notifications\Hooks as EchoHooks; use MediaWiki\Html\Html; +use MediaWiki\HTMLForm\OOUIHTMLForm; use MediaWiki\SpecialPage\UnlistedSpecialPage; use MediaWiki\User\Options\UserOptionsManager; use MediaWiki\User\User; -use OOUIHTMLForm; class SpecialDisplayNotificationsConfiguration extends UnlistedSpecialPage { /** diff --git a/includes/Special/SpecialNotificationsMarkRead.php b/includes/Special/SpecialNotificationsMarkRead.php index 80726b296..80accfd6e 100644 --- a/includes/Special/SpecialNotificationsMarkRead.php +++ b/includes/Special/SpecialNotificationsMarkRead.php @@ -2,8 +2,8 @@ namespace MediaWiki\Extension\Notifications\Special; -use HTMLForm; use MediaWiki\Extension\Notifications\NotifUser; +use MediaWiki\HTMLForm\HTMLForm; use MediaWiki\SpecialPage\FormSpecialPage; use MediaWiki\SpecialPage\SpecialPage; diff --git a/tests/phpunit/Api/ApiEchoCreateEventTest.php b/tests/phpunit/Api/ApiEchoCreateEventTest.php index ebcb8512f..69bf844b9 100644 --- a/tests/phpunit/Api/ApiEchoCreateEventTest.php +++ b/tests/phpunit/Api/ApiEchoCreateEventTest.php @@ -2,6 +2,7 @@ use MediaWiki\Extension\Notifications\Mapper\NotificationMapper; use MediaWiki\Extension\Notifications\NotifUser; +use MediaWiki\Tests\Api\ApiTestCase; /** * @group API diff --git a/tests/phpunit/Api/ApiEchoMarkReadTest.php b/tests/phpunit/Api/ApiEchoMarkReadTest.php index 28c2b9a63..efc20afe5 100644 --- a/tests/phpunit/Api/ApiEchoMarkReadTest.php +++ b/tests/phpunit/Api/ApiEchoMarkReadTest.php @@ -1,5 +1,7 @@ willReturn( User::newFromId( 123 ) ); $event->method( 'getType' ) ->willReturn( 'page-linked' ); - $this->assertEquals( [], EchoUserLocator::locateArticleCreator( $event ) ); + $this->assertEquals( [], UserLocator::locateArticleCreator( $event ) ); $normalUser = $this->getTestUser()->getUser(); $normalUser->addToDatabase(); @@ -145,7 +144,7 @@ class UserLocatorTest extends MediaWikiIntegrationTestCase { ->willReturn( 'page-linked' ); $this->assertEquals( $normalUser->getUser()->getId(), - array_key_first( EchoUserLocator::locateArticleCreator( $event ) ) + array_key_first( UserLocator::locateArticleCreator( $event ) ) ); }