Avoid wfMessage in special page

Use self::msg instead to avoid global state

Change-Id: I9a9af6ff854fdd94929d06ea270c044320f62cab
This commit is contained in:
Umherirrender 2020-12-19 20:07:50 +01:00
parent 99c3e91fb4
commit 9f4f4301cc
2 changed files with 4 additions and 5 deletions

View file

@ -5,7 +5,6 @@
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationProtected" />
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic" />
<exclude name="MediaWiki.Usage.ExtendClassUsage.FunctionConfigUsage" />
<exclude name="MediaWiki.Usage.ExtendClassUsage.FunctionVarUsage" />
<exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment" />
</rule>
<file>.</file>

View file

@ -37,7 +37,7 @@ class SpecialMathWikibase extends SpecialPage {
$this->getPlainText( 'math-wikibase-special-error-header' )
);
$out->addHTML(
wfMessage( 'math-wikibase-special-error-no-wikibase' )->inContentLanguage()->parse()
$this->msg( 'math-wikibase-special-error-no-wikibase' )->inContentLanguage()->parse()
);
return;
}
@ -122,14 +122,14 @@ class SpecialMathWikibase extends SpecialPage {
if ( $e instanceof InvalidArgumentException ) {
$this->logger->warning( "An invalid ID was specified. Reason: " . $e->getMessage() );
$this->getOutput()->addHTML(
wfMessage( 'math-wikibase-special-error-invalid-argument' )->inContentLanguage()->parse()
$this->msg( 'math-wikibase-special-error-invalid-argument' )->inContentLanguage()->parse()
);
} else {
$this->logger->error( "An unknown error occurred while fetching data from Wikibase.", [
'exception' => $e
] );
$this->getOutput()->addHTML(
wfMessage( 'math-wikibase-special-error-unknown' )->inContentLanguage()->parse()
$this->msg( 'math-wikibase-special-error-unknown' )->inContentLanguage()->parse()
);
}
}
@ -140,7 +140,7 @@ class SpecialMathWikibase extends SpecialPage {
* @return string the plain text in current content language
*/
private function getPlainText( $key ) {
return wfMessage( $key )->inContentLanguage()->plain();
return $this->msg( $key )->inContentLanguage()->plain();
}
/**