Make MalformedTitleException errorMessage non-null
authorLucas Werkmeister <lucas.werkmeister@wikimedia.de>
Tue, 20 Jun 2017 18:26:04 +0000 (20:26 +0200)
committerLucas Werkmeister <lucas.werkmeister@wikimedia.de>
Wed, 21 Jun 2017 13:22:05 +0000 (15:22 +0200)
A null $errorMessage constructor argument has not been supported since
I43d988602b, since wfMessage (via the Message constructor) throws an
exception if the message key is null. It follows that getErrorMessage()
can never return null.

Bug: T99818
Change-Id: I2cbf4909e7237b0a91d100cc5478fb4cfee1d748

includes/title/MalformedTitleException.php

index 2dddac5..213343f 100644 (file)
@@ -34,7 +34,7 @@ class MalformedTitleException extends Exception implements ILocalizedException {
         * $titleText will be appended if it's not null. (since MW 1.26)
         */
        public function __construct(
-               $errorMessage = null, $titleText = null, $errorMessageParameters = []
+               $errorMessage, $titleText = null, $errorMessageParameters = []
        ) {
                $this->errorMessage = $errorMessage;
                $this->titleText = $titleText;
@@ -59,7 +59,7 @@ class MalformedTitleException extends Exception implements ILocalizedException {
 
        /**
         * @since 1.26
-        * @return string|null
+        * @return string
         */
        public function getErrorMessage() {
                return $this->errorMessage;