diff --git a/composer.json b/composer.json index 052078efb..a4c741059 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "mediawiki/mediawiki-codesniffer": "28.0.0", "jakub-onderka/php-console-highlighter": "0.3.2", "mediawiki/minus-x": "0.3.2", - "mediawiki/mediawiki-phan-config": "0.8.0" + "mediawiki/mediawiki-phan-config": "0.9.0" }, "scripts": { "test": [ diff --git a/maintenance/MathGenerateTests.php b/maintenance/MathGenerateTests.php index 0bbf9c79d..74fab331a 100644 --- a/maintenance/MathGenerateTests.php +++ b/maintenance/MathGenerateTests.php @@ -77,6 +77,7 @@ class MathGenerateTests extends Maintenance { } $i = 0; foreach ( array_slice( $allEquations, $offset, $length, true ) as $input ) { + // @phan-suppress-next-line PhanTypeMismatchArgumentNullable $output = MathRenderer::renderMath( $input[1], $input[2], 'png' ); $output = preg_replace( '#src="(.*?)/(([a-f]|\d)*)"#', 'src="\2"', $output ); $parserTests[] = [ diff --git a/src/MathInputCheckRestbase.php b/src/MathInputCheckRestbase.php index 0a0636393..9f510cde9 100644 --- a/src/MathInputCheckRestbase.php +++ b/src/MathInputCheckRestbase.php @@ -32,7 +32,7 @@ class MathInputCheckRestbase extends MathInputCheck { * @see https://phabricator.wikimedia.org/T119300 * @param stdClass $e * @param MathRenderer|null $errorRenderer - * @return string + * @return string|null */ public function errorObjectToHtml( stdClass $e, $errorRenderer = null ) { if ( $errorRenderer === null ) { @@ -77,7 +77,7 @@ class MathInputCheckRestbase extends MathInputCheck { /** * Returns the string of the last error. - * @return string + * @return string|null */ public function getError() { $err = $this->restbaseInterface->getError(); diff --git a/src/MathMathML.php b/src/MathMathML.php index be7ec27b4..70e053052 100644 --- a/src/MathMathML.php +++ b/src/MathMathML.php @@ -306,6 +306,7 @@ class MathMathML extends MathRenderer { $this->lastError = ''; $requestResult = $this->makeRequest( $host, $post, $res, $this->lastError ); if ( $requestResult ) { + // @phan-suppress-next-line PhanTypeMismatchArgumentInternal $jsonResult = json_decode( $res ); if ( $jsonResult && json_last_error() === JSON_ERROR_NONE ) { if ( $jsonResult->success ) { diff --git a/src/MathValidator.php b/src/MathValidator.php index 30ff46df3..0fb0d9bf6 100644 --- a/src/MathValidator.php +++ b/src/MathValidator.php @@ -36,7 +36,7 @@ class MathValidator implements ValueValidator { // TeX string is not valid return Result::newError( [ - Error::newError( null, null, 'malformed-value', [ $checker->getError() ] ) + Error::newError( '', null, 'malformed-value', [ $checker->getError() ] ) ] ); } diff --git a/src/MathWikibaseConnector.php b/src/MathWikibaseConnector.php index 8f7ede00a..13e52eea9 100644 --- a/src/MathWikibaseConnector.php +++ b/src/MathWikibaseConnector.php @@ -192,7 +192,7 @@ class MathWikibaseConnector { } } - if ( $innerInfo ) { + if ( $innerInfo && $symbol ) { $innerInfo->setSymbol( $symbol ); $output->addHasPartElement( $innerInfo ); }