From: Siebrand Mazeland Date: Fri, 9 May 2014 19:34:13 +0000 (+0200) Subject: Pass phpcs-strict on includes/specials/ (2/3) X-Git-Tag: 1.31.0-rc.0~15775^2 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=2c10a13c64197fec3e7f65ac1c61b41de47f3191;p=lhc%2Fweb%2Fwiklou.git Pass phpcs-strict on includes/specials/ (2/3) Change-Id: Ide979e5b948115afcec59d929516411c2e8346ae --- diff --git a/includes/specials/SpecialEditWatchlist.php b/includes/specials/SpecialEditWatchlist.php index f918708d81..409a6ae150 100644 --- a/includes/specials/SpecialEditWatchlist.php +++ b/includes/specials/SpecialEditWatchlist.php @@ -562,7 +562,8 @@ class SpecialEditWatchlist extends UnlistedSpecialPage { $context->setTitle( $this->getPageTitle() ); // Remove subpage $form = new EditWatchlistNormalHTMLForm( $fields, $context ); $form->setSubmitTextMsg( 'watchlistedit-normal-submit' ); - # Used message keys: 'accesskey-watchlistedit-normal-submit', 'tooltip-watchlistedit-normal-submit' + # Used message keys: + # 'accesskey-watchlistedit-normal-submit', 'tooltip-watchlistedit-normal-submit' $form->setSubmitTooltip( 'watchlistedit-normal-submit' ); $form->setWrapperLegendMsg( 'watchlistedit-normal-legend' ); $form->addHeaderText( $this->msg( 'watchlistedit-normal-explain' )->parse() ); @@ -603,7 +604,10 @@ class SpecialEditWatchlist extends UnlistedSpecialPage { ); } - wfRunHooks( 'WatchlistEditorBuildRemoveLine', array( &$tools, $title, $title->isRedirect(), $this->getSkin() ) ); + wfRunHooks( + 'WatchlistEditorBuildRemoveLine', + array( &$tools, $title, $title->isRedirect(), $this->getSkin() ) + ); return $link . " (" . $this->getLanguage()->pipeList( $tools ) . ")"; } diff --git a/includes/specials/SpecialExport.php b/includes/specials/SpecialExport.php index 487d979015..bc8e728ecd 100644 --- a/includes/specials/SpecialExport.php +++ b/includes/specials/SpecialExport.php @@ -259,8 +259,14 @@ class SpecialExport extends SpecialPage { ) . '
'; } - // Enable this when we can do something useful exporting/importing image information. :) - //$form .= Xml::checkLabel( $this->msg( 'export-images' )->text(), 'images', 'wpExportImages', false ) . '
'; + /* Enable this when we can do something useful exporting/importing image information. + $form .= Xml::checkLabel( + $this->msg( 'export-images' )->text(), + 'images', + 'wpExportImages', + false + ) . '
'; + */ $form .= Xml::checkLabel( $this->msg( 'export-download' )->text(), 'wpDownload', @@ -510,7 +516,9 @@ class SpecialExport extends SpecialPage { * @return array */ private function getPageLinks( $inputPages, $pageSet, $depth ) { + // @codingStandardsIgnoreStart Squiz.WhiteSpace.SemicolonSpacing.Incorrect for ( ; $depth > 0; --$depth ) { + // @codingStandardsIgnoreEnd $pageSet = $this->getLinks( $inputPages, $pageSet, 'pagelinks', array( 'namespace' => 'pl_namespace', 'title' => 'pl_title' ), diff --git a/includes/specials/SpecialImport.php b/includes/specials/SpecialImport.php index 891962bc1d..28e6479474 100644 --- a/includes/specials/SpecialImport.php +++ b/includes/specials/SpecialImport.php @@ -99,7 +99,9 @@ class SpecialImport extends SpecialPage { $sourceName = $request->getVal( "source" ); $this->logcomment = $request->getText( 'log-comment' ); - $this->pageLinkDepth = $wgExportMaxLinkDepth == 0 ? 0 : $request->getIntOrNull( 'pagelink-depth' ); + $this->pageLinkDepth = $wgExportMaxLinkDepth == 0 + ? 0 + : $request->getIntOrNull( 'pagelink-depth' ); $this->rootpage = $request->getText( 'rootpage' ); $user = $this->getUser(); @@ -242,7 +244,10 @@ class SpecialImport extends SpecialPage { " . - Xml::label( $this->msg( 'import-interwiki-rootpage' )->text(), 'mw-interwiki-rootpage-upload' ) . + Xml::label( + $this->msg( 'import-interwiki-rootpage' )->text(), + 'mw-interwiki-rootpage-upload' + ) . " " . Xml::input( 'rootpage', 50, $this->rootpage, @@ -434,7 +439,9 @@ class ImportReporter extends ContextSource { } function reportNotice( $msg, array $params ) { - $this->getOutput()->addHTML( Html::element( 'li', array(), $this->msg( $msg, $params )->text() ) ); + $this->getOutput()->addHTML( + Html::element( 'li', array(), $this->msg( $msg, $params )->text() ) + ); } function reportLogItem( /* ... */ ) { @@ -475,7 +482,8 @@ class ImportReporter extends ContextSource { $detail = $this->msg( 'import-logentry-upload-detail' )->numParams( $successCount )->inContentLanguage()->text(); if ( $this->reason ) { - $detail .= $this->msg( 'colon-separator' )->inContentLanguage()->text() . $this->reason; + $detail .= $this->msg( 'colon-separator' )->inContentLanguage()->text() + . $this->reason; } $log->addEntry( 'upload', $title, $detail, array(), $this->getUser() ); } else { @@ -484,7 +492,8 @@ class ImportReporter extends ContextSource { $detail = $this->msg( 'import-logentry-interwiki-detail' )->numParams( $successCount )->params( $interwiki )->inContentLanguage()->text(); if ( $this->reason ) { - $detail .= $this->msg( 'colon-separator' )->inContentLanguage()->text() . $this->reason; + $detail .= $this->msg( 'colon-separator' )->inContentLanguage()->text() + . $this->reason; } $log->addEntry( 'interwiki', $title, $detail, array(), $this->getUser() ); } @@ -492,13 +501,23 @@ class ImportReporter extends ContextSource { $comment = $detail; // quick $dbw = wfGetDB( DB_MASTER ); $latest = $title->getLatestRevID(); - $nullRevision = Revision::newNullRevision( $dbw, $title->getArticleID(), $comment, true, $this->getUser() ); + $nullRevision = Revision::newNullRevision( + $dbw, + $title->getArticleID(), + $comment, + true, + $this->getUser() + ); + if ( !is_null( $nullRevision ) ) { $nullRevision->insertOn( $dbw ); $page = WikiPage::factory( $title ); # Update page record $page->updateRevisionOn( $dbw, $nullRevision ); - wfRunHooks( 'NewRevisionFromEditComplete', array( $page, $nullRevision, $latest, $this->getUser() ) ); + wfRunHooks( + 'NewRevisionFromEditComplete', + array( $page, $nullRevision, $latest, $this->getUser() ) + ); } } else { $this->getOutput()->addHTML( "
  • " . Linker::linkKnown( $title ) . " " . diff --git a/includes/specials/SpecialJavaScriptTest.php b/includes/specials/SpecialJavaScriptTest.php index 7982d5c8c0..1c4f79f4ce 100644 --- a/includes/specials/SpecialJavaScriptTest.php +++ b/includes/specials/SpecialJavaScriptTest.php @@ -25,13 +25,12 @@ * @ingroup SpecialPage */ class SpecialJavaScriptTest extends SpecialPage { - /** - * @var $frameworks Array: Mapping of framework ids and their initilizer methods + * @var array Mapping of framework ids and their initilizer methods * in this class. If a framework is requested but not in this array, * the 'unknownframework' error is served. */ - static $frameworks = array( + private static $frameworks = array( 'qunit' => 'initQUnitTesting', ); diff --git a/includes/specials/SpecialListfiles.php b/includes/specials/SpecialListfiles.php index f9caff6e43..6b54fe897b 100644 --- a/includes/specials/SpecialListfiles.php +++ b/includes/specials/SpecialListfiles.php @@ -68,14 +68,20 @@ class SpecialListFiles extends IncludableSpecialPage { * @ingroup SpecialPage Pager */ class ImageListPager extends TablePager { - var $mFieldNames = null; + protected $mFieldNames = null; + // Subclasses should override buildQueryConds instead of using $mQueryConds variable. - var $mQueryConds = array(); - var $mUserName = null; - var $mSearch = ''; - var $mIncluding = false; - var $mShowAll = false; - var $mTableName = 'image'; + protected $mQueryConds = array(); + + protected $mUserName = null; + + protected $mSearch = ''; + + protected $mIncluding = false; + + protected $mShowAll = false; + + protected $mTableName = 'image'; function __construct( IContextSource $context, $userName = null, $search = '', $including = false, $showAll = false @@ -298,7 +304,8 @@ class ImageListPager extends TablePager { function reallyDoQuery( $offset, $limit, $asc ) { $prevTableName = $this->mTableName; $this->mTableName = 'image'; - list( $tables, $fields, $conds, $fname, $options, $join_conds ) = $this->buildQueryInfo( $offset, $limit, $asc ); + list( $tables, $fields, $conds, $fname, $options, $join_conds ) = + $this->buildQueryInfo( $offset, $limit, $asc ); $imageRes = $this->mDb->select( $tables, $fields, $conds, $fname, $options, $join_conds ); $this->mTableName = $prevTableName; @@ -315,7 +322,8 @@ class ImageListPager extends TablePager { } $this->mIndexField = 'oi_' . substr( $this->mIndexField, 4 ); - list( $tables, $fields, $conds, $fname, $options, $join_conds ) = $this->buildQueryInfo( $offset, $limit, $asc ); + list( $tables, $fields, $conds, $fname, $options, $join_conds ) = + $this->buildQueryInfo( $offset, $limit, $asc ); $oldimageRes = $this->mDb->select( $tables, $fields, $conds, $fname, $options, $join_conds ); $this->mTableName = $prevTableName; @@ -360,11 +368,17 @@ class ImageListPager extends TablePager { } } } + + // @codingStandardsIgnoreStart Squiz.WhiteSpace.SemicolonSpacing.Incorrect for ( ; $i < $limit && $topRes1; $i++ ) { + // @codingStandardsIgnoreEnd $resultArray[] = $topRes1; $topRes1 = $res1->next(); } + + // @codingStandardsIgnoreStart Squiz.WhiteSpace.SemicolonSpacing.Incorrect for ( ; $i < $limit && $topRes2; $i++ ) { + // @codingStandardsIgnoreEnd $resultArray[] = $topRes2; $topRes2 = $res2->next(); } diff --git a/includes/specials/SpecialListgrouprights.php b/includes/specials/SpecialListgrouprights.php index 31034f9cb2..a77b70cf2e 100644 --- a/includes/specials/SpecialListgrouprights.php +++ b/includes/specials/SpecialListgrouprights.php @@ -29,9 +29,6 @@ * @author Petr Kadlec */ class SpecialListGroupRights extends SpecialPage { - /** - * Constructor - */ function __construct() { parent::__construct( 'Listgrouprights' ); } @@ -118,11 +115,12 @@ class SpecialListGroupRights extends SpecialPage { $addgroups = isset( $wgAddGroups[$group] ) ? $wgAddGroups[$group] : array(); $removegroups = isset( $wgRemoveGroups[$group] ) ? $wgRemoveGroups[$group] : array(); $addgroupsSelf = isset( $wgGroupsAddToSelf[$group] ) ? $wgGroupsAddToSelf[$group] : array(); - $removegroupsSelf = isset( $wgGroupsRemoveFromSelf[$group] ) ? $wgGroupsRemoveFromSelf[$group] : array(); + $removegroupsSelf = isset( $wgGroupsRemoveFromSelf[$group] ) + ? $wgGroupsRemoveFromSelf[$group] + : array(); $id = $group == '*' ? false : Sanitizer::escapeId( $group ); - $out->addHTML( Html::rawElement( 'tr', array( 'id' => $id ), - " + $out->addHTML( Html::rawElement( 'tr', array( 'id' => $id ), " $grouppage$grouplink " . $this->formatPermissions( $permissions, $revoke, $addgroups, $removegroups, diff --git a/includes/specials/SpecialLockdb.php b/includes/specials/SpecialLockdb.php index 95ef951075..338240548c 100644 --- a/includes/specials/SpecialLockdb.php +++ b/includes/specials/SpecialLockdb.php @@ -27,7 +27,7 @@ * @ingroup SpecialPage */ class SpecialLockdb extends FormSpecialPage { - var $reason = ''; + protected $reason = ''; public function __construct() { parent::__construct( 'Lockdb', 'siteadmin' ); diff --git a/includes/specials/SpecialLog.php b/includes/specials/SpecialLog.php index dd5ab939a0..6da66745f4 100644 --- a/includes/specials/SpecialLog.php +++ b/includes/specials/SpecialLog.php @@ -80,7 +80,9 @@ class SpecialLog extends SpecialPage { $type = $opts->getValue( 'type' ); if ( !LogPage::isLogType( $type ) ) { $opts->setValue( 'type', '' ); - } elseif ( isset( $wgLogRestrictions[$type] ) && !$this->getUser()->isAllowed( $wgLogRestrictions[$type] ) ) { + } elseif ( isset( $wgLogRestrictions[$type] ) + && !$this->getUser()->isAllowed( $wgLogRestrictions[$type] ) + ) { throw new PermissionsError( $wgLogRestrictions[$type] ); } diff --git a/includes/specials/SpecialMergeHistory.php b/includes/specials/SpecialMergeHistory.php index f799fc5aeb..097f1b6b54 100644 --- a/includes/specials/SpecialMergeHistory.php +++ b/includes/specials/SpecialMergeHistory.php @@ -28,12 +28,38 @@ * @ingroup SpecialPage */ class SpecialMergeHistory extends SpecialPage { - var $mAction, $mTarget, $mDest, $mTimestamp, $mTargetID, $mDestID, $mComment; + /** @var string */ + protected $mAction; - /** - * @var Title - */ - var $mTargetObj, $mDestObj; + /** @var string */ + protected $mTarget; + + /** @var string */ + protected $mDest; + + /** @var string */ + protected $mTimestamp; + + /** @var int */ + protected $mTargetID; + + /** @var int */ + protected $mDestID; + + /** @var string */ + protected $mComment; + + /** @var bool Was posted? */ + protected $mMerge; + + /** @var bool Was submitted? */ + protected $mSubmitted; + + /** @var Title */ + protected $mTargetObj; + + /** @var Title */ + protected $mDestObj; public function __construct() { parent::__construct( 'MergeHistory', 'mergehistory' ); @@ -57,7 +83,9 @@ class SpecialMergeHistory extends SpecialPage { } $this->mComment = $request->getText( 'wpComment' ); - $this->mMerge = $request->wasPosted() && $this->getUser()->matchEditToken( $request->getVal( 'wpEditToken' ) ); + $this->mMerge = $request->wasPosted() + && $this->getUser()->matchEditToken( $request->getVal( 'wpEditToken' ) ); + // target page if ( $this->mSubmitted ) { $this->mTargetObj = Title::newFromURL( $this->mTarget ); @@ -203,7 +231,10 @@ class SpecialMergeHistory extends SpecialPage {   ' . - Xml::submitButton( $this->msg( 'mergehistory-submit' )->text(), array( 'name' => 'merge', 'id' => 'mw-merge-submit' ) ) . + Xml::submitButton( + $this->msg( 'mergehistory-submit' )->text(), + array( 'name' => 'merge', 'id' => 'mw-merge-submit' ) + ) . ' ' . Xml::closeElement( 'table' ) . @@ -290,7 +321,8 @@ class SpecialMergeHistory extends SpecialPage { $comment = Linker::revComment( $rev ); return Html::rawElement( 'li', array(), - $this->msg( 'mergehistory-revisionrow' )->rawParams( $checkBox, $last, $pageLink, $userLink, $stxt, $comment )->escaped() ); + $this->msg( 'mergehistory-revisionrow' ) + ->rawParams( $checkBox, $last, $pageLink, $userLink, $stxt, $comment )->escaped() ); } function merge() { @@ -434,7 +466,11 @@ class SpecialMergeHistory extends SpecialPage { } class MergeHistoryPager extends ReverseChronologicalPager { - public $mForm, $mConds; + /** @var IContextSource */ + public $mForm; + + /** @var array */ + public $mConds; function __construct( $form, $conds = array(), $source, $dest ) { $this->mForm = $form; diff --git a/includes/specials/SpecialMovepage.php b/includes/specials/SpecialMovepage.php index 14d671c790..dce5ad95c2 100644 --- a/includes/specials/SpecialMovepage.php +++ b/includes/specials/SpecialMovepage.php @@ -27,15 +27,35 @@ * @ingroup SpecialPage */ class MovePageForm extends UnlistedSpecialPage { - /** - * Objects - * @var Title - */ - var $oldTitle, $newTitle; - // Text input - var $reason; + /** @var Title */ + protected $oldTitle; + + /** @var Title */ + protected $newTitle; + + + /** @var string Text input */ + protected $reason; + // Checks - var $moveTalk, $deleteAndMove, $moveSubpages, $fixRedirects, $leaveRedirect, $moveOverShared; + + /** @var bool */ + protected $moveTalk; + + /** @var bool */ + protected $deleteAndMove; + + /** @var bool */ + protected $moveSubpages; + + /** @var bool */ + protected $fixRedirects; + + /** @var bool */ + protected $leaveRedirect; + + /** @var bool */ + protected $moveOverShared; private $watch = false; @@ -685,17 +705,20 @@ class MovePageForm extends UnlistedSpecialPage { ); $newLink = Linker::linkKnown( $newSubpage ); - $extraOutput[] = $this->msg( 'movepage-page-moved' )->rawParams( $oldLink, $newLink )->escaped(); + $extraOutput[] = $this->msg( 'movepage-page-moved' ) + ->rawParams( $oldLink, $newLink )->escaped(); ++$count; if ( $count >= $wgMaximumMovedPages ) { - $extraOutput[] = $this->msg( 'movepage-max-pages' )->numParams( $wgMaximumMovedPages )->escaped(); + $extraOutput[] = $this->msg( 'movepage-max-pages' ) + ->numParams( $wgMaximumMovedPages )->escaped(); break; } } else { $oldLink = Linker::linkKnown( $oldSubpage ); $newLink = Linker::link( $newSubpage ); - $extraOutput[] = $this->msg( 'movepage-page-unmoved' )->rawParams( $oldLink, $newLink )->escaped(); + $extraOutput[] = $this->msg( 'movepage-page-unmoved' ) + ->rawParams( $oldLink, $newLink )->escaped(); } } }