Enforce type hinting for setTitle() in IContextSource subclasses
authorwithoutaname <drevitchi@gmail.com>
Tue, 8 Jul 2014 08:09:19 +0000 (01:09 -0700)
committerLegoktm <legoktm.wikipedia@gmail.com>
Sun, 13 Jul 2014 01:05:39 +0000 (01:05 +0000)
Change-Id: Iecd8535b04072823a6f4efe33697148f4d20118e

includes/context/DerivativeContext.php
includes/context/RequestContext.php

index f550e9e..d78f420 100644 (file)
@@ -126,12 +126,8 @@ class DerivativeContext extends ContextSource {
         * Set the Title object
         *
         * @param Title $t
-        * @throws MWException
         */
-       public function setTitle( $t ) {
-               if ( $t !== null && !$t instanceof Title ) {
-                       throw new MWException( __METHOD__ . " expects an instance of Title" );
-               }
+       public function setTitle( Title $t ) {
                $this->title = $t;
        }
 
index d4bf0b4..cd18404 100644 (file)
@@ -124,12 +124,8 @@ class RequestContext implements IContextSource {
         * Set the Title object
         *
         * @param Title $t
-        * @throws MWException
         */
-       public function setTitle( $t ) {
-               if ( $t !== null && !$t instanceof Title ) {
-                       throw new MWException( __METHOD__ . " expects an instance of Title" );
-               }
+       public function setTitle( Title $t ) {
                $this->title = $t;
                // Erase the WikiPage so a new one with the new title gets created.
                $this->wikipage = null;