Make long lines shorter to pass phpcs in 6 files
authorAmir E. Aharoni <amir.aharoni@mail.huji.ac.il>
Sat, 26 Sep 2015 16:58:43 +0000 (19:58 +0300)
committerAmire80 <amir.aharoni@mail.huji.ac.il>
Sat, 26 Sep 2015 17:07:06 +0000 (17:07 +0000)
Bug: T102614
Change-Id: I3159c33ddd16bded94a70f363258a294f407fc58

includes/clientpool/RedisConnectionPool.php
includes/context/RequestContext.php
includes/diff/TableDiffFormatter.php
includes/libs/HttpStatus.php
includes/objectcache/MultiWriteBagOStuff.php
includes/search/SearchHighlighter.php

index ec0573e..8a88fab 100644 (file)
@@ -442,7 +442,9 @@ class RedisConnRef {
         * @param Redis $conn
         * @param LoggerInterface $logger
         */
-       public function __construct( RedisConnectionPool $pool, $server, Redis $conn, LoggerInterface $logger ) {
+       public function __construct(
+               RedisConnectionPool $pool, $server, Redis $conn, LoggerInterface $logger
+       ) {
                $this->pool = $pool;
                $this->server = $server;
                $this->conn = $conn;
index 93adde1..42a2aee 100644 (file)
@@ -159,7 +159,10 @@ class RequestContext implements IContextSource, MutableContext {
                if ( $this->title === null ) {
                        global $wgTitle; # fallback to $wg till we can improve this
                        $this->title = $wgTitle;
-                       wfDebugLog( 'GlobalTitleFail', __METHOD__ . ' called by ' . wfGetAllCallers( 5 ) . ' with no title set.' );
+                       wfDebugLog(
+                               'GlobalTitleFail',
+                               __METHOD__ . ' called by ' . wfGetAllCallers( 5 ) . ' with no title set.'
+                       );
                }
 
                return $this->title;
index 83e04a5..4737f08 100644 (file)
@@ -62,8 +62,14 @@ class TableDiffFormatter extends DiffFormatter {
        protected function blockHeader( $xbeg, $xlen, $ybeg, $ylen ) {
                // '<!--LINE \d+ -->' get replaced by a localised line number
                // in DifferenceEngine::localiseLineNumbers
-               $r = '<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l' . $xbeg . '" ><!--LINE ' . $xbeg . "--></td>\n" .
-                       '<td colspan="2" class="diff-lineno"><!--LINE ' . $ybeg . "--></td></tr>\n";
+               $r = '<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l' .
+                       $xbeg .
+                       '" ><!--LINE ' .
+                       $xbeg .
+                       "--></td>\n" .
+                       '<td colspan="2" class="diff-lineno"><!--LINE ' .
+                       $ybeg .
+                       "--></td></tr>\n";
 
                return $r;
        }
index 442298a..3d7dee7 100644 (file)
@@ -102,7 +102,10 @@ class HttpStatus {
                }
 
                if ( $version === null ) {
-                       $version = isset( $_SERVER['SERVER_PROTOCOL'] ) && $_SERVER['SERVER_PROTOCOL'] === 'HTTP/1.0' ? '1.0' : '1.1';
+                       $version = isset( $_SERVER['SERVER_PROTOCOL'] ) &&
+                               $_SERVER['SERVER_PROTOCOL'] === 'HTTP/1.0' ?
+                                       '1.0' :
+                                       '1.1';
                }
 
                header( "HTTP/$version $code $message" );
index 1a52930..cb3754a 100644 (file)
@@ -60,7 +60,9 @@ class MultiWriteBagOStuff extends BagOStuff {
                parent::__construct( $params );
 
                if ( empty( $params['caches'] ) || !is_array( $params['caches'] ) ) {
-                       throw new InvalidArgumentException( __METHOD__ . ': "caches" parameter must be an array of caches' );
+                       throw new InvalidArgumentException(
+                               __METHOD__ . ': "caches" parameter must be an array of caches'
+                       );
                }
 
                $this->caches = array();
index 7d5d38f..98c05b5 100644 (file)
@@ -547,7 +547,9 @@ class SearchHighlighter {
                $text = ltrim( $text ) . "\n"; // make sure the preg_match may find the last line
                $text = str_replace( "\n\n", "\n", $text ); // remove empty lines
                preg_match( "/^(.*\n){0,$contextlines}/", $text, $match );
-               $text = htmlspecialchars( substr( trim( $match[0] ), 0, $contextlines * $contextchars ) ); // trim and limit to max number of chars
+
+               // Trim and limit to max number of chars
+               $text = htmlspecialchars( substr( trim( $match[0] ), 0, $contextlines * $contextchars ) );
                return str_replace( "\n", '<br>', $text );
        }
 }