+ global $wgCommentTableSchemaMigrationStage, $wgContLang;
+ // TODO uncomment once not used in extensions
+ // wfDeprecated( __METHOD__, '1.31' );
+ $store = new CommentStore( $wgContLang, $wgCommentTableSchemaMigrationStage );
+ $store->key = $key;
+ return $store;
+ }
+
+ /**
+ * @since 1.31
+ * @deprecated in 1.31 Use DI to inject a CommentStore instance into your class.
+ * @return CommentStore
+ */
+ public static function getStore() {
+ return MediaWikiServices::getInstance()->getCommentStore();
+ }
+
+ /**
+ * Compat method allowing use of self::newKey until removed.
+ * @param string|null $methodKey
+ * @throw InvalidArgumentException
+ * @return string
+ */
+ private function getKey( $methodKey = null ) {
+ $key = $this->key !== null ? $this->key : $methodKey;
+ if ( $key === null ) {
+ // @codeCoverageIgnoreStart
+ throw new InvalidArgumentException( '$key should not be null' );
+ // @codeCoverageIgnoreEnd
+ }
+ return $key;