Update a few type hints

Some random bits I found while working on some other code.

Change-Id: I29be84cb54e05af5030defd99cb1f42f9c6a5b63
This commit is contained in:
Thiemo Kreuz 2021-02-18 14:22:49 +01:00 committed by Thiemo Kreuz (WMDE)
parent e4577337d5
commit 56ad7ff334
6 changed files with 19 additions and 7 deletions

View file

@ -218,6 +218,9 @@ class MathLaTeXML extends MathMathML {
return parent::getSvg( $render );
}
/**
* @return string
*/
protected function getMathTableName() {
return 'mathlatexml';
}

View file

@ -262,7 +262,7 @@ class MathHooks {
/**
* List of message keys for the various math output settings.
*
* @return array of strings
* @return string[]
*/
public static function getMathNames() {
$names = [];

View file

@ -467,6 +467,9 @@ class MathMathML extends MathRenderer {
] ) );
}
/**
* @return string
*/
protected function getMathTableName() {
return 'mathoid';
}

View file

@ -130,7 +130,7 @@ abstract class MathRenderer {
/**
* @param string $md5
* @return MathRenderer the MathRenderer generated from md5
* @return self the MathRenderer generated from md5
*/
public static function newFromMd5( $md5 ) {
$class = get_called_class();
@ -147,7 +147,7 @@ abstract class MathRenderer {
* @param string $tex LaTeX markup
* @param array $params HTML attributes
* @param string $mode indicating rendering mode
* @return MathRenderer appropriate renderer for mode
* @return self appropriate renderer for mode
*/
public static function getRenderer( $tex, $params = [], $mode = 'png' ) {
global $wgDefaultUserOptions, $wgMathEnableExperimentalInputFormats, $wgMathoidCli;
@ -700,6 +700,9 @@ abstract class MathRenderer {
return trim( $this->svg );
}
/**
* @return string
*/
abstract protected function getMathTableName();
public function getModeStr() {

View file

@ -55,6 +55,9 @@ class MathSource extends MathRenderer {
);
}
/**
* @throws Exception always
*/
protected function getMathTableName() {
throw new Exception( 'in math source mode no database caching should happen' );
}

View file

@ -47,18 +47,18 @@ class SpecialMathStatus extends SpecialPage {
}
private function runMathMLTest( $modeName ) {
$this->getOutput()->addWikiMsgArray( 'math-test-start', $modeName );
$this->getOutput()->addWikiMsgArray( 'math-test-start', [ $modeName ] );
$this->testSpecialCaseText();
$this->testMathMLIntegration();
$this->testPmmlInput();
$this->getOutput()->addWikiMsgArray( 'math-test-end', $modeName );
$this->getOutput()->addWikiMsgArray( 'math-test-end', [ $modeName ] );
}
private function runMathLaTeXMLTest( $modeName ) {
$this->getOutput()->addWikiMsgArray( 'math-test-start', $modeName );
$this->getOutput()->addWikiMsgArray( 'math-test-start', [ $modeName ] );
$this->testLaTeXMLIntegration();
$this->testLaTeXMLLinebreak();
$this->getOutput()->addWikiMsgArray( 'math-test-end', $modeName );
$this->getOutput()->addWikiMsgArray( 'math-test-end', [ $modeName ] );
}
public function testSpecialCaseText() {