From a395db765bb5c5223402bedfc601862301cc9387 Mon Sep 17 00:00:00 2001 From: withoutaname Date: Tue, 8 Jul 2014 01:09:19 -0700 Subject: [PATCH] Enforce type hinting for setTitle() in IContextSource subclasses Change-Id: Iecd8535b04072823a6f4efe33697148f4d20118e --- includes/context/DerivativeContext.php | 6 +----- includes/context/RequestContext.php | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/includes/context/DerivativeContext.php b/includes/context/DerivativeContext.php index f550e9e6cf..d78f420a38 100644 --- a/includes/context/DerivativeContext.php +++ b/includes/context/DerivativeContext.php @@ -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; } diff --git a/includes/context/RequestContext.php b/includes/context/RequestContext.php index d4bf0b4fa8..cd18404846 100644 --- a/includes/context/RequestContext.php +++ b/includes/context/RequestContext.php @@ -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; -- 2.20.1