From e4189f59206d902b7bbff52b4f24053ceaab49d4 Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Mon, 27 Sep 2010 14:24:13 +0000 Subject: [PATCH] Fix a bunch of '? true : false' instances --- includes/Autopromote.php | 2 +- includes/Skin.php | 2 +- includes/SkinTemplate.php | 4 ++-- includes/WebRequest.php | 2 +- includes/db/DatabasePostgres.php | 2 +- includes/installer/WebInstallerPage.php | 2 +- includes/specials/SpecialAllmessages.php | 8 ++++---- includes/specials/SpecialBlockip.php | 2 +- includes/specials/SpecialContributions.php | 4 ++-- includes/specials/SpecialSearch.php | 2 +- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/includes/Autopromote.php b/includes/Autopromote.php index 560ba7a705..e8ef7fc90b 100644 --- a/includes/Autopromote.php +++ b/includes/Autopromote.php @@ -143,7 +143,7 @@ class Autopromote { throw new MWException( "Unrecognized condition {$cond[0]} for autopromotion!" ); } - return $result ? true : false; + return (bool)$result; } } } diff --git a/includes/Skin.php b/includes/Skin.php index 51ea098b68..f7520fe298 100644 --- a/includes/Skin.php +++ b/includes/Skin.php @@ -2046,7 +2046,7 @@ class Skin extends Linker { return array( 'href' => $title->getLocalURL( $urlaction ), - 'exists' => $title->getArticleID() != 0 ? true : false + 'exists' => $title->getArticleID() != 0; ); } diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index 79c8728497..8425333158 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -659,7 +659,7 @@ class SkinTemplate extends Skin { self::checkTitle( $title, $name ); return array( 'href' => $title->getLocalURL( $urlaction ), - 'exists' => $title->getArticleID() != 0 ? true : false + 'exists' => $title->getArticleID() != 0, ); } @@ -669,7 +669,7 @@ class SkinTemplate extends Skin { self::checkTitle( $title, $name ); return array( 'href' => $title->getLocalURL( $urlaction ), - 'exists' => $title->getArticleID() != 0 ? true : false + 'exists' => $title->getArticleID() != 0, ); } diff --git a/includes/WebRequest.php b/includes/WebRequest.php index 3dede3c2dc..09eded6f21 100644 --- a/includes/WebRequest.php +++ b/includes/WebRequest.php @@ -345,7 +345,7 @@ class WebRequest { * @return Boolean */ public function getBool( $name, $default = false ) { - return $this->getVal( $name, $default ) ? true : false; + return (bool)$this->getVal( $name, $default ); } /** diff --git a/includes/db/DatabasePostgres.php b/includes/db/DatabasePostgres.php index 53f417306a..672e022b4c 100644 --- a/includes/db/DatabasePostgres.php +++ b/includes/db/DatabasePostgres.php @@ -1179,7 +1179,7 @@ class DatabasePostgres extends DatabaseBase { . "AND c.relkind IN ('" . implode( "','", $types ) . "')"; $res = $this->query( $SQL ); $count = $res ? $res->numRows() : 0; - return $count ? true : false; + return (bool)$count; } /** diff --git a/includes/installer/WebInstallerPage.php b/includes/installer/WebInstallerPage.php index 97fa8df8e5..ccf10dee78 100644 --- a/includes/installer/WebInstallerPage.php +++ b/includes/installer/WebInstallerPage.php @@ -487,7 +487,7 @@ class WebInstaller_Name extends WebInstallerPage { // Title-style validation $title = Title::newFromText( $name ); if ( !$title ) { - $good = $nsType == 'site-name' ? true : false; + $good = $nsType == 'site-name'; } else { $name = $title->getDBkey(); $good = true; diff --git a/includes/specials/SpecialAllmessages.php b/includes/specials/SpecialAllmessages.php index a3ebaf95c7..f76b21571e 100644 --- a/includes/specials/SpecialAllmessages.php +++ b/includes/specials/SpecialAllmessages.php @@ -100,19 +100,19 @@ class SpecialAllmessages extends SpecialPage { 'filter', 'unmodified', 'mw-allmessages-form-filter-unmodified', - ( $this->filter == 'unmodified' ? true : false ) + ( $this->filter == 'unmodified' ) ) . Xml::radioLabel( wfMsg( 'allmessages-filter-all' ), 'filter', 'all', 'mw-allmessages-form-filter-all', - ( $this->filter == 'all' ? true : false ) + ( $this->filter == 'all' ) ) . Xml::radioLabel( wfMsg( 'allmessages-filter-modified' ), 'filter', 'modified', 'mw-allmessages-form-filter-modified', - ( $this->filter == 'modified' ? true : false ) + ( $this->filter == 'modified' ) ) . "\n @@ -124,7 +124,7 @@ class SpecialAllmessages extends SpecialPage { Xml::openElement( 'select', array( 'id' => 'mw-allmessages-form-lang', 'name' => 'lang' ) ); foreach( $languages as $lang => $name ) { - $selected = $lang == $this->langCode ? true : false; + $selected = $lang == $this->langCode; $out .= Xml::option( $lang . ' - ' . $name, $lang, $selected ) . "\n"; } $out .= Xml::closeElement( 'select' ) . diff --git a/includes/specials/SpecialBlockip.php b/includes/specials/SpecialBlockip.php index f3c9044cbe..2d2d0346c2 100644 --- a/includes/specials/SpecialBlockip.php +++ b/includes/specials/SpecialBlockip.php @@ -188,7 +188,7 @@ class IPBlockForm extends SpecialPage { list( $show, $value ) = explode( ':', $option ); $show = htmlspecialchars( $show ); $value = htmlspecialchars( $value ); - $blockExpiryFormOptions .= Xml::option( $show, $value, $this->BlockExpiry === $value ? true : false ) . "\n"; + $blockExpiryFormOptions .= Xml::option( $show, $value, $this->BlockExpiry === $value ) . "\n"; } $reasonDropDown = Xml::listDropDown( 'wpBlockReasonList', diff --git a/includes/specials/SpecialContributions.php b/includes/specials/SpecialContributions.php index c6cb9734c7..8487694291 100644 --- a/includes/specials/SpecialContributions.php +++ b/includes/specials/SpecialContributions.php @@ -346,9 +346,9 @@ class SpecialContributions extends SpecialPage { $f .= Xml::fieldset( wfMsg( 'sp-contributions-search' ) ) . Xml::radioLabel( wfMsgExt( 'sp-contributions-newbies', array( 'parsemag' ) ), - 'contribs', 'newbie' , 'newbie', $this->opts['contribs'] == 'newbie' ? true : false ) . '
' . + 'contribs', 'newbie' , 'newbie', $this->opts['contribs'] == 'newbie' ) . '
' . Xml::radioLabel( wfMsgExt( 'sp-contributions-username', array( 'parsemag' ) ), - 'contribs' , 'user', 'user', $this->opts['contribs'] == 'user' ? true : false ) . ' ' . + 'contribs' , 'user', 'user', $this->opts['contribs'] == 'user' ) . ' ' . Html::input( 'target', $this->opts['target'], 'text', array( 'size' => '20', 'required' => '' diff --git a/includes/specials/SpecialSearch.php b/includes/specials/SpecialSearch.php index a04ca91f32..86feace1a2 100644 --- a/includes/specials/SpecialSearch.php +++ b/includes/specials/SpecialSearch.php @@ -67,7 +67,7 @@ class SpecialSearch { if( empty( $this->namespaces ) ) { $this->namespaces = SearchEngine::userNamespaces( $user ); } - $this->searchRedirects = $request->getcheck( 'redirs' ) ? true : false; + $this->searchRedirects = $request->getCheck( 'redirs' ); $this->searchAdvanced = $request->getVal( 'advanced' ); $this->active = 'advanced'; $this->sk = $user->getSkin(); -- 2.20.1