From 81d0c7bcd49d023122616cbaaacf6cfc21bc5226 Mon Sep 17 00:00:00 2001 From: Umherirrender Date: Sat, 8 Jun 2024 23:46:45 +0200 Subject: [PATCH] Use namespaced classes Changes to the use statements done automatically via script Addition of missing use statement done manually Change-Id: I325f5bab163cddf76dbf8d5a6eca35a7ed7b6df7 --- FancyCaptcha/includes/FancyCaptcha.php | 2 +- FancyCaptcha/includes/HTMLFancyCaptchaField.php | 2 +- QuestyCaptcha/includes/QuestyCaptcha.php | 2 +- .../includes/HTMLReCaptchaNoCaptchaField.php | 2 +- ReCaptchaNoCaptcha/includes/ReCaptchaNoCaptcha.php | 2 +- SimpleCaptcha/SimpleCaptcha.php | 8 ++++---- Turnstile/includes/HTMLTurnstileField.php | 4 ++-- Turnstile/includes/Turnstile.php | 8 ++++---- hCaptcha/includes/HCaptcha.php | 4 ++-- hCaptcha/includes/HTMLHCaptchaField.php | 2 +- includes/Auth/LoginAttemptCounter.php | 2 +- includes/Hooks.php | 6 +++--- tests/phpunit/CaptchaAuthenticationRequestTest.php | 2 +- tests/phpunit/CaptchaPreAuthenticationProviderTest.php | 1 + tests/phpunit/HTMLFancyCaptchaFieldTest.php | 3 +++ tests/phpunit/HTMLReCaptchaNoCaptchaFieldTest.php | 3 +++ .../ReCaptchaNoCaptchaAuthenticationRequestTest.php | 2 +- tests/phpunit/SimpleCaptcha/CaptchaTest.php | 1 + 18 files changed, 32 insertions(+), 24 deletions(-) diff --git a/FancyCaptcha/includes/FancyCaptcha.php b/FancyCaptcha/includes/FancyCaptcha.php index 18b7e741a..3df08fc04 100644 --- a/FancyCaptcha/includes/FancyCaptcha.php +++ b/FancyCaptcha/includes/FancyCaptcha.php @@ -7,6 +7,7 @@ use FSFileBackend; use InvalidArgumentException; use MediaWiki\Auth\AuthenticationRequest; use MediaWiki\Auth\AuthManager; +use MediaWiki\Context\RequestContext; use MediaWiki\Extension\ConfirmEdit\Auth\CaptchaAuthenticationRequest; use MediaWiki\Extension\ConfirmEdit\SimpleCaptcha\SimpleCaptcha; use MediaWiki\Html\Html; @@ -16,7 +17,6 @@ use MediaWiki\Utils\MWTimestamp; use MediaWiki\WikiMap\WikiMap; use NullLockManager; use ObjectCache; -use RequestContext; use StatusValue; use UnderflowException; diff --git a/FancyCaptcha/includes/HTMLFancyCaptchaField.php b/FancyCaptcha/includes/HTMLFancyCaptchaField.php index 9cb136a5d..630fa2112 100644 --- a/FancyCaptcha/includes/HTMLFancyCaptchaField.php +++ b/FancyCaptcha/includes/HTMLFancyCaptchaField.php @@ -2,8 +2,8 @@ namespace MediaWiki\Extension\ConfirmEdit\FancyCaptcha; -use HTMLFormField; use MediaWiki\Html\Html; +use MediaWiki\HTMLForm\HTMLFormField; /** * Captcha input field for FancyCaptcha that displays a question and returns the answer. diff --git a/QuestyCaptcha/includes/QuestyCaptcha.php b/QuestyCaptcha/includes/QuestyCaptcha.php index d070141e2..aac3ea4d4 100644 --- a/QuestyCaptcha/includes/QuestyCaptcha.php +++ b/QuestyCaptcha/includes/QuestyCaptcha.php @@ -11,11 +11,11 @@ namespace MediaWiki\Extension\ConfirmEdit\QuestyCaptcha; use MediaWiki\Auth\AuthenticationRequest; +use MediaWiki\Context\RequestContext; use MediaWiki\Extension\ConfirmEdit\Auth\CaptchaAuthenticationRequest; use MediaWiki\Extension\ConfirmEdit\SimpleCaptcha\SimpleCaptcha; use MediaWiki\Extension\ConfirmEdit\Store\CaptchaStore; use MediaWiki\Html\Html; -use RequestContext; use Xml; class QuestyCaptcha extends SimpleCaptcha { diff --git a/ReCaptchaNoCaptcha/includes/HTMLReCaptchaNoCaptchaField.php b/ReCaptchaNoCaptcha/includes/HTMLReCaptchaNoCaptchaField.php index 0f0375e80..d6e4765fd 100644 --- a/ReCaptchaNoCaptcha/includes/HTMLReCaptchaNoCaptchaField.php +++ b/ReCaptchaNoCaptcha/includes/HTMLReCaptchaNoCaptchaField.php @@ -2,8 +2,8 @@ namespace MediaWiki\Extension\ConfirmEdit\ReCaptchaNoCaptcha; -use HTMLFormField; use MediaWiki\Html\Html; +use MediaWiki\HTMLForm\HTMLFormField; /** * Creates a ReCaptcha v2 widget. Does not return any data; handling the data submitted by the diff --git a/ReCaptchaNoCaptcha/includes/ReCaptchaNoCaptcha.php b/ReCaptchaNoCaptcha/includes/ReCaptchaNoCaptcha.php index 53a0ffcfa..162185231 100644 --- a/ReCaptchaNoCaptcha/includes/ReCaptchaNoCaptcha.php +++ b/ReCaptchaNoCaptcha/includes/ReCaptchaNoCaptcha.php @@ -11,9 +11,9 @@ use MediaWiki\Extension\ConfirmEdit\SimpleCaptcha\SimpleCaptcha; use MediaWiki\Html\Html; use MediaWiki\Language\RawMessage; use MediaWiki\MediaWikiServices; +use MediaWiki\Message\Message; use MediaWiki\Request\WebRequest; use MediaWiki\Status\Status; -use Message; class ReCaptchaNoCaptcha extends SimpleCaptcha { // used for renocaptcha-edit, renocaptcha-addurl, renocaptcha-badlogin, renocaptcha-createaccount, diff --git a/SimpleCaptcha/SimpleCaptcha.php b/SimpleCaptcha/SimpleCaptcha.php index 38673f2e0..8e3337623 100644 --- a/SimpleCaptcha/SimpleCaptcha.php +++ b/SimpleCaptcha/SimpleCaptcha.php @@ -6,14 +6,14 @@ use ApiBase; use ApiEditPage; use Content; use ExtensionRegistry; -use HTMLForm; -use IContextSource; use IDBAccessObject; use MailAddress; use MediaWiki\Auth\AuthenticationRequest; use MediaWiki\Cache\CacheKeyHelper; use MediaWiki\Config\Config; use MediaWiki\Config\ConfigException; +use MediaWiki\Context\IContextSource; +use MediaWiki\Context\RequestContext; use MediaWiki\EditPage\EditPage; use MediaWiki\Extension\ConfirmEdit\Auth\CaptchaAuthenticationRequest; use MediaWiki\Extension\ConfirmEdit\CaptchaTriggers; @@ -21,7 +21,9 @@ use MediaWiki\Extension\ConfirmEdit\Hooks\HookRunner; use MediaWiki\Extension\ConfirmEdit\Store\CaptchaStore; use MediaWiki\ExternalLinks\ExternalLinksLookup; use MediaWiki\ExternalLinks\LinkFilter; +use MediaWiki\HTMLForm\HTMLForm; use MediaWiki\MediaWikiServices; +use MediaWiki\Message\Message; use MediaWiki\Output\OutputPage; use MediaWiki\Request\ContentSecurityPolicy; use MediaWiki\Request\WebRequest; @@ -30,12 +32,10 @@ use MediaWiki\Revision\SlotRecord; use MediaWiki\Status\Status; use MediaWiki\Title\Title; use MediaWiki\User\User; -use Message; use OOUI\FieldLayout; use OOUI\HiddenInputWidget; use OOUI\NumberInputWidget; use ParserOptions; -use RequestContext; use TextContent; use UnexpectedValueException; use Wikimedia\IPUtils; diff --git a/Turnstile/includes/HTMLTurnstileField.php b/Turnstile/includes/HTMLTurnstileField.php index ca9618454..00f00de04 100644 --- a/Turnstile/includes/HTMLTurnstileField.php +++ b/Turnstile/includes/HTMLTurnstileField.php @@ -2,8 +2,8 @@ namespace MediaWiki\Extension\ConfirmEdit\Turnstile; -use Html; -use HTMLFormField; +use MediaWiki\Html\Html; +use MediaWiki\HTMLForm\HTMLFormField; /** * Creates a Turnstile widget. Does not return any data; handling the data submitted by the diff --git a/Turnstile/includes/Turnstile.php b/Turnstile/includes/Turnstile.php index 8cd12face..ca2201de7 100644 --- a/Turnstile/includes/Turnstile.php +++ b/Turnstile/includes/Turnstile.php @@ -4,16 +4,16 @@ namespace MediaWiki\Extension\ConfirmEdit\Turnstile; use ApiBase; use FormatJson; -use Html; use MediaWiki\Auth\AuthenticationRequest; use MediaWiki\Extension\ConfirmEdit\Auth\CaptchaAuthenticationRequest; use MediaWiki\Extension\ConfirmEdit\Hooks; use MediaWiki\Extension\ConfirmEdit\SimpleCaptcha\SimpleCaptcha; +use MediaWiki\Html\Html; use MediaWiki\Language\RawMessage; use MediaWiki\MediaWikiServices; -use Message; -use Status; -use WebRequest; +use MediaWiki\Message\Message; +use MediaWiki\Request\WebRequest; +use MediaWiki\Status\Status; class Turnstile extends SimpleCaptcha { // used for turnstile-edit, turnstile-addurl, turnstile-badlogin, turnstile-createaccount, diff --git a/hCaptcha/includes/HCaptcha.php b/hCaptcha/includes/HCaptcha.php index 838c67e02..b699f6f2e 100644 --- a/hCaptcha/includes/HCaptcha.php +++ b/hCaptcha/includes/HCaptcha.php @@ -5,17 +5,17 @@ namespace MediaWiki\Extension\ConfirmEdit\hCaptcha; use ApiBase; use FormatJson; use MediaWiki\Auth\AuthenticationRequest; +use MediaWiki\Context\RequestContext; use MediaWiki\Extension\ConfirmEdit\Auth\CaptchaAuthenticationRequest; use MediaWiki\Extension\ConfirmEdit\Hooks; use MediaWiki\Extension\ConfirmEdit\SimpleCaptcha\SimpleCaptcha; use MediaWiki\Html\Html; use MediaWiki\Language\RawMessage; use MediaWiki\MediaWikiServices; +use MediaWiki\Message\Message; use MediaWiki\Request\ContentSecurityPolicy; use MediaWiki\Request\WebRequest; use MediaWiki\Status\Status; -use Message; -use RequestContext; class HCaptcha extends SimpleCaptcha { // used for hcaptcha-edit, hcaptcha-addurl, hcaptcha-badlogin, hcaptcha-createaccount, diff --git a/hCaptcha/includes/HTMLHCaptchaField.php b/hCaptcha/includes/HTMLHCaptchaField.php index 97518adae..60a1257d6 100644 --- a/hCaptcha/includes/HTMLHCaptchaField.php +++ b/hCaptcha/includes/HTMLHCaptchaField.php @@ -2,8 +2,8 @@ namespace MediaWiki\Extension\ConfirmEdit\hCaptcha; -use HTMLFormField; use MediaWiki\Html\Html; +use MediaWiki\HTMLForm\HTMLFormField; class HTMLHCaptchaField extends HTMLFormField { /** @var string Public key parameter to be passed to hCaptcha. */ diff --git a/includes/Auth/LoginAttemptCounter.php b/includes/Auth/LoginAttemptCounter.php index 791961872..546501300 100644 --- a/includes/Auth/LoginAttemptCounter.php +++ b/includes/Auth/LoginAttemptCounter.php @@ -6,9 +6,9 @@ use BagOStuff; use MediaWiki\Extension\ConfirmEdit\CaptchaTriggers; use MediaWiki\Extension\ConfirmEdit\SimpleCaptcha\SimpleCaptcha; use MediaWiki\MediaWikiServices; +use MediaWiki\User\User; use MediaWiki\User\UserNameUtils; use ObjectCache; -use User; /** * Helper to count login attempts per IP and per username. diff --git a/includes/Hooks.php b/includes/Hooks.php index ce3641cbe..5c856e3bf 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -7,10 +7,9 @@ namespace MediaWiki\Extension\ConfirmEdit; use ApiBase; use Content; use ExtensionRegistry; -use HTMLForm; -use IContextSource; use MailAddress; use MediaWiki\Api\Hook\APIGetAllowedParamsHook; +use MediaWiki\Context\IContextSource; use MediaWiki\EditPage\EditPage; use MediaWiki\Extension\ConfirmEdit\SimpleCaptcha\SimpleCaptcha; use MediaWiki\Hook\AlternateEditPreviewHook; @@ -20,7 +19,9 @@ use MediaWiki\Hook\EditPageBeforeEditButtonsHook; use MediaWiki\Hook\EmailUserFormHook; use MediaWiki\Hook\EmailUserHook; use MediaWiki\Html\Html; +use MediaWiki\HTMLForm\HTMLForm; use MediaWiki\Output\OutputPage; +use MediaWiki\Parser\ParserOutput; use MediaWiki\Permissions\Hook\TitleReadWhitelistHook; use MediaWiki\ResourceLoader\Hook\ResourceLoaderRegisterModulesHook; use MediaWiki\ResourceLoader\ResourceLoader; @@ -34,7 +35,6 @@ use MediaWiki\Title\Title; use MediaWiki\User\User; use MediaWiki\User\UserIdentity; use MessageSpecifier; -use ParserOutput; use WANObjectCache; use Wikimedia\IPUtils; use WikiPage; diff --git a/tests/phpunit/CaptchaAuthenticationRequestTest.php b/tests/phpunit/CaptchaAuthenticationRequestTest.php index 2895dc363..392bf695b 100644 --- a/tests/phpunit/CaptchaAuthenticationRequestTest.php +++ b/tests/phpunit/CaptchaAuthenticationRequestTest.php @@ -1,10 +1,10 @@