X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Ftitle%2FMalformedTitleException.php;h=213343f968705df0aa63f58916956bd0d0d2ebe5;hp=799961a424e0d1c8eee66deb185f9b8861fbea92;hb=4d04f91c838a6f0421cbf48a4e926efb26d2d17b;hpb=3071f1fad720f1773864621158a0c59b73124896 diff --git a/includes/title/MalformedTitleException.php b/includes/title/MalformedTitleException.php index 799961a424..213343f968 100644 --- a/includes/title/MalformedTitleException.php +++ b/includes/title/MalformedTitleException.php @@ -22,7 +22,7 @@ * MalformedTitleException is thrown when a TitleParser is unable to parse a title string. * @since 1.23 */ -class MalformedTitleException extends Exception { +class MalformedTitleException extends Exception implements ILocalizedException { private $titleText = null; private $errorMessage = null; private $errorMessageParameters = []; @@ -34,7 +34,7 @@ class MalformedTitleException extends Exception { * $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 { /** * @since 1.26 - * @return string|null + * @return string */ public function getErrorMessage() { return $this->errorMessage; @@ -72,4 +72,12 @@ class MalformedTitleException extends Exception { public function getErrorMessageParameters() { return $this->errorMessageParameters; } + + /** + * @since 1.29 + * @return Message + */ + public function getMessageObject() { + return wfMessage( $this->getErrorMessage(), $this->getErrorMessageParameters() ); + } }