Addshore has uploaded a new change for review.
https://gerrit.wikimedia.org/r/281264
Change subject: Add @since tags to Collation stuff
......................................................................
Add @since tags to Collation stuff
Change-Id: Iec56ac4d1418737d171f8faa9c8f498fba5383ee
---
M includes/collation/Collation.php
M includes/collation/CollationCkb.php
M includes/collation/CollationEt.php
M includes/collation/IcuCollation.php
M includes/collation/IdentityCollation.php
M includes/collation/UppercaseCollation.php
6 files changed, 48 insertions(+), 7 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/64/281264/1
diff --git a/includes/collation/Collation.php b/includes/collation/Collation.php
index 84d1f24..9fb0660 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 @@
}
/**
+ * @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 @@
* 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 @@
*
* 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 da1a562..01a4f7f 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 d80bce3..5dc9fa2 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 @@
);
}
- 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 fee4cd0..c77ca1c 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 @@
'uz' => [ "Ch", "G'", "Ng", "O'", "Sh" ],
];
+ /**
+ * @since 1.16.3
+ */
const RECORD_LENGTH = 14;
public function __construct( $locale ) {
@@ -226,6 +232,11 @@
return $this->getLetterByIndex( $min );
}
+ /**
+ * @since 1.16.3
+ * @return array|mixed
+ * @throws MWException
+ */
public function getFirstLetterData() {
if ( $this->firstLetterData !== null ) {
return $this->firstLetterData;
@@ -377,6 +388,9 @@
return $data;
}
+ /**
+ * @since 1.16.3
+ */
public function getLetterByIndex( $index ) {
if ( $this->firstLetterData === null ) {
$this->getFirstLetterData();
@@ -384,6 +398,9 @@
return $this->firstLetterData['chars'][$index];
}
+ /**
+ * @since 1.16.3
+ */
public function getSortKeyByLetterIndex( $index ) {
if ( $this->firstLetterData === null ) {
$this->getFirstLetterData();
@@ -391,6 +408,9 @@
return $this->firstLetterData['keys'][$index];
}
+ /**
+ * @since 1.16.3
+ */
public function getFirstLetterCount() {
if ( $this->firstLetterData === null ) {
$this->getFirstLetterData();
@@ -398,7 +418,10 @@
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 9a99f1a..46e7f38 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 c589a76..92a4c3b 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
*/
--
To view, visit https://gerrit.wikimedia.org/r/281264
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iec56ac4d1418737d171f8faa9c8f498fba5383ee
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Addshore <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits