dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Default $wgActorTableSchemaMigrationStage to READ_NEW"
[lhc/web/wiklou.git]
/
languages
/
Language.php
diff --git
a/languages/Language.php
b/languages/Language.php
index
9eea7ab
..
52cb231
100644
(file)
--- a/
languages/Language.php
+++ b/
languages/Language.php
@@
-3515,8
+3515,8
@@
class Language {
* Truncate a string to a specified number of characters, appending an optional
* string (e.g. for ellipsis).
*
* Truncate a string to a specified number of characters, appending an optional
* string (e.g. for ellipsis).
*
- * This provides multibyte version of truncate
() method of this class, suitable for truncation
- * based on number of characters, instead of number of bytes.
+ * This provides multibyte version of truncate
ForDatabase() method of this class,
+ *
suitable for truncation
based on number of characters, instead of number of bytes.
*
* If $length is negative, the string will be truncated from the beginning.
*
*
* If $length is negative, the string will be truncated from the beginning.
*
@@
-3556,12
+3556,8
@@
class Language {
* @return string
*/
private function truncateInternal(
* @return string
*/
private function truncateInternal(
- $string, $length, $ellipsis, $adjustLength,
$measureLength,
$getSubstring
+ $string, $length, $ellipsis, $adjustLength,
callable $measureLength, callable
$getSubstring
) {
) {
- if ( !is_callable( $measureLength ) || !is_callable( $getSubstring ) ) {
- throw new InvalidArgumentException( 'Invalid callback provided' );
- }
-
# Check if there is no need to truncate
if ( $measureLength( $string ) <= abs( $length ) ) {
return $string; // no need to truncate
# Check if there is no need to truncate
if ( $measureLength( $string ) <= abs( $length ) ) {
return $string; // no need to truncate
@@
-3701,6
+3697,7
@@
class Language {
}
} elseif ( $dispLen > $length && $dispLen > strlen( $ellipsis ) ) {
# String in fact does need truncation, the truncation point was OK.
}
} elseif ( $dispLen > $length && $dispLen > strlen( $ellipsis ) ) {
# String in fact does need truncation, the truncation point was OK.
+ // @phan-suppress-next-line PhanTypeInvalidExpressionArrayDestructuring
list( $ret, $openTags ) = $maybeState; // reload state
$ret = $this->removeBadCharLast( $ret ); // multi-byte char fix
$ret .= $ellipsis; // add ellipsis
list( $ret, $openTags ) = $maybeState; // reload state
$ret = $this->removeBadCharLast( $ret ); // multi-byte char fix
$ret .= $ellipsis; // add ellipsis
@@
-4023,15
+4020,12
@@
class Language {
* Checks that convertPlural was given an array and pads it to requested
* amount of forms by copying the last one.
*
* Checks that convertPlural was given an array and pads it to requested
* amount of forms by copying the last one.
*
- * @param array $forms
Array of forms given to convertPlural
+ * @param array $forms
* @param int $count How many forms should there be at least
* @param int $count How many forms should there be at least
- * @return array Padded array of forms
or an exception if not an array
+ * @return array Padded array of forms
*/
protected function preConvertPlural( /* Array */ $forms, $count ) {
*/
protected function preConvertPlural( /* Array */ $forms, $count ) {
- while ( count( $forms ) < $count ) {
- $forms[] = $forms[count( $forms ) - 1];
- }
- return $forms;
+ return array_pad( $forms, $count, end( $forms ) );
}
/**
}
/**
@@
-4857,6
+4851,8
@@
class Language {
* @param array $query Optional URL query parameter string
* @param bool $atend Optional param for specified if this is the last page
* @return string
* @param array $query Optional URL query parameter string
* @param bool $atend Optional param for specified if this is the last page
* @return string
+ * @deprecated since 1.33, use SpecialPage::viewPrevNext()
+ * instead.
*/
public function viewPrevNext( Title $title, $offset, $limit,
array $query = [], $atend = false
*/
public function viewPrevNext( Title $title, $offset, $limit,
array $query = [], $atend = false