From c4f69827bc670fc0bed322d31cb1173bcd43db24 Mon Sep 17 00:00:00 2001 From: Jackmcbarn Date: Fri, 26 Jun 2015 01:32:28 -0400 Subject: [PATCH] Fix some PHPCS issues Change-Id: I6289ce362f8dfde7baf2b665f082820898844973 --- includes/actions/InfoAction.php | 3 ++- includes/api/ApiFeedWatchlist.php | 3 ++- includes/api/ApiFormatPhp.php | 3 ++- includes/cache/MessageCache.php | 3 ++- includes/htmlform/HTMLTextAreaField.php | 2 +- includes/htmlform/HTMLTextField.php | 2 +- includes/libs/BufferingStatsdDataFactory.php | 1 - includes/libs/normal/UtfNormalUtil.php | 1 + includes/media/FormatMetadata.php | 8 +++++--- includes/parser/ParserCache.php | 1 - includes/poolcounter/PoolCounter.php | 9 +++++---- includes/profiler/output/ProfilerOutputDump.php | 6 +++++- includes/title/MalformedTitleException.php | 3 ++- 13 files changed, 28 insertions(+), 17 deletions(-) diff --git a/includes/actions/InfoAction.php b/includes/actions/InfoAction.php index 203c687eb4..bf86b51404 100644 --- a/includes/actions/InfoAction.php +++ b/includes/actions/InfoAction.php @@ -448,7 +448,8 @@ class InfoAction extends FormlessAction { } } $expiry = $title->getRestrictionExpiry( $restrictionType ); - $formattedexpiry = $this->msg( 'parentheses', $this->getLanguage()->formatExpiry( $expiry ) )->escaped(); + $formattedexpiry = $this->msg( 'parentheses', + $this->getLanguage()->formatExpiry( $expiry ) )->escaped(); $message .= $this->msg( 'word-separator' )->escaped() . $formattedexpiry; // Messages: restriction-edit, restriction-move, restriction-create, diff --git a/includes/api/ApiFeedWatchlist.php b/includes/api/ApiFeedWatchlist.php index d1beef8ae7..853b138379 100644 --- a/includes/api/ApiFeedWatchlist.php +++ b/includes/api/ApiFeedWatchlist.php @@ -126,7 +126,8 @@ class ApiFeedWatchlist extends ApiBase { $msg = wfMessage( 'watchlist' )->inContentLanguage()->text(); - $feedTitle = $this->getConfig()->get( 'Sitename' ) . ' - ' . $msg . ' [' . $this->getConfig()->get( 'LanguageCode' ) . ']'; + $feedTitle = $this->getConfig()->get( 'Sitename' ) . ' - ' . $msg . + ' [' . $this->getConfig()->get( 'LanguageCode' ) . ']'; $feedUrl = SpecialPage::getTitleFor( 'Watchlist' )->getFullURL(); $feed = new $feedClasses[$params['feedformat']] ( diff --git a/includes/api/ApiFormatPhp.php b/includes/api/ApiFormatPhp.php index d88dd40bd4..6420a5b518 100644 --- a/includes/api/ApiFormatPhp.php +++ b/includes/api/ApiFormatPhp.php @@ -68,7 +68,8 @@ class ApiFormatPhp extends ApiFormatBase { preg_match( '/\<\s*cross-domain-policy\s*\>/i', $text ) ) { $this->dieUsage( - 'This response cannot be represented using format=php. See https://bugzilla.wikimedia.org/show_bug.cgi?id=66776', + 'This response cannot be represented using format=php. ' . + 'See https://bugzilla.wikimedia.org/show_bug.cgi?id=66776', 'internalerror' ); } diff --git a/includes/cache/MessageCache.php b/includes/cache/MessageCache.php index 79f4d6c54b..585fcd32c7 100644 --- a/includes/cache/MessageCache.php +++ b/includes/cache/MessageCache.php @@ -1113,7 +1113,8 @@ class MessageCache { if ( !$title || !$title instanceof Title ) { global $wgTitle; - wfDebugLog( 'GlobalTitleFail', __METHOD__ . ' called by ' . wfGetAllCallers( 5 ) . ' with no title set.' ); + wfDebugLog( 'GlobalTitleFail', __METHOD__ . ' called by ' . + wfGetAllCallers( 5 ) . ' with no title set.' ); $title = $wgTitle; } // Sometimes $wgTitle isn't set either... diff --git a/includes/htmlform/HTMLTextAreaField.php b/includes/htmlform/HTMLTextAreaField.php index a4ed95fb72..e4f78b25fa 100644 --- a/includes/htmlform/HTMLTextAreaField.php +++ b/includes/htmlform/HTMLTextAreaField.php @@ -14,7 +14,7 @@ class HTMLTextAreaField extends HTMLFormField { function getSpellCheck() { $val = isset( $this->mParams['spellcheck'] ) ? $this->mParams['spellcheck'] : null; - if( is_bool( $val ) ) { + if ( is_bool( $val ) ) { // "spellcheck" attribute literally requires "true" or "false" to work. return $val === true ? 'true' : 'false'; } diff --git a/includes/htmlform/HTMLTextField.php b/includes/htmlform/HTMLTextField.php index 06b397f2a7..9c5b8689fd 100644 --- a/includes/htmlform/HTMLTextField.php +++ b/includes/htmlform/HTMLTextField.php @@ -7,7 +7,7 @@ class HTMLTextField extends HTMLFormField { function getSpellCheck() { $val = isset( $this->mParams['spellcheck'] ) ? $this->mParams['spellcheck'] : null; - if( is_bool( $val ) ) { + if ( is_bool( $val ) ) { // "spellcheck" attribute literally requires "true" or "false" to work. return $val === true ? 'true' : 'false'; } diff --git a/includes/libs/BufferingStatsdDataFactory.php b/includes/libs/BufferingStatsdDataFactory.php index 457237a2c8..0caf90b39c 100644 --- a/includes/libs/BufferingStatsdDataFactory.php +++ b/includes/libs/BufferingStatsdDataFactory.php @@ -23,7 +23,6 @@ use Liuggio\StatsdClient\Entity\StatsdDataInterface; use Liuggio\StatsdClient\Factory\StatsdDataFactory; - /** * A factory for application metric data. * diff --git a/includes/libs/normal/UtfNormalUtil.php b/includes/libs/normal/UtfNormalUtil.php index ad9a2b9a6c..9ed9bc2431 100644 --- a/includes/libs/normal/UtfNormalUtil.php +++ b/includes/libs/normal/UtfNormalUtil.php @@ -27,6 +27,7 @@ use UtfNormal\Utils; + /** * Return UTF-8 sequence for a given Unicode code point. * diff --git a/includes/media/FormatMetadata.php b/includes/media/FormatMetadata.php index 17e3ddad0f..0fee8cc00f 100644 --- a/includes/media/FormatMetadata.php +++ b/includes/media/FormatMetadata.php @@ -1732,8 +1732,9 @@ class FormatMetadata extends ContextSource { } /** - * Turns an XMP-style multivalue array into a single value by dropping all but the first value. - * If the value is not a multivalue array (or a multivalue array inside a multilang array), it is returned unchanged. + * Turns an XMP-style multivalue array into a single value by dropping all but the first + * value. If the value is not a multivalue array (or a multivalue array inside a multilang + * array), it is returned unchanged. * See mediawiki.org/wiki/Manual:File_metadata_handling#Multi-language_array_format * @param mixed $value * @return mixed The value, or the first value if there were multiple ones @@ -1742,7 +1743,8 @@ class FormatMetadata extends ContextSource { protected function resolveMultivalueValue( $value ) { if ( !is_array( $value ) ) { return $value; - } elseif ( isset( $value['_type'] ) && $value['_type'] === 'lang' ) { // if this is a multilang array, process fields separately + } elseif ( isset( $value['_type'] ) && $value['_type'] === 'lang' ) { + // if this is a multilang array, process fields separately $newValue = array(); foreach ( $value as $k => $v ) { $newValue[$k] = $this->resolveMultivalueValue( $v ); diff --git a/includes/parser/ParserCache.php b/includes/parser/ParserCache.php index 117b6e7544..44b0bc9e16 100644 --- a/includes/parser/ParserCache.php +++ b/includes/parser/ParserCache.php @@ -217,7 +217,6 @@ class ParserCache { ? $article->getPage() : $article; - if ( !$useOutdated && $value->expired( $touched ) ) { wfIncrStats( "pcache.miss.expired" ); $cacheTime = $value->getCacheTime(); diff --git a/includes/poolcounter/PoolCounter.php b/includes/poolcounter/PoolCounter.php index 5692d73199..1ec14aa148 100644 --- a/includes/poolcounter/PoolCounter.php +++ b/includes/poolcounter/PoolCounter.php @@ -192,10 +192,11 @@ abstract class PoolCounter { } /** - * Given a key (any string) and the number of lots, returns a slot number (an integer from the [0..($slots-1)] range). - * This is used for a global limit on the number of instances of a given type that can acquire a lock. - * The hashing is deterministic so that PoolCounter::$workers is always an upper limit of how many instances with - * the same key can acquire a lock. + * Given a key (any string) and the number of lots, returns a slot number (an integer from + * the [0..($slots-1)] range). This is used for a global limit on the number of instances of + * a given type that can acquire a lock. The hashing is deterministic so that + * PoolCounter::$workers is always an upper limit of how many instances with the same key + * can acquire a lock. * * @param string $key PoolCounter instance key (any string) * @param int $slots The number of slots (max allowed value is 65536) diff --git a/includes/profiler/output/ProfilerOutputDump.php b/includes/profiler/output/ProfilerOutputDump.php index bf4b85c2b8..09f5688785 100644 --- a/includes/profiler/output/ProfilerOutputDump.php +++ b/includes/profiler/output/ProfilerOutputDump.php @@ -45,7 +45,11 @@ class ProfilerOutputDump extends ProfilerOutput { public function log( array $stats ) { $data = $this->collector->getRawData(); - $filename = sprintf( "%s/%s.%s%s", $this->params['outputDir'], uniqid(), $this->collector->getProfileID(), $this->suffix ); + $filename = sprintf( "%s/%s.%s%s", + $this->params['outputDir'], + uniqid(), + $this->collector->getProfileID(), + $this->suffix ); file_put_contents( $filename, serialize( $data ) ); } } diff --git a/includes/title/MalformedTitleException.php b/includes/title/MalformedTitleException.php index fb89e4fe06..0892ce4e57 100644 --- a/includes/title/MalformedTitleException.php +++ b/includes/title/MalformedTitleException.php @@ -30,7 +30,8 @@ class MalformedTitleException extends Exception { /** * @param string $errorMessage Localisation message describing the error (since MW 1.26) * @param string $titleText The invalid title text (since MW 1.26) - * @param string[] $errorMessageParameters Additional parameters for the error message. $titleText will be appended if it's not null. (since MW 1.26) + * @param string[] $errorMessageParameters Additional parameters for the error message. + * $titleText will be appended if it's not null. (since MW 1.26) */ public function __construct( $errorMessage = null, $titleText = null, $errorMessageParameters = array() ) { $this->errorMessage = $errorMessage; -- 2.20.1