From b6adafc146006e8ad5cc06418f1c8f64f8535316 Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Wed, 12 Mar 2014 12:50:43 +0100 Subject: [PATCH] Fix CodeSniffer errors and warnings For the files touched in I06ee0f01d8 as logged at https://integration.wikimedia.org/ci/job/mediawiki-core-phpcs-strict-HEAD/7798/console Change-Id: I811884f7a5ada4d0551552d0a2c2775d6b17b59f --- includes/AutoLoader.php | 3 ++- includes/ChangesFeed.php | 16 +++++++++------ .../specialpage/ChangesListSpecialPage.php | 8 +++++++- includes/specials/SpecialRecentchanges.php | 12 +++++++---- .../specials/SpecialRecentchangeslinked.php | 20 ++++++++++++++----- 5 files changed, 42 insertions(+), 17 deletions(-) diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php index d4cc9509b2..e5c3eeb80d 100644 --- a/includes/AutoLoader.php +++ b/includes/AutoLoader.php @@ -96,7 +96,8 @@ $wgAutoloadLocalClasses = array( 'HTMLFloatField' => 'includes/htmlform/HTMLFloatField.php', 'HTMLForm' => 'includes/htmlform/HTMLForm.php', 'HTMLFormField' => 'includes/htmlform/HTMLFormField.php', - 'HTMLFormFieldRequiredOptionsException' => 'includes/htmlform/HTMLFormFieldRequiredOptionsException.php', + 'HTMLFormFieldRequiredOptionsException' => + 'includes/htmlform/HTMLFormFieldRequiredOptionsException.php', 'HTMLHiddenField' => 'includes/htmlform/HTMLHiddenField.php', 'HTMLInfoField' => 'includes/htmlform/HTMLInfoField.php', 'HTMLIntField' => 'includes/htmlform/HTMLIntField.php', diff --git a/includes/ChangesFeed.php b/includes/ChangesFeed.php index cf05782bd8..a5e5364800 100644 --- a/includes/ChangesFeed.php +++ b/includes/ChangesFeed.php @@ -67,10 +67,12 @@ class ChangesFeed { /** * Generates feed's content * - * @param $feed ChannelFeed subclass object (generally the one returned by getFeedObject()) - * @param $rows ResultWrapper object with rows in recentchanges table - * @param $lastmod Integer: timestamp of the last item in the recentchanges table (only used for the cache key) - * @param $opts FormOptions as in SpecialRecentChanges::getDefaultOptions() + * @param ChannelFeed $feed ChannelFeed subclass object (generally the one returned + * by getFeedObject()) + * @param ResultWrapper $rows ResultWrapper object with rows in recentchanges table + * @param int $lastmod Timestamp of the last item in the recentchanges table (only + * used for the cache key) + * @param FormOptions $opts As in SpecialRecentChanges::getDefaultOptions() * @return null|bool True or null */ public function execute( $feed, $rows, $lastmod, $opts ) { @@ -201,7 +203,10 @@ class ChangesFeed { foreach ( $sorted as $obj ) { $title = Title::makeTitle( $obj->rc_namespace, $obj->rc_title ); - $talkpage = MWNamespace::canTalk( $obj->rc_namespace ) ? $title->getTalkPage()->getFullURL() : ''; + $talkpage = MWNamespace::canTalk( $obj->rc_namespace ) + ? $title->getTalkPage()->getFullURL() + : ''; + // Skip items with deleted content (avoids partially complete/inconsistent output) if ( $obj->rc_deleted ) { continue; @@ -231,5 +236,4 @@ class ChangesFeed { wfProfileOut( __METHOD__ ); return $items; } - } diff --git a/includes/specialpage/ChangesListSpecialPage.php b/includes/specialpage/ChangesListSpecialPage.php index c08d03393f..888829ad43 100644 --- a/includes/specialpage/ChangesListSpecialPage.php +++ b/includes/specialpage/ChangesListSpecialPage.php @@ -28,7 +28,13 @@ * @ingroup SpecialPage */ abstract class ChangesListSpecialPage extends SpecialPage { - var $rcSubpage, $rcOptions; // @todo Rename these, make protected + /** @var string */ + protected $rcSubpage; + + /** @var FormOptions */ + protected $rcOptions; + + /** @var array */ protected $customFilters; /** diff --git a/includes/specials/SpecialRecentchanges.php b/includes/specials/SpecialRecentchanges.php index e05c8b89d2..720d0a80f8 100644 --- a/includes/specials/SpecialRecentchanges.php +++ b/includes/specials/SpecialRecentchanges.php @@ -27,10 +27,11 @@ * @ingroup SpecialPage */ class SpecialRecentChanges extends ChangesListSpecialPage { - + // @codingStandardsIgnoreStart Needed "useless" override to change parameters. public function __construct( $name = 'Recentchanges', $restriction = '' ) { parent::__construct( $name, $restriction ); } + // @codingStandardsIgnoreEnd /** * Main execution point @@ -285,7 +286,8 @@ class SpecialRecentChanges extends ChangesListSpecialPage { $limit = $opts['limit']; - $showWatcherCount = $wgRCShowWatchingUsers && $this->getUser()->getOption( 'shownumberswatching' ); + $showWatcherCount = $wgRCShowWatchingUsers + && $this->getUser()->getOption( 'shownumberswatching' ); $watcherCache = array(); $dbr = $this->getDB(); @@ -334,7 +336,9 @@ class SpecialRecentChanges extends ChangesListSpecialPage { if ( $rows->numRows() === 0 ) { $this->getOutput()->addHtml( - '
' . $this->msg( 'recentchanges-noresult' )->parse() . '
' + '
' . + $this->msg( 'recentchanges-noresult' )->parse() . + '
' ); } else { $this->getOutput()->addHTML( $rclistOutput ); @@ -688,7 +692,7 @@ class SpecialRecentChanges extends ChangesListSpecialPage { 'hideliu' => 'rcshowhideliu', 'hidepatrolled' => 'rcshowhidepatr', 'hidemyself' => 'rcshowhidemine' - ); + ); $showhide = array( 'show', 'hide' ); diff --git a/includes/specials/SpecialRecentchangeslinked.php b/includes/specials/SpecialRecentchangeslinked.php index 34dd51f61b..c4f40befec 100644 --- a/includes/specials/SpecialRecentchangeslinked.php +++ b/includes/specials/SpecialRecentchangeslinked.php @@ -27,7 +27,8 @@ * @ingroup SpecialPage */ class SpecialRecentChangesLinked extends SpecialRecentChanges { - var $rclTargetTitle; + /** @var bool|Title */ + protected $rclTargetTitle; function __construct() { parent::__construct( 'Recentchangeslinked' ); @@ -55,7 +56,8 @@ class SpecialRecentChangesLinked extends SpecialRecentChanges { $outputPage = $this->getOutput(); $title = Title::newFromURL( $target ); if ( !$title || $title->isExternal() ) { - $outputPage->addHtml( '
' . $this->msg( 'allpagesbadtitle' )->parse() . '
' ); + $outputPage->addHtml( '
' . $this->msg( 'allpagesbadtitle' ) + ->parse() . '
' ); return false; } @@ -105,7 +107,9 @@ class SpecialRecentChangesLinked extends SpecialRecentChanges { $opts['tagfilter'] ); - if ( !wfRunHooks( 'SpecialRecentChangesQuery', array( &$conds, &$tables, &$join_conds, $opts, &$query_options, &$select ) ) ) { + if ( !wfRunHooks( 'SpecialRecentChangesQuery', + array( &$conds, &$tables, &$join_conds, $opts, &$query_options, &$select ) ) + ) { return false; } @@ -128,14 +132,20 @@ class SpecialRecentChangesLinked extends SpecialRecentChanges { } // field name prefixes for all the various tables we might want to join with - $prefix = array( 'pagelinks' => 'pl', 'templatelinks' => 'tl', 'categorylinks' => 'cl', 'imagelinks' => 'il' ); + $prefix = array( + 'pagelinks' => 'pl', + 'templatelinks' => 'tl', + 'categorylinks' => 'cl', + 'imagelinks' => 'il' + ); $subsql = array(); // SELECT statements to combine with UNION foreach ( $link_tables as $link_table ) { $pfx = $prefix[$link_table]; - // imagelinks and categorylinks tables have no xx_namespace field, and have xx_to instead of xx_title + // imagelinks and categorylinks tables have no xx_namespace field, + // and have xx_to instead of xx_title if ( $link_table == 'imagelinks' ) { $link_ns = NS_FILE; } elseif ( $link_table == 'categorylinks' ) { -- 2.20.1