CommentStore: Hard-deprecate newKey()
[lhc/web/wiklou.git] / includes / CommentStore.php
index 484b846..9969b78 100644 (file)
@@ -98,7 +98,7 @@ class CommentStore {
 
        /**
         * @param Language $lang Language to use for comment truncation. Defaults
-        *  to $wgContLang.
+        *  to content language.
         * @param int $migrationStage One of the MIGRATION_* constants
         */
        public function __construct( Language $lang, $migrationStage ) {
@@ -114,10 +114,10 @@ class CommentStore {
         * @return CommentStore
         */
        public static function newKey( $key ) {
-               global $wgCommentTableSchemaMigrationStage, $wgContLang;
-               // TODO uncomment once not used in extensions
-               // wfDeprecated( __METHOD__, '1.31' );
-               $store = new CommentStore( $wgContLang, $wgCommentTableSchemaMigrationStage );
+               global $wgCommentTableSchemaMigrationStage;
+               wfDeprecated( __METHOD__, '1.31' );
+               $store = new CommentStore( MediaWikiServices::getInstance()->getContentLanguage(),
+                       $wgCommentTableSchemaMigrationStage );
                $store->key = $key;
                return $store;
        }
@@ -138,7 +138,7 @@ class CommentStore {
         * @return string
         */
        private function getKey( $methodKey = null ) {
-               $key = $this->key !== null ? $this->key : $methodKey;
+               $key = $this->key ?? $methodKey;
                if ( $key === null ) {
                        // @codeCoverageIgnoreStart
                        throw new InvalidArgumentException( '$key should not be null' );