From e9eb00b2037aa6524c4fe5c4bbd6a3d5eb15d283 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Sun, 11 May 2014 17:32:18 +0200 Subject: [PATCH] Make phpcs-strict pass on includes/ (1/~10) Change-Id: Ib51381a2261d064988ba2f39b71c0252f2458faf --- includes/FeedUtils.php | 16 +++++++++++---- includes/FileDeleteForm.php | 39 ++++++++++++++++++++++++++++-------- includes/GlobalFunctions.php | 4 ++++ includes/Hooks.php | 4 ++-- includes/Html.php | 18 ++++++++++------- includes/HtmlFormatter.php | 3 ++- includes/ImageQueryPage.php | 5 ++++- includes/Init.php | 2 +- includes/Licenses.php | 32 +++++++++-------------------- includes/Message.php | 16 +++++++++++++-- 10 files changed, 91 insertions(+), 48 deletions(-) diff --git a/includes/FeedUtils.php b/includes/FeedUtils.php index d407a0e1ad..83ce7553b4 100644 --- a/includes/FeedUtils.php +++ b/includes/FeedUtils.php @@ -102,7 +102,9 @@ class FeedUtils { * @param string $actiontext Text of the action; in case of log event * @return string */ - public static function formatDiffRow( $title, $oldid, $newid, $timestamp, $comment, $actiontext = '' ) { + public static function formatDiffRow( $title, $oldid, $newid, $timestamp, + $comment, $actiontext = '' + ) { global $wgFeedDiffCutoff, $wgLang; wfProfileIn( __METHOD__ ); @@ -245,9 +247,15 @@ class FeedUtils { 'diff' => 'background-color: white; color:black;', 'diff-otitle' => 'background-color: white; color:black; text-align: center;', 'diff-ntitle' => 'background-color: white; color:black; text-align: center;', - 'diff-addedline' => 'color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;', - 'diff-deletedline' => 'color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;', - 'diff-context' => 'background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;', + 'diff-addedline' => 'color:black; font-size: 88%; border-style: solid; ' + . 'border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; ' + . 'vertical-align: top; white-space: pre-wrap;', + 'diff-deletedline' => 'color:black; font-size: 88%; border-style: solid; ' + . 'border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; ' + . 'vertical-align: top; white-space: pre-wrap;', + 'diff-context' => 'background-color: #f9f9f9; color: #333333; font-size: 88%; ' + . 'border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; ' + . 'border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;', 'diffchange' => 'font-weight: bold; text-decoration: none;', ); diff --git a/includes/FileDeleteForm.php b/includes/FileDeleteForm.php index 642c49e13e..b4e245813f 100644 --- a/includes/FileDeleteForm.php +++ b/includes/FileDeleteForm.php @@ -83,7 +83,10 @@ class FileDeleteForm { $suppress = $wgRequest->getVal( 'wpSuppress' ) && $wgUser->isAllowed( 'suppressrevision' ); if ( $this->oldimage ) { - $this->oldfile = RepoGroup::singleton()->getLocalRepo()->newFromArchiveName( $this->title, $this->oldimage ); + $this->oldfile = RepoGroup::singleton()->getLocalRepo()->newFromArchiveName( + $this->title, + $this->oldimage + ); } if ( !self::haveDeletableFile( $this->file, $this->oldfile, $this->oldimage ) ) { @@ -107,11 +110,20 @@ class FileDeleteForm { $reason = $deleteReasonList; } - $status = self::doDelete( $this->title, $this->file, $this->oldimage, $reason, $suppress, $wgUser ); + $status = self::doDelete( + $this->title, + $this->file, + $this->oldimage, + $reason, + $suppress, + $wgUser + ); if ( !$status->isGood() ) { $wgOut->addHTML( '

' . $this->prepareMessage( 'filedeleteerror-short' ) . "

\n" ); - $wgOut->addWikiText( '
' . $status->getWikiText( 'filedeleteerror-short', 'filedeleteerror-long' ) . '
' ); + $wgOut->addWikiText( '
' . + $status->getWikiText( 'filedeleteerror-short', 'filedeleteerror-long' ) + . '
' ); } if ( $status->ok ) { $wgOut->setPageTitle( wfMessage( 'actioncomplete' ) ); @@ -141,7 +153,9 @@ class FileDeleteForm { * @throws MWException * @return bool|Status */ - public static function doDelete( &$title, &$file, &$oldimage, $reason, $suppress, User $user = null ) { + public static function doDelete( &$title, &$file, &$oldimage, $reason, + $suppress, User $user = null + ) { if ( $user === null ) { global $wgUser; $user = $wgUser; @@ -188,7 +202,8 @@ class FileDeleteForm { } } } catch ( MWException $e ) { - // rollback before returning to prevent UI from displaying incorrect "View or restore N deleted edits?" + // Rollback before returning to prevent UI from displaying + // incorrect "View or restore N deleted edits?" $dbw->rollback( __METHOD__ ); throw $e; } @@ -266,8 +281,14 @@ class FileDeleteForm { " . - Xml::submitButton( wfMessage( 'filedelete-submit' )->text(), - array( 'name' => 'mw-filedelete-submit', 'id' => 'mw-filedelete-submit', 'tabindex' => '4' ) ) . + Xml::submitButton( + wfMessage( 'filedelete-submit' )->text(), + array( + 'name' => 'mw-filedelete-submit', + 'id' => 'mw-filedelete-submit', + 'tabindex' => '4' + ) + ) . " " . Xml::closeElement( 'table' ) . @@ -309,8 +330,10 @@ class FileDeleteForm { private function prepareMessage( $message ) { global $wgLang; if ( $this->oldimage ) { + # Message keys used: + # 'filedelete-intro-old', 'filedelete-nofile-old', 'filedelete-success-old' return wfMessage( - "{$message}-old", # To ensure grep will find them: 'filedelete-intro-old', 'filedelete-nofile-old', 'filedelete-success-old' + "{$message}-old", wfEscapeWikiText( $this->title->getText() ), $wgLang->date( $this->getTimestamp(), true ), $wgLang->time( $this->getTimestamp(), true ), diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index d94d2f13f5..ed99aa9979 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -2922,8 +2922,10 @@ function wfShellExec( $cmd, &$retval = null, $environ = array(), $readyPipes = $pipes; // Clear last error + // @codingStandardsIgnoreStart Generic.PHP.NoSilencedErrors.Discouraged @trigger_error( '' ); if ( @stream_select( $readyPipes, $emptyArray, $emptyArray, null ) === false ) { + // @codingStandardsIgnoreEnd $error = error_get_last(); if ( strncmp( $error['message'], $eintrMessage, strlen( $eintrMessage ) ) == 0 ) { continue; @@ -3407,9 +3409,11 @@ function wfBaseConvert( $input, $sourceBase, $destBase, $pad = 1, $decimal = bcadd( $decimal, $baseChars[$char] ); } + // @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed for ( $result = ''; bccomp( $decimal, 0 ); $decimal = bcdiv( $decimal, $destBase, 0 ) ) { $result .= $baseChars[bcmod( $decimal, $destBase )]; } + // @codingStandardsIgnoreEnd $result = strrev( $result ); } else { diff --git a/includes/Hooks.php b/includes/Hooks.php index 785e71707c..89457e8436 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -27,7 +27,8 @@ /** * @since 1.18 */ -class MWHookException extends MWException {} +class MWHookException extends MWException { +} /** * Hooks class. @@ -37,7 +38,6 @@ class MWHookException extends MWException {} * @since 1.18 */ class Hooks { - /** * Array of events mapped to an array of callbacks to be run * when that event is triggered. diff --git a/includes/Html.php b/includes/Html.php index 2a8c9b1736..5262ffe619 100644 --- a/includes/Html.php +++ b/includes/Html.php @@ -695,16 +695,20 @@ class Html { * * @param array $params Params to set. * - selected: [optional] Id of namespace which should be pre-selected - * - all: [optional] Value of item for "all namespaces". If null or unset, no "