Use "break" instead of "continue"
[lhc/web/wiklou.git] / languages / LanguageConverter.php
index dcc2cf3..cb0f66f 100644 (file)
@@ -85,7 +85,7 @@ class LanguageConverter {
         * @param array $flags Defining the custom strings that maps to the flags
         * @param array $manualLevel Limit for supported variants
         */
-       public function __construct( $langobj, $maincode, $variants = [],
+       public function __construct( Language $langobj, $maincode, $variants = [],
                                                                $variantfallbacks = [], $flags = [],
                                                                $manualLevel = [] ) {
                global $wgDisabledVariants;
@@ -250,7 +250,7 @@ class LanguageConverter {
         * @return mixed Variant if one found, null otherwise
         */
        protected function getUserVariant() {
-               global $wgUser, $wgContLang;
+               global $wgUser;
 
                // memoizing this function wreaks havoc on parserTest.php
                /*
@@ -266,7 +266,10 @@ class LanguageConverter {
                        return false;
                }
                if ( $wgUser->isLoggedIn() ) {
-                       if ( $this->mMainLanguageCode == $wgContLang->getCode() ) {
+                       if (
+                               $this->mMainLanguageCode ==
+                               MediaWikiServices::getInstance()->getContentLanguage()->getCode()
+                       ) {
                                $ret = $wgUser->getOption( 'variant' );
                        } else {
                                $ret = $wgUser->getOption( 'variant-' . $this->mMainLanguageCode );
@@ -770,7 +773,7 @@ class LanguageConverter {
                                                        $warningDone = true;
                                                }
                                                $startPos += 2;
-                                               continue;
+                                               break;
                                        }
                                        // Recursively parse another rule
                                        $inner .= $this->recursiveConvertRule( $text, $variant, $startPos, $depth + 1 );