IcuCollation: Deprecate getICUVersion(), no need for PHP53 back-compat
authorJames D. Forrester <jforrester@wikimedia.org>
Thu, 24 May 2018 20:11:11 +0000 (13:11 -0700)
committerKrinkle <krinklemail@gmail.com>
Thu, 24 May 2018 21:23:18 +0000 (21:23 +0000)
Change-Id: If8dfdaf187b32b7b9a2c09a240416b9f481593f1

RELEASE-NOTES-1.32
includes/collation/IcuCollation.php

index 00e43c5..7cc1eb0 100644 (file)
@@ -133,6 +133,8 @@ because of Phabricator reports.
   to use it.
 * WatchAction::getUnwatchToken is deprecated. Use WatchAction::getWatchToken
   with the 'unwatch' action parameter instead.
+* IcuCollation::getICUVersion() is deprecated, as you can just use the PHP
+  constant INTL_ICU_VERSION directly in all versions that MediaWiki supports.
 
 === Other changes in 1.32 ===
 * Soft hyphens (U+00AD) are now automatically removed from titles; these
index 9ac81ae..583e44a 100644 (file)
@@ -333,7 +333,7 @@ class IcuCollation extends Collation {
                                static::class,
                                $this->locale,
                                $this->digitTransformLanguage->getCode(),
-                               self::getICUVersion(),
+                               INTL_ICU_VERSION,
                                self::FIRST_LETTER_VERSION
                        );
                        $this->firstLetterData = $cache->getWithSetCallback( $cacheKey, $cache::TTL_WEEK, function () {
@@ -528,18 +528,14 @@ class IcuCollation extends Collation {
         * can't be determined.
         *
         * The constant INTL_ICU_VERSION this function refers to isn't really
-        * documented. It is available since PHP 5.3.7 (see PHP 54561
-        * https://bugs.php.net/bug.php?id=54561). This function will return
-        * false on older PHPs.
-        *
-        * TODO: Remove the backwards-compatibility as MediaWiki now requires
-        * higher levels of PHP.
+        * documented, but see https://bugs.php.net/bug.php?id=54561.
         *
         * @since 1.21
-        * @return string|bool
+        * @deprecated since 1.32, use INTL_ICU_VERSION directly
+        * @return string
         */
        static function getICUVersion() {
-               return defined( 'INTL_ICU_VERSION' ) ? INTL_ICU_VERSION : false;
+               return INTL_ICU_VERSION;
        }
 
        /**
@@ -550,7 +546,7 @@ class IcuCollation extends Collation {
         * @return string|bool
         */
        static function getUnicodeVersionForICU() {
-               $icuVersion = self::getICUVersion();
+               $icuVersion = INTL_ICU_VERSION;
                if ( !$icuVersion ) {
                        return false;
                }