From: James D. Forrester Date: Thu, 24 May 2018 20:11:11 +0000 (-0700) Subject: IcuCollation: Deprecate getICUVersion(), no need for PHP53 back-compat X-Git-Tag: 1.34.0-rc.0~5307 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmes_infos.php?a=commitdiff_plain;ds=sidebyside;h=a6c4d473defb54b6dbfd35678c654d2ce5d437f1;p=lhc%2Fweb%2Fwiklou.git IcuCollation: Deprecate getICUVersion(), no need for PHP53 back-compat Change-Id: If8dfdaf187b32b7b9a2c09a240416b9f481593f1 --- diff --git a/RELEASE-NOTES-1.32 b/RELEASE-NOTES-1.32 index 00e43c5ff9..7cc1eb02f2 100644 --- a/RELEASE-NOTES-1.32 +++ b/RELEASE-NOTES-1.32 @@ -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 diff --git a/includes/collation/IcuCollation.php b/includes/collation/IcuCollation.php index 9ac81ae01e..583e44a175 100644 --- a/includes/collation/IcuCollation.php +++ b/includes/collation/IcuCollation.php @@ -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; }