From: lwelling Date: Fri, 3 May 2013 17:26:14 +0000 (-0400) Subject: Code style fixes in Language::isValidCode() X-Git-Tag: 1.31.0-rc.0~19775 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/supprimer.php?a=commitdiff_plain;h=31fe5f54b72b3d375c4ee2c94bef4dd770ed9540;p=lhc%2Fweb%2Fwiklou.git Code style fixes in Language::isValidCode() Fix issues from https://gerrit.wikimedia.org/r/#/c/62123 Change-Id: I97e826bb9aa9e3a14d07aab7cf02a09ef2c84ef7 --- diff --git a/languages/Language.php b/languages/Language.php index 84e7f37db8..2fd4bb75d0 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -327,18 +327,18 @@ class Language { */ public static function isValidCode( $code ) { static $cache = array(); - if( isset( $cache[$code] ) ) { + if ( isset( $cache[$code] ) ) { return $cache[$code]; } // People think language codes are html safe, so enforce it. // Ideally we should only allow a-zA-Z0-9- // but, .+ and other chars are often used for {{int:}} hacks // see bugs 37564, 37587, 36938 - $return = + $cache[$code] = strcspn( $code, ":/\\\000&<>'\"" ) === strlen( $code ) && !preg_match( Title::getTitleInvalidRegex(), $code ); - $cache[ $code ] = $return; - return $return; + + return $cache[$code]; } /**