Code style: no space after unary minus operator
authorBartosz Dziewoński <matma.rex@gmail.com>
Thu, 5 Jan 2017 13:38:32 +0000 (14:38 +0100)
committerBartosz Dziewoński <matma.rex@gmail.com>
Thu, 5 Jan 2017 13:38:32 +0000 (14:38 +0100)
Searched for /([^\d\w\s\)\]]\s*)- \d/ to find potential issues.
It seems there's no PHPCS check for this, huh.

Also fixed typo in a comment in LoginSignupSpecialPage.

Change-Id: Iaab1a1f5a9f234971e550e7909aa5c3e0c02a983

includes/Preferences.php
includes/json/FormatJson.php
includes/search/SearchHighlighter.php
includes/specialpage/LoginSignupSpecialPage.php

index cf8e7b8..97fdb33 100644 (file)
@@ -1409,7 +1409,7 @@ class Preferences {
                                # Max is +14:00 and min is -12:00, see:
                                # https://en.wikipedia.org/wiki/Timezone
                                $minDiff = min( $minDiff, 840 );  # 14:00
-                               $minDiff = max( $minDiff, - 720 ); # -12:00
+                               $minDiff = max( $minDiff, -720 ); # -12:00
                                return 'Offset|' . $minDiff;
                }
        }
index 41541ef..0c77a7b 100644 (file)
@@ -216,7 +216,7 @@ class FormatJson {
                        $count = 0;
                        $value =
                                preg_replace( '/,([ \t]*[}\]][^"\r\n]*([\r\n]|$)|[ \t]*[\r\n][ \t\r\n]*[}\]])/', '$1',
-                                       $value, - 1, $count );
+                                       $value, -1, $count );
                        if ( $count > 0 ) {
                                $result = json_decode( $value, $assoc );
                                if ( JSON_ERROR_NONE === json_last_error() ) {
index dd41a6e..d0e3a24 100644 (file)
@@ -75,10 +75,10 @@ class SearchHighlighter {
                        if ( preg_match( $spat, $text, $matches, PREG_OFFSET_CAPTURE, $start ) ) {
                                $epat = '';
                                foreach ( $matches as $key => $val ) {
-                                       if ( $key > 0 && $val[1] != - 1 ) {
+                                       if ( $key > 0 && $val[1] != -1 ) {
                                                if ( $key == 2 ) {
                                                        // see if this is an image link
-                                                       $ns = substr( $val[0], 2, - 1 );
+                                                       $ns = substr( $val[0], 2, -1 );
                                                        if ( $wgContLang->getNsIndex( $ns ) != NS_FILE ) {
                                                                break;
                                                        }
@@ -252,10 +252,10 @@ class SearchHighlighter {
 
                // $snippets = array_map( 'htmlspecialchars', $extended );
                $snippets = $extended;
-               $last = - 1;
+               $last = -1;
                $extract = '';
                foreach ( $snippets as $index => $line ) {
-                       if ( $last == - 1 ) {
+                       if ( $last == -1 ) {
                                $extract .= $line; // first line
                        } elseif ( $last + 1 == $index
                                && $offsets[$last] + strlen( $snippets[$last] ) >= strlen( $all[$last] )
index 540ce4b..c3ee321 100644 (file)
@@ -1088,13 +1088,13 @@ abstract class LoginSignupSpecialPage extends AuthManagerSpecialPage {
                        // B/C for old extensions that haven't been converted to AuthManager (or have been
                        // but somebody is using the old version) and still use templates via the
                        // UserCreateForm/UserLoginForm hook.
-                       // 'header' used by ConfirmEdit, CondfirmAccount, Persona, WikimediaIncubator, SemanticSignup
+                       // 'header' used by ConfirmEdit, ConfirmAccount, Persona, WikimediaIncubator, SemanticSignup
                        // 'formheader' used by MobileFrontend
                        $fieldDefinitions['header'] = [
                                'type' => 'info',
                                'raw' => true,
                                'default' => $template->get( 'header' ) ?: $template->get( 'formheader' ),
-                               'weight' => - 110,
+                               'weight' => -110,
                        ];
                }
                if ( $this->mEntryError ) {