Use new ResourceLoader namespace

Extensions using Phan need to be updated simultaneously with core due
to T308443.

Bug: T308718
Depends-On: Id08a220e1d6085e2b33f3f6c9d0e3935a4204659
Change-Id: Iffd8dea36f3b52181f3f3414a761d441d230b7b8
This commit is contained in:
Tim Starling 2022-05-20 12:11:31 +10:00 committed by Bartosz Dziewoński
parent 9f8332bc68
commit 32dd490e7f
2 changed files with 9 additions and 11 deletions

View file

@ -7,7 +7,7 @@
"descriptionmsg": "discussiontools-desc",
"manifest_version": 2,
"requires": {
"MediaWiki": ">= 1.38.0",
"MediaWiki": ">= 1.39.0",
"extensions": {
"VisualEditor": ">= 0.1.2",
"Linter": "*"

View file

@ -12,10 +12,8 @@ namespace MediaWiki\Extension\DiscussionTools;
use Config;
use ExtensionRegistry;
use MediaWiki\MediaWikiServices;
use MediaWiki\ResourceLoader as RL;
use MessageLocalizer;
use ResourceLoaderContext;
use ResourceLoaderFileModule;
use ResourceLoaderModule;
use Title;
class ResourceLoaderData {
@ -25,13 +23,13 @@ class ResourceLoaderData {
* We need all of this data *in content language*. Some of it is already available in JS, but only
* in client language, so it's useless for us (e.g. digit transform table, month name messages).
*
* @param ResourceLoaderContext $context
* @param RL\Context $context
* @param Config $config
* @param string|null $langCode
* @return array
*/
public static function getLocalData(
ResourceLoaderContext $context, Config $config, ?string $langCode = null
RL\Context $context, Config $config, ?string $langCode = null
): array {
$services = MediaWikiServices::getInstance();
@ -52,13 +50,13 @@ class ResourceLoaderData {
/**
* Return messages in content language, for use in a ResourceLoader module.
*
* @param ResourceLoaderContext $context
* @param RL\Context $context
* @param Config $config
* @param array $messagesKeys
* @return array
*/
public static function getContentLanguageMessages(
ResourceLoaderContext $context, Config $config, array $messagesKeys = []
RL\Context $context, Config $config, array $messagesKeys = []
): array {
return array_combine(
$messagesKeys,
@ -136,9 +134,9 @@ class ResourceLoaderData {
* Add optional dependencies to a ResourceLoader module definition depending on loaded extensions.
*
* @param array $info
* @return ResourceLoaderModule
* @return RL\Module
*/
public static function addOptionalDependencies( array $info ): ResourceLoaderModule {
public static function addOptionalDependencies( array $info ): RL\Module {
$extensionRegistry = ExtensionRegistry::getInstance();
foreach ( $info['optionalDependencies'] as $ext => $deps ) {
@ -147,7 +145,7 @@ class ResourceLoaderData {
}
}
$class = $info['class'] ?? ResourceLoaderFileModule::class;
$class = $info['class'] ?? RL\FileModule::class;
return new $class( $info );
}
}