From a6c4d473defb54b6dbfd35678c654d2ce5d437f1 Mon Sep 17 00:00:00 2001 From: "James D. Forrester" Date: Thu, 24 May 2018 13:11:11 -0700 Subject: [PATCH] IcuCollation: Deprecate getICUVersion(), no need for PHP53 back-compat Change-Id: If8dfdaf187b32b7b9a2c09a240416b9f481593f1 --- RELEASE-NOTES-1.32 | 2 ++ includes/collation/IcuCollation.php | 16 ++++++---------- 2 files changed, 8 insertions(+), 10 deletions(-) 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; } -- 2.20.1