MediaWiki::getTitle is checking, if a title is set on the context, but
that needs to call RequestContext::getTitle, which gives a warning, when
no title is set:
RequestContext::getTitle called by MediaWiki::getTitle with no title
set.
Adding a RequestContext::hasTitle function to check the title and avoid
the warning. Was added in I72c5c3fb75c9ceff02390c91b3735f2da90845de.
Change-Id: I4d8f8ef799cd91f0d2affe881019583ac77a31b7
* @return Title
*/
public function getTitle() {
- if ( $this->context->getTitle() === null ) {
+ if ( !$this->context->hasTitle() ) {
$this->context->setTitle( $this->parseTitle() );
}
return $this->context->getTitle();
return $this->title;
}
+ /**
+ * Check, if a Title object is set
+ *
+ * @since 1.25
+ * @return bool
+ */
+ public function hasTitle() {
+ return $this->title !== null;
+ }
+
/**
* Check whether a WikiPage object can be get with getWikiPage().
* Callers should expect that an exception is thrown from getWikiPage()