r91238 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91237‎ | r91238 | r91239 >
Date:00:12, 1 July 2011
Author:aaron
Status:ok
Tags:
Comment:
Follow-up r91123:
* Tweaked getRevision() return type to NULL on failure
* Changed "$revision === null" checks to just "!$revision" (this avoids the landmine of getting false or something)
Modified paths:
  • /trunk/phase3/includes/Article.php (modified) (history)
  • /trunk/phase3/includes/WikiPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Article.php
@@ -280,7 +280,7 @@
281281
282282 if ( $oldid ) {
283283 $revision = Revision::newFromId( $oldid );
284 - if ( $revision === null ) {
 284+ if ( !$revision ) {
285285 wfDebug( __METHOD__ . " failed to retrieve specified revision, id $oldid\n" );
286286 return false;
287287 }
@@ -300,7 +300,7 @@
301301 }
302302
303303 $revision = $this->mPage->getRevision();
304 - if ( $revision === null ) {
 304+ if ( !$revision ) {
305305 wfDebug( __METHOD__ . " failed to retrieve current page, rev_id " . $this->mPage->getLatest() . "\n" );
306306 return false;
307307 }
Index: trunk/phase3/includes/WikiPage.php
@@ -471,14 +471,14 @@
472472
473473 /**
474474 * Get the latest revision
475 - * @return Revision|false
 475+ * @return Revision|null
476476 */
477477 public function getRevision() {
478478 $this->loadLastEdit();
479479 if ( $this->mLastRevision ) {
480480 return $this->mLastRevision;
481481 }
482 - return false;
 482+ return null;
483483 }
484484
485485 /**

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r91123* Split off WikiPage class from Article, WikiFilePage class from ImagePage, a...aaron22:09, 29 June 2011

Status & tagging log