X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fparser%2FParser.php;h=d56af1d224f3d54687be2005494394700eaddb91;hp=9ec58346cc9ebe9b3d728d0f99a9e4263806aecf;hb=2c565dc8e74f078b01d842c98b6192c36c8edace;hpb=0c4efc4dd942fe38cdbac6977a28f45314a9839e diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 9ec58346cc..d56af1d224 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -228,7 +228,11 @@ class Parser { public $mOptions; /** - * @var Title + * Since 1.34, leaving `mTitle` uninitialized or setting `mTitle` to + * `null` is deprecated. + * + * @internal + * @var Title|null */ public $mTitle; # Title context, used for self-link rendering and similar things public $mOutputType; # Output type, one of the OT_xxx constants @@ -906,9 +910,9 @@ class Parser { /** * Set the context title * - * @param Title $t + * @param Title|null $t */ - public function setTitle( $t ) { + public function setTitle( Title $t = null ) { if ( !$t ) { $t = Title::makeTitle( NS_SPECIAL, 'Badtitle/Parser' ); } @@ -924,9 +928,14 @@ class Parser { /** * Accessor for the Title object * + * Since 1.34, leaving `mTitle` uninitialized as `null` is deprecated. + * * @return Title|null */ - public function getTitle() { + public function getTitle() : ?Title { + if ( $this->mTitle === null ) { + wfDeprecated( 'Parser title should never be null', '1.34' ); + } return $this->mTitle; } @@ -934,9 +943,9 @@ class Parser { * Accessor/mutator for the Title object * * @param Title|null $x Title object or null to just get the current one - * @return Title + * @return Title|null */ - public function Title( $x = null ) { + public function Title( Title $x = null ) : ?Title { return wfSetVar( $this->mTitle, $x ); } @@ -1042,9 +1051,10 @@ class Parser { /** * Get the language object for language conversion * @deprecated since 1.32, just use getTargetLanguage() - * @return Language|null + * @return Language */ public function getConverterLanguage() { + wfDeprecated( __METHOD__, '1.32' ); return $this->getTargetLanguage(); }