Merge "Remove outdated CSS selectors for Special:AllMessages"
[lhc/web/wiklou.git] / languages / LanguageConverter.php
index ea26c64..3c8d300 100644 (file)
@@ -140,10 +140,7 @@ class LanguageConverter {
         *   main code if there is no fallback
         */
        public function getVariantFallbacks( $variant ) {
-               if ( isset( $this->mVariantFallbacks[$variant] ) ) {
-                       return $this->mVariantFallbacks[$variant];
-               }
-               return $this->mMainLanguageCode;
+               return $this->mVariantFallbacks[$variant] ?? $this->mMainLanguageCode;
        }
 
        /**
@@ -212,9 +209,13 @@ class LanguageConverter {
        }
 
        /**
-        * Validate the variant
+        * Validate the variant and return an appropriate strict internal
+        * variant code if one exists.  Compare to Language::hasVariant()
+        * which does a strict test.
+        *
         * @param string|null $variant The variant to validate
-        * @return mixed Returns the variant if it is valid, null otherwise
+        * @return mixed Returns an equivalent valid variant code if possible,
+        *   null otherwise
         */
        public function validateVariant( $variant = null ) {
                if ( $variant === null ) {