From 685b177a37cb0f632c5812735583ee87a825f474 Mon Sep 17 00:00:00 2001 From: Umherirrender Date: Sun, 20 Oct 2024 10:59:48 +0200 Subject: [PATCH] Use namespaced classes Changes to the use statements done automatically via script Addition of missing use statement done manually Change-Id: I353b5721ff12ad2ad591ed12f865dac256066091 --- maintenance/createOAuthConsumer.php | 2 +- maintenance/migrateCentralWiki.php | 2 +- maintenance/migrateCentralWikiLogs.php | 1 + maintenance/testOAuthConsumer.php | 2 +- src/Backend/Consumer.php | 4 ++-- src/Backend/ConsumerAcceptance.php | 4 ++-- src/Backend/MWOAuthDAO.php | 2 +- src/Backend/MWOAuthDataStore.php | 2 +- src/Backend/Utils.php | 2 +- src/Control/ConsumerAcceptanceSubmitControl.php | 2 +- src/Control/ConsumerSubmitControl.php | 6 +++--- src/Control/SubmitControl.php | 2 +- src/Frontend/OAuthLogFormatter.php | 2 +- src/Frontend/SpecialPages/SpecialMWOAuth.php | 2 +- .../SpecialPages/SpecialMWOAuthConsumerRegistration.php | 4 ++-- src/Frontend/SpecialPages/SpecialMWOAuthListConsumers.php | 2 +- src/Frontend/SpecialPages/SpecialMWOAuthManageConsumers.php | 2 +- src/Frontend/SpecialPages/SpecialMWOAuthManageMyGrants.php | 2 +- src/Repository/CacheRepository.php | 2 +- src/Rest/Handler/RequestClient.php | 2 +- src/Rest/Handler/Resource.php | 2 +- src/SessionProvider.php | 4 ++-- tests/phpunit/Rest/EndpointTestBase.php | 2 +- tests/phpunit/Rest/RequestClientEndpointTest.php | 2 +- tests/phpunit/Rest/ResetClientSecretEndpointTest.php | 2 +- 25 files changed, 31 insertions(+), 30 deletions(-) diff --git a/maintenance/createOAuthConsumer.php b/maintenance/createOAuthConsumer.php index b8f0a614..7ce0814e 100644 --- a/maintenance/createOAuthConsumer.php +++ b/maintenance/createOAuthConsumer.php @@ -19,11 +19,11 @@ namespace MediaWiki\Extension\OAuth; -use Maintenance; use MediaWiki\Context\RequestContext; use MediaWiki\Extension\OAuth\Backend\Consumer; use MediaWiki\Extension\OAuth\Backend\Utils; use MediaWiki\Extension\OAuth\Control\ConsumerSubmitControl; +use MediaWiki\Maintenance\Maintenance; use MediaWiki\User\User; use MWRestrictions; diff --git a/maintenance/migrateCentralWiki.php b/maintenance/migrateCentralWiki.php index 0a58a5dc..e36aa7a4 100644 --- a/maintenance/migrateCentralWiki.php +++ b/maintenance/migrateCentralWiki.php @@ -25,10 +25,10 @@ require_once "$IP/maintenance/Maintenance.php"; -use Maintenance; use MediaWiki\Extension\OAuth\Backend\Consumer; use MediaWiki\Extension\OAuth\Backend\ConsumerAcceptance; use MediaWiki\Extension\OAuth\Backend\MWOAuthDAO; +use MediaWiki\Maintenance\Maintenance; use MediaWiki\MediaWikiServices; class MigrateCentralWiki extends Maintenance { diff --git a/maintenance/migrateCentralWikiLogs.php b/maintenance/migrateCentralWikiLogs.php index 4465e440..5862b5dd 100644 --- a/maintenance/migrateCentralWikiLogs.php +++ b/maintenance/migrateCentralWikiLogs.php @@ -16,6 +16,7 @@ require_once "$IP/maintenance/Maintenance.php"; +use MediaWiki\Maintenance\Maintenance; use MediaWiki\MediaWikiServices; use MediaWiki\Title\Title; use MediaWiki\WikiMap\WikiMap; diff --git a/maintenance/testOAuthConsumer.php b/maintenance/testOAuthConsumer.php index 1b24e681..437f26e1 100644 --- a/maintenance/testOAuthConsumer.php +++ b/maintenance/testOAuthConsumer.php @@ -2,12 +2,12 @@ namespace MediaWiki\Extension\OAuth; -use Maintenance; use MediaWiki\Extension\OAuth\Lib\OAuthConsumer; use MediaWiki\Extension\OAuth\Lib\OAuthException; use MediaWiki\Extension\OAuth\Lib\OAuthRequest; use MediaWiki\Extension\OAuth\Lib\OAuthSignatureMethodHmacSha1; use MediaWiki\Extension\OAuth\Lib\OAuthSignatureMethodRsaSha1; +use MediaWiki\Maintenance\Maintenance; /** * @ingroup Maintenance diff --git a/src/Backend/Consumer.php b/src/Backend/Consumer.php index 216390ad..0b4a9f3a 100644 --- a/src/Backend/Consumer.php +++ b/src/Backend/Consumer.php @@ -21,11 +21,10 @@ namespace MediaWiki\Extension\OAuth\Backend; -use FormatJson; -use IDBAccessObject; use LogicException; use MediaWiki\Context\IContextSource; use MediaWiki\Extension\OAuth\Entity\ClientEntity as OAuth2Client; +use MediaWiki\Json\FormatJson; use MediaWiki\Linker\Linker; use MediaWiki\MediaWikiServices; use MediaWiki\Message\Message; @@ -34,6 +33,7 @@ use MediaWiki\WikiMap\WikiMap; use MWRestrictions; use Wikimedia\Rdbms\IDatabase; +use Wikimedia\Rdbms\IDBAccessObject; /** * Representation of an OAuth consumer. diff --git a/src/Backend/ConsumerAcceptance.php b/src/Backend/ConsumerAcceptance.php index fd2482d6..9af80e24 100644 --- a/src/Backend/ConsumerAcceptance.php +++ b/src/Backend/ConsumerAcceptance.php @@ -2,11 +2,11 @@ namespace MediaWiki\Extension\OAuth\Backend; -use FormatJson; -use IDBAccessObject; use MediaWiki\Context\IContextSource; +use MediaWiki\Json\FormatJson; use MediaWiki\MediaWikiServices; use Wikimedia\Rdbms\IDatabase; +use Wikimedia\Rdbms\IDBAccessObject; /** * (c) Aaron Schulz 2013, GPL diff --git a/src/Backend/MWOAuthDAO.php b/src/Backend/MWOAuthDAO.php index ffae2cdc..03b7b292 100644 --- a/src/Backend/MWOAuthDAO.php +++ b/src/Backend/MWOAuthDAO.php @@ -3,7 +3,6 @@ namespace MediaWiki\Extension\OAuth\Backend; use Exception; -use IDBAccessObject; use LogicException; use MediaWiki\Context\IContextSource; use MediaWiki\Logger\LoggerFactory; @@ -14,6 +13,7 @@ use Wikimedia\Rdbms\DBError; use Wikimedia\Rdbms\DBReadOnlyError; use Wikimedia\Rdbms\IDatabase; +use Wikimedia\Rdbms\IDBAccessObject; /** * (c) Aaron Schulz 2013, GPL diff --git a/src/Backend/MWOAuthDataStore.php b/src/Backend/MWOAuthDataStore.php index 70106a53..7312ad91 100644 --- a/src/Backend/MWOAuthDataStore.php +++ b/src/Backend/MWOAuthDataStore.php @@ -2,7 +2,6 @@ namespace MediaWiki\Extension\OAuth\Backend; -use BagOStuff; use InvalidArgumentException; use MediaWiki\Extension\OAuth\Lib\OAuthConsumer; use MediaWiki\Extension\OAuth\Lib\OAuthDataStore; @@ -11,6 +10,7 @@ use MediaWiki\Message\Message; use MWCryptRand; use Psr\Log\LoggerInterface; +use Wikimedia\ObjectCache\BagOStuff; use Wikimedia\Rdbms\IDatabase; class MWOAuthDataStore extends OAuthDataStore { diff --git a/src/Backend/Utils.php b/src/Backend/Utils.php index 3243498b..adc4c113 100644 --- a/src/Backend/Utils.php +++ b/src/Backend/Utils.php @@ -2,7 +2,6 @@ namespace MediaWiki\Extension\OAuth\Backend; -use BagOStuff; use MediaWiki\Context\RequestContext; use MediaWiki\Deferred\AutoCommitUpdate; use MediaWiki\Deferred\DeferredUpdates; @@ -15,6 +14,7 @@ use MediaWiki\User\User; use MediaWiki\WikiMap\WikiMap; use MWException; +use Wikimedia\ObjectCache\BagOStuff; use Wikimedia\Rdbms\IDatabase; /** diff --git a/src/Control/ConsumerAcceptanceSubmitControl.php b/src/Control/ConsumerAcceptanceSubmitControl.php index b8b7945f..348addce 100644 --- a/src/Control/ConsumerAcceptanceSubmitControl.php +++ b/src/Control/ConsumerAcceptanceSubmitControl.php @@ -21,7 +21,6 @@ namespace MediaWiki\Extension\OAuth\Control; -use FormatJson; use MediaWiki\Context\IContextSource; use MediaWiki\Extension\OAuth\Backend\Consumer; use MediaWiki\Extension\OAuth\Backend\ConsumerAcceptance; @@ -29,6 +28,7 @@ use MediaWiki\Extension\OAuth\Backend\Utils; use MediaWiki\Extension\OAuth\Lib\OAuthException; use MediaWiki\Extension\OAuth\Repository\AccessTokenRepository; +use MediaWiki\Json\FormatJson; use MediaWiki\Logger\LoggerFactory; use MediaWiki\MediaWikiServices; use Wikimedia\Rdbms\IDatabase; diff --git a/src/Control/ConsumerSubmitControl.php b/src/Control/ConsumerSubmitControl.php index ff3a9fcb..af6fc9bd 100644 --- a/src/Control/ConsumerSubmitControl.php +++ b/src/Control/ConsumerSubmitControl.php @@ -2,13 +2,11 @@ namespace MediaWiki\Extension\OAuth\Control; -use ApiMessage; use Composer\Semver\VersionParser; use Exception; -use ExtensionRegistry; -use FormatJson; use LogicException; use ManualLogEntry; +use MediaWiki\Api\ApiMessage; use MediaWiki\Context\IContextSource; use MediaWiki\Extension\Notifications\Model\Event; use MediaWiki\Extension\OAuth\Backend\Consumer; @@ -17,9 +15,11 @@ use MediaWiki\Extension\OAuth\Backend\Utils; use MediaWiki\Extension\OAuth\Entity\ClientEntity; use MediaWiki\Extension\OAuth\OAuthServices; +use MediaWiki\Json\FormatJson; use MediaWiki\Logger\LoggerFactory; use MediaWiki\MediaWikiServices; use MediaWiki\Parser\Sanitizer; +use MediaWiki\Registration\ExtensionRegistry; use MediaWiki\SpecialPage\SpecialPage; use MediaWiki\Title\Title; use MediaWiki\User\User; diff --git a/src/Control/SubmitControl.php b/src/Control/SubmitControl.php index 563c37cb..1f8022ac 100644 --- a/src/Control/SubmitControl.php +++ b/src/Control/SubmitControl.php @@ -2,8 +2,8 @@ namespace MediaWiki\Extension\OAuth\Control; -use ApiMessage; use LogicException; +use MediaWiki\Api\ApiMessage; use MediaWiki\Context\ContextSource; use MediaWiki\Context\IContextSource; use MediaWiki\HTMLForm\HTMLForm; diff --git a/src/Frontend/OAuthLogFormatter.php b/src/Frontend/OAuthLogFormatter.php index c954d05c..d59203a6 100644 --- a/src/Frontend/OAuthLogFormatter.php +++ b/src/Frontend/OAuthLogFormatter.php @@ -2,12 +2,12 @@ namespace MediaWiki\Extension\OAuth\Frontend; -use ExtensionRegistry; use LogEntry; use LogFormatter; use MediaWiki\Linker\Linker; use MediaWiki\Linker\LinkRenderer; use MediaWiki\Message\Message; +use MediaWiki\Registration\ExtensionRegistry; use MediaWiki\Title\Title; use MediaWiki\Title\TitleFactory; use MediaWiki\User\UserEditTracker; diff --git a/src/Frontend/SpecialPages/SpecialMWOAuth.php b/src/Frontend/SpecialPages/SpecialMWOAuth.php index 20430179..6463da2d 100644 --- a/src/Frontend/SpecialPages/SpecialMWOAuth.php +++ b/src/Frontend/SpecialPages/SpecialMWOAuth.php @@ -22,7 +22,6 @@ */ use Firebase\JWT\JWT; -use FormatJson; use MediaWiki\Context\IContextSource; use MediaWiki\Extension\OAuth\Backend\Consumer; use MediaWiki\Extension\OAuth\Backend\ConsumerAcceptance; @@ -38,6 +37,7 @@ use MediaWiki\Extension\OAuth\UserStatementProvider; use MediaWiki\Html\Html; use MediaWiki\HTMLForm\HTMLForm; +use MediaWiki\Json\FormatJson; use MediaWiki\Linker\Linker; use MediaWiki\Logger\LoggerFactory; use MediaWiki\Message\Message; diff --git a/src/Frontend/SpecialPages/SpecialMWOAuthConsumerRegistration.php b/src/Frontend/SpecialPages/SpecialMWOAuthConsumerRegistration.php index e5991c02..b071cf45 100644 --- a/src/Frontend/SpecialPages/SpecialMWOAuthConsumerRegistration.php +++ b/src/Frontend/SpecialPages/SpecialMWOAuthConsumerRegistration.php @@ -22,7 +22,6 @@ */ use ErrorPageError; -use FormatJson; use InvalidArgumentException; use LogEventsList; use LogPage; @@ -37,6 +36,7 @@ use MediaWiki\HTMLForm\Field\HTMLHiddenField; use MediaWiki\HTMLForm\Field\HTMLRestrictionsField; use MediaWiki\HTMLForm\HTMLForm; +use MediaWiki\Json\FormatJson; use MediaWiki\Message\Message; use MediaWiki\Permissions\GrantsInfo; use MediaWiki\Permissions\GrantsLocalization; @@ -45,12 +45,12 @@ use MediaWiki\Status\Status; use MediaWiki\User\User; use MediaWiki\WikiMap\WikiMap; +use MediaWiki\Xml\Xml; use MWRestrictions; use PermissionsError; use stdClass; use UserBlockedError; use Wikimedia\Rdbms\IDatabase; -use Xml; /** * Page that has registration request form and consumer update form diff --git a/src/Frontend/SpecialPages/SpecialMWOAuthListConsumers.php b/src/Frontend/SpecialPages/SpecialMWOAuthListConsumers.php index 9e2e3976..a38b732e 100644 --- a/src/Frontend/SpecialPages/SpecialMWOAuthListConsumers.php +++ b/src/Frontend/SpecialPages/SpecialMWOAuthListConsumers.php @@ -36,12 +36,12 @@ use MediaWiki\SpecialPage\SpecialPage; use MediaWiki\User\User; use MediaWiki\WikiMap\WikiMap; +use MediaWiki\Xml\Xml; use MWException; use OOUI\HtmlSnippet; use PermissionsError; use stdClass; use Wikimedia\Rdbms\IDatabase; -use Xml; /** * Special page for listing the queue of consumer requests and managing diff --git a/src/Frontend/SpecialPages/SpecialMWOAuthManageConsumers.php b/src/Frontend/SpecialPages/SpecialMWOAuthManageConsumers.php index 264091c0..374249e9 100644 --- a/src/Frontend/SpecialPages/SpecialMWOAuthManageConsumers.php +++ b/src/Frontend/SpecialPages/SpecialMWOAuthManageConsumers.php @@ -39,12 +39,12 @@ use MediaWiki\SpecialPage\SpecialPage; use MediaWiki\Status\Status; use MediaWiki\Title\Title; +use MediaWiki\Xml\Xml; use MWRestrictions; use OOUI\HtmlSnippet; use PermissionsError; use stdClass; use Wikimedia\Rdbms\IDatabase; -use Xml; /** * Special page for listing the queue of consumer requests and managing diff --git a/src/Frontend/SpecialPages/SpecialMWOAuthManageMyGrants.php b/src/Frontend/SpecialPages/SpecialMWOAuthManageMyGrants.php index e21aae5b..dead1144 100644 --- a/src/Frontend/SpecialPages/SpecialMWOAuthManageMyGrants.php +++ b/src/Frontend/SpecialPages/SpecialMWOAuthManageMyGrants.php @@ -3,7 +3,6 @@ namespace MediaWiki\Extension\OAuth\Frontend\SpecialPages; use ErrorPageError; -use FormatJson; use MediaWiki\Context\IContextSource; use MediaWiki\Extension\OAuth\Backend\Consumer; use MediaWiki\Extension\OAuth\Backend\ConsumerAcceptance; @@ -14,6 +13,7 @@ use MediaWiki\Extension\OAuth\Frontend\Pagers\ManageMyGrantsPager; use MediaWiki\Extension\OAuth\Frontend\UIUtils; use MediaWiki\HTMLForm\HTMLForm; +use MediaWiki\Json\FormatJson; use MediaWiki\MediaWikiServices; use MediaWiki\Permissions\GrantsInfo; use MediaWiki\Permissions\GrantsLocalization; diff --git a/src/Repository/CacheRepository.php b/src/Repository/CacheRepository.php index 9a2bc292..37b3e1c4 100644 --- a/src/Repository/CacheRepository.php +++ b/src/Repository/CacheRepository.php @@ -2,8 +2,8 @@ namespace MediaWiki\Extension\OAuth\Repository; -use BagOStuff; use MediaWiki\Extension\OAuth\Backend\Utils; +use Wikimedia\ObjectCache\BagOStuff; abstract class CacheRepository { diff --git a/src/Rest/Handler/RequestClient.php b/src/Rest/Handler/RequestClient.php index fa83232a..dc660fa9 100644 --- a/src/Rest/Handler/RequestClient.php +++ b/src/Rest/Handler/RequestClient.php @@ -2,8 +2,8 @@ namespace MediaWiki\Extension\OAuth\Rest\Handler; -use FormatJson; use MediaWiki\Extension\OAuth\Repository\ScopeRepository; +use MediaWiki\Json\FormatJson; use MediaWiki\Rest\LocalizedHttpException; use MediaWiki\Rest\Validator\Validator; use MWRestrictions; diff --git a/src/Rest/Handler/Resource.php b/src/Rest/Handler/Resource.php index 63d7bd9c..fc4f297a 100644 --- a/src/Rest/Handler/Resource.php +++ b/src/Rest/Handler/Resource.php @@ -2,12 +2,12 @@ namespace MediaWiki\Extension\OAuth\Rest\Handler; -use FormatJson; use GuzzleHttp\Psr7\ServerRequest; use MediaWiki\Extension\OAuth\Backend\MWOAuthException; use MediaWiki\Extension\OAuth\ResourceServer; use MediaWiki\Extension\OAuth\Response; use MediaWiki\Extension\OAuth\UserStatementProvider; +use MediaWiki\Json\FormatJson; use MediaWiki\Rest\Handler; use MediaWiki\Rest\HttpException; use MWException; diff --git a/src/SessionProvider.php b/src/SessionProvider.php index 21e41f7d..4d2a0b5a 100644 --- a/src/SessionProvider.php +++ b/src/SessionProvider.php @@ -2,11 +2,11 @@ namespace MediaWiki\Extension\OAuth; -use ApiBase; -use ApiMessage; use Exception; use GuzzleHttp\Psr7\ServerRequest; use InvalidArgumentException; +use MediaWiki\Api\ApiBase; +use MediaWiki\Api\ApiMessage; use MediaWiki\Api\Hook\ApiCheckCanExecuteHook; use MediaWiki\Context\RequestContext; use MediaWiki\Extension\OAuth\Backend\Consumer; diff --git a/tests/phpunit/Rest/EndpointTestBase.php b/tests/phpunit/Rest/EndpointTestBase.php index 30560b96..09e69246 100644 --- a/tests/phpunit/Rest/EndpointTestBase.php +++ b/tests/phpunit/Rest/EndpointTestBase.php @@ -3,9 +3,9 @@ namespace MediaWiki\Extension\OAuth\Tests\Rest; use Exception; -use FormatJson; use GuzzleHttp\Psr7\Uri; use MediaWiki\Context\RequestContext; +use MediaWiki\Json\FormatJson; use MediaWiki\Rest\Handler; use MediaWiki\Rest\HttpException; use MediaWiki\Rest\RequestData; diff --git a/tests/phpunit/Rest/RequestClientEndpointTest.php b/tests/phpunit/Rest/RequestClientEndpointTest.php index 44c7e46c..c0a70970 100644 --- a/tests/phpunit/Rest/RequestClientEndpointTest.php +++ b/tests/phpunit/Rest/RequestClientEndpointTest.php @@ -3,8 +3,8 @@ namespace MediaWiki\Extension\OAuth\Tests\Rest; use Exception; -use FormatJson; use MediaWiki\Extension\OAuth\Rest\Handler\RequestClient; +use MediaWiki\Json\FormatJson; use MediaWiki\MainConfigNames; use MediaWiki\Rest\Handler; use MediaWiki\Rest\ResponseInterface; diff --git a/tests/phpunit/Rest/ResetClientSecretEndpointTest.php b/tests/phpunit/Rest/ResetClientSecretEndpointTest.php index 27dae3fa..e87d40fe 100644 --- a/tests/phpunit/Rest/ResetClientSecretEndpointTest.php +++ b/tests/phpunit/Rest/ResetClientSecretEndpointTest.php @@ -3,10 +3,10 @@ namespace MediaWiki\Extension\OAuth\Tests\Rest; use Exception; -use FormatJson; use MediaWiki\Extension\OAuth\Backend\Consumer; use MediaWiki\Extension\OAuth\Backend\Utils; use MediaWiki\Extension\OAuth\Rest\Handler\ResetClientSecret; +use MediaWiki\Json\FormatJson; use MediaWiki\MainConfigNames; use MediaWiki\Rest\Handler; use MediaWiki\Rest\ResponseInterface;