From b985813c56af6c92a72c7954de0779fe41d41228 Mon Sep 17 00:00:00 2001 From: Umherirrender Date: Mon, 10 Jun 2024 22:35:51 +0200 Subject: [PATCH] Use namespaced classes Changes to the use statements done automatically via script Addition of missing use statement done manually Change-Id: Ia08d43b3973a12b8e0628c8552bee1c4b702f249 --- .phan/stubs/FlaggedRevs.php | 1 + includes/ApiParsoidTrait.php | 4 +-- includes/ApiVisualEditor.php | 8 +++--- includes/ApiVisualEditorEdit.php | 6 ++--- includes/DirectParsoidClient.php | 2 +- includes/Hooks.php | 26 +++++++++---------- includes/SpecialCollabPad.php | 4 +-- includes/VisualEditorBeforeEditorHook.php | 2 +- includes/VisualEditorHookRunner.php | 2 +- includes/VisualEditorParsoidClientFactory.php | 2 +- tests/phpunit/ApiVisualEditorTest.php | 4 +-- 11 files changed, 31 insertions(+), 30 deletions(-) diff --git a/.phan/stubs/FlaggedRevs.php b/.phan/stubs/FlaggedRevs.php index fbf1dda1d7..439d6249fd 100644 --- a/.phan/stubs/FlaggedRevs.php +++ b/.phan/stubs/FlaggedRevs.php @@ -2,6 +2,7 @@ // @phpcs:disable MediaWiki.Files.ClassMatchesFilename.NotMatch +use MediaWiki\Context\ContextSource; use MediaWiki\Title\Title; /** diff --git a/includes/ApiParsoidTrait.php b/includes/ApiParsoidTrait.php index 1c4da35e9f..33b21a564c 100644 --- a/includes/ApiParsoidTrait.php +++ b/includes/ApiParsoidTrait.php @@ -14,17 +14,17 @@ use ApiUsageException; use Language; use Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface; use MediaWiki\MediaWikiServices; +use MediaWiki\Message\Message; +use MediaWiki\Request\WebRequest; use MediaWiki\Rest\HttpException; use MediaWiki\Rest\LocalizedHttpException; use MediaWiki\Revision\RevisionRecord; use MediaWiki\Title\Title; -use Message; use NullStatsdDataFactory; use PrefixingStatsdDataFactoryProxy; use Psr\Log\LoggerInterface; use Psr\Log\NullLogger; use Throwable; -use WebRequest; trait ApiParsoidTrait { diff --git a/includes/ApiVisualEditor.php b/includes/ApiVisualEditor.php index af60e6aed7..98f4e6f117 100644 --- a/includes/ApiVisualEditor.php +++ b/includes/ApiVisualEditor.php @@ -15,12 +15,13 @@ use ApiBlockInfoTrait; use ApiMain; use ApiResult; use Article; -use Config; use ContentHandler; -use DerivativeContext; use ExtensionRegistry; use IBufferingStatsdDataFactory; +use MediaWiki\Config\Config; use MediaWiki\Content\Transform\ContentTransformer; +use MediaWiki\Context\DerivativeContext; +use MediaWiki\Context\RequestContext; use MediaWiki\EditPage\EditPage; use MediaWiki\EditPage\IntroMessageBuilder; use MediaWiki\EditPage\PreloadedContentBuilder; @@ -36,12 +37,11 @@ use MediaWiki\SpecialPage\SpecialPageFactory; use MediaWiki\Title\Title; use MediaWiki\User\Options\UserOptionsLookup; use MediaWiki\User\TempUser\TempUserCreator; +use MediaWiki\User\User; use MediaWiki\User\UserFactory; use MediaWiki\User\UserIdentity; use MediaWiki\Watchlist\WatchlistManager; use MessageLocalizer; -use RequestContext; -use User; use Wikimedia\Assert\Assert; use Wikimedia\ParamValidator\ParamValidator; use WikitextContent; diff --git a/includes/ApiVisualEditorEdit.php b/includes/ApiVisualEditorEdit.php index 960e5c369f..3ace28128e 100644 --- a/includes/ApiVisualEditorEdit.php +++ b/includes/ApiVisualEditorEdit.php @@ -15,15 +15,17 @@ use ApiMain; use BagOStuff; use ContentHandler; use Deflate; -use DerivativeContext; use DifferenceEngine; use ExtensionRegistry; use FlaggablePageView; use IBufferingStatsdDataFactory; use IDBAccessObject; +use MediaWiki\Context\DerivativeContext; +use MediaWiki\Context\RequestContext; use MediaWiki\HookContainer\HookContainer; use MediaWiki\Logger\LoggerFactory; use MediaWiki\Page\WikiPageFactory; +use MediaWiki\Parser\Sanitizer; use MediaWiki\Request\DerivativeRequest; use MediaWiki\Revision\SlotRecord; use MediaWiki\SpecialPage\SpecialPageFactory; @@ -31,8 +33,6 @@ use MediaWiki\Storage\PageEditStash; use MediaWiki\Title\Title; use MediaWiki\User\UserIdentity; use ObjectCache; -use RequestContext; -use Sanitizer; use SkinFactory; use Wikimedia\ParamValidator\ParamValidator; diff --git a/includes/DirectParsoidClient.php b/includes/DirectParsoidClient.php index 2d7f081ce1..f1b01492d4 100644 --- a/includes/DirectParsoidClient.php +++ b/includes/DirectParsoidClient.php @@ -19,7 +19,7 @@ use MediaWiki\Rest\Handler\Helper\PageRestHelperFactory; use MediaWiki\Revision\MutableRevisionRecord; use MediaWiki\Revision\RevisionRecord; use MediaWiki\Revision\SlotRecord; -use User; +use MediaWiki\User\User; use Wikimedia\Bcp47Code\Bcp47Code; use WikitextContent; diff --git a/includes/Hooks.php b/includes/Hooks.php index 99df14d953..54fc937c44 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -11,51 +11,51 @@ namespace MediaWiki\Extension\VisualEditor; use Article; -use Config; -use DeferredUpdates; use ExtensionRegistry; -use Html; -use HTMLForm; -use IContextSource; use Language; use MediaWiki\Actions\ActionEntryPoint; use MediaWiki\Auth\Hook\UserLoggedInHook; use MediaWiki\ChangeTags\Hook\ChangeTagsListActiveHook; use MediaWiki\ChangeTags\Hook\ListDefinedTagsHook; +use MediaWiki\Config\Config; +use MediaWiki\Context\IContextSource; +use MediaWiki\Context\RequestContext; +use MediaWiki\Deferred\DeferredUpdates; use MediaWiki\Diff\Hook\DifferenceEngineViewHeaderHook; use MediaWiki\Diff\Hook\TextSlotDiffRendererTablePrefixHook; use MediaWiki\EditPage\EditPage; use MediaWiki\Extension\VisualEditor\EditCheck\ApiEditCheckReferenceUrl; use MediaWiki\Hook\BeforeInitializeHook; -use MediaWiki\Hook\BeforePageDisplayHook; use MediaWiki\Hook\CustomEditorHook; use MediaWiki\Hook\EditPage__showEditForm_fieldsHook; -use MediaWiki\Hook\MakeGlobalVariablesScriptHook; -use MediaWiki\Hook\OutputPageBodyAttributesHook; use MediaWiki\Hook\ParserTestGlobalsHook; use MediaWiki\Hook\RecentChange_saveHook; use MediaWiki\Hook\SkinEditSectionLinksHook; use MediaWiki\Hook\SkinTemplateNavigation__UniversalHook; +use MediaWiki\Html\Html; +use MediaWiki\HTMLForm\HTMLForm; use MediaWiki\MediaWikiServices; +use MediaWiki\Output\Hook\BeforePageDisplayHook; +use MediaWiki\Output\Hook\MakeGlobalVariablesScriptHook; +use MediaWiki\Output\Hook\OutputPageBodyAttributesHook; +use MediaWiki\Output\OutputPage; use MediaWiki\Preferences\Hook\GetPreferencesHook; use MediaWiki\Preferences\Hook\PreferencesFormPreSaveHook; +use MediaWiki\Request\WebRequest; use MediaWiki\ResourceLoader\Hook\ResourceLoaderGetConfigVarsHook; use MediaWiki\ResourceLoader\Hook\ResourceLoaderRegisterModulesHook; use MediaWiki\ResourceLoader\ResourceLoader; use MediaWiki\SpecialPage\Hook\RedirectSpecialArticleRedirectParamsHook; +use MediaWiki\SpecialPage\SpecialPage; use MediaWiki\Title\Title; +use MediaWiki\User\User; use MediaWiki\User\UserIdentity; use OOUI\ButtonGroupWidget; use OOUI\ButtonWidget; -use OutputPage; use RecentChange; -use RequestContext; use Skin; use SkinTemplate; -use SpecialPage; use TextSlotDiffRenderer; -use User; -use WebRequest; /** * @phpcs:disable MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName diff --git a/includes/SpecialCollabPad.php b/includes/SpecialCollabPad.php index ac42f6c5d4..6de7d62351 100644 --- a/includes/SpecialCollabPad.php +++ b/includes/SpecialCollabPad.php @@ -10,7 +10,9 @@ namespace MediaWiki\Extension\VisualEditor; +use MediaWiki\SpecialPage\SpecialPage; use MediaWiki\Title\Title; +use MediaWiki\User\User; use MediaWiki\Widget\TitleInputWidget; use OOUI\ActionFieldLayout; use OOUI\ButtonWidget; @@ -18,8 +20,6 @@ use OOUI\FieldsetLayout; use OOUI\FormLayout; use OOUI\ProgressBarWidget; use OOUI\TextInputWidget; -use SpecialPage; -use User; class SpecialCollabPad extends SpecialPage { diff --git a/includes/VisualEditorBeforeEditorHook.php b/includes/VisualEditorBeforeEditorHook.php index 89608a5d19..285223cc92 100644 --- a/includes/VisualEditorBeforeEditorHook.php +++ b/includes/VisualEditorBeforeEditorHook.php @@ -2,7 +2,7 @@ namespace MediaWiki\Extension\VisualEditor; -use OutputPage; +use MediaWiki\Output\OutputPage; use Skin; /** diff --git a/includes/VisualEditorHookRunner.php b/includes/VisualEditorHookRunner.php index ae88f8e2b1..2a5b547005 100644 --- a/includes/VisualEditorHookRunner.php +++ b/includes/VisualEditorHookRunner.php @@ -12,9 +12,9 @@ namespace MediaWiki\Extension\VisualEditor; */ use MediaWiki\HookContainer\HookContainer; +use MediaWiki\Output\OutputPage; use MediaWiki\Page\ProperPageIdentity; use MediaWiki\User\UserIdentity; -use OutputPage; use Skin; class VisualEditorHookRunner implements diff --git a/includes/VisualEditorParsoidClientFactory.php b/includes/VisualEditorParsoidClientFactory.php index caf7329f63..ae8f8f3dbe 100644 --- a/includes/VisualEditorParsoidClientFactory.php +++ b/includes/VisualEditorParsoidClientFactory.php @@ -2,9 +2,9 @@ namespace MediaWiki\Extension\VisualEditor; +use MediaWiki\Context\RequestContext; use MediaWiki\Permissions\Authority; use MediaWiki\Rest\Handler\Helper\PageRestHelperFactory; -use RequestContext; /** * @since 1.40 diff --git a/tests/phpunit/ApiVisualEditorTest.php b/tests/phpunit/ApiVisualEditorTest.php index 65a5ce4622..c37fcca0a4 100644 --- a/tests/phpunit/ApiVisualEditorTest.php +++ b/tests/phpunit/ApiVisualEditorTest.php @@ -2,10 +2,10 @@ namespace MediaWiki\Extension\VisualEditor\Tests; -use ApiTestCase; use ExtensionRegistry; -use HashConfig; +use MediaWiki\Config\HashConfig; use MediaWiki\Extension\VisualEditor\ApiVisualEditor; +use MediaWiki\Tests\Api\ApiTestCase; use Wikimedia\ScopedCallback; /**