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 "PHAN: conditionally load stubs"
[lhc/web/wiklou.git]
/
includes
/
parser
/
CoreParserFunctions.php
diff --git
a/includes/parser/CoreParserFunctions.php
b/includes/parser/CoreParserFunctions.php
index
ef26db6
..
6aa3acc
100644
(file)
--- a/
includes/parser/CoreParserFunctions.php
+++ b/
includes/parser/CoreParserFunctions.php
@@
-20,6
+20,7
@@
* @file
* @ingroup Parser
*/
* @file
* @ingroup Parser
*/
+use MediaWiki\MediaWikiServices;
/**
* Various core parser functions, registered in Parser::firstCallInit()
/**
* Various core parser functions, registered in Parser::firstCallInit()
@@
-275,7
+276,7
@@
class CoreParserFunctions {
}
if ( !is_null( $title ) ) {
# Convert NS_MEDIA -> NS_FILE
}
if ( !is_null( $title ) ) {
# Convert NS_MEDIA -> NS_FILE
- if ( $title->
getNamespace() == NS_MEDIA
) {
+ if ( $title->
inNamespace( NS_MEDIA )
) {
$title = Title::makeTitle( NS_FILE, $title->getDBkey() );
}
if ( !is_null( $arg ) ) {
$title = Title::makeTitle( NS_FILE, $title->getDBkey() );
}
if ( !is_null( $arg ) ) {
@@
-340,16
+341,17
@@
class CoreParserFunctions {
// allow prefix.
$title = Title::newFromText( $username );
// allow prefix.
$title = Title::newFromText( $username );
- if ( $title && $title->
getNamespace() == NS_USER
) {
+ if ( $title && $title->
inNamespace( NS_USER )
) {
$username = $title->getText();
}
// check parameter, or use the ParserOptions if in interface message
$user = User::newFromName( $username );
$username = $title->getText();
}
// check parameter, or use the ParserOptions if in interface message
$user = User::newFromName( $username );
+ $genderCache = MediaWikiServices::getInstance()->getGenderCache();
if ( $user ) {
if ( $user ) {
- $gender =
GenderCache::singleton()
->getGenderOf( $user, __METHOD__ );
+ $gender =
$genderCache
->getGenderOf( $user, __METHOD__ );
} elseif ( $username === '' && $parser->getOptions()->getInterfaceMessage() ) {
} elseif ( $username === '' && $parser->getOptions()->getInterfaceMessage() ) {
- $gender =
GenderCache::singleton()
->getGenderOf( $parser->getOptions()->getUser(), __METHOD__ );
+ $gender =
$genderCache
->getGenderOf( $parser->getOptions()->getUser(), __METHOD__ );
}
$ret = $parser->getFunctionLang()->gender( $gender, $forms );
return $ret;
}
$ret = $parser->getFunctionLang()->gender( $gender, $forms );
return $ret;
@@
-487,7
+489,15
@@
class CoreParserFunctions {
return $mwObject->matchStartToEnd( $value );
}
return $mwObject->matchStartToEnd( $value );
}
- public static function formatRaw( $num, $raw, Language $language ) {
+ /**
+ * Formats a number according to a language.
+ *
+ * @param int|float $num
+ * @param string $raw
+ * @param Language|StubUserLang $language
+ * @return string
+ */
+ public static function formatRaw( $num, $raw, $language ) {
if ( self::matchAgainstMagicword( 'rawsuffix', $raw ) ) {
return $num;
} else {
if ( self::matchAgainstMagicword( 'rawsuffix', $raw ) ) {
return $num;
} else {