Merge "Fix and make some types in PHPDoc and JSDoc tags more specific"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sat, 5 Aug 2017 22:07:59 +0000 (22:07 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sat, 5 Aug 2017 22:08:00 +0000 (22:08 +0000)
1  2 
includes/api/ApiBase.php
languages/Language.php

diff --combined includes/api/ApiBase.php
@@@ -548,7 -548,7 +548,7 @@@ abstract class ApiBase extends ContextS
                // Main module has this method overridden
                // Safety - avoid infinite loop:
                if ( $this->isMain() ) {
 -                      ApiBase::dieDebug( __METHOD__, 'base method was called on main module.' );
 +                      self::dieDebug( __METHOD__, 'base method was called on main module.' );
                }
  
                return $this->getMain()->lacksSameOriginSecurity();
                // Main module has getResult() method overridden
                // Safety - avoid infinite loop:
                if ( $this->isMain() ) {
 -                      ApiBase::dieDebug( __METHOD__, 'base method was called on main module. ' );
 +                      self::dieDebug( __METHOD__, 'base method was called on main module. ' );
                }
  
                return $this->getMain()->getResult();
                // Main module has getErrorFormatter() method overridden
                // Safety - avoid infinite loop:
                if ( $this->isMain() ) {
 -                      ApiBase::dieDebug( __METHOD__, 'base method was called on main module. ' );
 +                      self::dieDebug( __METHOD__, 'base method was called on main module. ' );
                }
  
                return $this->getMain()->getErrorFormatter();
                // Main module has getContinuationManager() method overridden
                // Safety - avoid infinite loop:
                if ( $this->isMain() ) {
 -                      ApiBase::dieDebug( __METHOD__, 'base method was called on main module. ' );
 +                      self::dieDebug( __METHOD__, 'base method was called on main module. ' );
                }
  
                return $this->getMain()->getContinuationManager();
                // Main module has setContinuationManager() method overridden
                // Safety - avoid infinite loop:
                if ( $this->isMain() ) {
 -                      ApiBase::dieDebug( __METHOD__, 'base method was called on main module. ' );
 +                      self::dieDebug( __METHOD__, 'base method was called on main module. ' );
                }
  
                $this->getMain()->setContinuationManager( $manager );
                if ( $type == 'boolean' ) {
                        if ( isset( $default ) && $default !== false ) {
                                // Having a default value of anything other than 'false' is not allowed
 -                              ApiBase::dieDebug(
 +                              self::dieDebug(
                                        __METHOD__,
                                        "Boolean param $encParamName's default is set to '$default'. " .
                                                'Boolean parameters must default to false.'
                } elseif ( $type == 'upload' ) {
                        if ( isset( $default ) ) {
                                // Having a default value is not allowed
 -                              ApiBase::dieDebug(
 +                              self::dieDebug(
                                        __METHOD__,
                                        "File upload param $encParamName's default is set to " .
                                                "'$default'. File upload parameters may not have a default." );
                        }
                        if ( $multi ) {
 -                              ApiBase::dieDebug( __METHOD__, "Multi-values not supported for $encParamName" );
 +                              self::dieDebug( __METHOD__, "Multi-values not supported for $encParamName" );
                        }
                        $value = $this->getMain()->getUpload( $encParamName );
                        if ( !$value->exists() ) {
  
                $allSpecifier = ( is_string( $allowAll ) ? $allowAll : self::ALL_DEFAULT_STRING );
                if ( $allowAll && $multi && is_array( $type ) && in_array( $allSpecifier, $type, true ) ) {
 -                      ApiBase::dieDebug(
 +                      self::dieDebug(
                                __METHOD__,
                                "For param $encParamName, PARAM_ALL collides with a possible value" );
                }
                                                if ( !isset( $paramSettings[self::PARAM_MAX] )
                                                        || !isset( $paramSettings[self::PARAM_MAX2] )
                                                ) {
 -                                                      ApiBase::dieDebug(
 +                                                      self::dieDebug(
                                                                __METHOD__,
                                                                "MAX1 or MAX2 are not defined for the limit $encParamName"
                                                        );
                                                }
                                                if ( $multi ) {
 -                                                      ApiBase::dieDebug( __METHOD__, "Multi-values not supported for $encParamName" );
 +                                                      self::dieDebug( __METHOD__, "Multi-values not supported for $encParamName" );
                                                }
                                                $min = isset( $paramSettings[self::PARAM_MIN] ) ? $paramSettings[self::PARAM_MIN] : 0;
                                                if ( $value == 'max' ) {
                                                break;
                                        case 'boolean':
                                                if ( $multi ) {
 -                                                      ApiBase::dieDebug( __METHOD__, "Multi-values not supported for $encParamName" );
 +                                                      self::dieDebug( __METHOD__, "Multi-values not supported for $encParamName" );
                                                }
                                                break;
                                        case 'timestamp':
                                                }
                                                break;
                                        default:
 -                                              ApiBase::dieDebug( __METHOD__, "Param $encParamName's type is unknown - $type" );
 +                                              self::dieDebug( __METHOD__, "Param $encParamName's type is unknown - $type" );
                                }
                        }
  
         * @return Message
         */
        public function getFinalSummary() {
 -              $msg = ApiBase::makeMessage( $this->getSummaryMessage(), $this->getContext(), [
 +              $msg = self::makeMessage( $this->getSummaryMessage(), $this->getContext(), [
                        $this->getModulePrefix(),
                        $this->getModuleName(),
                        $this->getModulePath(),
                ] );
                if ( !$msg->exists() ) {
                        wfDeprecated( 'API help "description" messages', '1.30' );
 -                      $msg = ApiBase::makeMessage( $this->getDescriptionMessage(), $this->getContext(), [
 +                      $msg = self::makeMessage( $this->getDescriptionMessage(), $this->getContext(), [
                                $this->getModulePrefix(),
                                $this->getModuleName(),
                                $this->getModulePath(),
                        ] );
 -                      $msg = ApiBase::makeMessage( 'rawmessage', $this->getContext(), [
 +                      $msg = self::makeMessage( 'rawmessage', $this->getContext(), [
                                preg_replace( '/\n.*/s', '', $msg->text() )
                        ] );
                }
                        $desc = (string)$desc;
                }
  
 -              $summary = ApiBase::makeMessage( $this->getSummaryMessage(), $this->getContext(), [
 +              $summary = self::makeMessage( $this->getSummaryMessage(), $this->getContext(), [
                        $this->getModulePrefix(),
                        $this->getModuleName(),
                        $this->getModulePath(),
                ] );
 -              $extendedDescription = ApiBase::makeMessage(
 +              $extendedDescription = self::makeMessage(
                        $this->getExtendedDescription(), $this->getContext(), [
                                $this->getModulePrefix(),
                                $this->getModuleName(),
                        $msgs = [ $summary, $extendedDescription ];
                } else {
                        wfDeprecated( 'API help "description" messages', '1.30' );
 -                      $description = ApiBase::makeMessage( $this->getDescriptionMessage(), $this->getContext(), [
 +                      $description = self::makeMessage( $this->getDescriptionMessage(), $this->getContext(), [
                                $this->getModulePrefix(),
                                $this->getModuleName(),
                                $this->getModulePath(),
  
                if ( $this->needsToken() ) {
                        $params['token'] = [
 -                              ApiBase::PARAM_TYPE => 'string',
 -                              ApiBase::PARAM_REQUIRED => true,
 -                              ApiBase::PARAM_SENSITIVE => true,
 -                              ApiBase::PARAM_HELP_MSG => [
 +                              self::PARAM_TYPE => 'string',
 +                              self::PARAM_REQUIRED => true,
 +                              self::PARAM_SENSITIVE => true,
 +                              self::PARAM_HELP_MSG => [
                                        'api-help-param-token',
                                        $this->needsToken(),
                                ],
                }
                $desc = self::escapeWikiText( $desc );
  
 -              $params = $this->getFinalParams( ApiBase::GET_VALUES_FOR_HELP );
 +              $params = $this->getFinalParams( self::GET_VALUES_FOR_HELP );
                $msgs = [];
                foreach ( $params as $param => $settings ) {
                        if ( !is_array( $settings ) ) {
                                $d = implode( ' ', $d );
                        }
  
 -                      if ( isset( $settings[ApiBase::PARAM_HELP_MSG] ) ) {
 -                              $msg = $settings[ApiBase::PARAM_HELP_MSG];
 +                      if ( isset( $settings[self::PARAM_HELP_MSG] ) ) {
 +                              $msg = $settings[self::PARAM_HELP_MSG];
                        } else {
                                $msg = $this->msg( "apihelp-{$path}-param-{$param}" );
                                if ( !$msg->exists() ) {
                                        $msg = $this->msg( 'api-help-fallback-parameter', $d );
                                }
                        }
 -                      $msg = ApiBase::makeMessage( $msg, $this->getContext(),
 +                      $msg = self::makeMessage( $msg, $this->getContext(),
                                [ $prefix, $param, $name, $path ] );
                        if ( !$msg ) {
                                self::dieDebug( __METHOD__,
                        }
                        $msgs[$param] = [ $msg ];
  
 -                      if ( isset( $settings[ApiBase::PARAM_TYPE] ) &&
 -                              $settings[ApiBase::PARAM_TYPE] === 'submodule'
 +                      if ( isset( $settings[self::PARAM_TYPE] ) &&
 +                              $settings[self::PARAM_TYPE] === 'submodule'
                        ) {
 -                              if ( isset( $settings[ApiBase::PARAM_SUBMODULE_MAP] ) ) {
 -                                      $map = $settings[ApiBase::PARAM_SUBMODULE_MAP];
 +                              if ( isset( $settings[self::PARAM_SUBMODULE_MAP] ) ) {
 +                                      $map = $settings[self::PARAM_SUBMODULE_MAP];
                                } else {
                                        $prefix = $this->isMain() ? '' : ( $this->getModulePath() . '+' );
                                        $map = [];
                                        $arr[] = $m->setContext( $this->getContext() );
                                }
                                $msgs[$param] = array_merge( $msgs[$param], $submodules, $deprecatedSubmodules );
 -                      } elseif ( isset( $settings[ApiBase::PARAM_HELP_MSG_PER_VALUE] ) ) {
 -                              if ( !is_array( $settings[ApiBase::PARAM_HELP_MSG_PER_VALUE] ) ) {
 +                      } elseif ( isset( $settings[self::PARAM_HELP_MSG_PER_VALUE] ) ) {
 +                              if ( !is_array( $settings[self::PARAM_HELP_MSG_PER_VALUE] ) ) {
                                        self::dieDebug( __METHOD__,
                                                'ApiBase::PARAM_HELP_MSG_PER_VALUE is not valid' );
                                }
 -                              if ( !is_array( $settings[ApiBase::PARAM_TYPE] ) ) {
 +                              if ( !is_array( $settings[self::PARAM_TYPE] ) ) {
                                        self::dieDebug( __METHOD__,
                                                'ApiBase::PARAM_HELP_MSG_PER_VALUE may only be used when ' .
                                                'ApiBase::PARAM_TYPE is an array' );
                                }
  
 -                              $valueMsgs = $settings[ApiBase::PARAM_HELP_MSG_PER_VALUE];
 -                              $deprecatedValues = isset( $settings[ApiBase::PARAM_DEPRECATED_VALUES] )
 -                                      ? $settings[ApiBase::PARAM_DEPRECATED_VALUES]
 +                              $valueMsgs = $settings[self::PARAM_HELP_MSG_PER_VALUE];
 +                              $deprecatedValues = isset( $settings[self::PARAM_DEPRECATED_VALUES] )
 +                                      ? $settings[self::PARAM_DEPRECATED_VALUES]
                                        : [];
  
 -                              foreach ( $settings[ApiBase::PARAM_TYPE] as $value ) {
 +                              foreach ( $settings[self::PARAM_TYPE] as $value ) {
                                        if ( isset( $valueMsgs[$value] ) ) {
                                                $msg = $valueMsgs[$value];
                                        } else {
                                                $msg = "apihelp-{$path}-paramvalue-{$param}-{$value}";
                                        }
 -                                      $m = ApiBase::makeMessage( $msg, $this->getContext(),
 +                                      $m = self::makeMessage( $msg, $this->getContext(),
                                                [ $prefix, $param, $name, $path, $value ] );
                                        if ( $m ) {
                                                $m = new ApiHelpParamValueMessage(
                                }
                        }
  
 -                      if ( isset( $settings[ApiBase::PARAM_HELP_MSG_APPEND] ) ) {
 -                              if ( !is_array( $settings[ApiBase::PARAM_HELP_MSG_APPEND] ) ) {
 +                      if ( isset( $settings[self::PARAM_HELP_MSG_APPEND] ) ) {
 +                              if ( !is_array( $settings[self::PARAM_HELP_MSG_APPEND] ) ) {
                                        self::dieDebug( __METHOD__,
                                                'Value for ApiBase::PARAM_HELP_MSG_APPEND is not an array' );
                                }
 -                              foreach ( $settings[ApiBase::PARAM_HELP_MSG_APPEND] as $m ) {
 -                                      $m = ApiBase::makeMessage( $m, $this->getContext(),
 +                              foreach ( $settings[self::PARAM_HELP_MSG_APPEND] as $m ) {
 +                                      $m = self::makeMessage( $m, $this->getContext(),
                                                [ $prefix, $param, $name, $path ] );
                                        if ( $m ) {
                                                $msgs[$param][] = $m;
         * @param string $warning Warning message
         */
        public function setWarning( $warning ) {
 +              wfDeprecated( __METHOD__, '1.29' );
                $msg = new ApiRawMessage( $warning, 'warning' );
                $this->getErrorFormatter()->addWarning( $this->getModulePath(), $msg );
        }
         * @throws ApiUsageException always
         */
        public function dieUsage( $description, $errorCode, $httpRespCode = 0, $extradata = null ) {
 +              wfDeprecated( __METHOD__, '1.29' );
                $this->dieWithError(
                        new RawMessage( '$1', [ $description ] ),
                        $errorCode,
         * @throws MWException
         */
        public function getErrorFromStatus( $status, &$extraData = null ) {
 +              wfDeprecated( __METHOD__, '1.29' );
                if ( $status->isGood() ) {
                        throw new MWException( 'Successful status passed to ApiBase::dieStatus' );
                }
         * Return the error message related to a certain array
         * @deprecated since 1.29
         * @param array|string|MessageSpecifier $error Element of a getUserPermissionsErrors()-style array
-        * @return [ 'code' => code, 'info' => info ]
+        * @return array [ 'code' => code, 'info' => info ]
         */
        public function parseMsg( $error ) {
 +              wfDeprecated( __METHOD__, '1.29' );
                // Check whether someone passed the whole array, instead of one element as
                // documented. This breaks if it's actually an array of fallback keys, but
                // that's long-standing misbehavior introduced in r87627 to incorrectly
         * @throws ApiUsageException always
         */
        public function dieUsageMsg( $error ) {
 +              wfDeprecated( __METHOD__, '1.29' );
                $this->dieWithError( $this->parseMsgInternal( $error ) );
        }
  
         * @since 1.21
         */
        public function dieUsageMsgOrDebug( $error ) {
 +              wfDeprecated( __METHOD__, '1.29' );
                $this->dieWithErrorOrDebug( $this->parseMsgInternal( $error ) );
        }
  
diff --combined languages/Language.php
@@@ -208,11 -208,11 +208,11 @@@ class Language 
         * @return Language
         */
        protected static function newFromCode( $code, $fallback = false ) {
 -              if ( !Language::isValidCode( $code ) ) {
 +              if ( !self::isValidCode( $code ) ) {
                        throw new MWException( "Invalid language code \"$code\"" );
                }
  
 -              if ( !Language::isValidBuiltInCode( $code ) ) {
 +              if ( !self::isValidBuiltInCode( $code ) ) {
                        // It's not possible to customise this code with class files, so
                        // just return a Language object. This is to support uselang= hacks.
                        $lang = new Language;
                }
  
                // Keep trying the fallback list until we find an existing class
 -              $fallbacks = Language::getFallbacksFor( $code );
 +              $fallbacks = self::getFallbacksFor( $code );
                foreach ( $fallbacks as $fallbackCode ) {
 -                      if ( !Language::isValidBuiltInCode( $fallbackCode ) ) {
 +                      if ( !self::isValidBuiltInCode( $fallbackCode ) ) {
                                throw new MWException( "Invalid fallback '$fallbackCode' in fallback sequence for '$code'" );
                        }
  
                global $wgExtraLanguageNames, $wgUsePigLatinVariant;
  
                // If passed an invalid language code to use, fallback to en
 -              if ( $inLanguage !== null && !Language::isValidCode( $inLanguage ) ) {
 +              if ( $inLanguage !== null && !self::isValidCode( $inLanguage ) ) {
                        $inLanguage = 'en';
                }
  
         *      YYYYMMDDHHMMSS
         *      01234567890123
         * @param DateTimeZone $zone Timezone of $ts
-        * @param[out] int $ttl The amount of time (in seconds) the output may be cached for.
+        * @param int &$ttl The amount of time (in seconds) the output may be cached for.
         * Only makes sense if $ts is the current time.
         * @todo handling of "o" format character for Iranian, Hebrew, Hijri & Thai?
         *
                                case 'D':
                                        $usedDay = true;
                                        $s .= $this->getWeekdayAbbreviation(
 -                                              Language::dateTimeObjFormat( $dateTimeObj, $ts, $zone, 'w' ) + 1
 +                                              self::dateTimeObjFormat( $dateTimeObj, $ts, $zone, 'w' ) + 1
                                        );
                                        break;
                                case 'j':
                                case 'l':
                                        $usedDay = true;
                                        $s .= $this->getWeekdayName(
 -                                              Language::dateTimeObjFormat( $dateTimeObj, $ts, $zone, 'w' ) + 1
 +                                              self::dateTimeObjFormat( $dateTimeObj, $ts, $zone, 'w' ) + 1
                                        );
                                        break;
                                case 'F':
                                case 'O':
                                case 'P':
                                case 'T':
 -                                      $s .= Language::dateTimeObjFormat( $dateTimeObj, $ts, $zone, $code );
 +                                      $s .= self::dateTimeObjFormat( $dateTimeObj, $ts, $zone, $code );
                                        break;
                                case 'w':
                                case 'N':
                                case 'z':
                                        $usedDay = true;
 -                                      $num = Language::dateTimeObjFormat( $dateTimeObj, $ts, $zone, $code );
 +                                      $num = self::dateTimeObjFormat( $dateTimeObj, $ts, $zone, $code );
                                        break;
                                case 'W':
                                        $usedWeek = true;
 -                                      $num = Language::dateTimeObjFormat( $dateTimeObj, $ts, $zone, $code );
 +                                      $num = self::dateTimeObjFormat( $dateTimeObj, $ts, $zone, $code );
                                        break;
                                case 't':
                                        $usedMonth = true;
 -                                      $num = Language::dateTimeObjFormat( $dateTimeObj, $ts, $zone, $code );
 +                                      $num = self::dateTimeObjFormat( $dateTimeObj, $ts, $zone, $code );
                                        break;
                                case 'L':
                                        $usedIsLeapYear = true;
 -                                      $num = Language::dateTimeObjFormat( $dateTimeObj, $ts, $zone, $code );
 +                                      $num = self::dateTimeObjFormat( $dateTimeObj, $ts, $zone, $code );
                                        break;
                                case 'o':
                                        $usedISOYear = true;
 -                                      $num = Language::dateTimeObjFormat( $dateTimeObj, $ts, $zone, $code );
 +                                      $num = self::dateTimeObjFormat( $dateTimeObj, $ts, $zone, $code );
                                        break;
                                case 'U':
                                        $usedSecond = true;
                                        // fall through
                                case 'I':
                                case 'Z':
 -                                      $num = Language::dateTimeObjFormat( $dateTimeObj, $ts, $zone, $code );
 +                                      $num = self::dateTimeObjFormat( $dateTimeObj, $ts, $zone, $code );
                                        break;
                                case '\\':
                                        # Backslash escaping
                                        $s .= $num;
                                        $raw = false;
                                } elseif ( $roman ) {
 -                                      $s .= Language::romanNumeral( $num );
 +                                      $s .= self::romanNumeral( $num );
                                        $roman = false;
                                } elseif ( $hebrewNum ) {
                                        $s .= self::hebrewNumeral( $num );
                                substr( $ts, 10, 2 ) * 60 - substr( $ts, 12, 2 );
                        if ( $usedWeek ) {
                                $possibleTtls[] =
 -                                      ( 7 - Language::dateTimeObjFormat( $dateTimeObj, $ts, $zone, 'N' ) ) * 86400 +
 +                                      ( 7 - self::dateTimeObjFormat( $dateTimeObj, $ts, $zone, 'N' ) ) * 86400 +
                                        $timeRemainingInDay;
                        } elseif ( $usedISOYear ) {
                                // December 28th falls on the last ISO week of the year, every year.
                                        substr( $ts, 0, 4 ) . '1228',
                                        $zone ?: new DateTimeZone( 'UTC' )
                                )->format( 'W' );
 -                              $currentISOWeek = Language::dateTimeObjFormat( $dateTimeObj, $ts, $zone, 'W' );
 +                              $currentISOWeek = self::dateTimeObjFormat( $dateTimeObj, $ts, $zone, 'W' );
                                $weeksRemaining = $lastWeekOfISOYear - $currentISOWeek;
                                $timeRemainingInWeek =
 -                                      ( 7 - Language::dateTimeObjFormat( $dateTimeObj, $ts, $zone, 'N' ) ) * 86400
 +                                      ( 7 - self::dateTimeObjFormat( $dateTimeObj, $ts, $zone, 'N' ) ) * 86400
                                        + $timeRemainingInDay;
                                $possibleTtls[] = $weeksRemaining * 604800 + $timeRemainingInWeek;
                        }
  
                        if ( $usedMonth ) {
                                $possibleTtls[] =
 -                                      ( Language::dateTimeObjFormat( $dateTimeObj, $ts, $zone, 't' ) -
 +                                      ( self::dateTimeObjFormat( $dateTimeObj, $ts, $zone, 't' ) -
                                                substr( $ts, 6, 2 ) ) * 86400
                                        + $timeRemainingInDay;
                        } elseif ( $usedYear ) {
                                $possibleTtls[] =
 -                                      ( Language::dateTimeObjFormat( $dateTimeObj, $ts, $zone, 'L' ) + 364 -
 -                                              Language::dateTimeObjFormat( $dateTimeObj, $ts, $zone, 'z' ) ) * 86400
 +                                      ( self::dateTimeObjFormat( $dateTimeObj, $ts, $zone, 'L' ) + 364 -
 +                                              self::dateTimeObjFormat( $dateTimeObj, $ts, $zone, 'z' ) ) * 86400
                                        + $timeRemainingInDay;
                        } elseif ( $usedIsLeapYear ) {
                                $year = substr( $ts, 0, 4 );
                                $timeRemainingInYear =
 -                                      ( Language::dateTimeObjFormat( $dateTimeObj, $ts, $zone, 'L' ) + 364 -
 -                                              Language::dateTimeObjFormat( $dateTimeObj, $ts, $zone, 'z' ) ) * 86400
 +                                      ( self::dateTimeObjFormat( $dateTimeObj, $ts, $zone, 'L' ) + 364 -
 +                                              self::dateTimeObjFormat( $dateTimeObj, $ts, $zone, 'z' ) ) * 86400
                                        + $timeRemainingInDay;
                                $mod = $year % 4;
                                if ( $mod || ( !( $year % 100 ) && $year % 400 ) ) {
         * @return string Text, wrapped in LRE...PDF or RLE...PDF or nothing
         */
        public function embedBidi( $text = '' ) {
 -              $dir = Language::strongDirFromContent( $text );
 +              $dir = self::strongDirFromContent( $text );
                if ( $dir === 'ltr' ) {
                        // Wrap in LEFT-TO-RIGHT EMBEDDING ... POP DIRECTIONAL FORMATTING
                        return self::$lre . $text . self::$pdf;
                        $this->mParentLanguage = null;
                        return null;
                }
 -              $lang = Language::factory( $code );
 +              $lang = self::factory( $code );
                if ( !$lang->hasVariant( $this->getCode() ) ) {
                        $this->mParentLanguage = null;
                        return null;
         * @return array Non-empty array, ending in "en"
         */
        public static function getFallbacksFor( $code ) {
 -              if ( $code === 'en' || !Language::isValidBuiltInCode( $code ) ) {
 +              if ( $code === 'en' || !self::isValidBuiltInCode( $code ) ) {
                        return [];
                }
                // For unknown languages, fallbackSequence returns an empty array,
        public function formatExpiry( $expiry, $format = true, $infinity = 'infinity' ) {
                static $dbInfinity;
                if ( $dbInfinity === null ) {
 -                      $dbInfinity = wfGetDB( DB_SLAVE )->getInfinity();
 +                      $dbInfinity = wfGetDB( DB_REPLICA )->getInfinity();
                }
  
                if ( $expiry == '' || $expiry === 'infinity' || $expiry == $dbInfinity ) {
         */
        public function getCompiledPluralRules() {
                $pluralRules = self::$dataCache->getItem( strtolower( $this->mCode ), 'compiledPluralRules' );
 -              $fallbacks = Language::getFallbacksFor( $this->mCode );
 +              $fallbacks = self::getFallbacksFor( $this->mCode );
                if ( !$pluralRules ) {
                        foreach ( $fallbacks as $fallbackCode ) {
                                $pluralRules = self::$dataCache->getItem( strtolower( $fallbackCode ), 'compiledPluralRules' );
         */
        public function getPluralRules() {
                $pluralRules = self::$dataCache->getItem( strtolower( $this->mCode ), 'pluralRules' );
 -              $fallbacks = Language::getFallbacksFor( $this->mCode );
 +              $fallbacks = self::getFallbacksFor( $this->mCode );
                if ( !$pluralRules ) {
                        foreach ( $fallbacks as $fallbackCode ) {
                                $pluralRules = self::$dataCache->getItem( strtolower( $fallbackCode ), 'pluralRules' );
         */
        public function getPluralRuleTypes() {
                $pluralRuleTypes = self::$dataCache->getItem( strtolower( $this->mCode ), 'pluralRuleTypes' );
 -              $fallbacks = Language::getFallbacksFor( $this->mCode );
 +              $fallbacks = self::getFallbacksFor( $this->mCode );
                if ( !$pluralRuleTypes ) {
                        foreach ( $fallbacks as $fallbackCode ) {
                                $pluralRuleTypes = self::$dataCache->getItem( strtolower( $fallbackCode ), 'pluralRuleTypes' );