API: Add missing `@ingroup API` to a few Api-related classes
[lhc/web/wiklou.git] / languages / Language.php
index 7b89a9c..51ff8d5 100644 (file)
@@ -55,13 +55,15 @@ class Language {
        const SUPPORTED = 'mwfile';
 
        /**
-        * @var LanguageConverter
+        * @var LanguageConverter|FakeConverter
         */
        public $mConverter;
 
        public $mVariants, $mCode, $mLoaded = false;
        public $mMagicExtensions = [];
-       private $mHtmlCode = null, $mParentLanguage = false;
+       private $mHtmlCode = null;
+       /** @var Language|false */
+       private $mParentLanguage = false;
 
        public $dateFormatStrings = [];
        public $mExtendedSpecialPageAliases;
@@ -467,6 +469,7 @@ class Language {
 
        /**
         * Reduce memory usage
+        * @suppress PhanTypeSuspiciousNonTraversableForeach
         */
        function __destruct() {
                foreach ( $this as $name => $value ) {
@@ -814,7 +817,8 @@ class Language {
         * @return array
         */
        public function getExtraUserToggles() {
-               return (array)self::$dataCache->getItem( $this->mCode, 'extraUserToggles' );
+               wfDeprecated( __METHOD__, '1.34' );
+               return [];
        }
 
        /**
@@ -2966,8 +2970,8 @@ class Language {
        }
 
        /**
-        * @param array $termsArray
-        * @return array
+        * @param string[] $termsArray
+        * @return string[]
         */
        function convertForSearchResult( $termsArray ) {
                # some languages, e.g. Chinese, need to do a conversion
@@ -3033,34 +3037,6 @@ class Language {
                }
        }
 
-       /**
-        * @deprecated No-op since 1.28
-        */
-       function initEncoding() {
-               wfDeprecated( __METHOD__, '1.28' );
-               // No-op.
-       }
-
-       /**
-        * @param string $s
-        * @return string
-        * @deprecated No-op since 1.28
-        */
-       function recodeForEdit( $s ) {
-               wfDeprecated( __METHOD__, '1.28' );
-               return $s;
-       }
-
-       /**
-        * @param string $s
-        * @return string
-        * @deprecated No-op since 1.28
-        */
-       function recodeInput( $s ) {
-               wfDeprecated( __METHOD__, '1.28' );
-               return $s;
-       }
-
        /**
         * Convert a UTF-8 string to normal form C. In Malayalam and Arabic, this
         * also cleans up certain backwards-compatible sequences, converting them
@@ -4564,7 +4540,7 @@ class Language {
         *
         * @since 1.22
         * @param string $code Language code
-        * @return array Array( fallbacks, site fallbacks )
+        * @return array [ fallbacks, site fallbacks ]
         */
        public static function getFallbacksIncludingSiteLanguage( $code ) {
                global $wgLanguageCode;
@@ -4686,6 +4662,7 @@ class Language {
         *
         * @param int|float $seconds
         * @param array $format An optional argument that formats the returned string in different ways:
+        *   If $format['avoid'] === 'avoidhours': don't show hours, just show days
         *   If $format['avoid'] === 'avoidseconds': don't show seconds if $seconds >= 1 hour,
         *   If $format['avoid'] === 'avoidminutes': don't show seconds/minutes if $seconds > 48 hours,
         *   If $format['noabbrevs'] is true: use 'seconds' and friends instead of 'seconds-abbrev'
@@ -4744,12 +4721,19 @@ class Language {
                        $s = $hoursMsg->params( $this->formatNum( $hours ) )->text();
                        $s .= ' ';
                        $s .= $minutesMsg->params( $this->formatNum( $minutes ) )->text();
-                       if ( !in_array( $format['avoid'], [ 'avoidseconds', 'avoidminutes' ] ) ) {
+                       if ( !in_array( $format['avoid'], [ 'avoidseconds', 'avoidminutes', 'avoidhours' ] ) ) {
                                $s .= ' ' . $secondsMsg->params( $this->formatNum( $secondsPart ) )->text();
                        }
                } else {
                        $days = floor( $seconds / 86400 );
-                       if ( $format['avoid'] === 'avoidminutes' ) {
+                       if ( $format['avoid'] === 'avoidhours' ) {
+                               $hours = round( ( $seconds - $days * 86400 ) / 3600 );
+                               if ( $hours == 24 ) {
+                                       $hours = 0;
+                                       $days++;
+                               }
+                               $s = $daysMsg->params( $this->formatNum( $days ) )->text();
+                       } elseif ( $format['avoid'] === 'avoidminutes' ) {
                                $hours = round( ( $seconds - $days * 86400 ) / 3600 );
                                if ( $hours == 24 ) {
                                        $hours = 0;
@@ -4876,12 +4860,13 @@ class Language {
         * @param array $query Optional URL query parameter string
         * @param bool $atend Optional param for specified if this is the last page
         * @return string
-        * @deprecated since 1.33, use SpecialPage::viewPrevNext()
+        * @deprecated since 1.34, use PrevNextNavigationRenderer::buildPrevNextNavigation()
         *  instead.
         */
        public function viewPrevNext( Title $title, $offset, $limit,
                array $query = [], $atend = false
        ) {
+               wfDeprecated( __METHOD__, '1.34' );
                // @todo FIXME: Why on earth this needs one message for the text and another one for tooltip?
 
                # Make 'previous' link