docs: Clarify that functions returning namespace names include underscores (not spaces)

Bug: T316092
Change-Id: I380e529590033e5d34adc37d21e8607feb4fab19
This commit is contained in:
Bartosz Dziewoński 2022-08-24 22:41:57 +02:00 committed by Krinkle
parent 21304f90e8
commit d64cbc17e9
4 changed files with 9 additions and 7 deletions

View file

@ -1155,7 +1155,7 @@ class Title implements LinkTarget, PageIdentity, IDBAccessObject {
/**
* Get the namespace text
*
* @return string|false Namespace text
* @return string|false Namespace name with underscores (not spaces), e.g. 'User_talk'
*/
public function getNsText() {
if ( $this->isExternal() ) {
@ -1185,7 +1185,7 @@ class Title implements LinkTarget, PageIdentity, IDBAccessObject {
/**
* Get the namespace text of the subject (rather than talk) page
*
* @return string Namespace text
* @return string Namespace name with underscores (not spaces)
*/
public function getSubjectNsText() {
$services = MediaWikiServices::getInstance();
@ -1196,7 +1196,7 @@ class Title implements LinkTarget, PageIdentity, IDBAccessObject {
/**
* Get the namespace text of the talk page
*
* @return string Namespace text
* @return string Namespace name with underscores (not spaces)
*/
public function getTalkNsText() {
$services = MediaWikiServices::getInstance();

View file

@ -595,9 +595,11 @@ class Language {
/**
* Get a namespace value by key
*
* Namespace name uses underscores (not spaces), e.g. 'MediaWiki_talk'.
*
* <code>
* $mw_ns = $lang->getNsText( NS_MEDIAWIKI );
* echo $mw_ns; // prints 'MediaWiki'
* $mw_ns = $lang->getNsText( NS_MEDIAWIKI_TALK );
* echo $mw_ns; // prints 'MediaWiki_talk'
* </code>
*
* @param int $index The array key of the namespace to return

View file

@ -113,7 +113,7 @@ class MediaWikiTitleCodec implements TitleFormatter, TitleParser {
* @param string $text
*
* @throws InvalidArgumentException If the namespace is invalid
* @return string Namespace name with underscores (not spaces)
* @return string Namespace name with underscores (not spaces), e.g. 'User_talk'
*/
public function getNamespaceName( $namespace, $text ) {
if ( $this->language->needsGenderDistinction() &&

View file

@ -97,7 +97,7 @@ interface TitleFormatter {
* @param string $text
*
* @throws InvalidArgumentException
* @return string
* @return string Namespace name with underscores (not spaces), e.g. 'User_talk'
*/
public function getNamespaceName( $namespace, $text );
}