jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/362603 )

Change subject: resourceloader: Minor documentation and coding style 
improvements
......................................................................


resourceloader: Minor documentation and coding style improvements

Based on current non-voting codesniffer warnings.

Change-Id: I34cbc31eda3eaa519a71fe2c04122859f2f15914
---
M includes/resourceloader/ResourceLoaderClientHtml.php
M includes/resourceloader/ResourceLoaderFileModule.php
M includes/resourceloader/ResourceLoaderImage.php
M includes/resourceloader/ResourceLoaderSiteModule.php
M includes/resourceloader/ResourceLoaderUploadDialogModule.php
5 files changed, 14 insertions(+), 8 deletions(-)

Approvals:
  Legoktm: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/resourceloader/ResourceLoaderClientHtml.php 
b/includes/resourceloader/ResourceLoaderClientHtml.php
index ace8f41..197ac51 100644
--- a/includes/resourceloader/ResourceLoaderClientHtml.php
+++ b/includes/resourceloader/ResourceLoaderClientHtml.php
@@ -109,7 +109,7 @@
         *
         * 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 @@
                sort( $modules );
 
                if ( $mainContext->getDebug() && count( $modules ) > 1 ) {
-
                        $chunks = [];
                        // Recursively call us for every item
                        foreach ( $modules as $name ) {
diff --git a/includes/resourceloader/ResourceLoaderFileModule.php 
b/includes/resourceloader/ResourceLoaderFileModule.php
index 725bc6a..79b8e79 100644
--- a/includes/resourceloader/ResourceLoaderFileModule.php
+++ b/includes/resourceloader/ResourceLoaderFileModule.php
@@ -980,18 +980,19 @@
                $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 @@
         * 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 ) {
diff --git a/includes/resourceloader/ResourceLoaderImage.php 
b/includes/resourceloader/ResourceLoaderImage.php
index 19d5471..072ae79 100644
--- a/includes/resourceloader/ResourceLoaderImage.php
+++ b/includes/resourceloader/ResourceLoaderImage.php
@@ -148,9 +148,8 @@
        public function getExtension( $format = 'original' ) {
                if ( $format === 'rasterized' && $this->extension === 'svg' ) {
                        return 'png';
-               } else {
-                       return $this->extension;
                }
+               return $this->extension;
        }
 
        /**
diff --git a/includes/resourceloader/ResourceLoaderSiteModule.php 
b/includes/resourceloader/ResourceLoaderSiteModule.php
index 7401d58..08641b0 100644
--- a/includes/resourceloader/ResourceLoaderSiteModule.php
+++ b/includes/resourceloader/ResourceLoaderSiteModule.php
@@ -42,7 +42,7 @@
                return $pages;
        }
 
-       /*
+       /**
         * @return array
         */
        public function getDependencies( ResourceLoaderContext $context = null 
) {
diff --git a/includes/resourceloader/ResourceLoaderUploadDialogModule.php 
b/includes/resourceloader/ResourceLoaderUploadDialogModule.php
index 52e2210..9377ed6 100644
--- a/includes/resourceloader/ResourceLoaderUploadDialogModule.php
+++ b/includes/resourceloader/ResourceLoaderUploadDialogModule.php
@@ -29,6 +29,9 @@
 
        protected $targets = [ 'desktop', 'mobile' ];
 
+       /**
+        * @return string JavaScript code
+        */
        public function getScript( ResourceLoaderContext $context ) {
                $config = $context->getResourceLoader()->getConfig();
                return ResourceLoader::makeConfigSetScript( [
@@ -36,6 +39,9 @@
                ] );
        }
 
+       /**
+        * @return bool
+        */
        public function enableModuleContentVersion() {
                return true;
        }

-- 
To view, visit https://gerrit.wikimedia.org/r/362603
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I34cbc31eda3eaa519a71fe2c04122859f2f15914
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Krinkle <krinklem...@gmail.com>
Gerrit-Reviewer: Legoktm <lego...@member.fsf.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to