From 56ad7ff334bf9210124adca623df363797b8a138 Mon Sep 17 00:00:00 2001 From: Thiemo Kreuz Date: Thu, 18 Feb 2021 14:22:49 +0100 Subject: [PATCH] Update a few type hints Some random bits I found while working on some other code. Change-Id: I29be84cb54e05af5030defd99cb1f42f9c6a5b63 --- MathLaTeXML.php | 3 +++ src/MathHooks.php | 2 +- src/MathMathML.php | 3 +++ src/MathRenderer.php | 7 +++++-- src/MathSource.php | 3 +++ src/SpecialMathStatus.php | 8 ++++---- 6 files changed, 19 insertions(+), 7 deletions(-) diff --git a/MathLaTeXML.php b/MathLaTeXML.php index 49c3926bb..32ed01a31 100644 --- a/MathLaTeXML.php +++ b/MathLaTeXML.php @@ -218,6 +218,9 @@ class MathLaTeXML extends MathMathML { return parent::getSvg( $render ); } + /** + * @return string + */ protected function getMathTableName() { return 'mathlatexml'; } diff --git a/src/MathHooks.php b/src/MathHooks.php index 4f6630fea..4d39992f4 100644 --- a/src/MathHooks.php +++ b/src/MathHooks.php @@ -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 = []; diff --git a/src/MathMathML.php b/src/MathMathML.php index 104975131..fa4f8258d 100644 --- a/src/MathMathML.php +++ b/src/MathMathML.php @@ -467,6 +467,9 @@ class MathMathML extends MathRenderer { ] ) ); } + /** + * @return string + */ protected function getMathTableName() { return 'mathoid'; } diff --git a/src/MathRenderer.php b/src/MathRenderer.php index 06105f16d..5fc36d93f 100644 --- a/src/MathRenderer.php +++ b/src/MathRenderer.php @@ -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() { diff --git a/src/MathSource.php b/src/MathSource.php index a60922257..dae983a1a 100644 --- a/src/MathSource.php +++ b/src/MathSource.php @@ -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' ); } diff --git a/src/SpecialMathStatus.php b/src/SpecialMathStatus.php index fe4f90e33..54614cbbb 100644 --- a/src/SpecialMathStatus.php +++ b/src/SpecialMathStatus.php @@ -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() {