Merge "Update old URLs in DefaultSettings related to Squid caching"
[lhc/web/wiklou.git] / includes / resourceloader / ResourceLoaderContext.php
index 1f06ede..3db0c01 100644 (file)
@@ -1,7 +1,5 @@
 <?php
 /**
- * Context for ResourceLoader modules.
- *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -26,8 +24,11 @@ use MediaWiki\Logger\LoggerFactory;
 use MediaWiki\MediaWikiServices;
 
 /**
- * Object passed around to modules which contains information about the state
- * of a specific loader request.
+ * Context object that contains information about the state of a specific
+ * ResourceLoader web request. Passed around to ResourceLoaderModule methods.
+ *
+ * @ingroup ResourceLoader
+ * @since 1.17
  */
 class ResourceLoaderContext implements MessageLocalizer {
        const DEFAULT_LANG = 'qqx';
@@ -55,6 +56,7 @@ class ResourceLoaderContext implements MessageLocalizer {
        protected $direction;
        protected $hash;
        protected $userObj;
+       /** @var ResourceLoaderImage|false */
        protected $imageObj;
 
        /**
@@ -66,8 +68,8 @@ class ResourceLoaderContext implements MessageLocalizer {
                $this->request = $request;
                $this->logger = $resourceLoader->getLogger();
 
-               // Future developers: Use WebRequest::getRawVal() instead of getVal().
-               // The getVal() method performs slow Language+UTF logic. (f303bb9360)
+               // Optimisation: Use WebRequest::getRawVal() instead of getVal(). We don't
+               // need the slow Language+UTF logic meant for user input here. (f303bb9360)
 
                // List of modules
                $modules = $request->getRawVal( 'modules' );
@@ -76,8 +78,8 @@ class ResourceLoaderContext implements MessageLocalizer {
                // Various parameters
                $this->user = $request->getRawVal( 'user' );
                $this->debug = $request->getRawVal( 'debug' ) === 'true';
-               $this->only = $request->getRawVal( 'only', null );
-               $this->version = $request->getRawVal( 'version', null );
+               $this->only = $request->getRawVal( 'only' );
+               $this->version = $request->getRawVal( 'version' );
                $this->raw = $request->getFuzzyBool( 'raw' );
 
                // Image requests
@@ -95,19 +97,6 @@ class ResourceLoaderContext implements MessageLocalizer {
                }
        }
 
-       /**
-        * Reverse the process done by ResourceLoader::makePackedModulesString().
-        *
-        * @deprecated since 1.33 Use ResourceLoader::expandModuleNames instead.
-        * @param string $modules Packed module name list
-        * @return array Array of module names
-        * @codeCoverageIgnore
-        */
-       public static function expandModuleNames( $modules ) {
-               wfDeprecated( __METHOD__, '1.33' );
-               return ResourceLoader::expandModuleNames( $modules );
-       }
-
        /**
         * Return a dummy ResourceLoaderContext object suitable for passing into
         * things that don't "really" need a context.
@@ -140,8 +129,10 @@ class ResourceLoaderContext implements MessageLocalizer {
         * @deprecated since 1.34 Use ResourceLoaderModule::getConfig instead
         * inside module methods. Use ResourceLoader::getConfig elsewhere.
         * @return Config
+        * @codeCoverageIgnore
         */
        public function getConfig() {
+               wfDeprecated( __METHOD__, '1.34' );
                return $this->getResourceLoader()->getConfig();
        }
 
@@ -225,6 +216,7 @@ class ResourceLoaderContext implements MessageLocalizer {
         * @param string|string[]|MessageSpecifier $key Message key, or array of keys,
         *   or a MessageSpecifier.
         * @param mixed $args,...
+        * @suppress PhanCommentParamWithoutRealParam HHVM bug T228695#5450847
         * @return Message
         */
        public function msg( $key ) {