From c6f066b88c2ab775f2ecccc7555bfc7a5445bd7c Mon Sep 17 00:00:00 2001 From: "Amir E. Aharoni" Date: Sat, 26 Sep 2015 19:58:43 +0300 Subject: [PATCH] Make long lines shorter to pass phpcs in 6 files Bug: T102614 Change-Id: I3159c33ddd16bded94a70f363258a294f407fc58 --- includes/clientpool/RedisConnectionPool.php | 4 +++- includes/context/RequestContext.php | 5 ++++- includes/diff/TableDiffFormatter.php | 10 ++++++++-- includes/libs/HttpStatus.php | 5 ++++- includes/objectcache/MultiWriteBagOStuff.php | 4 +++- includes/search/SearchHighlighter.php | 4 +++- 6 files changed, 25 insertions(+), 7 deletions(-) diff --git a/includes/clientpool/RedisConnectionPool.php b/includes/clientpool/RedisConnectionPool.php index ec0573ef75..8a88fabbf0 100644 --- a/includes/clientpool/RedisConnectionPool.php +++ b/includes/clientpool/RedisConnectionPool.php @@ -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; diff --git a/includes/context/RequestContext.php b/includes/context/RequestContext.php index 93adde1fee..42a2aee642 100644 --- a/includes/context/RequestContext.php +++ b/includes/context/RequestContext.php @@ -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; diff --git a/includes/diff/TableDiffFormatter.php b/includes/diff/TableDiffFormatter.php index 83e04a5484..4737f08546 100644 --- a/includes/diff/TableDiffFormatter.php +++ b/includes/diff/TableDiffFormatter.php @@ -62,8 +62,14 @@ class TableDiffFormatter extends DiffFormatter { protected function blockHeader( $xbeg, $xlen, $ybeg, $ylen ) { // '' get replaced by a localised line number // in DifferenceEngine::localiseLineNumbers - $r = '\n" . - '\n"; + $r = '\n" . + '\n"; return $r; } diff --git a/includes/libs/HttpStatus.php b/includes/libs/HttpStatus.php index 442298a60b..3d7dee7da1 100644 --- a/includes/libs/HttpStatus.php +++ b/includes/libs/HttpStatus.php @@ -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" ); diff --git a/includes/objectcache/MultiWriteBagOStuff.php b/includes/objectcache/MultiWriteBagOStuff.php index 1a52930e52..cb3754a8f4 100644 --- a/includes/objectcache/MultiWriteBagOStuff.php +++ b/includes/objectcache/MultiWriteBagOStuff.php @@ -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(); diff --git a/includes/search/SearchHighlighter.php b/includes/search/SearchHighlighter.php index 7d5d38f22b..98c05b5695 100644 --- a/includes/search/SearchHighlighter.php +++ b/includes/search/SearchHighlighter.php @@ -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", '
', $text ); } } -- 2.20.1