r73563 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73562‎ | r73563 | r73564 >
Date:19:19, 22 September 2010
Author:demon
Status:ok (Comments)
Tags:
Comment:
Skip new object construction if it's going to be the same
Modified paths:
  • /trunk/phase3/includes/Message.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Message.php
@@ -158,7 +158,9 @@
159159 if( $lang instanceof Language ){
160160 $this->language = $lang;
161161 } elseif ( is_string( $lang ) ) {
162 - $this->language = Language::factory( $lang );
 162+ if( $this->language->getCode() != $lang ) {
 163+ $this->language = Language::factory( $lang );
 164+ }
163165 } else {
164166 $type = gettype( $lang );
165167 throw new MWException( __METHOD__ . " must be "

Comments

#Comment by Nikerabbit (talk | contribs)   19:47, 22 September 2010

Why not use !==?

#Comment by 😂 (talk | contribs)   21:53, 22 September 2010

Because it wouldn't make a difference here and != is faster?

Status & tagging log