From 9b44bc863e6f8fa29c5b5a60259958d758c3f161 Mon Sep 17 00:00:00 2001 From: addshore Date: Sun, 3 Apr 2016 11:36:49 +0300 Subject: [PATCH] Add @since tags to Collation stuff Change-Id: Iec56ac4d1418737d171f8faa9c8f498fba5383ee --- includes/collation/Collation.php | 14 ++++++++++++-- includes/collation/CollationCkb.php | 4 +++- includes/collation/CollationEt.php | 8 +++++--- includes/collation/IcuCollation.php | 23 ++++++++++++++++++++++- includes/collation/IdentityCollation.php | 2 ++ includes/collation/UppercaseCollation.php | 2 ++ 6 files changed, 46 insertions(+), 7 deletions(-) diff --git a/includes/collation/Collation.php b/includes/collation/Collation.php index 84d1f249cc..9fb06604f8 100644 --- a/includes/collation/Collation.php +++ b/includes/collation/Collation.php @@ -20,13 +20,18 @@ * @file */ +/** + * @since 1.16.3 + * @author Tim Starling + */ abstract class Collation { private static $instance; /** + * @since 1.16.3 * @return Collation */ - static function singleton() { + public static function singleton() { if ( !self::$instance ) { global $wgCategoryCollation; self::$instance = self::factory( $wgCategoryCollation ); @@ -35,11 +40,12 @@ abstract class Collation { } /** + * @since 1.16.3 * @throws MWException * @param string $collationName * @return Collation */ - static function factory( $collationName ) { + public static function factory( $collationName ) { switch ( $collationName ) { case 'uppercase': return new UppercaseCollation; @@ -78,6 +84,8 @@ abstract class Collation { * has no other particular expectations (and that one can be changed if * necessary). * + * @since 1.16.3 + * * @param string $string UTF-8 string * @return string Binary sortkey */ @@ -103,6 +111,8 @@ abstract class Collation { * * etc., assuming for the sake of argument that $wgCapitalLinks is false. * + * @since 1.16.3 + * * @param string $string UTF-8 string * @return string UTF-8 string corresponding to the first letter of input */ diff --git a/includes/collation/CollationCkb.php b/includes/collation/CollationCkb.php index da1a56259e..01a4f7f52a 100644 --- a/includes/collation/CollationCkb.php +++ b/includes/collation/CollationCkb.php @@ -22,9 +22,11 @@ * Workaround for the lack of support of Sorani Kurdish / Central Kurdish language ('ckb') in ICU. * * Uses the same collation rules as Persian / Farsi ('fa'), but different characters for digits. + * + * @since 1.23 */ class CollationCkb extends IcuCollation { - function __construct() { + public function __construct() { // This will set $locale and collators, which affect the actual sorting order parent::__construct( 'fa' ); // Override the 'fa' language set by parent constructor, which affects #getFirstLetterData() diff --git a/includes/collation/CollationEt.php b/includes/collation/CollationEt.php index d80bce30e1..5dc9fa29ec 100644 --- a/includes/collation/CollationEt.php +++ b/includes/collation/CollationEt.php @@ -25,9 +25,11 @@ * Estonian. We work around this by replacing 'W' and 'w' with 'á´¡' U+1D21 'LATIN LETTER SMALL * CAPITAL W' for sortkey generation, which is collated like 'W' and is not tailored to have the * same primary weight as 'V' in Estonian. + * + * @since 1.24 */ class CollationEt extends IcuCollation { - function __construct() { + public function __construct() { parent::__construct( 'et' ); } @@ -48,11 +50,11 @@ class CollationEt extends IcuCollation { ); } - function getSortKey( $string ) { + public function getSortKey( $string ) { return parent::getSortKey( self::mangle( $string ) ); } - function getFirstLetter( $string ) { + public function getFirstLetter( $string ) { return self::unmangle( parent::getFirstLetter( self::mangle( $string ) ) ); } } diff --git a/includes/collation/IcuCollation.php b/includes/collation/IcuCollation.php index fee4cd08e5..0aa14065aa 100644 --- a/includes/collation/IcuCollation.php +++ b/includes/collation/IcuCollation.php @@ -18,6 +18,9 @@ * @file */ +/** + * @since 1.16.3 + */ class IcuCollation extends Collation { const FIRST_LETTER_VERSION = 2; @@ -159,6 +162,9 @@ class IcuCollation extends Collation { 'uz' => [ "Ch", "G'", "Ng", "O'", "Sh" ], ]; + /** + * @since 1.16.3 + */ const RECORD_LENGTH = 14; public function __construct( $locale ) { @@ -226,6 +232,9 @@ class IcuCollation extends Collation { return $this->getLetterByIndex( $min ); } + /** + * @since 1.16.3 + */ public function getFirstLetterData() { if ( $this->firstLetterData !== null ) { return $this->firstLetterData; @@ -377,6 +386,9 @@ class IcuCollation extends Collation { return $data; } + /** + * @since 1.16.3 + */ public function getLetterByIndex( $index ) { if ( $this->firstLetterData === null ) { $this->getFirstLetterData(); @@ -384,6 +396,9 @@ class IcuCollation extends Collation { return $this->firstLetterData['chars'][$index]; } + /** + * @since 1.16.3 + */ public function getSortKeyByLetterIndex( $index ) { if ( $this->firstLetterData === null ) { $this->getFirstLetterData(); @@ -391,6 +406,9 @@ class IcuCollation extends Collation { return $this->firstLetterData['keys'][$index]; } + /** + * @since 1.16.3 + */ public function getFirstLetterCount() { if ( $this->firstLetterData === null ) { $this->getFirstLetterData(); @@ -398,7 +416,10 @@ class IcuCollation extends Collation { return count( $this->firstLetterData['chars'] ); } - static function isCjk( $codepoint ) { + /** + * @since 1.16.3 + */ + public static function isCjk( $codepoint ) { foreach ( self::$cjkBlocks as $block ) { if ( $codepoint >= $block[0] && $codepoint <= $block[1] ) { return true; diff --git a/includes/collation/IdentityCollation.php b/includes/collation/IdentityCollation.php index 9a99f1a4e8..46e7f38f5b 100644 --- a/includes/collation/IdentityCollation.php +++ b/includes/collation/IdentityCollation.php @@ -23,6 +23,8 @@ * * Does sorting based on binary value of the string. * Like how things were pre 1.17. + * + * @since 1.18 */ class IdentityCollation extends Collation { diff --git a/includes/collation/UppercaseCollation.php b/includes/collation/UppercaseCollation.php index c589a760b9..92a4c3b47a 100644 --- a/includes/collation/UppercaseCollation.php +++ b/includes/collation/UppercaseCollation.php @@ -15,6 +15,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * http://www.gnu.org/copyleft/gpl.html * + * @since 1.16.3 + * * @file */ -- 2.20.1