From: Umherirrender Date: Sat, 1 Jul 2017 08:32:08 +0000 (+0200) Subject: Remove empty lines at begin of function, if, foreach, switch X-Git-Tag: 1.31.0-rc.0~2807^2 X-Git-Url: http://git.cyclocoop.org//%22%22._DIR_PLUGIN_FULLCALENDAR.%22prive/themes/spip/images/event_edit.png/%22?a=commitdiff_plain;h=b5cddfb27b0d50bd396b1ff92d022b2dec766754;p=lhc%2Fweb%2Fwiklou.git Remove empty lines at begin of function, if, foreach, switch Organize phpcs.xml a bit Change-Id: Ifb767729b481b4b686e6d6444cf48b1f580cc478 --- diff --git a/docs/hooks.txt b/docs/hooks.txt index 3d310c3508..62e5bdb217 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -74,9 +74,7 @@ Using a hook-running strategy, we can avoid having all this option-specific stuff in our mainline code. Using hooks, the function becomes: function showAnArticle( $article ) { - if ( Hooks::run( 'ArticleShow', array( &$article ) ) ) { - # code to actually show the article goes here Hooks::run( 'ArticleShowComplete', array( &$article ) ); diff --git a/includes/Block.php b/includes/Block.php index a7e7308a1d..2c935df8ec 100644 --- a/includes/Block.php +++ b/includes/Block.php @@ -829,7 +829,6 @@ class Block { * @return bool */ public function deleteIfExpired() { - if ( $this->isExpired() ) { wfDebug( "Block::deleteIfExpired() -- deleting\n" ); $this->delete(); @@ -1111,7 +1110,6 @@ class Block { * not be the same as the target you gave if you used $vagueTarget! */ public static function newFromTarget( $specificTarget, $vagueTarget = null, $fromMaster = false ) { - list( $target, $type ) = self::parseTarget( $specificTarget ); if ( $type == Block::TYPE_ID || $type == Block::TYPE_AUTO ) { return Block::newFromID( $target ); diff --git a/includes/Category.php b/includes/Category.php index 5c7cb8d7ba..c22ea64abf 100644 --- a/includes/Category.php +++ b/includes/Category.php @@ -269,7 +269,6 @@ class Category { * @return TitleArray TitleArray object for category members. */ public function getMembers( $limit = false, $offset = '' ) { - $dbr = wfGetDB( DB_REPLICA ); $conds = [ 'cl_to' => $this->getName(), 'cl_from = page_id' ]; diff --git a/includes/CategoryFinder.php b/includes/CategoryFinder.php index 595cf95104..89bf5c7327 100644 --- a/includes/CategoryFinder.php +++ b/includes/CategoryFinder.php @@ -186,7 +186,6 @@ class CategoryFinder { * Scans a "parent layer" of the articles/categories in $this->next */ private function scanNextLayer() { - # Find all parents of the article currently in $this->next $layer = []; $res = $this->dbr->select( diff --git a/includes/CategoryViewer.php b/includes/CategoryViewer.php index 7086a48b77..9d692d71b3 100644 --- a/includes/CategoryViewer.php +++ b/includes/CategoryViewer.php @@ -108,7 +108,6 @@ class CategoryViewer extends ContextSource { * @return string HTML output */ public function getHTML() { - $this->showGallery = $this->getConfig()->get( 'CategoryMagicGallery' ) && !$this->getOutput()->mNoGallery; diff --git a/includes/DeprecatedGlobal.php b/includes/DeprecatedGlobal.php index 14329d3213..7c592c6e59 100644 --- a/includes/DeprecatedGlobal.php +++ b/includes/DeprecatedGlobal.php @@ -38,7 +38,6 @@ class DeprecatedGlobal extends StubObject { // PSR2.Methods.MethodDeclaration.Underscore // PSR2.Classes.PropertyDeclaration.ScopeMissing function _newObject() { - /* Put the caller offset for wfDeprecated as 6, as * that gives the function that uses this object, since: * 1 = this function ( _newObject ) diff --git a/includes/FeedUtils.php b/includes/FeedUtils.php index 3268291b51..96a88d3d98 100644 --- a/includes/FeedUtils.php +++ b/includes/FeedUtils.php @@ -188,7 +188,6 @@ class FeedUtils { } if ( $html === null ) { - // Omit large new page diffs, T31110 // Also use diff link for non-textual content $diffText = self::getDiffLink( $title, $newid ); diff --git a/includes/Linker.php b/includes/Linker.php index 6942a39935..58455324d0 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -1882,7 +1882,6 @@ class Linker { * @return string HTML output */ public static function formatHiddenCategories( $hiddencats ) { - $outText = ''; if ( count( $hiddencats ) > 0 ) { # Construct the HTML diff --git a/includes/MediaWiki.php b/includes/MediaWiki.php index 9fdc95ae0f..4df4d76f53 100644 --- a/includes/MediaWiki.php +++ b/includes/MediaWiki.php @@ -821,7 +821,6 @@ class MediaWiki { // ATTENTION: This hook is likely to be removed soon due to overall design of the system. if ( Hooks::run( 'BeforeHttpsRedirect', [ $this->context, &$redirUrl ] ) ) { - if ( $request->wasPosted() ) { // This is weird and we'd hope it almost never happens. This // means that a POST came in via HTTP and policy requires us diff --git a/includes/MovePage.php b/includes/MovePage.php index ce6ecad236..8d0c33dcc2 100644 --- a/includes/MovePage.php +++ b/includes/MovePage.php @@ -440,8 +440,8 @@ class MovePage { * @throws MWException */ private function moveToInternal( User $user, &$nt, $reason = '', $createRedirect = true, - array $changeTags = [] ) { - + array $changeTags = [] + ) { global $wgContLang; if ( $nt->exists() ) { $moveOverRedirect = true; diff --git a/includes/OutputHandler.php b/includes/OutputHandler.php index 2f47006272..2dc3732011 100644 --- a/includes/OutputHandler.php +++ b/includes/OutputHandler.php @@ -183,7 +183,6 @@ function wfDoContentLength( $length ) { * @return string */ function wfHtmlValidationHandler( $s ) { - $errors = ''; if ( MWTidy::checkErrors( $s, $errors ) ) { return $s; diff --git a/includes/Sanitizer.php b/includes/Sanitizer.php index 8424432f94..dd4a3146a0 100644 --- a/includes/Sanitizer.php +++ b/includes/Sanitizer.php @@ -906,7 +906,6 @@ class Sanitizer { * @return string normalized css */ public static function normalizeCss( $value ) { - // Decode character references like { $value = Sanitizer::decodeCharReferences( $value ); diff --git a/includes/Title.php b/includes/Title.php index 2ebeb0d756..083a725d98 100644 --- a/includes/Title.php +++ b/includes/Title.php @@ -3735,8 +3735,8 @@ class Title implements LinkTarget { * @return array|bool True on success, getUserPermissionsErrors()-like array on failure */ public function moveTo( &$nt, $auth = true, $reason = '', $createRedirect = true, - array $changeTags = [] ) { - + array $changeTags = [] + ) { global $wgUser; $err = $this->isValidMoveOperation( $nt, $auth, $reason ); if ( is_array( $err ) ) { @@ -3773,8 +3773,8 @@ class Title implements LinkTarget { * no pages were moved */ public function moveSubpages( $nt, $auth = true, $reason = '', $createRedirect = true, - array $changeTags = [] ) { - + array $changeTags = [] + ) { global $wgMaximumMovedPages; // Check permissions if ( !$this->userCan( 'move-subpages' ) ) { diff --git a/includes/actions/CreditsAction.php b/includes/actions/CreditsAction.php index 803695a77f..021f426ee3 100644 --- a/includes/actions/CreditsAction.php +++ b/includes/actions/CreditsAction.php @@ -44,7 +44,6 @@ class CreditsAction extends FormlessAction { * @return string HTML */ public function onView() { - if ( $this->page->getID() == 0 ) { $s = $this->msg( 'nocredits' )->parse(); } else { diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index 3a9167f0d0..2dcece1ed1 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -967,7 +967,6 @@ abstract class ApiBase extends ContextSource { * @return bool */ protected function getWatchlistValue( $watchlist, $titleObj, $userOption = null ) { - $userWatching = $this->getUser()->isWatched( $titleObj, User::IGNORE_USER_RIGHTS ); switch ( $watchlist ) { diff --git a/includes/api/ApiEditPage.php b/includes/api/ApiEditPage.php index 0b8156b0f8..2245195cb0 100644 --- a/includes/api/ApiEditPage.php +++ b/includes/api/ApiEditPage.php @@ -64,7 +64,6 @@ class ApiEditPage extends ApiBase { /** @var $newTitle Title */ foreach ( $titles as $id => $newTitle ) { - if ( !isset( $titles[$id - 1] ) ) { $titles[$id - 1] = $oldTitle; } diff --git a/includes/api/ApiModuleManager.php b/includes/api/ApiModuleManager.php index 42dfb719bb..b5e47ac9c9 100644 --- a/includes/api/ApiModuleManager.php +++ b/includes/api/ApiModuleManager.php @@ -97,7 +97,6 @@ class ApiModuleManager extends ContextSource { * @param string $group Which group modules belong to (action,format,...) */ public function addModules( array $modules, $group ) { - foreach ( $modules as $name => $moduleSpec ) { if ( is_array( $moduleSpec ) ) { $class = $moduleSpec['class']; diff --git a/includes/api/ApiQueryBase.php b/includes/api/ApiQueryBase.php index baefbda3f1..f8eaa84074 100644 --- a/includes/api/ApiQueryBase.php +++ b/includes/api/ApiQueryBase.php @@ -356,7 +356,6 @@ abstract class ApiQueryBase extends ApiBase { * @return ResultWrapper */ protected function select( $method, $extraQuery = [], array &$hookData = null ) { - $tables = array_merge( $this->tables, isset( $extraQuery['tables'] ) ? (array)$extraQuery['tables'] : [] diff --git a/includes/api/ApiQueryUsers.php b/includes/api/ApiQueryUsers.php index 5b094cd908..2a0eaddfb6 100644 --- a/includes/api/ApiQueryUsers.php +++ b/includes/api/ApiQueryUsers.php @@ -182,7 +182,6 @@ class ApiQueryUsers extends ApiQueryBase { } foreach ( $res as $row ) { - // create user object and pass along $userGroups if set // that reduces the number of database queries needed in User dramatically if ( !isset( $userGroups ) ) { diff --git a/includes/cache/BacklinkCache.php b/includes/cache/BacklinkCache.php index 11f3c2bb42..4341daafe6 100644 --- a/includes/cache/BacklinkCache.php +++ b/includes/cache/BacklinkCache.php @@ -174,7 +174,6 @@ class BacklinkCache { * @return ResultWrapper */ protected function queryLinks( $table, $startId, $endId, $max, $select = 'all' ) { - $fromField = $this->getPrefix( $table ) . '_from'; if ( !$startId && !$endId && is_infinite( $max ) diff --git a/includes/changes/ChangesListBooleanFilter.php b/includes/changes/ChangesListBooleanFilter.php index 73c0fb01ef..930269cab6 100644 --- a/includes/changes/ChangesListBooleanFilter.php +++ b/includes/changes/ChangesListBooleanFilter.php @@ -184,8 +184,8 @@ class ChangesListBooleanFilter extends ChangesListFilter { * @param array &$join_conds Array of join conditions; see IDatabase::select $join_conds */ public function modifyQuery( IDatabase $dbr, ChangesListSpecialPage $specialPage, - &$tables, &$fields, &$conds, &$query_options, &$join_conds ) { - + &$tables, &$fields, &$conds, &$query_options, &$join_conds + ) { if ( $this->queryCallable === null ) { return; } diff --git a/includes/changes/ChangesListFilter.php b/includes/changes/ChangesListFilter.php index bd895bb075..0b34a5d969 100644 --- a/includes/changes/ChangesListFilter.php +++ b/includes/changes/ChangesListFilter.php @@ -186,12 +186,8 @@ abstract class ChangesListFilter { * @param string $backwardKey i18n key for conflict message in reverse * direction (when in UI context of $other object) */ - public function conflictsWith( $other, $globalKey, $forwardKey, - $backwardKey ) { - - if ( $globalKey === null || $forwardKey === null || - $backwardKey === null ) { - + public function conflictsWith( $other, $globalKey, $forwardKey, $backwardKey ) { + if ( $globalKey === null || $forwardKey === null || $backwardKey === null ) { throw new MWException( 'All messages must be specified' ); } @@ -220,9 +216,7 @@ abstract class ChangesListFilter { * @param string $contextDescription i18n key for conflict message in this * direction (when in UI context of $this object) */ - public function setUnidirectionalConflict( $other, $globalDescription, - $contextDescription ) { - + public function setUnidirectionalConflict( $other, $globalDescription, $contextDescription ) { if ( $other instanceof ChangesListFilterGroup ) { $this->conflictingGroups[] = [ 'group' => $other->getName(), diff --git a/includes/changes/ChangesListFilterGroup.php b/includes/changes/ChangesListFilterGroup.php index 3555158ed4..0dc1145491 100644 --- a/includes/changes/ChangesListFilterGroup.php +++ b/includes/changes/ChangesListFilterGroup.php @@ -229,12 +229,8 @@ abstract class ChangesListFilterGroup { * @param string $backwardKey i18n key for conflict message in reverse * direction (when in UI context of $other object) */ - public function conflictsWith( $other, $globalKey, $forwardKey, - $backwardKey ) { - - if ( $globalKey === null || $forwardKey === null || - $backwardKey === null ) { - + public function conflictsWith( $other, $globalKey, $forwardKey, $backwardKey ) { + if ( $globalKey === null || $forwardKey === null || $backwardKey === null ) { throw new MWException( 'All messages must be specified' ); } @@ -263,9 +259,7 @@ abstract class ChangesListFilterGroup { * @param string $contextDescription i18n key for conflict message in this * direction (when in UI context of $this object) */ - public function setUnidirectionalConflict( $other, $globalDescription, - $contextDescription ) { - + public function setUnidirectionalConflict( $other, $globalDescription, $contextDescription ) { if ( $other instanceof ChangesListFilterGroup ) { $this->conflictingGroups[] = [ 'group' => $other->getName(), diff --git a/includes/changes/ChangesListStringOptionsFilterGroup.php b/includes/changes/ChangesListStringOptionsFilterGroup.php index 86b4a8bc74..487120d8a2 100644 --- a/includes/changes/ChangesListStringOptionsFilterGroup.php +++ b/includes/changes/ChangesListStringOptionsFilterGroup.php @@ -185,8 +185,8 @@ class ChangesListStringOptionsFilterGroup extends ChangesListFilterGroup { * @param string $value URL parameter value */ public function modifyQuery( IDatabase $dbr, ChangesListSpecialPage $specialPage, - &$tables, &$fields, &$conds, &$query_options, &$join_conds, $value ) { - + &$tables, &$fields, &$conds, &$query_options, &$join_conds, $value + ) { $allowedFilterNames = []; foreach ( $this->filters as $filter ) { $allowedFilterNames[] = $filter->getName(); diff --git a/includes/changes/EnhancedChangesList.php b/includes/changes/EnhancedChangesList.php index 64d4aa79e4..30c6995008 100644 --- a/includes/changes/EnhancedChangesList.php +++ b/includes/changes/EnhancedChangesList.php @@ -98,7 +98,6 @@ class EnhancedChangesList extends ChangesList { * @return string */ public function recentChangesLine( &$rc, $watched = false, $linenumber = null ) { - $date = $this->getLanguage()->userDate( $rc->mAttribs['rc_timestamp'], $this->getUser() diff --git a/includes/changes/OldChangesList.php b/includes/changes/OldChangesList.php index 2a53d6694d..09205bd318 100644 --- a/includes/changes/OldChangesList.php +++ b/includes/changes/OldChangesList.php @@ -32,7 +32,6 @@ class OldChangesList extends ChangesList { * @return string|bool */ public function recentChangesLine( &$rc, $watched = false, $linenumber = null ) { - $classes = $this->getHTMLClasses( $rc, $watched ); // use mw-line-even/mw-line-odd class only if linenumber is given (feature from T16468) if ( $linenumber ) { diff --git a/includes/changetags/ChangeTags.php b/includes/changetags/ChangeTags.php index 6ba9c10a70..c9b5f96d50 100644 --- a/includes/changetags/ChangeTags.php +++ b/includes/changetags/ChangeTags.php @@ -201,7 +201,6 @@ class ChangeTags { &$rev_id = null, &$log_id = null, $params = null, RecentChange $rc = null, User $user = null ) { - $tagsToAdd = array_filter( (array)$tagsToAdd ); // Make sure we're submitting all tags... $tagsToRemove = array_filter( (array)$tagsToRemove ); @@ -275,8 +274,8 @@ class ChangeTags { // update the tag_summary row $prevTags = []; if ( !self::updateTagSummaryRow( $tagsToAdd, $tagsToRemove, $rc_id, $rev_id, - $log_id, $prevTags ) ) { - + $log_id, $prevTags ) + ) { // nothing to do return [ [], [], $prevTags ]; } @@ -343,8 +342,8 @@ class ChangeTags { * @since 1.25 */ protected static function updateTagSummaryRow( &$tagsToAdd, &$tagsToRemove, - $rc_id, $rev_id, $log_id, &$prevTags = [] ) { - + $rc_id, $rev_id, $log_id, &$prevTags = [] + ) { $dbw = wfGetDB( DB_MASTER ); $tsConds = array_filter( [ @@ -419,9 +418,7 @@ class ChangeTags { * @return Status * @since 1.25 */ - public static function canAddTagsAccompanyingChange( array $tags, - User $user = null ) { - + public static function canAddTagsAccompanyingChange( array $tags, User $user = null ) { if ( !is_null( $user ) ) { if ( !$user->isAllowed( 'applychangetags' ) ) { return Status::newFatal( 'tags-apply-no-permission' ); @@ -465,7 +462,6 @@ class ChangeTags { public static function addTagsAccompanyingChangeWithChecks( array $tags, $rc_id, $rev_id, $log_id, $params, User $user ) { - // are we allowed to do this? $result = self::canAddTagsAccompanyingChange( $tags, $user ); if ( !$result->isOK() ) { @@ -491,8 +487,8 @@ class ChangeTags { * @since 1.25 */ public static function canUpdateTags( array $tagsToAdd, array $tagsToRemove, - User $user = null ) { - + User $user = null + ) { if ( !is_null( $user ) ) { if ( !$user->isAllowed( 'changetags' ) ) { return Status::newFatal( 'tags-update-no-permission' ); @@ -554,8 +550,8 @@ class ChangeTags { * @since 1.25 */ public static function updateTagsWithChecks( $tagsToAdd, $tagsToRemove, - $rc_id, $rev_id, $log_id, $params, $reason, User $user ) { - + $rc_id, $rev_id, $log_id, $params, $reason, User $user + ) { if ( is_null( $tagsToAdd ) ) { $tagsToAdd = []; } @@ -792,8 +788,8 @@ class ChangeTags { * @since 1.25 */ protected static function logTagManagementAction( $action, $tag, $reason, - User $user, $tagCount = null, array $logEntryTags = [] ) { - + User $user, $tagCount = null, array $logEntryTags = [] + ) { $dbw = wfGetDB( DB_MASTER ); $logEntry = new ManualLogEntry( 'managetags', $action ); @@ -869,8 +865,8 @@ class ChangeTags { * @since 1.25 */ public static function activateTagWithChecks( $tag, $reason, User $user, - $ignoreWarnings = false, array $logEntryTags = [] ) { - + $ignoreWarnings = false, array $logEntryTags = [] + ) { // are we allowed to do this? $result = self::canActivateTag( $tag, $user ); if ( $ignoreWarnings ? !$result->isOK() : !$result->isGood() ) { @@ -932,8 +928,8 @@ class ChangeTags { * @since 1.25 */ public static function deactivateTagWithChecks( $tag, $reason, User $user, - $ignoreWarnings = false, array $logEntryTags = [] ) { - + $ignoreWarnings = false, array $logEntryTags = [] + ) { // are we allowed to do this? $result = self::canDeactivateTag( $tag, $user ); if ( $ignoreWarnings ? !$result->isOK() : !$result->isGood() ) { @@ -1034,8 +1030,8 @@ class ChangeTags { * @since 1.25 */ public static function createTagWithChecks( $tag, $reason, User $user, - $ignoreWarnings = false, array $logEntryTags = [] ) { - + $ignoreWarnings = false, array $logEntryTags = [] + ) { // are we allowed to do this? $result = self::canCreateTag( $tag, $user ); if ( $ignoreWarnings ? !$result->isOK() : !$result->isGood() ) { @@ -1165,8 +1161,8 @@ class ChangeTags { * @since 1.25 */ public static function deleteTagWithChecks( $tag, $reason, User $user, - $ignoreWarnings = false, array $logEntryTags = [] ) { - + $ignoreWarnings = false, array $logEntryTags = [] + ) { // are we allowed to do this? $result = self::canDeleteTag( $tag, $user ); if ( $ignoreWarnings ? !$result->isOK() : !$result->isGood() ) { diff --git a/includes/changetags/ChangeTagsList.php b/includes/changetags/ChangeTagsList.php index a37f5f2c11..afbbb2bf5b 100644 --- a/includes/changetags/ChangeTagsList.php +++ b/includes/changetags/ChangeTagsList.php @@ -39,8 +39,8 @@ abstract class ChangeTagsList extends RevisionListBase { * @throws Exception If you give an unknown $typeName */ public static function factory( $typeName, IContextSource $context, - Title $title, array $ids ) { - + Title $title, array $ids + ) { switch ( $typeName ) { case 'revision': $className = 'ChangeTagsRevisionList'; diff --git a/includes/changetags/ChangeTagsLogList.php b/includes/changetags/ChangeTagsLogList.php index 271005f465..e6d918a63c 100644 --- a/includes/changetags/ChangeTagsLogList.php +++ b/includes/changetags/ChangeTagsLogList.php @@ -71,9 +71,7 @@ class ChangeTagsLogList extends ChangeTagsList { * @param User $user * @return Status */ - public function updateChangeTagsOnAll( $tagsToAdd, $tagsToRemove, $params, - $reason, $user ) { - + public function updateChangeTagsOnAll( $tagsToAdd, $tagsToRemove, $params, $reason, $user ) { // @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed for ( $this->reset(); $this->current(); $this->next() ) { // @codingStandardsIgnoreEnd diff --git a/includes/changetags/ChangeTagsRevisionList.php b/includes/changetags/ChangeTagsRevisionList.php index a0248c617b..91193b0ecd 100644 --- a/includes/changetags/ChangeTagsRevisionList.php +++ b/includes/changetags/ChangeTagsRevisionList.php @@ -81,9 +81,7 @@ class ChangeTagsRevisionList extends ChangeTagsList { * @param User $user * @return Status */ - public function updateChangeTagsOnAll( $tagsToAdd, $tagsToRemove, $params, - $reason, $user ) { - + public function updateChangeTagsOnAll( $tagsToAdd, $tagsToRemove, $params, $reason, $user ) { // @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed for ( $this->reset(); $this->current(); $this->next() ) { // @codingStandardsIgnoreEnd diff --git a/includes/content/AbstractContent.php b/includes/content/AbstractContent.php index 811b241798..1d472e0509 100644 --- a/includes/content/AbstractContent.php +++ b/includes/content/AbstractContent.php @@ -488,8 +488,8 @@ abstract class AbstractContent implements Content { $po = new ParserOutput(); if ( Hooks::run( 'ContentGetParserOutput', - [ $this, $title, $revId, $options, $generateHtml, &$po ] ) ) { - + [ $this, $title, $revId, $options, $generateHtml, &$po ] ) + ) { // Save and restore the old value, just in case something is reusing // the ParserOptions object in some weird way. $oldRedir = $options->getRedirectTarget(); diff --git a/includes/content/ContentHandler.php b/includes/content/ContentHandler.php index 85894ed539..f85b00d8ed 100644 --- a/includes/content/ContentHandler.php +++ b/includes/content/ContentHandler.php @@ -619,8 +619,8 @@ abstract class ContentHandler { */ public function createDifferenceEngine( IContextSource $context, $old = 0, $new = 0, $rcid = 0, // FIXME: Deprecated, no longer used - $refreshCache = false, $unhide = false ) { - + $refreshCache = false, $unhide = false + ) { // hook: get difference engine $differenceEngine = null; if ( !Hooks::run( 'GetDifferenceEngine', diff --git a/includes/content/WikitextContent.php b/includes/content/WikitextContent.php index d649baf89c..942390f68f 100644 --- a/includes/content/WikitextContent.php +++ b/includes/content/WikitextContent.php @@ -68,7 +68,6 @@ class WikitextContent extends TextContent { * @see Content::replaceSection() */ public function replaceSection( $sectionId, Content $with, $sectionTitle = '' ) { - $myModelId = $this->getModel(); $sectionModelId = $with->getModel(); diff --git a/includes/debug/logger/monolog/LegacyHandler.php b/includes/debug/logger/monolog/LegacyHandler.php index 58fca8e9cc..dbeb13691a 100644 --- a/includes/debug/logger/monolog/LegacyHandler.php +++ b/includes/debug/logger/monolog/LegacyHandler.php @@ -194,7 +194,6 @@ class LegacyHandler extends AbstractProcessingHandler { $text = (string)$record['formatted']; if ( $this->useUdp() ) { - // Clean it up for the multiplexer if ( $this->prefix !== '' ) { $leader = ( $this->prefix === '{channel}' ) ? diff --git a/includes/diff/DiffEngine.php b/includes/diff/DiffEngine.php index 25d50d371d..53378e5827 100644 --- a/includes/diff/DiffEngine.php +++ b/includes/diff/DiffEngine.php @@ -79,7 +79,6 @@ class DiffEngine { * @return DiffOp[] */ public function diff( $from_lines, $to_lines ) { - // Diff and store locally $this->diffInternal( $from_lines, $to_lines ); diff --git a/includes/diff/DiffFormatter.php b/includes/diff/DiffFormatter.php index 4b44b3c4b2..6231c78ea7 100644 --- a/includes/diff/DiffFormatter.php +++ b/includes/diff/DiffFormatter.php @@ -60,7 +60,6 @@ abstract class DiffFormatter { * @return string The formatted output. */ public function format( $diff ) { - $xi = $yi = 1; $block = false; $context = []; diff --git a/includes/diff/TableDiffFormatter.php b/includes/diff/TableDiffFormatter.php index bcae7467f7..14307b5844 100644 --- a/includes/diff/TableDiffFormatter.php +++ b/includes/diff/TableDiffFormatter.php @@ -196,7 +196,6 @@ class TableDiffFormatter extends DiffFormatter { * @param string[] $closing */ protected function changed( $orig, $closing ) { - $diff = new WordLevelDiff( $orig, $closing ); $del = $diff->orig(); $add = $diff->closing(); diff --git a/includes/export/XmlDumpWriter.php b/includes/export/XmlDumpWriter.php index 5a1f92c4cc..943408cc98 100644 --- a/includes/export/XmlDumpWriter.php +++ b/includes/export/XmlDumpWriter.php @@ -199,7 +199,6 @@ class XmlDumpWriter { * @access private */ function writeRevision( $row ) { - $out = " \n"; $out .= " " . Xml::element( 'id', null, strval( $row->rev_id ) ) . "\n"; if ( isset( $row->rev_parent_id ) && $row->rev_parent_id ) { @@ -287,7 +286,6 @@ class XmlDumpWriter { * @access private */ function writeLogItem( $row ) { - $out = " \n"; $out .= " " . Xml::element( 'id', null, strval( $row->log_id ) ) . "\n"; diff --git a/includes/gallery/PackedOverlayImageGallery.php b/includes/gallery/PackedOverlayImageGallery.php index e1ee7fafbd..db8ce68b9a 100644 --- a/includes/gallery/PackedOverlayImageGallery.php +++ b/includes/gallery/PackedOverlayImageGallery.php @@ -31,7 +31,6 @@ class PackedOverlayImageGallery extends PackedImageGallery { * @return string */ protected function wrapGalleryText( $galleryText, $thumb ) { - // If we have no text, do not output anything to avoid // ugly white overlay. if ( trim( $galleryText ) === '' ) { diff --git a/includes/import/WikiImporter.php b/includes/import/WikiImporter.php index 2fc9f5e527..63258cbcba 100644 --- a/includes/import/WikiImporter.php +++ b/includes/import/WikiImporter.php @@ -394,8 +394,8 @@ class WikiImporter { * @return bool */ public function finishImportPage( $title, $foreignTitle, $revCount, - $sRevCount, $pageInfo ) { - + $sRevCount, $pageInfo + ) { // Update article count statistics (T42009) // The normal counting logic in WikiPage->doEditUpdates() is designed for // one-revision-at-a-time editing, not bulk imports. In this situation it @@ -691,7 +691,6 @@ class WikiImporter { * @return bool|mixed */ private function processLogItem( $logInfo ) { - $revision = new WikiRevision( $this->config ); if ( isset( $logInfo['id'] ) ) { diff --git a/includes/installer/PostgresUpdater.php b/includes/installer/PostgresUpdater.php index 39cb89cd49..0172f1a4e5 100644 --- a/includes/installer/PostgresUpdater.php +++ b/includes/installer/PostgresUpdater.php @@ -751,7 +751,6 @@ END; } protected function setDefault( $table, $field, $default ) { - $info = $this->db->fieldInfo( $table, $field ); if ( $info->defaultValue() !== $default ) { $this->output( "Changing '$table.$field' default value\n" ); diff --git a/includes/interwiki/InterwikiLookupAdapter.php b/includes/interwiki/InterwikiLookupAdapter.php index 3baea1a0e5..076c37fe1f 100644 --- a/includes/interwiki/InterwikiLookupAdapter.php +++ b/includes/interwiki/InterwikiLookupAdapter.php @@ -60,7 +60,6 @@ class InterwikiLookupAdapter implements InterwikiLookup { * @return bool Whether it exists */ public function isValidInterwiki( $prefix ) { - return array_key_exists( $prefix, $this->getInterwikiMap() ); } diff --git a/includes/libs/CryptRand.php b/includes/libs/CryptRand.php index 4b4a913569..859d58b5dd 100644 --- a/includes/libs/CryptRand.php +++ b/includes/libs/CryptRand.php @@ -234,7 +234,6 @@ class CryptRand { * @return string Raw binary random data */ public function generate( $bytes, $forceStrong = false ) { - $bytes = floor( $bytes ); static $buffer = ''; if ( is_null( $this->strong ) ) { diff --git a/includes/libs/objectcache/MemcachedClient.php b/includes/libs/objectcache/MemcachedClient.php index a94f86ae4d..5cb49a9972 100644 --- a/includes/libs/objectcache/MemcachedClient.php +++ b/includes/libs/objectcache/MemcachedClient.php @@ -469,7 +469,6 @@ class MemcachedClient { * @return mixed */ public function get( $key, &$casToken = null ) { - if ( $this->_debug ) { $this->_debugprint( "get($key)" ); } diff --git a/includes/libs/xmp/XMP.php b/includes/libs/xmp/XMP.php index 9d886bf9a0..debe869e7e 100644 --- a/includes/libs/xmp/XMP.php +++ b/includes/libs/xmp/XMP.php @@ -135,7 +135,6 @@ class XMPReader implements LoggerAwareInterface { * Primary job is to initialize the XMLParser */ function __construct( LoggerInterface $logger = null ) { - if ( !function_exists( 'xml_parser_create_ns' ) ) { // this should already be checked by this point throw new RuntimeException( 'XMP support requires XML Parser' ); @@ -174,7 +173,6 @@ class XMPReader implements LoggerAwareInterface { * For example in jpeg's with extendedXMP */ private function resetXMLParser() { - $this->destroyXMLParser(); $this->xmlParser = xml_parser_create_ns( 'UTF-8', ' ' ); @@ -495,7 +493,6 @@ class XMPReader implements LoggerAwareInterface { * @throws RuntimeException On invalid data */ function char( $parser, $data ) { - $data = trim( $data ); if ( trim( $data ) === "" ) { return; @@ -644,7 +641,6 @@ class XMPReader implements LoggerAwareInterface { * @throws RuntimeException */ private function endElementNested( $elm ) { - /* cur item must be the same as $elm, unless if in MODE_STRUCT * in which case it could also be rdf:Description */ if ( $this->curItem[0] !== $elm @@ -754,7 +750,6 @@ class XMPReader implements LoggerAwareInterface { * @param string $elm Namespace and element */ private function endElementModeQDesc( $elm ) { - if ( $elm === self::NS_RDF . ' value' ) { list( $ns, $tag ) = explode( ' ', $this->curItem[0], 2 ); $this->saveValue( $ns, $tag, $this->charContent ); @@ -1191,7 +1186,6 @@ class XMPReader implements LoggerAwareInterface { * @throws RuntimeException */ function startElement( $parser, $elm, $attribs ) { - if ( $elm === self::NS_RDF . ' RDF' || $elm === 'adobe:ns:meta/ xmpmeta' || $elm === 'adobe:ns:meta/ xapmeta' @@ -1332,7 +1326,6 @@ class XMPReader implements LoggerAwareInterface { * @param string $val Value to save */ private function saveValue( $ns, $tag, $val ) { - $info =& $this->items[$ns][$tag]; $finalName = isset( $info['map_name'] ) ? $info['map_name'] : $tag; diff --git a/includes/media/BitmapMetadataHandler.php b/includes/media/BitmapMetadataHandler.php index c5f9cbbdd5..35c97518ea 100644 --- a/includes/media/BitmapMetadataHandler.php +++ b/includes/media/BitmapMetadataHandler.php @@ -230,7 +230,6 @@ class BitmapMetadataHandler { * @return array Metadata array */ public static function GIF( $filename ) { - $meta = new self(); $baseArray = GIFMetadataExtractor::getMetadata( $filename ); diff --git a/includes/media/Exif.php b/includes/media/Exif.php index 95fa8594fc..9bfbc96c69 100644 --- a/includes/media/Exif.php +++ b/includes/media/Exif.php @@ -362,7 +362,6 @@ class Exif { * if we make up our own types like Exif::DATE. */ function collapseData() { - $this->exifGPStoNumber( 'GPSLatitude' ); $this->exifGPStoNumber( 'GPSDestLatitude' ); $this->exifGPStoNumber( 'GPSLongitude' ); @@ -446,7 +445,6 @@ class Exif { */ private function charCodeString( $prop ) { if ( isset( $this->mFilteredExifData[$prop] ) ) { - if ( strlen( $this->mFilteredExifData[$prop] ) <= 8 ) { // invalid. Must be at least 9 bytes long. diff --git a/includes/media/IPTC.php b/includes/media/IPTC.php index b7ebfc93a5..343adc2088 100644 --- a/includes/media/IPTC.php +++ b/includes/media/IPTC.php @@ -476,7 +476,6 @@ class IPTC { * only code that seems to have wide use. It does detect that code. */ static function getCharset( $tag ) { - // According to iim standard, charset is defined by the tag 1:90. // in which there are iso 2022 escape sequences to specify the character set. // the iim standard seems to encourage that all necessary escape sequences are diff --git a/includes/media/JpegMetadataExtractor.php b/includes/media/JpegMetadataExtractor.php index 67c957adac..211845cc8f 100644 --- a/includes/media/JpegMetadataExtractor.php +++ b/includes/media/JpegMetadataExtractor.php @@ -94,7 +94,6 @@ class JpegMetadataExtractor { $buffer = fread( $fh, 1 ); } if ( $buffer === "\xFE" ) { - // COM section -- file comment // First see if valid utf-8, // if not try to convert it to windows-1252. diff --git a/includes/media/MediaHandler.php b/includes/media/MediaHandler.php index 88962642e5..76c979e0a4 100644 --- a/includes/media/MediaHandler.php +++ b/includes/media/MediaHandler.php @@ -157,7 +157,6 @@ abstract class MediaHandler { */ function convertMetadataVersion( $metadata, $version = 1 ) { if ( !is_array( $metadata ) ) { - // unserialize to keep return parameter consistent. MediaWiki\suppressWarnings(); $ret = unserialize( $metadata ); diff --git a/includes/media/PNG.php b/includes/media/PNG.php index 294abb350d..b6288bc3f4 100644 --- a/includes/media/PNG.php +++ b/includes/media/PNG.php @@ -112,7 +112,6 @@ class PNGHandler extends BitmapHandler { } function isMetadataValid( $image, $metadata ) { - if ( $metadata === self::BROKEN_FILE ) { // Do not repetitivly regenerate metadata on broken file. return self::METADATA_GOOD; diff --git a/includes/media/TransformationalImageHandler.php b/includes/media/TransformationalImageHandler.php index 2a74e0d708..742a5b7f61 100644 --- a/includes/media/TransformationalImageHandler.php +++ b/includes/media/TransformationalImageHandler.php @@ -156,7 +156,6 @@ abstract class TransformationalImageHandler extends ImageHandler { && $scalerParams['physicalHeight'] == $scalerParams['srcHeight'] && !isset( $scalerParams['quality'] ) ) { - # normaliseParams (or the user) wants us to return the unscaled image wfDebug( __METHOD__ . ": returning unscaled image\n" ); diff --git a/includes/page/Article.php b/includes/page/Article.php index dd542323cb..656e6102ad 100644 --- a/includes/page/Article.php +++ b/includes/page/Article.php @@ -214,7 +214,6 @@ class Article implements Page { * @since 1.21 */ protected function getContentObject() { - if ( $this->mPage->getId() === 0 ) { # If this is a MediaWiki:x message, then load the messages # and return the message value for x. @@ -569,8 +568,8 @@ class Article implements Page { $outputPage->setRevisionTimestamp( $this->mPage->getTimestamp() ); if ( !Hooks::run( 'ArticleContentViewCustom', - [ $this->fetchContentObject(), $this->getTitle(), $outputPage ] ) ) { - + [ $this->fetchContentObject(), $this->getTitle(), $outputPage ] ) + ) { # Allow extensions do their own custom view for certain pages $outputDone = true; } diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php index 5c7c7fef3b..3ba2d2e69e 100644 --- a/includes/page/WikiPage.php +++ b/includes/page/WikiPage.php @@ -1314,7 +1314,6 @@ class WikiPage implements Page, IDBAccessObject { * @return bool */ public function updateIfNewerOn( $dbw, $revision ) { - $row = $dbw->selectRow( [ 'revision', 'page' ], [ 'rev_id', 'rev_timestamp', 'page_is_redirect' ], @@ -1386,7 +1385,6 @@ class WikiPage implements Page, IDBAccessObject { public function replaceSectionContent( $sectionId, Content $sectionContent, $sectionTitle = '', $edittime = null ) { - $baseRevId = null; if ( $edittime && $sectionId !== 'new' ) { $dbr = wfGetDB( DB_REPLICA ); @@ -1425,7 +1423,6 @@ class WikiPage implements Page, IDBAccessObject { public function replaceSectionAtRev( $sectionId, Content $sectionContent, $sectionTitle = '', $baseRevId = null ) { - if ( strval( $sectionId ) === '' ) { // Whole-page edit; let the whole text through $newContent = $sectionContent; diff --git a/includes/parser/CoreParserFunctions.php b/includes/parser/CoreParserFunctions.php index e34d10b6a3..f0f1f5fa97 100644 --- a/includes/parser/CoreParserFunctions.php +++ b/includes/parser/CoreParserFunctions.php @@ -174,7 +174,6 @@ class CoreParserFunctions { $magicWords = new MagicWordArray( [ 'url_path', 'url_query', 'url_wiki' ] ); } switch ( $magicWords->matchStartToEnd( $arg ) ) { - // Encode as though it's a wiki page, '_' for ' '. case 'url_wiki': $func = 'wfUrlencode'; diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index b0d0e5c8eb..9ea65e013d 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -1075,7 +1075,6 @@ class Parser { * @return string */ public function doTableStuff( $text ) { - $lines = StringUtils::explode( "\n", $text ); $out = ''; $td_history = []; # Is currently a td tag open? @@ -1279,7 +1278,6 @@ class Parser { * @return string */ public function internalParse( $text, $isMain = true, $frame = false ) { - $origText = $text; // Avoid PHP 7.1 warning from passing $this by reference @@ -1855,7 +1853,6 @@ class Parser { * @return string */ public function replaceExternalLinks( $text ) { - $bits = preg_split( $this->mExtLinkBracketedRegex, $text, -1, PREG_SPLIT_DELIM_CAPTURE ); if ( $bits === false ) { throw new MWException( "PCRE needs to be compiled with " @@ -3031,7 +3028,6 @@ class Parser { * @return string The text of the template */ public function braceSubstitution( $piece, $frame ) { - // Flags // $text has been filled @@ -3786,7 +3782,6 @@ class Parser { * @return array */ public function argSubstitution( $piece, $frame ) { - $error = false; $parts = $piece['parts']; $nameWithSpaces = $frame->expand( $piece['title'] ); @@ -3967,7 +3962,6 @@ class Parser { * @return string */ public function doDoubleUnderscore( $text ) { - # The position of __TOC__ needs to be recorded $mw = MagicWord::get( 'toc' ); if ( $mw->match( $text ) ) { @@ -4948,7 +4942,6 @@ class Parser { * @return string HTML */ public function renderImageGallery( $text, $params ) { - $mode = false; if ( isset( $params['mode'] ) ) { $mode = $params['mode']; diff --git a/includes/parser/Preprocessor_DOM.php b/includes/parser/Preprocessor_DOM.php index 753930735d..3c750ad7dc 100644 --- a/includes/parser/Preprocessor_DOM.php +++ b/includes/parser/Preprocessor_DOM.php @@ -148,7 +148,6 @@ class Preprocessor_DOM extends Preprocessor { * @return PPNode_DOM */ public function preprocessToObj( $text, $flags = 0 ) { - $xml = $this->cacheGetTree( $text, $flags ); if ( $xml === false ) { $xml = $this->preprocessToXml( $text, $flags ); @@ -373,7 +372,6 @@ class Preprocessor_DOM extends Preprocessor { } // Handle comments if ( isset( $matches[2] ) && $matches[2] == '!--' ) { - // To avoid leaving blank lines, when a sequence of // space-separated comments is both preceded and followed by // a newline (ignoring spaces), then diff --git a/includes/parser/Preprocessor_Hash.php b/includes/parser/Preprocessor_Hash.php index 597d1f231c..25d253f9b9 100644 --- a/includes/parser/Preprocessor_Hash.php +++ b/includes/parser/Preprocessor_Hash.php @@ -304,7 +304,6 @@ class Preprocessor_Hash extends Preprocessor { } // Handle comments if ( isset( $matches[2] ) && $matches[2] == '!--' ) { - // To avoid leaving blank lines, when a sequence of // space-separated comments is both preceded and followed by // a newline (ignoring spaces), then diff --git a/includes/resourceloader/ResourceLoaderModule.php b/includes/resourceloader/ResourceLoaderModule.php index 743b69b3fe..1c767fa5b8 100644 --- a/includes/resourceloader/ResourceLoaderModule.php +++ b/includes/resourceloader/ResourceLoaderModule.php @@ -461,7 +461,6 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface { * @param array $localFileRefs List of files */ protected function saveFileDependencies( ResourceLoaderContext $context, $localFileRefs ) { - try { // Related bugs and performance considerations: // 1. Don't needlessly change the database value with the same list in a @@ -757,7 +756,6 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface { // (e.g. startup module) iterate more than once over all modules to get versions. $contextHash = $context->getHash(); if ( !array_key_exists( $contextHash, $this->versionHash ) ) { - if ( $this->enableModuleContentVersion() ) { // Detect changes directly $str = json_encode( $this->getModuleContent( $context ) ); diff --git a/includes/resourceloader/ResourceLoaderStartUpModule.php b/includes/resourceloader/ResourceLoaderStartUpModule.php index d92dc0ab6a..8973fe31c3 100644 --- a/includes/resourceloader/ResourceLoaderStartUpModule.php +++ b/includes/resourceloader/ResourceLoaderStartUpModule.php @@ -33,7 +33,6 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule { * @return array */ protected function getConfigSettings( $context ) { - $hash = $context->getHash(); if ( isset( $this->configVars[$hash] ) ) { return $this->configVars[$hash]; @@ -135,7 +134,6 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule { // The list of implicit dependencies won't be altered, so we can // cache them without having to worry. if ( !isset( $dependencyCache[$moduleName] ) ) { - if ( !isset( $registryData[$moduleName] ) ) { // Dependencies may not exist $dependencyCache[$moduleName] = []; diff --git a/includes/search/SearchNearMatcher.php b/includes/search/SearchNearMatcher.php index 0400021a1a..8e8686542c 100644 --- a/includes/search/SearchNearMatcher.php +++ b/includes/search/SearchNearMatcher.php @@ -70,7 +70,6 @@ class SearchNearMatcher { } foreach ( $allSearchTerms as $term ) { - # Exact match? No need to look further. $title = Title::newFromText( $term ); if ( is_null( $title ) ) { diff --git a/includes/site/MediaWikiPageNameNormalizer.php b/includes/site/MediaWikiPageNameNormalizer.php index 1a079b4295..c4e490a4c7 100644 --- a/includes/site/MediaWikiPageNameNormalizer.php +++ b/includes/site/MediaWikiPageNameNormalizer.php @@ -69,7 +69,6 @@ class MediaWikiPageNameNormalizer { * @throws \MWException */ public function normalizePageName( $pageName, $apiUrl ) { - // Check if we have strings as arguments. if ( !is_string( $pageName ) ) { throw new \MWException( '$pageName must be a string' ); diff --git a/includes/skins/MediaWikiI18N.php b/includes/skins/MediaWikiI18N.php index 02e8391ccd..7fcdb3c96b 100644 --- a/includes/skins/MediaWikiI18N.php +++ b/includes/skins/MediaWikiI18N.php @@ -33,7 +33,6 @@ class MediaWikiI18N { } function translate( $value ) { - // Hack for i18n:attributes in PHPTAL 1.0.0 dev version as of 2004-10-23 $value = preg_replace( '/^string:/', '', $value ); diff --git a/includes/skins/Skin.php b/includes/skins/Skin.php index e9d2f076b1..6834ca5fad 100644 --- a/includes/skins/Skin.php +++ b/includes/skins/Skin.php @@ -1391,7 +1391,6 @@ abstract class Skin extends ContextSource { * @return string */ function getNewtalks() { - $newMessagesAlert = ''; $user = $this->getUser(); $newtalks = $user->getNewMessageLinks(); diff --git a/includes/specialpage/ChangesListSpecialPage.php b/includes/specialpage/ChangesListSpecialPage.php index 1b561ef643..0be06461f4 100644 --- a/includes/specialpage/ChangesListSpecialPage.php +++ b/includes/specialpage/ChangesListSpecialPage.php @@ -92,8 +92,8 @@ abstract class ChangesListSpecialPage extends SpecialPage { 'showHideSuffix' => 'showhideliu', 'default' => false, 'queryCallable' => function ( $specialClassName, $ctx, $dbr, &$tables, &$fields, &$conds, - &$query_options, &$join_conds ) { - + &$query_options, &$join_conds + ) { $conds[] = 'rc_user = 0'; }, 'cssClassSuffix' => 'liu', @@ -111,8 +111,8 @@ abstract class ChangesListSpecialPage extends SpecialPage { 'showHideSuffix' => 'showhideanons', 'default' => false, 'queryCallable' => function ( $specialClassName, $ctx, $dbr, &$tables, &$fields, &$conds, - &$query_options, &$join_conds ) { - + &$query_options, &$join_conds + ) { $conds[] = 'rc_user != 0'; }, 'cssClassSuffix' => 'anon', @@ -182,8 +182,8 @@ abstract class ChangesListSpecialPage extends SpecialPage { 'showHideSuffix' => 'showhidemine', 'default' => false, 'queryCallable' => function ( $specialClassName, $ctx, $dbr, &$tables, &$fields, &$conds, - &$query_options, &$join_conds ) { - + &$query_options, &$join_conds + ) { $user = $ctx->getUser(); $conds[] = 'rc_user_text != ' . $dbr->addQuotes( $user->getName() ); }, @@ -198,8 +198,8 @@ abstract class ChangesListSpecialPage extends SpecialPage { 'description' => 'rcfilters-filter-editsbyother-description', 'default' => false, 'queryCallable' => function ( $specialClassName, $ctx, $dbr, &$tables, &$fields, &$conds, - &$query_options, &$join_conds ) { - + &$query_options, &$join_conds + ) { $user = $ctx->getUser(); $conds[] = 'rc_user_text = ' . $dbr->addQuotes( $user->getName() ); }, @@ -225,8 +225,8 @@ abstract class ChangesListSpecialPage extends SpecialPage { 'showHideSuffix' => 'showhidebots', 'default' => false, 'queryCallable' => function ( $specialClassName, $ctx, $dbr, &$tables, &$fields, &$conds, - &$query_options, &$join_conds ) { - + &$query_options, &$join_conds + ) { $conds[] = 'rc_bot = 0'; }, 'cssClassSuffix' => 'bot', @@ -240,8 +240,8 @@ abstract class ChangesListSpecialPage extends SpecialPage { 'description' => 'rcfilters-filter-humans-description', 'default' => false, 'queryCallable' => function ( $specialClassName, $ctx, $dbr, &$tables, &$fields, &$conds, - &$query_options, &$join_conds ) { - + &$query_options, &$join_conds + ) { $conds[] = 'rc_bot = 1'; }, 'cssClassSuffix' => 'human', @@ -269,8 +269,8 @@ abstract class ChangesListSpecialPage extends SpecialPage { 'showHideSuffix' => 'showhideminor', 'default' => false, 'queryCallable' => function ( $specialClassName, $ctx, $dbr, &$tables, &$fields, &$conds, - &$query_options, &$join_conds ) { - + &$query_options, &$join_conds + ) { $conds[] = 'rc_minor = 0'; }, 'cssClassSuffix' => 'minor', @@ -284,8 +284,8 @@ abstract class ChangesListSpecialPage extends SpecialPage { 'description' => 'rcfilters-filter-major-description', 'default' => false, 'queryCallable' => function ( $specialClassName, $ctx, $dbr, &$tables, &$fields, &$conds, - &$query_options, &$join_conds ) { - + &$query_options, &$join_conds + ) { $conds[] = 'rc_minor = 1'; }, 'cssClassSuffix' => 'major', @@ -347,8 +347,8 @@ abstract class ChangesListSpecialPage extends SpecialPage { 'default' => false, 'priority' => -2, 'queryCallable' => function ( $specialClassName, $ctx, $dbr, &$tables, &$fields, &$conds, - &$query_options, &$join_conds ) { - + &$query_options, &$join_conds + ) { $conds[] = 'rc_type != ' . $dbr->addQuotes( RC_EDIT ); }, 'cssClassSuffix' => 'src-mw-edit', @@ -363,8 +363,8 @@ abstract class ChangesListSpecialPage extends SpecialPage { 'default' => false, 'priority' => -3, 'queryCallable' => function ( $specialClassName, $ctx, $dbr, &$tables, &$fields, &$conds, - &$query_options, &$join_conds ) { - + &$query_options, &$join_conds + ) { $conds[] = 'rc_type != ' . $dbr->addQuotes( RC_NEW ); }, 'cssClassSuffix' => 'src-mw-new', @@ -382,8 +382,8 @@ abstract class ChangesListSpecialPage extends SpecialPage { 'default' => false, 'priority' => -5, 'queryCallable' => function ( $specialClassName, $ctx, $dbr, &$tables, &$fields, &$conds, - &$query_options, &$join_conds ) { - + &$query_options, &$join_conds + ) { $conds[] = 'rc_type != ' . $dbr->addQuotes( RC_LOG ); }, 'cssClassSuffix' => 'src-mw-log', @@ -412,8 +412,8 @@ abstract class ChangesListSpecialPage extends SpecialPage { 'showHideSuffix' => 'showhidepatr', 'default' => false, 'queryCallable' => function ( $specialClassName, $ctx, $dbr, &$tables, &$fields, &$conds, - &$query_options, &$join_conds ) { - + &$query_options, &$join_conds + ) { $conds[] = 'rc_patrolled = 0'; }, 'cssClassSuffix' => 'patrolled', @@ -427,8 +427,8 @@ abstract class ChangesListSpecialPage extends SpecialPage { 'description' => 'rcfilters-filter-unpatrolled-description', 'default' => false, 'queryCallable' => function ( $specialClassName, $ctx, $dbr, &$tables, &$fields, &$conds, - &$query_options, &$join_conds ) { - + &$query_options, &$join_conds + ) { $conds[] = 'rc_patrolled = 1'; }, 'cssClassSuffix' => 'unpatrolled', @@ -450,8 +450,8 @@ abstract class ChangesListSpecialPage extends SpecialPage { 'default' => false, 'priority' => -4, 'queryCallable' => function ( $specialClassName, $ctx, $dbr, &$tables, &$fields, &$conds, - &$query_options, &$join_conds ) { - + &$query_options, &$join_conds + ) { $conds[] = 'rc_type != ' . $dbr->addQuotes( RC_CATEGORIZE ); }, 'cssClassSuffix' => 'src-mw-categorize', @@ -470,7 +470,6 @@ abstract class ChangesListSpecialPage extends SpecialPage { $opts = $this->getOptions(); /** @var ChangesListFilterGroup $group */ foreach ( $this->getFilterGroups() as $group ) { - if ( $group->getConflictingGroups() ) { wfLogWarning( $group->getName() . @@ -487,7 +486,6 @@ abstract class ChangesListSpecialPage extends SpecialPage { /** @var ChangesListFilter $filter */ foreach ( $group->getFilters() as $filter ) { - /** @var ChangesListFilter $conflictingFilter */ foreach ( $filter->getConflictingFilters() as $conflictingFilter ) { if ( @@ -1061,8 +1059,8 @@ abstract class ChangesListSpecialPage extends SpecialPage { * @param FormOptions $opts */ protected function buildQuery( &$tables, &$fields, &$conds, &$query_options, - &$join_conds, FormOptions $opts ) { - + &$join_conds, FormOptions $opts + ) { $dbr = $this->getDB(); $user = $this->getUser(); @@ -1121,8 +1119,8 @@ abstract class ChangesListSpecialPage extends SpecialPage { * @return bool|ResultWrapper Result or false */ protected function doMainQuery( $tables, $fields, $conds, - $query_options, $join_conds, FormOptions $opts ) { - + $query_options, $join_conds, FormOptions $opts + ) { $tables[] = 'recentchanges'; $fields = array_merge( RecentChange::selectFields(), $fields ); @@ -1332,8 +1330,8 @@ abstract class ChangesListSpecialPage extends SpecialPage { * (optional) */ public function filterOnUserExperienceLevel( $specialPageClassName, $context, $dbr, - &$tables, &$fields, &$conds, &$query_options, &$join_conds, $selectedExpLevels, $now = 0 ) { - + &$tables, &$fields, &$conds, &$query_options, &$join_conds, $selectedExpLevels, $now = 0 + ) { global $wgLearnerEdits, $wgExperiencedUserEdits, $wgLearnerMemberSince, diff --git a/includes/specialpage/QueryPage.php b/includes/specialpage/QueryPage.php index 93873c02a2..73b812899a 100644 --- a/includes/specialpage/QueryPage.php +++ b/includes/specialpage/QueryPage.php @@ -601,7 +601,6 @@ abstract class QueryPage extends SpecialPage { # Get the cached result, select one extra row for navigation $res = $this->fetchFromCache( $dbLimit, $this->offset ); if ( !$this->listoutput ) { - # Fetch the timestamp of this update $ts = $this->getCachedTimestamp(); $lang = $this->getLanguage(); diff --git a/includes/specialpage/SpecialPageFactory.php b/includes/specialpage/SpecialPageFactory.php index 88336dd49f..8dcb30c907 100644 --- a/includes/specialpage/SpecialPageFactory.php +++ b/includes/specialpage/SpecialPageFactory.php @@ -234,7 +234,6 @@ class SpecialPageFactory { global $wgPageLanguageUseDB, $wgContentHandlerUseDB; if ( !is_array( self::$list ) ) { - self::$list = self::$coreList; if ( !$wgDisableInternalSearch ) { diff --git a/includes/specials/SpecialChangeEmail.php b/includes/specials/SpecialChangeEmail.php index eb98fe76a7..c5143002c3 100644 --- a/includes/specials/SpecialChangeEmail.php +++ b/includes/specials/SpecialChangeEmail.php @@ -63,7 +63,6 @@ class SpecialChangeEmail extends FormSpecialPage { } protected function checkExecutePermissions( User $user ) { - if ( !AuthManager::singleton()->allowsPropertyChange( 'emailaddress' ) ) { throw new ErrorPageError( 'changeemail', 'cannotchangeemail' ); } diff --git a/includes/specials/SpecialContributions.php b/includes/specials/SpecialContributions.php index 40706aceed..3845649314 100644 --- a/includes/specials/SpecialContributions.php +++ b/includes/specials/SpecialContributions.php @@ -329,7 +329,6 @@ class SpecialContributions extends IncludableSpecialPage { * @return array */ public static function getUserLinks( SpecialPage $sp, User $target ) { - $id = $target->getId(); $username = $target->getName(); $userpage = $target->getUserPage(); diff --git a/includes/specials/SpecialExport.php b/includes/specials/SpecialExport.php index f5e9e49b69..d5c5528d7a 100644 --- a/includes/specials/SpecialExport.php +++ b/includes/specials/SpecialExport.php @@ -330,7 +330,6 @@ class SpecialExport extends SpecialPage { * @param bool $exportall Whether to export everything */ private function doExport( $page, $history, $list_authors, $exportall ) { - // If we are grabbing everything, enable full history and ignore the rest if ( $exportall ) { $history = WikiExporter::FULL; diff --git a/includes/specials/SpecialPageData.php b/includes/specials/SpecialPageData.php index f7084a870e..c52c426e88 100644 --- a/includes/specials/SpecialPageData.php +++ b/includes/specials/SpecialPageData.php @@ -48,7 +48,6 @@ class SpecialPageData extends SpecialPage { * @return PageDataRequestHandler */ private function newDefaultRequestHandler() { - return new PageDataRequestHandler(); } diff --git a/includes/specials/SpecialRecentchanges.php b/includes/specials/SpecialRecentchanges.php index 75d104bb14..21f6b691c6 100644 --- a/includes/specials/SpecialRecentchanges.php +++ b/includes/specials/SpecialRecentchanges.php @@ -367,8 +367,8 @@ class SpecialRecentChanges extends ChangesListSpecialPage { * @inheritdoc */ protected function buildQuery( &$tables, &$fields, &$conds, - &$query_options, &$join_conds, FormOptions $opts ) { - + &$query_options, &$join_conds, FormOptions $opts + ) { $dbr = $this->getDB(); parent::buildQuery( $tables, $fields, $conds, $query_options, $join_conds, $opts ); @@ -392,8 +392,8 @@ class SpecialRecentChanges extends ChangesListSpecialPage { * @inheritdoc */ protected function doMainQuery( $tables, $fields, $conds, $query_options, - $join_conds, FormOptions $opts ) { - + $join_conds, FormOptions $opts + ) { $dbr = $this->getDB(); $user = $this->getUser(); diff --git a/includes/specials/SpecialRecentchangeslinked.php b/includes/specials/SpecialRecentchangeslinked.php index 873285b8c7..b3b9210380 100644 --- a/includes/specials/SpecialRecentchangeslinked.php +++ b/includes/specials/SpecialRecentchangeslinked.php @@ -50,8 +50,8 @@ class SpecialRecentChangesLinked extends SpecialRecentChanges { * @inheritdoc */ protected function doMainQuery( $tables, $select, $conds, $query_options, - $join_conds, FormOptions $opts ) { - + $join_conds, FormOptions $opts + ) { $target = $opts['target']; $showlinkedto = $opts['showlinkedto']; $limit = $opts['limit']; diff --git a/includes/specials/SpecialSearch.php b/includes/specials/SpecialSearch.php index e89dbc96ed..e5adeb53b4 100644 --- a/includes/specials/SpecialSearch.php +++ b/includes/specials/SpecialSearch.php @@ -399,7 +399,6 @@ class SpecialSearch extends SpecialPage { $mainResultWidget = new FullSearchResultWidget( $this, $linkRenderer ); if ( $search->getFeatureData( 'enable-new-crossproject-page' ) ) { - $sidebarResultWidget = new InterwikiSearchResultWidget( $this, $linkRenderer ); $sidebarResultsWidget = new InterwikiSearchResultSetWidget( $this, diff --git a/includes/specials/SpecialSpecialpages.php b/includes/specials/SpecialSpecialpages.php index b18b370c6b..451669ce61 100644 --- a/includes/specials/SpecialSpecialpages.php +++ b/includes/specials/SpecialSpecialpages.php @@ -96,7 +96,6 @@ class SpecialSpecialpages extends UnlistedSpecialPage { $includesCachedPages = false; foreach ( $groups as $group => $sortedPages ) { - $out->wrapWikiMsg( "

$1

\n", "specialpages-group-$group" diff --git a/includes/specials/SpecialStatistics.php b/includes/specials/SpecialStatistics.php index 19850e6a2d..a60549bf73 100644 --- a/includes/specials/SpecialStatistics.php +++ b/includes/specials/SpecialStatistics.php @@ -253,7 +253,6 @@ class SpecialStatistics extends SpecialPage { foreach ( $stats as $header => $items ) { // Identify the structure used if ( is_array( $items ) ) { - // Ignore headers that are recursively set as legacy header if ( $header !== 'statistics-header-hooks' ) { $return .= $this->formatRowHeader( $header ); diff --git a/includes/specials/SpecialTags.php b/includes/specials/SpecialTags.php index e67356f616..605ee008d8 100644 --- a/includes/specials/SpecialTags.php +++ b/includes/specials/SpecialTags.php @@ -246,7 +246,6 @@ class SpecialTags extends SpecialPage { } if ( $showManageActions ) { // we've already checked that the user had the requisite userright - // activate if ( ChangeTags::canActivateTag( $tag )->isOK() ) { $actionLinks[] = $linkRenderer->makeKnownLink( @@ -264,7 +263,6 @@ class SpecialTags extends SpecialPage { [], [ 'tag' => $tag ] ); } - } if ( $showDeleteActions || $showManageActions ) { diff --git a/includes/specials/SpecialUpload.php b/includes/specials/SpecialUpload.php index def639d83b..073e58df15 100644 --- a/includes/specials/SpecialUpload.php +++ b/includes/specials/SpecialUpload.php @@ -678,7 +678,6 @@ class SpecialUpload extends SpecialPage { */ protected function processVerificationError( $details ) { switch ( $details['status'] ) { - /** Statuses that only require name changing **/ case UploadBase::MIN_LENGTH_PARTNAME: $this->showRecoverableUploadError( $this->msg( 'minlength1' )->escaped() ); diff --git a/includes/specials/SpecialUserrights.php b/includes/specials/SpecialUserrights.php index d0a0317fa8..0a712eff21 100644 --- a/includes/specials/SpecialUserrights.php +++ b/includes/specials/SpecialUserrights.php @@ -326,8 +326,8 @@ class UserrightsPage extends SpecialPage { * @return array Tuple of added, then removed groups */ function doSaveUserGroups( $user, $add, $remove, $reason = '', $tags = [], - $groupExpiries = [] ) { - + $groupExpiries = [] + ) { // Validate input set... $isself = $user->getName() == $this->getUser()->getName(); $groups = $user->getGroups(); @@ -433,8 +433,8 @@ class UserrightsPage extends SpecialPage { * @param array $newUGMs Associative array of (group name => UserGroupMembership) */ protected function addLogEntry( $user, $oldGroups, $newGroups, $reason, $tags, - $oldUGMs, $newUGMs ) { - + $oldUGMs, $newUGMs + ) { // make sure $oldUGMs and $newUGMs are in the same order, and serialise // each UGM object to a simplified array $oldUGMs = array_map( function ( $group ) use ( $oldUGMs ) { diff --git a/includes/specials/SpecialWatchlist.php b/includes/specials/SpecialWatchlist.php index e9d3f26f76..65131ec25f 100644 --- a/includes/specials/SpecialWatchlist.php +++ b/includes/specials/SpecialWatchlist.php @@ -246,8 +246,8 @@ class SpecialWatchlist extends ChangesListSpecialPage { * @inheritdoc */ protected function buildQuery( &$tables, &$fields, &$conds, &$query_options, - &$join_conds, FormOptions $opts ) { - + &$join_conds, FormOptions $opts + ) { $dbr = $this->getDB(); parent::buildQuery( $tables, $fields, $conds, $query_options, $join_conds, $opts ); @@ -263,8 +263,8 @@ class SpecialWatchlist extends ChangesListSpecialPage { * @inheritdoc */ protected function doMainQuery( $tables, $fields, $conds, $query_options, - $join_conds, FormOptions $opts ) { - + $join_conds, FormOptions $opts + ) { $dbr = $this->getDB(); $user = $this->getUser(); diff --git a/includes/title/MediaWikiTitleCodec.php b/includes/title/MediaWikiTitleCodec.php index 7a71714bca..0fff97cb26 100644 --- a/includes/title/MediaWikiTitleCodec.php +++ b/includes/title/MediaWikiTitleCodec.php @@ -86,7 +86,6 @@ class MediaWikiTitleCodec implements TitleFormatter, TitleParser { if ( $this->language->needsGenderDistinction() && MWNamespace::hasGenderDistinction( $namespace ) ) { - // NOTE: we are assuming here that the title text is a user name! $gender = $this->genderCache->getGenderOf( $text, __METHOD__ ); $name = $this->language->getGenderNsText( $namespace, $gender ); diff --git a/includes/upload/UploadBase.php b/includes/upload/UploadBase.php index 57bb22ab96..f08f4cfce9 100644 --- a/includes/upload/UploadBase.php +++ b/includes/upload/UploadBase.php @@ -321,7 +321,6 @@ abstract class UploadBase { * @return mixed Const self::OK or else an array with error information */ public function verifyUpload() { - /** * If there was no filename or a zero size given, give up quick. */ @@ -1431,7 +1430,6 @@ abstract class UploadBase { * @return bool */ public function checkSvgScriptCallback( $element, $attribs, $data = null ) { - list( $namespace, $strippedElement ) = $this->splitXmlNamespace( $element ); // We specifically don't include: @@ -1666,7 +1664,6 @@ abstract class UploadBase { * @return bool true if the CSS contains an illegal string, false if otherwise */ private static function checkCssFragment( $value ) { - # Forbid external stylesheets, for both reliability and to protect viewer's privacy if ( stripos( $value, '@import' ) !== false ) { return true; diff --git a/includes/user/UserGroupMembership.php b/includes/user/UserGroupMembership.php index cf05df331e..a06be834c4 100644 --- a/includes/user/UserGroupMembership.php +++ b/includes/user/UserGroupMembership.php @@ -344,8 +344,8 @@ class UserGroupMembership { * @return string */ public static function getLink( $ugm, IContextSource $context, $format, - $userName = null ) { - + $userName = null + ) { if ( $format !== 'wiki' && $format !== 'html' ) { throw new MWException( 'UserGroupMembership::getLink() $format parameter should be ' . "'wiki' or 'html'" ); diff --git a/includes/utils/AutoloadGenerator.php b/includes/utils/AutoloadGenerator.php index 54a86775f8..8931e3ca17 100644 --- a/includes/utils/AutoloadGenerator.php +++ b/includes/utils/AutoloadGenerator.php @@ -137,13 +137,11 @@ class AutoloadGenerator { // format class-name : path when they get converted into json. foreach ( $this->classes as $path => $contained ) { foreach ( $contained as $fqcn ) { - // Using substr to remove the leading '/' $json[$key][$fqcn] = substr( $path, 1 ); } } foreach ( $this->overrides as $path => $fqcn ) { - // Using substr to remove the leading '/' $json[$key][$fqcn] = substr( $path, 1 ); } @@ -223,7 +221,6 @@ EOD; * @return string */ public function getAutoload( $commandName = 'AutoloadGenerator' ) { - // We need to check whether an extenson.json or skin.json exists or not, and // incase it doesn't, update the autoload.php file. diff --git a/includes/widget/search/InterwikiSearchResultSetWidget.php b/includes/widget/search/InterwikiSearchResultSetWidget.php index ef93362dd3..9145bb66aa 100644 --- a/includes/widget/search/InterwikiSearchResultSetWidget.php +++ b/includes/widget/search/InterwikiSearchResultSetWidget.php @@ -123,7 +123,6 @@ class InterwikiSearchResultSetWidget implements SearchResultSetWidget { * @return string HTML */ protected function footerHtml( $term, $iwPrefix ) { - $href = Title::makeTitle( NS_SPECIAL, 'Search', null, $iwPrefix )->getLocalURL( [ 'search' => $term, 'fulltext' => 1 ] ); @@ -171,7 +170,6 @@ class InterwikiSearchResultSetWidget implements SearchResultSetWidget { * @return OOUI\IconWidget **/ protected function iwIcon( $iwPrefix ) { - $interwiki = $this->iwLookup->fetch( $iwPrefix ); $parsed = wfParseUrl( wfExpandUrl( $interwiki ? $interwiki->getURL() : '/' ) ); diff --git a/includes/widget/search/InterwikiSearchResultWidget.php b/includes/widget/search/InterwikiSearchResultWidget.php index 861fb6dc6a..bcd1c16f4d 100644 --- a/includes/widget/search/InterwikiSearchResultWidget.php +++ b/includes/widget/search/InterwikiSearchResultWidget.php @@ -29,7 +29,6 @@ class InterwikiSearchResultWidget implements SearchResultWidget { * @return string HTML */ public function render( SearchResult $result, $terms, $position ) { - $title = $result->getTitle(); $iwPrefix = $result->getTitle()->getInterwiki(); $titleSnippet = $result->getTitleSnippet(); @@ -46,7 +45,6 @@ class InterwikiSearchResultWidget implements SearchResultWidget { $redirectTitle = $result->getRedirectTitle(); $redirect = ''; if ( $redirectTitle !== null ) { - $redirectText = $result->getRedirectSnippet(); if ( $redirectText ) { diff --git a/languages/Language.php b/languages/Language.php index b5eef8caa0..83dff65aba 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -361,7 +361,6 @@ class Language { * @return bool */ public static function isValidBuiltInCode( $code ) { - if ( !is_string( $code ) ) { if ( is_object( $code ) ) { $addmsg = " of class " . get_class( $code ); diff --git a/languages/LanguageConverter.php b/languages/LanguageConverter.php index 213778682e..6d0368c7a1 100644 --- a/languages/LanguageConverter.php +++ b/languages/LanguageConverter.php @@ -339,7 +339,6 @@ class LanguageConverter { * @return string The converted text */ public function autoConvert( $text, $toVariant = false ) { - $this->loadTables(); if ( !$toVariant ) { diff --git a/languages/classes/LanguageBe_tarask.php b/languages/classes/LanguageBe_tarask.php index 56faa4ac16..6007bb4395 100644 --- a/languages/classes/LanguageBe_tarask.php +++ b/languages/classes/LanguageBe_tarask.php @@ -44,7 +44,6 @@ class LanguageBe_tarask extends Language { * @return string */ function normalizeForSearch( $string ) { - # MySQL fulltext index doesn't grok utf-8, so we # need to fold cases and convert to hex diff --git a/languages/classes/LanguageKk.php b/languages/classes/LanguageKk.php index 3a50987733..f6f03c48af 100644 --- a/languages/classes/LanguageKk.php +++ b/languages/classes/LanguageKk.php @@ -86,7 +86,6 @@ class KkConverter extends LanguageConverter { } function loadRegs() { - $this->mCyrl2Latn = [ # # Punctuation '/№/u' => 'No.', @@ -423,7 +422,6 @@ class LanguageKk extends LanguageKk_cyrl { * @return string */ function convertGrammar( $word, $case ) { - $variant = $this->getPreferredVariant(); switch ( $variant ) { case 'kk-arab': diff --git a/languages/classes/LanguageKu_ku.php b/languages/classes/LanguageKu_ku.php index e745965a0c..4e9c3659b6 100644 --- a/languages/classes/LanguageKu_ku.php +++ b/languages/classes/LanguageKu_ku.php @@ -37,7 +37,6 @@ class LanguageKu_ku extends Language { * @return string */ function commafy( $_ ) { - if ( !preg_match( '/^\d{1,4}$/', $_ ) ) { return strrev( (string)preg_replace( '/(\d{3})(?=\d)(?!\d*\.)/', '$1,', strrev( $_ ) ) ); } else { diff --git a/languages/classes/LanguageYue.php b/languages/classes/LanguageYue.php index d5f3e76085..1107fa6df3 100644 --- a/languages/classes/LanguageYue.php +++ b/languages/classes/LanguageYue.php @@ -54,7 +54,6 @@ class LanguageYue extends Language { * @return string */ function normalizeForSearch( $string ) { - // Double-width roman characters $s = self::convertDoubleWidth( $string ); $s = trim( $s ); diff --git a/languages/classes/LanguageZh_hans.php b/languages/classes/LanguageZh_hans.php index 77a41e12c1..9d81c213cf 100644 --- a/languages/classes/LanguageZh_hans.php +++ b/languages/classes/LanguageZh_hans.php @@ -56,7 +56,6 @@ class LanguageZh_hans extends Language { * @return string */ function normalizeForSearch( $s ) { - // Double-width roman characters $s = parent::normalizeForSearch( $s ); $s = trim( $s ); diff --git a/maintenance/checkSyntax.php b/maintenance/checkSyntax.php index 49bd05cf8a..3910f29d20 100644 --- a/maintenance/checkSyntax.php +++ b/maintenance/checkSyntax.php @@ -168,7 +168,6 @@ class CheckSyntax extends Maintenance { * @return array Resulting list of changed files */ private function getGitModifiedFiles( $path ) { - global $wgMaxShellMemory; if ( !is_dir( "$path/.git" ) ) { diff --git a/maintenance/deleteOldRevisions.php b/maintenance/deleteOldRevisions.php index 24a63a3eeb..9559623830 100644 --- a/maintenance/deleteOldRevisions.php +++ b/maintenance/deleteOldRevisions.php @@ -43,7 +43,6 @@ class DeleteOldRevisions extends Maintenance { } function doDelete( $delete = false, $args = [] ) { - # Data should come off the master, wrapped in a transaction $dbw = $this->getDB( DB_MASTER ); $this->beginTransaction( $dbw, __METHOD__ ); diff --git a/maintenance/dumpTextPass.php b/maintenance/dumpTextPass.php index c6e9aad646..2b79b546d4 100644 --- a/maintenance/dumpTextPass.php +++ b/maintenance/dumpTextPass.php @@ -575,7 +575,6 @@ TEXT } while ( $failures < $this->maxFailures ) { - // As soon as we found a good text for the $id, we will return immediately. // Hence, if we make it past the try catch block, we know that we did not // find a good text. diff --git a/maintenance/importImages.php b/maintenance/importImages.php index b3866c13a2..625e1f70de 100644 --- a/maintenance/importImages.php +++ b/maintenance/importImages.php @@ -185,9 +185,7 @@ class ImportImages extends Maintenance { # Batch "upload" operation $count = count( $files ); if ( $count > 0 ) { - foreach ( $files as $file ) { - if ( $sleep && ( $processed > 0 ) ) { sleep( $sleep ); } diff --git a/maintenance/language/checkDupeMessages.php b/maintenance/language/checkDupeMessages.php index baf917c90a..92ddc449d5 100644 --- a/maintenance/language/checkDupeMessages.php +++ b/maintenance/language/checkDupeMessages.php @@ -93,7 +93,6 @@ if ( $run ) { $count = 0; if ( ( $messageExist ) && ( $messageCExist ) ) { - if ( !strcmp( $runMode, 'php' ) ) { print "getDestinationTitle( $ns, $name, diff --git a/maintenance/nukePage.php b/maintenance/nukePage.php index de037dc1c9..ff821cc5e3 100644 --- a/maintenance/nukePage.php +++ b/maintenance/nukePage.php @@ -39,7 +39,6 @@ class NukePage extends Maintenance { } public function execute() { - $name = $this->getArg(); $delete = $this->getOption( 'delete', false ); diff --git a/maintenance/oracle/alterSharedConstraints.php b/maintenance/oracle/alterSharedConstraints.php index 48c3d37511..ed412dae21 100644 --- a/maintenance/oracle/alterSharedConstraints.php +++ b/maintenance/oracle/alterSharedConstraints.php @@ -67,8 +67,8 @@ class AlterSharedConstraints extends Maintenance { AND ucc.constraint_name = uc.constraint_name AND uccpk.constraint_name = uc.r_constraint_name AND uccpk.table_name = '$ltable'" ); - while ( ( $row = $result->fetchRow() ) !== false ) { + while ( ( $row = $result->fetchRow() ) !== false ) { $this->output( "Altering {$row['constraint_name']} ..." ); try { diff --git a/maintenance/refreshLinks.php b/maintenance/refreshLinks.php index 9f3552a678..facc5064c1 100644 --- a/maintenance/refreshLinks.php +++ b/maintenance/refreshLinks.php @@ -178,7 +178,6 @@ class RefreshLinks extends Maintenance { $this->output( "Starting from page_id $start of $end.\n" ); for ( $id = $start; $id <= $end; $id++ ) { - if ( !( $id % self::REPORTING_INTERVAL ) ) { $this->output( "$id\n" ); wfWaitForSlaves(); @@ -191,7 +190,6 @@ class RefreshLinks extends Maintenance { $this->output( "Starting from page_id $start of $end.\n" ); for ( $id = $start; $id <= $end; $id++ ) { - if ( !( $id % self::REPORTING_INTERVAL ) ) { $this->output( "$id\n" ); wfWaitForSlaves(); diff --git a/maintenance/removeUnusedAccounts.php b/maintenance/removeUnusedAccounts.php index ec8fcfe1ae..c750784e2a 100644 --- a/maintenance/removeUnusedAccounts.php +++ b/maintenance/removeUnusedAccounts.php @@ -39,7 +39,6 @@ class RemoveUnusedAccounts extends Maintenance { } public function execute() { - $this->output( "Remove unused accounts\n\n" ); # Do an initial scan for inactive accounts and report the result diff --git a/maintenance/userOptions.inc b/maintenance/userOptions.inc index c657c03f7b..5d773d1426 100644 --- a/maintenance/userOptions.inc +++ b/maintenance/userOptions.inc @@ -82,7 +82,6 @@ class UserOptions { * @return bool */ private function initializeOpts( $opts, $args ) { - $this->mQuick = isset( $opts['nowarn'] ); $this->mQuiet = isset( $opts['quiet'] ); $this->mDry = isset( $opts['dry'] ); @@ -149,12 +148,10 @@ class UserOptions { ); foreach ( $result as $id ) { - $user = User::newFromId( $id->user_id ); // Get the options and update stats if ( $this->mAnOption ) { - if ( !array_key_exists( $this->mAnOption, $defaultOptions ) ) { print "Invalid user option. Use --list to see valid choices\n"; exit; @@ -203,14 +200,12 @@ class UserOptions { ); foreach ( $result as $id ) { - $user = User::newFromId( $id->user_id ); $curValue = $user->getOption( $this->mAnOption ); $username = $user->getName(); if ( $curValue == $this->mOldValue ) { - if ( !$this->mQuiet ) { print "Setting {$this->mAnOption} for $username from '{$this->mOldValue}' " . "to '{$this->mNewValue}'): "; @@ -279,7 +274,6 @@ USAGE; * @return bool */ public function warn() { - if ( $this->mQuick ) { return true; } diff --git a/mw-config/index.php b/mw-config/index.php index be9debcb8d..10b8d973cd 100644 --- a/mw-config/index.php +++ b/mw-config/index.php @@ -44,7 +44,6 @@ function wfInstallerMain() { $installer = InstallerOverrides::getWebInstaller( $wgRequest ); if ( !$installer->startSession() ) { - if ( $installer->request->getVal( "css" ) ) { // Do not display errors on css pages $installer->outputCss(); diff --git a/phpcs.xml b/phpcs.xml index 7eca9ea505..a02e1a8c1b 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -1,6 +1,9 @@ + + + @@ -17,9 +20,6 @@ - - - @@ -36,18 +36,15 @@ - . - - */languages/messages/Messages*.php */includes/StubObject.php - - 0 - + . + + node_modules/ vendor/ ^extensions/ diff --git a/tests/phpunit/MediaWikiTestCase.php b/tests/phpunit/MediaWikiTestCase.php index c2eebfae0a..26ee420122 100644 --- a/tests/phpunit/MediaWikiTestCase.php +++ b/tests/phpunit/MediaWikiTestCase.php @@ -1049,7 +1049,6 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { private function addCoreDBData() { if ( $this->db->getType() == 'oracle' ) { - # Insert 0 user to prevent FK violations # Anonymous user if ( !$this->db->selectField( 'user', '1', [ 'user_id' => 0 ] ) ) { @@ -1713,7 +1712,6 @@ abstract class MediaWikiTestCase extends PHPUnit_Framework_TestCase { if ( !isset( $wgNamespaceContentModels[$ns] ) || $wgNamespaceContentModels[$ns] === CONTENT_MODEL_WIKITEXT ) { - $wikitextNS = $ns; return $wikitextNS; diff --git a/tests/phpunit/includes/GlobalFunctions/GlobalTest.php b/tests/phpunit/includes/GlobalFunctions/GlobalTest.php index 33b6e2f664..5e54b8d436 100644 --- a/tests/phpunit/includes/GlobalFunctions/GlobalTest.php +++ b/tests/phpunit/includes/GlobalFunctions/GlobalTest.php @@ -362,7 +362,6 @@ class GlobalTest extends MediaWikiTestCase { * @covers ::wfClientAcceptsGzip */ public function testClientAcceptsGzipTest() { - $settings = [ 'gzip' => true, 'bzip' => false, @@ -396,7 +395,6 @@ class GlobalTest extends MediaWikiTestCase { * @covers ::wfPercent */ public function testWfPercentTest() { - $pcts = [ [ 6 / 7, '0.86%', 2, false ], [ 3 / 3, '1%' ], diff --git a/tests/phpunit/includes/LinkerTest.php b/tests/phpunit/includes/LinkerTest.php index 2ca5935225..3e3fb0fc3a 100644 --- a/tests/phpunit/includes/LinkerTest.php +++ b/tests/phpunit/includes/LinkerTest.php @@ -265,7 +265,6 @@ class LinkerTest extends MediaWikiLangTestCase { * @dataProvider provideCasesForFormatLinksInComment */ public function testFormatLinksInComment( $expected, $input, $wiki ) { - $conf = new SiteConfiguration(); $conf->settings = [ 'wgServer' => [ diff --git a/tests/phpunit/includes/WatchedItemIntegrationTest.php b/tests/phpunit/includes/WatchedItemIntegrationTest.php index 65a8c86bb7..01e7ecb9d3 100644 --- a/tests/phpunit/includes/WatchedItemIntegrationTest.php +++ b/tests/phpunit/includes/WatchedItemIntegrationTest.php @@ -28,7 +28,6 @@ class WatchedItemIntegrationTest extends MediaWikiTestCase { } public function testWatchAndUnWatchItem() { - $user = $this->getUser(); $title = Title::newFromText( 'WatchedItemIntegrationTestPage' ); // Cleanup after previous tests diff --git a/tests/phpunit/includes/api/generateRandomImages.php b/tests/phpunit/includes/api/generateRandomImages.php index d49971470d..d4a5acff07 100644 --- a/tests/phpunit/includes/api/generateRandomImages.php +++ b/tests/phpunit/includes/api/generateRandomImages.php @@ -16,7 +16,6 @@ class GenerateRandomImages extends Maintenance { } public function execute() { - $getOptSpec = [ 'dictionaryFile::', 'minWidth::', diff --git a/tests/phpunit/includes/api/query/ApiQueryBasicTest.php b/tests/phpunit/includes/api/query/ApiQueryBasicTest.php index fbc794ed12..c612f265ca 100644 --- a/tests/phpunit/includes/api/query/ApiQueryBasicTest.php +++ b/tests/phpunit/includes/api/query/ApiQueryBasicTest.php @@ -248,7 +248,6 @@ class ApiQueryBasicTest extends ApiQueryTestBase { * Test basic lists */ public function testAllTogether() { - // All props together $this->check( $this->merge( self::$links, diff --git a/tests/phpunit/includes/changes/TestRecentChangesHelper.php b/tests/phpunit/includes/changes/TestRecentChangesHelper.php index 2f908feb63..4da09d8535 100644 --- a/tests/phpunit/includes/changes/TestRecentChangesHelper.php +++ b/tests/phpunit/includes/changes/TestRecentChangesHelper.php @@ -12,7 +12,6 @@ class TestRecentChangesHelper { public function makeEditRecentChange( User $user, $titleText, $curid, $thisid, $lastid, $timestamp, $counter, $watchingUsers ) { - $attribs = array_merge( $this->getDefaultAttributes( $titleText, $timestamp ), [ @@ -72,7 +71,6 @@ class TestRecentChangesHelper { public function makeNewBotEditRecentChange( User $user, $titleText, $curid, $thisid, $lastid, $timestamp, $counter, $watchingUsers ) { - $attribs = array_merge( $this->getDefaultAttributes( $titleText, $timestamp ), [ @@ -111,7 +109,6 @@ class TestRecentChangesHelper { public function makeCategorizationRecentChange( User $user, $titleText, $curid, $thisid, $lastid, $timestamp ) { - $attribs = array_merge( $this->getDefaultAttributes( $titleText, $timestamp ), [ diff --git a/tests/phpunit/includes/import/ImportLinkCacheIntegrationTest.php b/tests/phpunit/includes/import/ImportLinkCacheIntegrationTest.php index 8e06f9e968..bdb4831a93 100644 --- a/tests/phpunit/includes/import/ImportLinkCacheIntegrationTest.php +++ b/tests/phpunit/includes/import/ImportLinkCacheIntegrationTest.php @@ -27,7 +27,6 @@ class ImportLinkCacheIntegrationTest extends MediaWikiTestCase { } public function testImportForImportSource() { - $this->doImport( $this->importStreamSource ); // Imported title @@ -56,7 +55,6 @@ class ImportLinkCacheIntegrationTest extends MediaWikiTestCase { * @depends testImportForImportSource */ public function testReImportForImportSource() { - $this->doImport( $this->importStreamSource ); // ReImported title @@ -76,7 +74,6 @@ class ImportLinkCacheIntegrationTest extends MediaWikiTestCase { } private function doImport( $importStreamSource ) { - $importer = new WikiImporter( $importStreamSource->value, MediaWikiServices::getInstance()->getMainConfig() diff --git a/tests/phpunit/includes/interwiki/InterwikiLookupAdapterTest.php b/tests/phpunit/includes/interwiki/InterwikiLookupAdapterTest.php index 1d62a78766..31c9e50c49 100644 --- a/tests/phpunit/includes/interwiki/InterwikiLookupAdapterTest.php +++ b/tests/phpunit/includes/interwiki/InterwikiLookupAdapterTest.php @@ -39,7 +39,6 @@ class InterwikiLookupAdapterTest extends MediaWikiTestCase { } public function testFetch() { - $interwiki = $this->interwikiLookup->fetch( '' ); $this->assertNull( $interwiki ); diff --git a/tests/phpunit/includes/libs/xmp/XMPTest.php b/tests/phpunit/includes/libs/xmp/XMPTest.php index 9291eb6b00..5eee8b88c9 100644 --- a/tests/phpunit/includes/libs/xmp/XMPTest.php +++ b/tests/phpunit/includes/libs/xmp/XMPTest.php @@ -181,7 +181,6 @@ class XMPTest extends PHPUnit_Framework_TestCase { * @covers XMPReader::checkParseSafety */ public function testCheckParseSafety() { - // Test for detection $xmpPath = __DIR__ . '/../../../data/xmp/'; $file = fopen( $xmpPath . 'doctype-included.xmp', 'rb' ); diff --git a/tests/phpunit/includes/linkeddata/PageDataRequestHandlerTest.php b/tests/phpunit/includes/linkeddata/PageDataRequestHandlerTest.php index 666dcf2a10..2b18b08b24 100644 --- a/tests/phpunit/includes/linkeddata/PageDataRequestHandlerTest.php +++ b/tests/phpunit/includes/linkeddata/PageDataRequestHandlerTest.php @@ -77,7 +77,6 @@ class PageDataRequestHandlerTest extends \MediaWikiTestCase { } public function handleRequestProvider() { - $cases = []; $cases[] = [ '', [], [], '!!', 400 ]; diff --git a/tests/phpunit/includes/media/GIFMetadataExtractorTest.php b/tests/phpunit/includes/media/GIFMetadataExtractorTest.php index 1044e5210e..278b441bbd 100644 --- a/tests/phpunit/includes/media/GIFMetadataExtractorTest.php +++ b/tests/phpunit/includes/media/GIFMetadataExtractorTest.php @@ -24,7 +24,6 @@ class GIFMetadataExtractorTest extends MediaWikiTestCase { } public static function provideGetMetadata() { - $xmpNugget = << diff --git a/tests/phpunit/includes/password/UserPasswordPolicyTest.php b/tests/phpunit/includes/password/UserPasswordPolicyTest.php index 3bd82b4ac8..0839cfbbf1 100644 --- a/tests/phpunit/includes/password/UserPasswordPolicyTest.php +++ b/tests/phpunit/includes/password/UserPasswordPolicyTest.php @@ -58,7 +58,6 @@ class UserPasswordPolicyTest extends MediaWikiTestCase { } public function testGetPoliciesForUser() { - $upp = $this->getUserPasswordPolicy(); $user = User::newFromName( 'TestUserPolicy' ); @@ -100,7 +99,6 @@ class UserPasswordPolicyTest extends MediaWikiTestCase { * @dataProvider provideCheckUserPassword */ public function testCheckUserPassword( $username, $groups, $password, $valid, $ok, $msg ) { - $upp = $this->getUserPasswordPolicy(); $user = User::newFromName( $username ); diff --git a/tests/phpunit/includes/specials/SpecialPreferencesTest.php b/tests/phpunit/includes/specials/SpecialPreferencesTest.php index fd587bfa0c..ac58d68c57 100644 --- a/tests/phpunit/includes/specials/SpecialPreferencesTest.php +++ b/tests/phpunit/includes/specials/SpecialPreferencesTest.php @@ -21,7 +21,6 @@ class SpecialPreferencesTest extends MediaWikiTestCase { * @todo give this test a real name explaining what is being tested here */ public function testBug41337() { - // Set a low limit $this->setMwGlobals( 'wgMaxSigChars', 2 ); diff --git a/tests/phpunit/includes/title/ForeignTitleTest.php b/tests/phpunit/includes/title/ForeignTitleTest.php index b6c2427807..25ff186b25 100644 --- a/tests/phpunit/includes/title/ForeignTitleTest.php +++ b/tests/phpunit/includes/title/ForeignTitleTest.php @@ -51,8 +51,8 @@ class ForeignTitleTest extends MediaWikiTestCase { * @dataProvider basicProvider */ public function testBasic( ForeignTitle $title, $expectedId, $expectedName, - $expectedText ) { - + $expectedText + ) { $this->assertEquals( true, $title->isNamespaceIdKnown() ); $this->assertEquals( $expectedId, $title->getNamespaceId() ); $this->assertEquals( $expectedName, $title->getNamespaceName() ); diff --git a/tests/phpunit/includes/title/NamespaceAwareForeignTitleFactoryTest.php b/tests/phpunit/includes/title/NamespaceAwareForeignTitleFactoryTest.php index 520108aac1..9aa3578da7 100644 --- a/tests/phpunit/includes/title/NamespaceAwareForeignTitleFactoryTest.php +++ b/tests/phpunit/includes/title/NamespaceAwareForeignTitleFactoryTest.php @@ -76,7 +76,6 @@ class NamespaceAwareForeignTitleFactoryTest extends MediaWikiTestCase { * @dataProvider basicProvider */ public function testBasic( $title, $ns, ForeignTitle $foreignTitle ) { - $foreignNamespaces = [ 0 => '', 1 => 'Talk', 100 => 'Portal', 9000 => 'Bogus' ]; diff --git a/tests/phpunit/includes/title/SubpageImportTitleFactoryTest.php b/tests/phpunit/includes/title/SubpageImportTitleFactoryTest.php index baeb95cfad..93ce08009f 100644 --- a/tests/phpunit/includes/title/SubpageImportTitleFactoryTest.php +++ b/tests/phpunit/includes/title/SubpageImportTitleFactoryTest.php @@ -60,8 +60,8 @@ class SubpageImportTitleFactoryTest extends MediaWikiTestCase { * @dataProvider basicProvider */ public function testBasic( ForeignTitle $foreignTitle, Title $rootPage, - Title $title ) { - + Title $title + ) { $factory = new SubpageImportTitleFactory( $rootPage ); $testTitle = $factory->createTitleFromForeignTitle( $foreignTitle ); diff --git a/tests/phpunit/includes/utils/MWCryptHKDFTest.php b/tests/phpunit/includes/utils/MWCryptHKDFTest.php index 760d41e86c..86c19ae451 100644 --- a/tests/phpunit/includes/utils/MWCryptHKDFTest.php +++ b/tests/phpunit/includes/utils/MWCryptHKDFTest.php @@ -40,7 +40,6 @@ class MWCryptHKDFTest extends MediaWikiTestCase { * Test vectors from Appendix A on https://tools.ietf.org/html/rfc5869 */ public static function providerRfc5869() { - // @codingStandardsIgnoreStart Generic.Files.LineLength return [ // A.1 diff --git a/tests/phpunit/maintenance/DumpTestCase.php b/tests/phpunit/maintenance/DumpTestCase.php index 1d55ab8434..99bd427737 100644 --- a/tests/phpunit/maintenance/DumpTestCase.php +++ b/tests/phpunit/maintenance/DumpTestCase.php @@ -298,7 +298,6 @@ abstract class DumpTestCase extends MediaWikiLangTestCase { * @param string $name Title of the current page */ protected function assertPageStart( $id, $ns, $name ) { - $this->assertNodeStart( "page" ); $this->skipWhitespace(); @@ -393,7 +392,6 @@ abstract class DumpTestCase extends MediaWikiLangTestCase { if ( ( $this->xml->nodeType == XMLReader::END_ELEMENT ) && ( $this->xml->name == "text" ) ) { - $this->xml->read(); } $this->skipWhitespace(); diff --git a/tests/phpunit/maintenance/MaintenanceTest.php b/tests/phpunit/maintenance/MaintenanceTest.php index 6b0e3443c1..e21e72696a 100644 --- a/tests/phpunit/maintenance/MaintenanceTest.php +++ b/tests/phpunit/maintenance/MaintenanceTest.php @@ -52,7 +52,6 @@ class MaintenanceFixup extends Maintenance { * Simulates what Maintenance wants to happen at script's end. */ public function simulateShutdown() { - if ( $this->shutdownSimulated ) { $this->testCase->fail( __METHOD__ . " called more than once" ); } @@ -175,7 +174,6 @@ class MaintenanceTest extends MediaWikiTestCase { * after shutdown simulation. */ private function assertOutputPrePostShutdown( $preShutdownOutput, $expectNLAppending ) { - $this->assertEquals( $preShutdownOutput, $this->getActualOutput(), "Output before shutdown simulation" ); diff --git a/tests/phpunit/maintenance/backupTextPassTest.php b/tests/phpunit/maintenance/backupTextPassTest.php index ea5ca8d847..8242c79de1 100644 --- a/tests/phpunit/maintenance/backupTextPassTest.php +++ b/tests/phpunit/maintenance/backupTextPassTest.php @@ -265,7 +265,6 @@ class TextPassDumperDatabaseTest extends DumpTestCase { // duration. If the dump did not take long enough increase the iteration // count, to generate a bigger stub file next time. while ( $lastDuration < $minDuration ) { - // Setting up the dump wfRecursiveRemoveDir( $nameOutputDir ); $this->assertTrue( wfMkdirParents( $nameOutputDir ), @@ -323,7 +322,6 @@ class TextPassDumperDatabaseTest extends DumpTestCase { // Each run of the following loop body tries to handle exactly 1 /page/ (not // iteration of stub content). $i is only increased after having treated page 4. for ( $i = 0; $i < $iterations; ) { - // 1. Assuring a file is opened and ready. Skipping across header if // necessary. if ( !$fileOpened ) { @@ -511,7 +509,6 @@ class TextPassDumperDatabaseTest extends DumpTestCase { $content = $header; $iterations = intval( $iterations ); for ( $i = 0; $i < $iterations; $i++ ) { - $page1 = ' BackupDumperTestP1 0 diff --git a/tests/phpunit/maintenance/backup_LogTest.php b/tests/phpunit/maintenance/backup_LogTest.php index 0019a3fc9f..91e1b1e7bc 100644 --- a/tests/phpunit/maintenance/backup_LogTest.php +++ b/tests/phpunit/maintenance/backup_LogTest.php @@ -104,7 +104,6 @@ class BackupDumperLoggerTest extends DumpTestCase { private function assertLogItem( $id, $user_name, $user_id, $comment, $type, $subtype, $title, $parameters = [] ) { - $this->assertNodeStart( "logitem" ); $this->skipWhitespace(); diff --git a/tests/qunit/data/testrunner.js b/tests/qunit/data/testrunner.js index 39baf17013..d7da5a05c3 100644 --- a/tests/qunit/data/testrunner.js +++ b/tests/qunit/data/testrunner.js @@ -202,7 +202,6 @@ return { setup: function () { - // Greetings, mock environment! mw.config = new MwMap(); mw.config.set( freshConfigCopy( localEnv.config ) );