No space within the ?: operator
authorBartosz Dziewoński <matma.rex@gmail.com>
Mon, 25 Aug 2014 15:40:51 +0000 (17:40 +0200)
committerBartosz Dziewoński <matma.rex@gmail.com>
Mon, 25 Aug 2014 15:40:51 +0000 (17:40 +0200)
This style is a lot more common in our code.

Change-Id: I7f2fb3716c24c4a95a4c6c4a732b0226c315f242

includes/context/RequestContext.php
includes/jobqueue/JobRunner.php
maintenance/getConfiguration.php
maintenance/sql.php

index 5178189..091e8da 100644 (file)
@@ -297,7 +297,7 @@ class RequestContext implements IContextSource {
                        $e = new Exception;
                        wfDebugLog( 'recursion-guard', "Recursion detected:\n" . $e->getTraceAsString() );
 
-                       $code = $this->getConfig()->get( 'LanguageCode' ) ? : 'en';
+                       $code = $this->getConfig()->get( 'LanguageCode' ) ?: 'en';
                        $this->lang = Language::factory( $code );
                } elseif ( $this->lang === null ) {
                        $this->recursion = true;
index c5e7f2e..617a3a3 100644 (file)
@@ -235,7 +235,7 @@ class JobRunner {
                        $content = stream_get_contents( $handle );
                        flock( $handle, LOCK_UN );
                        fclose( $handle );
-                       $backoffs = json_decode( $content, true ) ? : array();
+                       $backoffs = json_decode( $content, true ) ?: array();
                }
 
                return $backoffs;
@@ -253,7 +253,7 @@ class JobRunner {
                $handle = fopen( $file, 'wb+' );
                flock( $handle, LOCK_EX );
                $content = stream_get_contents( $handle );
-               $cBackoffs = json_decode( $content, true ) ? : array();
+               $cBackoffs = json_decode( $content, true ) ?: array();
                foreach ( $backoffs as $type => $timestamp ) {
                        $cBackoffs[$type] = isset( $cBackoffs[$type] ) ? $cBackoffs[$type] : 0;
                        $cBackoffs[$type] = max( $cBackoffs[$type], $backoffs[$type] );
index 1db53f3..d5f6834 100644 (file)
@@ -87,7 +87,7 @@ class GetConfiguration extends Maintenance {
        public function finalSetup() {
                parent::finalSetup();
 
-               $this->regex = $this->getOption( 'regex' ) ? : $this->getOption( 'iregex' );
+               $this->regex = $this->getOption( 'regex' ) ?: $this->getOption( 'iregex' );
                if ( $this->regex ) {
                        $this->regex = '/' . $this->regex . '/';
                        if ( $this->hasOption( 'iregex' ) ) {
index 389b270..afa3ef7 100644 (file)
@@ -39,7 +39,7 @@ class MwSql extends Maintenance {
        }
 
        public function execute() {
-               $wiki = $this->getOption( 'wikidb' ) ? : false;
+               $wiki = $this->getOption( 'wikidb' ) ?: false;
                // Get the appropriate load balancer (for this wiki)
                if ( $this->hasOption( 'cluster' ) ) {
                        $lb = wfGetLBFactory()->getExternalLB( $this->getOption( 'cluster' ), $wiki );