resourceloader: Minor documentation and coding style improvements

Based on current non-voting codesniffer warnings.

Change-Id: I34cbc31eda3eaa519a71fe2c04122859f2f15914
This commit is contained in:
Timo Tijhof 2017-06-30 17:31:56 -07:00
parent 6711b872b8
commit 98b148d247
5 changed files with 14 additions and 8 deletions

View file

@ -109,7 +109,7 @@ class ResourceLoaderClientHtml {
*
* See OutputPage::buildExemptModules() for use cases.
*
* @param array $modules Module state keyed by module name
* @param array $states Module state keyed by module name
*/
public function setExemptStates( array $states ) {
$this->exemptStates = $states;
@ -370,7 +370,6 @@ class ResourceLoaderClientHtml {
sort( $modules );
if ( $mainContext->getDebug() && count( $modules ) > 1 ) {
$chunks = [];
// Recursively call us for every item
foreach ( $modules as $name ) {

View file

@ -980,18 +980,19 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
$files = $compiler->AllParsedFiles();
$this->localFileRefs = array_merge( $this->localFileRefs, $files );
// Cache for 24 hours (86400 seconds).
$cache->set( $cacheKey, [
'css' => $css,
'files' => $files,
'hash' => FileContentsHasher::getFileContentsHash( $files ),
], 60 * 60 * 24 ); // 86400 seconds, or 24 hours.
], 3600 * 24 );
return $css;
}
/**
* Takes named templates by the module and returns an array mapping.
* @return array of templates mapping template alias to content
* @return array Templates mapping template alias to content
* @throws MWException
*/
public function getTemplates() {
@ -1022,7 +1023,8 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
* the BOM character is not valid in the middle of a string.
* We already assume UTF-8 everywhere, so this should be safe.
*
* @return string input minus the intial BOM char
* @param string $input
* @return string Input minus the intial BOM char
*/
protected function stripBom( $input ) {
if ( substr_compare( "\xef\xbb\xbf", $input, 0, 3 ) === 0 ) {

View file

@ -148,9 +148,8 @@ class ResourceLoaderImage {
public function getExtension( $format = 'original' ) {
if ( $format === 'rasterized' && $this->extension === 'svg' ) {
return 'png';
} else {
return $this->extension;
}
return $this->extension;
}
/**

View file

@ -42,7 +42,7 @@ class ResourceLoaderSiteModule extends ResourceLoaderWikiModule {
return $pages;
}
/*
/**
* @return array
*/
public function getDependencies( ResourceLoaderContext $context = null ) {

View file

@ -29,6 +29,9 @@ class ResourceLoaderUploadDialogModule extends ResourceLoaderModule {
protected $targets = [ 'desktop', 'mobile' ];
/**
* @return string JavaScript code
*/
public function getScript( ResourceLoaderContext $context ) {
$config = $context->getResourceLoader()->getConfig();
return ResourceLoader::makeConfigSetScript( [
@ -36,6 +39,9 @@ class ResourceLoaderUploadDialogModule extends ResourceLoaderModule {
] );
}
/**
* @return bool
*/
public function enableModuleContentVersion() {
return true;
}