Fix a bunch of '? true : false' instances
authorChad Horohoe <demon@users.mediawiki.org>
Mon, 27 Sep 2010 14:24:13 +0000 (14:24 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Mon, 27 Sep 2010 14:24:13 +0000 (14:24 +0000)
includes/Autopromote.php
includes/Skin.php
includes/SkinTemplate.php
includes/WebRequest.php
includes/db/DatabasePostgres.php
includes/installer/WebInstallerPage.php
includes/specials/SpecialAllmessages.php
includes/specials/SpecialBlockip.php
includes/specials/SpecialContributions.php
includes/specials/SpecialSearch.php

index 560ba7a..e8ef7fc 100644 (file)
@@ -143,7 +143,7 @@ class Autopromote {
                                        throw new MWException( "Unrecognized condition {$cond[0]} for autopromotion!" );
                                }
 
-                               return $result ? true : false;
+                               return (bool)$result;
                }
        }
 }
index 51ea098..f7520fe 100644 (file)
@@ -2046,7 +2046,7 @@ class Skin extends Linker {
 
                return array(
                        'href' => $title->getLocalURL( $urlaction ),
-                       'exists' => $title->getArticleID() != 0 ? true : false
+                       'exists' => $title->getArticleID() != 0;
                );
        }
 
index 79c8728..8425333 100644 (file)
@@ -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,
                );
        }
 
index 3dede3c..09eded6 100644 (file)
@@ -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 );
        }
        
        /**
index 53f4173..672e022 100644 (file)
@@ -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;
        }
 
        /**
index 97fa8df..ccf10de 100644 (file)
@@ -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;
index a3ebaf9..f76b215 100644 (file)
@@ -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' )
                                ) .
                                "</td>\n
                        </tr>
@@ -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' ) .
index f3c9044..2d2d034 100644 (file)
@@ -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',
index c6cb973..8487694 100644 (file)
@@ -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 ) . '<br />' .
+                               'contribs', 'newbie' , 'newbie', $this->opts['contribs'] == 'newbie' ) . '<br />' .
                        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' => ''
index a04ca91..86feace 100644 (file)
@@ -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();