Umherirrender has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/358535 )
Change subject: Make phpcs pass - includes/ Formatter / Model / Notifications ...................................................................... Make phpcs pass - includes/ Formatter / Model / Notifications Change-Id: I82bece77566ae8d5437c57fc39c52000b2422373 --- M includes/Api/ApiFlowBaseGet.php M includes/Api/ApiFlowBasePost.php M includes/Formatter/AbstractFormatter.php M includes/Formatter/AbstractQuery.php M includes/Formatter/ChangesListFormatter.php M includes/Formatter/HistoryQuery.php M includes/Formatter/RevisionFormatter.php M includes/Formatter/TopicFormatter.php M includes/Formatter/TopicListFormatter.php M includes/Formatter/TopicListQuery.php M includes/Log/ActionFormatter.php M includes/Log/ModerationLogger.php M includes/Model/AbstractRevision.php M includes/Model/PostRevision.php M includes/Model/UUID.php M includes/Notifications/Controller.php M includes/Notifications/FlowEnabledOnTalkpagePresentationModel.php M includes/Notifications/MentionPresentationModel.php M includes/Notifications/NewTopicPresentationModel.php M includes/Notifications/PostReplyPresentationModel.php M includes/Specials/SpecialEnableFlow.php 21 files changed, 40 insertions(+), 42 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow refs/changes/35/358535/1 diff --git a/includes/Api/ApiFlowBaseGet.php b/includes/Api/ApiFlowBaseGet.php index 773d9f1..8ee75f9 100644 --- a/includes/Api/ApiFlowBaseGet.php +++ b/includes/Api/ApiFlowBaseGet.php @@ -21,7 +21,7 @@ ) ); /** @var Block $block */ - foreach( $blocks as $block ) { + foreach ( $blocks as $block ) { $block->init( $context, $action ); if ( $block->canRender( $action ) ) { @@ -44,7 +44,7 @@ $this->dieWithError( 'flow-error-no-render', 'no-render' ); } - $blocks = array_keys($output[$action]['result']); + $blocks = array_keys( $output[$action]['result'] ); $this->getResult()->setIndexedTagName( $blocks, 'block' ); // Required until php5.4 which has the JsonSerializable interface diff --git a/includes/Api/ApiFlowBasePost.php b/includes/Api/ApiFlowBasePost.php index f1effef..551aba1 100644 --- a/includes/Api/ApiFlowBasePost.php +++ b/includes/Api/ApiFlowBasePost.php @@ -36,7 +36,7 @@ $savedBlocks = array(); $result->setIndexedTagName( $savedBlocks, 'block' ); - foreach( $blocksToCommit as $block ) { + foreach ( $blocksToCommit as $block ) { $savedBlocks[] = $block->getName(); } diff --git a/includes/Formatter/AbstractFormatter.php b/includes/Formatter/AbstractFormatter.php index f576e22..d1f2215 100644 --- a/includes/Formatter/AbstractFormatter.php +++ b/includes/Formatter/AbstractFormatter.php @@ -117,7 +117,7 @@ if ( isset( $have[$key] ) ) { if ( $link instanceof Anchor ) { $formatted[] = $link->toHtml(); - } elseif( $link instanceof Message ) { + } elseif ( $link instanceof Message ) { $formatted[] = $link->escaped(); } else { // plain text diff --git a/includes/Formatter/AbstractQuery.php b/includes/Formatter/AbstractQuery.php index f70fef1..4d428fe 100644 --- a/includes/Formatter/AbstractQuery.php +++ b/includes/Formatter/AbstractQuery.php @@ -83,7 +83,7 @@ $revisions = array(); $previousRevisionIds = array(); $collectionIds = array(); - foreach( $results as $result ) { + foreach ( $results as $result ) { if ( $result instanceof PostRevision ) { // If top-level, then just get the workflow. // Otherwise we need to find the root post. @@ -115,12 +115,11 @@ // map from post Id to the related root post id $rootPostIds = array_filter( $this->treeRepository->findRoots( $postIds ) ); $rootPostRequests = array(); - foreach( $rootPostIds as $postId ) { + foreach ( $rootPostIds as $postId ) { $rootPostRequests[] = array( 'rev_type_id' => $postId ); } // these tree identity maps are required for determining where a reply goes when - // // replying to a specific post. $identityMap = $this->treeRepository->fetchSubtreeIdentityMap( array_unique( $rootPostIds, SORT_REGULAR ) diff --git a/includes/Formatter/ChangesListFormatter.php b/includes/Formatter/ChangesListFormatter.php index cc0f384..a31f2c1 100644 --- a/includes/Formatter/ChangesListFormatter.php +++ b/includes/Formatter/ChangesListFormatter.php @@ -91,7 +91,7 @@ $prefix = $ctx->msg( 'autocomment-prefix' )->inContentLanguage()->escaped(); $link = Linker::link( $title = $row->workflow->getOwnerTitle(), - $ctx->getLanguage()->getArrow('backwards'), + $ctx->getLanguage()->getArrow( 'backwards' ), array(), array(), 'noclasses' diff --git a/includes/Formatter/HistoryQuery.php b/includes/Formatter/HistoryQuery.php index f92d9c1..548bd10 100644 --- a/includes/Formatter/HistoryQuery.php +++ b/includes/Formatter/HistoryQuery.php @@ -13,7 +13,6 @@ // to try to reduce the number of rounds (preferably to 1). // If you raise this, also increase history_index_limit and bump the // key of the indexes using history_index_limit - // // This magic number is based on new-post/new-topic being about 26% of post revisions. // (queried from production), since that is the only thing currently excluded. const POST_OVERFETCH_FACTOR = 1.36; @@ -57,7 +56,7 @@ * @param UUID $offset UUID to use as offset (optional) * @return array Associative array of options for query */ - protected function getOptions( $direction, $limit, UUID $offset = null) { + protected function getOptions( $direction, $limit, UUID $offset = null ) { return array( 'sort' => 'rev_id', 'order' => $direction === 'fwd' ? 'DESC' : 'ASC', @@ -120,7 +119,7 @@ $trimmedResultAfterFiltering = array_slice( $resultAfterFiltering, 0, $remainingNeeded ); $result = array_merge( $result, $trimmedResultAfterFiltering ); - } while( count( $result ) < $limit && $internalOverfetched !== null ); + } while ( count( $result ) < $limit && $internalOverfetched !== null ); return $result; } diff --git a/includes/Formatter/RevisionFormatter.php b/includes/Formatter/RevisionFormatter.php index 9a5c2d3..241f172 100644 --- a/includes/Formatter/RevisionFormatter.php +++ b/includes/Formatter/RevisionFormatter.php @@ -495,7 +495,7 @@ if ( !$this->permissions->isAllowed( $revision, $type ) ) { continue; } - switch( $type ) { + switch ( $type ) { case 'thank': if ( // thanks extension must be available @@ -639,7 +639,7 @@ throw new FlowException( "$type called without \$postId" ); } $moderateAction = $flowAction = null; - switch( $revision->getModerationState() ) { + switch ( $revision->getModerationState() ) { case AbstractRevision::MODERATED_HIDDEN: case AbstractRevision::MODERATED_DELETED: case AbstractRevision::MODERATED_SUPPRESSED: @@ -659,7 +659,7 @@ // Need to use 'edit-topic-summary' to match FlowActions case 'edit-topic-summary': // summarize link is only available to topic workflow - if( !in_array( $workflow->getType(), array( 'topic', 'topicsummary' ) ) ) { + if ( !in_array( $workflow->getType(), array( 'topic', 'topicsummary' ) ) ) { continue; } $links['summarize'] = $this->urlGenerator->editTopicSummaryAction( $title, $workflowId ); @@ -696,7 +696,7 @@ $links = array(); foreach ( $linkTypes as $type ) { - switch( $type ) { + switch ( $type ) { case 'watch-topic': $links['watch-topic'] = $this->urlGenerator->watchTopicLink( $title, $workflowId ); break; diff --git a/includes/Formatter/TopicFormatter.php b/includes/Formatter/TopicFormatter.php index 6ded65d..8872681 100644 --- a/includes/Formatter/TopicFormatter.php +++ b/includes/Formatter/TopicFormatter.php @@ -41,7 +41,7 @@ public function formatApi( Workflow $listWorkflow, array $found, IContextSource $ctx ) { $roots = $revisions = $posts = $replies = array(); - foreach( $found as $formatterRow ) { + foreach ( $found as $formatterRow ) { $serialized = $this->serializer->formatApi( $formatterRow, $ctx ); if ( !$serialized ) { continue; @@ -107,7 +107,7 @@ foreach ( $data['replies'] as $postId ) { $stack->push( $revisions[$posts[$postId][0]] ); } - } while( !$stack->isEmpty() ); + } while ( !$stack->isEmpty() ); $workflow = isset( $workflows[$postAlphaId] ) ? $workflows[$postAlphaId] : null; diff --git a/includes/Formatter/TopicListFormatter.php b/includes/Formatter/TopicListFormatter.php index 163ee55..7df792b 100644 --- a/includes/Formatter/TopicListFormatter.php +++ b/includes/Formatter/TopicListFormatter.php @@ -67,7 +67,7 @@ */ public function buildResult( array $workflows, array $found, IContextSource $ctx ) { $revisions = $posts = $replies = array(); - foreach( $found as $formatterRow ) { + foreach ( $found as $formatterRow ) { $serialized = $this->serializer->formatApi( $formatterRow, $ctx ); if ( !$serialized ) { continue; @@ -138,7 +138,7 @@ foreach ( $data['replies'] as $postId ) { $stack->push( $revisions[$posts[$postId][0]] ); } - } while( !$stack->isEmpty() ); + } while ( !$stack->isEmpty() ); /** @var Workflow|null $workflow */ $workflow = isset( $workflows[$postAlphaId] ) ? $workflows[$postAlphaId] : null; diff --git a/includes/Formatter/TopicListQuery.php b/includes/Formatter/TopicListQuery.php index 1d5a632..01bfb8a 100644 --- a/includes/Formatter/TopicListQuery.php +++ b/includes/Formatter/TopicListQuery.php @@ -60,7 +60,7 @@ $replies = array(); foreach ( $posts as $post ) { try { - if ( !$this->permissions->isAllowed( $post, 'view' ) ) { + if ( !$this->permissions->isAllowed( $post, 'view' ) ) { continue; } $row = new TopicRow; diff --git a/includes/Log/ActionFormatter.php b/includes/Log/ActionFormatter.php index ad71d17..b8935dc 100644 --- a/includes/Log/ActionFormatter.php +++ b/includes/Log/ActionFormatter.php @@ -103,11 +103,9 @@ $rootLastRevision = $root->getLastRevision(); // Give grep a chance to find the usages: - // // A few of the -topic-title-not-visible are not reachable with the current // config (since people looking at the suppression log can see suppressed // content), but are included to make it less brittle. - // // logentry-delete-flow-delete-post, logentry-delete-flow-delete-post-topic-title-not-visible, // logentry-delete-flow-restore-post, logentry-delete-flow-restore-post-topic-title-not-visible, // logentry-suppress-flow-restore-post, logentry-suppress-flow-restore-post-topic-title-not-visible, diff --git a/includes/Log/ModerationLogger.php b/includes/Log/ModerationLogger.php index 4b2932b..f9a6f64 100644 --- a/includes/Log/ModerationLogger.php +++ b/includes/Log/ModerationLogger.php @@ -85,7 +85,7 @@ $logId = $logEntry->insert(); if ( $error ) { - wfDebugLog( 'Flow', __METHOD__ . ': Could not map workflowId to workflow object for ' . $workflowId->getAlphadecimal() . " log entry $logId defaulted to Main_Page"); + wfDebugLog( 'Flow', __METHOD__ . ': Could not map workflowId to workflow object for ' . $workflowId->getAlphadecimal() . " log entry $logId defaulted to Main_Page" ); } return $logId; @@ -98,7 +98,7 @@ */ public function getLogType( PostRevision $post, $action ) { $logType = $this->actions->getValue( $action, 'log_type' ); - if ( $logType instanceof Closure) { + if ( $logType instanceof Closure ) { $logType = $logType( $post, $this ); } diff --git a/includes/Model/AbstractRevision.php b/includes/Model/AbstractRevision.php index d5f080d..43f4813 100644 --- a/includes/Model/AbstractRevision.php +++ b/includes/Model/AbstractRevision.php @@ -286,7 +286,7 @@ * @return AbstractRevision */ public function moderate( User $user, $state, $changeType, $reason ) { - if ( ! $this->isValidModerationState( $state ) ) { + if ( !$this->isValidModerationState( $state ) ) { wfWarn( __METHOD__ . ': Provided moderation state does not exist : ' . $state ); return null; } @@ -504,7 +504,7 @@ // never trust incoming html - roundtrip to wikitext first if ( $format === 'html' ) { - $content = Utils::convert( $format, 'wikitext', $content, $title ); + $content = Utils::convert( $format, 'wikitext', $content, $title ); $format = 'wikitext'; } @@ -757,7 +757,7 @@ public static function getModerationChangeTypes() { if ( self::$moderationChangeTypes === null ) { self::$moderationChangeTypes = array(); - foreach( self::$perms as $perm ) { + foreach ( self::$perms as $perm ) { if ( $perm != '' ) { self::$moderationChangeTypes[] = "{$perm}-topic"; self::$moderationChangeTypes[] = "{$perm}-post"; @@ -840,7 +840,9 @@ // it is possible that more than 1 changes on the same page have the same timestamp // the revision id is hidden in rc_params['flow-workflow-change']['revision'] $revId = $this->revId->getAlphadecimal(); + // @codingStandardsIgnoreStart while ( $row = $rows->next() ) { + // @codingStandardsIgnoreEnd $rc = RecentChange::newFromRow( $row ); $params = $rc->parseParams(); if ( $params && $params['flow-workflow-change']['revision'] === $revId ) { diff --git a/includes/Model/PostRevision.php b/includes/Model/PostRevision.php index 520254f..f573b39 100644 --- a/includes/Model/PostRevision.php +++ b/includes/Model/PostRevision.php @@ -122,7 +122,7 @@ $obj = parent::fromStorageRow( $row, $obj ); $treeRevId = UUID::create( $row['tree_rev_id'] ); - if ( ! $obj->revId->equals( $treeRevId ) ) { + if ( !$obj->revId->equals( $treeRevId ) ) { $treeRevIdStr = ( $treeRevId !== null ) ? $treeRevId->getAlphadecimal() : var_export( $row['tree_rev_id'], true ); diff --git a/includes/Model/UUID.php b/includes/Model/UUID.php index d6e1ea6..2902ef6 100644 --- a/includes/Model/UUID.php +++ b/includes/Model/UUID.php @@ -345,7 +345,7 @@ */ public static function convertUUIDs( $array, $format = 'binary' ) { $array = ObjectManager::makeArray( $array ); - foreach( $array as $key => $value ) { + foreach ( $array as $key => $value ) { if ( $value instanceof UUIDBlob ) { // database encoded binary value if ( $format === 'alphadecimal' ) { diff --git a/includes/Notifications/Controller.php b/includes/Notifications/Controller.php index b38e2f2..c99f877 100644 --- a/includes/Notifications/Controller.php +++ b/includes/Notifications/Controller.php @@ -186,7 +186,7 @@ // pass along mentioned users to other notification, so it knows who to ignore $extraData['mentioned-users'] = $mentionedUsers; - switch( $eventName ) { + switch ( $eventName ) { case 'flow-post-reply': $extraData += array( 'reply-to' => $revision->getReplyToId(), @@ -646,7 +646,7 @@ $links = $output->getLinks(); - if ( ! isset( $links[NS_USER] ) || ! is_array( $links[NS_USER] ) ) { + if ( !isset( $links[NS_USER] ) || !is_array( $links[NS_USER] ) ) { // Nothing return array(); } @@ -797,7 +797,7 @@ * @param array $tree Tree structure * @return UUID First post ID found, or null on failure */ - protected function getFirstPreorderDepthFirst( array $relevantPostIds, UUID $root, array $tree ) { + protected function getFirstPreorderDepthFirst( array $relevantPostIds, UUID $root, array $tree ) { $rootAlpha = $root->getAlphadecimal(); if ( isset( $relevantPostIds[$rootAlpha] ) ) { @@ -811,7 +811,7 @@ } foreach ( $children as $child ) { - $relevantPostId = $this->getFirstPreorderDepthFirst( $relevantPostIds, UUID::create( $child ), $tree ); + $relevantPostId = $this->getFirstPreorderDepthFirst( $relevantPostIds, UUID::create( $child ), $tree ); if ( $relevantPostId !== null ) { return $relevantPostId; } diff --git a/includes/Notifications/FlowEnabledOnTalkpagePresentationModel.php b/includes/Notifications/FlowEnabledOnTalkpagePresentationModel.php index 973dfd2..41e5da1 100644 --- a/includes/Notifications/FlowEnabledOnTalkpagePresentationModel.php +++ b/includes/Notifications/FlowEnabledOnTalkpagePresentationModel.php @@ -33,7 +33,7 @@ public function getHeaderMessage() { $msg = parent::getHeaderMessage(); - $msg->params( $this->getTruncatedTitleText( $this->event->getTitle(), true) ); + $msg->params( $this->getTruncatedTitleText( $this->event->getTitle(), true ) ); return $msg; } diff --git a/includes/Notifications/MentionPresentationModel.php b/includes/Notifications/MentionPresentationModel.php index 16e37c0..00c126a 100644 --- a/includes/Notifications/MentionPresentationModel.php +++ b/includes/Notifications/MentionPresentationModel.php @@ -41,7 +41,7 @@ public function getHeaderMessage() { $msg = parent::getHeaderMessage(); - $msg->params( $this->getTruncatedTitleText( $this->event->getTitle(), true) ); + $msg->params( $this->getTruncatedTitleText( $this->event->getTitle(), true ) ); $msg->params( $this->getViewingUserForGender() ); if ( in_array( $this->getRevisionType(), array( 'post', 'post-summary' ) ) ) { diff --git a/includes/Notifications/NewTopicPresentationModel.php b/includes/Notifications/NewTopicPresentationModel.php index d9558b9..b27e6a8 100644 --- a/includes/Notifications/NewTopicPresentationModel.php +++ b/includes/Notifications/NewTopicPresentationModel.php @@ -71,10 +71,10 @@ $count = $this->getNotificationCountForOutput(); // Repeat is B/C until unused parameter is removed from translations $msg->numParams( $count, $count ); - $msg->params( $this->getTruncatedTitleText( $this->event->getTitle(), true) ); + $msg->params( $this->getTruncatedTitleText( $this->event->getTitle(), true ) ); } else { $msg->params( $this->getAgentForOutput() ); - $msg->params( $this->getTruncatedTitleText( $this->event->getTitle(), true) ); + $msg->params( $this->getTruncatedTitleText( $this->event->getTitle(), true ) ); $msg->plaintextParams( $this->getTopicTitle() ); } diff --git a/includes/Notifications/PostReplyPresentationModel.php b/includes/Notifications/PostReplyPresentationModel.php index b084d8c..431cbea 100644 --- a/includes/Notifications/PostReplyPresentationModel.php +++ b/includes/Notifications/PostReplyPresentationModel.php @@ -77,7 +77,7 @@ return $msg; } else { $msg = parent::getHeaderMessage(); - $msg->params( $this->getTruncatedTitleText( $this->event->getTitle(), true) ); + $msg->params( $this->getTruncatedTitleText( $this->event->getTitle(), true ) ); $msg->plaintextParams( $this->getTopicTitle() ); return $msg; } @@ -92,9 +92,9 @@ public function getBodyMessage() { if ( !$this->isBundled() ) { if ( $this->isUserTalkPage() ) { - $msg = $this->msg("notification-body-flow-post-reply-v2"); + $msg = $this->msg( "notification-body-flow-post-reply-v2" ); } else { - $msg = $this->msg("notification-body-flow-post-reply-user-talk"); + $msg = $this->msg( "notification-body-flow-post-reply-user-talk" ); } $msg->plaintextParams( $this->getContentSnippet() ); return $msg; diff --git a/includes/Specials/SpecialEnableFlow.php b/includes/Specials/SpecialEnableFlow.php index c133581..bd54ecd 100644 --- a/includes/Specials/SpecialEnableFlow.php +++ b/includes/Specials/SpecialEnableFlow.php @@ -146,11 +146,11 @@ $params ); - foreach( $blocks as $block ) { + foreach ( $blocks as $block ) { if ( $block->hasErrors() ) { $errors = $block->getErrors(); - foreach( $errors as $errorKey ) { + foreach ( $errors as $errorKey ) { $status->fatal( $block->getErrorMessage( $errorKey ) ); } } -- To view, visit https://gerrit.wikimedia.org/r/358535 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I82bece77566ae8d5437c57fc39c52000b2422373 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Flow Gerrit-Branch: master Gerrit-Owner: Umherirrender <umherirrender_de...@web.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits