language: Improve documentation of bool return values and such
Change-Id: I9e2680b10473115a4d9af1083fbd2484af1c23f4
This commit is contained in:
parent
a061a61bb8
commit
554872a201
3 changed files with 9 additions and 6 deletions
|
|
@ -102,7 +102,8 @@ class LanguageFactory {
|
||||||
/**
|
/**
|
||||||
* Get a cached or new language object for a given language code
|
* Get a cached or new language object for a given language code
|
||||||
* @param string $code
|
* @param string $code
|
||||||
* @throws MWException
|
* @throws MWException if the language code contains dangerous characters, e.g. HTML special
|
||||||
|
* characters or characters illegal in MediaWiki titles.
|
||||||
* @return Language
|
* @return Language
|
||||||
*/
|
*/
|
||||||
public function getLanguage( $code ) : Language {
|
public function getLanguage( $code ) : Language {
|
||||||
|
|
@ -141,7 +142,7 @@ class LanguageFactory {
|
||||||
* Create a language object for a given language code
|
* Create a language object for a given language code
|
||||||
* @param string $code
|
* @param string $code
|
||||||
* @param bool $fallback Whether we're going through language fallback chain
|
* @param bool $fallback Whether we're going through language fallback chain
|
||||||
* @throws MWException
|
* @throws MWException if the language code or fallback sequence is invalid
|
||||||
* @return Language
|
* @return Language
|
||||||
*/
|
*/
|
||||||
private function newFromCode( $code, $fallback = false ) : Language {
|
private function newFromCode( $code, $fallback = false ) : Language {
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,8 @@ class LanguageNameUtils {
|
||||||
*
|
*
|
||||||
* @param string $code
|
* @param string $code
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool False if the language code contains dangerous characters, e.g. HTML special
|
||||||
|
* characters or characters illegal in MediaWiki titles.
|
||||||
*/
|
*/
|
||||||
public function isValidCode( string $code ) : bool {
|
public function isValidCode( string $code ) : bool {
|
||||||
if ( !isset( $this->validCodeCache[$code] ) ) {
|
if ( !isset( $this->validCodeCache[$code] ) ) {
|
||||||
|
|
|
||||||
|
|
@ -334,7 +334,7 @@ class Language {
|
||||||
* Get a cached or new language object for a given language code
|
* Get a cached or new language object for a given language code
|
||||||
* @deprecated since 1.35, use LanguageFactory
|
* @deprecated since 1.35, use LanguageFactory
|
||||||
* @param string $code
|
* @param string $code
|
||||||
* @throws MWException
|
* @throws MWException if the language code is invalid
|
||||||
* @return Language
|
* @return Language
|
||||||
*/
|
*/
|
||||||
public static function factory( $code ) {
|
public static function factory( $code ) {
|
||||||
|
|
@ -443,7 +443,8 @@ class Language {
|
||||||
*
|
*
|
||||||
* @param string $code
|
* @param string $code
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool False if the language code contains dangerous characters, e.g. HTML special
|
||||||
|
* characters or characters illegal in MediaWiki titles.
|
||||||
*/
|
*/
|
||||||
public static function isValidCode( $code ) {
|
public static function isValidCode( $code ) {
|
||||||
return MediaWikiServices::getInstance()->getLanguageNameUtils()->isValidCode( $code );
|
return MediaWikiServices::getInstance()->getLanguageNameUtils()->isValidCode( $code );
|
||||||
|
|
@ -728,7 +729,7 @@ class Language {
|
||||||
* canonical ones defined in Namespace.php.
|
* canonical ones defined in Namespace.php.
|
||||||
*
|
*
|
||||||
* @param string $text
|
* @param string $text
|
||||||
* @return int|bool An integer if $text is a valid value otherwise false
|
* @return int|false An integer if $text is a valid value otherwise false
|
||||||
*/
|
*/
|
||||||
public function getLocalNsIndex( $text ) {
|
public function getLocalNsIndex( $text ) {
|
||||||
$lctext = $this->lc( $text );
|
$lctext = $this->lc( $text );
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue