Merge "Add media type based filtering to Special:NewFiles"
[lhc/web/wiklou.git] / includes / context / ContextSource.php
index 829dd73..36d6df2 100644 (file)
@@ -19,6 +19,7 @@
  * @file
  */
 use Liuggio\StatsdClient\Factory\StatsdDataFactory;
+use MediaWiki\MediaWikiServices;
 
 /**
  * The simplest way of implementing IContextSource is to hold a RequestContext as a
@@ -39,7 +40,7 @@ abstract class ContextSource implements IContextSource {
         */
        public function getContext() {
                if ( $this->context === null ) {
-                       $class = get_class( $this );
+                       $class = static::class;
                        wfDebug( __METHOD__ . " ($class): called and \$context is null. " .
                                "Using RequestContext::getMain() for sanity\n" );
                        $this->context = RequestContext::getMain();
@@ -169,10 +170,10 @@ abstract class ContextSource implements IContextSource {
         * @deprecated since 1.27 use a StatsdDataFactory from MediaWikiServices (preferably injected)
         *
         * @since 1.25
-        * @return StatsdDataFactory
+        * @return MediawikiStatsdDataFactory
         */
        public function getStats() {
-               return $this->getContext()->getStats();
+               return MediaWikiServices::getInstance()->getStatsdDataFactory();
        }
 
        /**
@@ -180,10 +181,12 @@ abstract class ContextSource implements IContextSource {
         * Parameters are the same as wfMessage()
         *
         * @since 1.18
+        * @param string|string[]|MessageSpecifier $key Message key, or array of keys,
+        *   or a MessageSpecifier.
         * @param mixed ...
         * @return Message
         */
-       public function msg( /* $args */ ) {
+       public function msg( $key /* $args */ ) {
                $args = func_get_args();
 
                return call_user_func_array( [ $this->getContext(), 'msg' ], $args );