From 0cccd68dc892b0e9c18336490aa836ece765da16 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bartosz=20Dziewo=C5=84ski?= Date: Thu, 5 Jan 2017 14:38:32 +0100 Subject: [PATCH] Code style: no space after unary minus operator 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 | 2 +- includes/json/FormatJson.php | 2 +- includes/search/SearchHighlighter.php | 8 ++++---- includes/specialpage/LoginSignupSpecialPage.php | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/includes/Preferences.php b/includes/Preferences.php index cf8e7b8088..97fdb3375f 100644 --- a/includes/Preferences.php +++ b/includes/Preferences.php @@ -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; } } diff --git a/includes/json/FormatJson.php b/includes/json/FormatJson.php index 41541ef4d6..0c77a7bcc2 100644 --- a/includes/json/FormatJson.php +++ b/includes/json/FormatJson.php @@ -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() ) { diff --git a/includes/search/SearchHighlighter.php b/includes/search/SearchHighlighter.php index dd41a6e1e4..d0e3a240d6 100644 --- a/includes/search/SearchHighlighter.php +++ b/includes/search/SearchHighlighter.php @@ -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] ) diff --git a/includes/specialpage/LoginSignupSpecialPage.php b/includes/specialpage/LoginSignupSpecialPage.php index 540ce4bc7c..c3ee32120b 100644 --- a/includes/specialpage/LoginSignupSpecialPage.php +++ b/includes/specialpage/LoginSignupSpecialPage.php @@ -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 ) { -- 2.20.1