The methods existed for two use cases.
1. Inside ResourceLoaderContext, usage was removed with I4e4ee758cd22.
2. In Module class methods that get $context, already have their own
Config and Logger instances injected from ResourceLoader::getModule(),
which should be used instead.
Deprecating these opens the paths for making ResourceLoaderContext
a purer value object with no ResourceLoader, Config, or Logger objects
needing to be passed (in the future).
Bug: T32956
Change-Id: I74a9535918ea43b2c00073c5d4469f864d1eeb41
* DatabaseBlock::setCookie, DatabaseBlock::getCookieValue,
DatabaseBlock::getIdFromCookieValue and AbstractBlock::shouldTrackWithCookie
are moved to internal helper methods for BlockManager::trackBlockWithCookie.
+* ResourceLoaderContext::getConfig and ResourceLoaderContext::getLogger have
+ been deprecated. Inside ResourceLoaderModule subclasses, use the local methods
+ instead. Elsewhere, use the methods from the ResourceLoader class.
=== Other changes in 1.34 ===
* …
}
/**
+ * @deprecated since 1.34 Use ResourceLoaderModule::getConfig instead
+ * inside module methods. Use ResourceLoader::getConfig elsewhere.
* @return Config
*/
public function getConfig() {
}
/**
+ * @deprecated since 1.34 Use ResourceLoaderModule::getLogger instead
+ * inside module methods. Use ResourceLoader::getLogger elsewhere.
* @since 1.27
* @return \Psr\Log\LoggerInterface
*/
}
if ( $versionHash !== '' && strlen( $versionHash ) !== 7 ) {
- $context->getLogger()->warning(
+ $this->getLogger()->warning(
"Module '{module}' produced an invalid version hash: '{version}'.",
[
'module' => $name,
public function testAccessors() {
$ctx = new ResourceLoaderContext( $this->getResourceLoader(), new FauxRequest( [] ) );
+ $this->assertInstanceOf( ResourceLoader::class, $ctx->getResourceLoader() );
+ $this->assertInstanceOf( Config::class, $ctx->getConfig() );
$this->assertInstanceOf( WebRequest::class, $ctx->getRequest() );
- $this->assertInstanceOf( \Psr\Log\LoggerInterface::class, $ctx->getLogger() );
+ $this->assertInstanceOf( Psr\Log\LoggerInterface::class, $ctx->getLogger() );
}
public function testTypicalRequest() {