Merge "Allow $context->setTitle( null )"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 8 Oct 2013 18:30:02 +0000 (18:30 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 8 Oct 2013 18:30:02 +0000 (18:30 +0000)
includes/context/DerivativeContext.php
includes/context/RequestContext.php

index d4caf05..fd9bf96 100644 (file)
@@ -100,7 +100,10 @@ class DerivativeContext extends ContextSource {
         *
         * @param Title $t
         */
-       public function setTitle( Title $t ) {
+       public function setTitle( $t ) {
+               if ( $t !== null && !$t instanceof Title ) {
+                       throw new MWException( __METHOD__ . " expects an instance of Title" );
+               }
                $this->title = $t;
        }
 
index b9dbe77..01ec57c 100644 (file)
@@ -90,7 +90,10 @@ class RequestContext implements IContextSource {
         *
         * @param Title $t
         */
-       public function setTitle( Title $t ) {
+       public function setTitle( $t ) {
+               if ( $t !== null && !$t instanceof Title ) {
+                       throw new MWException( __METHOD__ . " expects an instance of Title" );
+               }
                $this->title = $t;
                // Erase the WikiPage so a new one with the new title gets created.
                $this->wikipage = null;