jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/357864 )

Change subject: Make phpcs pass - classes
......................................................................


Make phpcs pass - classes

Short array syntax will be used in follow ups
to keep this patch set small

Change-Id: I91a63277eae052dbb503f80b94cfd4fff3081941
---
M classes/DeletionController.php
M classes/Dispatch.php
M classes/HistoricalThread.php
M classes/Hooks.php
M classes/Thread.php
M classes/ThreadHistoryPager.php
M classes/View.php
7 files changed, 125 insertions(+), 121 deletions(-)

Approvals:
  jenkins-bot: Verified
  Jforrester: Looks good to me, approved



diff --git a/classes/DeletionController.php b/classes/DeletionController.php
index 22d7479..2ee0af1 100644
--- a/classes/DeletionController.php
+++ b/classes/DeletionController.php
@@ -30,7 +30,7 @@
                } elseif ( $thread->replies() ) {
                        foreach ( $thread->replies() as $reply ) {
                                $reply->setSuperthread( $thread->superthread() 
);
-                               $reply->save( );
+                               $reply->save();
                        }
                }
 
diff --git a/classes/Dispatch.php b/classes/Dispatch.php
index faeef52..fd64b64 100644
--- a/classes/Dispatch.php
+++ b/classes/Dispatch.php
@@ -44,8 +44,9 @@
                        $viewname = 'TalkpageView';
                } elseif ( !$lqt_action && (
                                ( !in_array( $action, $lqt_actions ) && $action 
) ||
-                               $request->getVal( 'diff', null ) !== null  ||
-                               $request->getVal( 'oldid', null ) !== null ) ) {
+                               $request->getVal( 'diff', null ) !== null ||
+                               $request->getVal( 'oldid', null ) !== null )
+               ) {
                        // Pass through wrapper
                        $viewname = 'TalkpageHeaderView';
                } elseif ( $action == 'protect' || $action == 'unprotect' ) {
diff --git a/classes/HistoricalThread.php b/classes/HistoricalThread.php
index 6d25622..61cc289 100644
--- a/classes/HistoricalThread.php
+++ b/classes/HistoricalThread.php
@@ -60,7 +60,6 @@
                return true;
        }
 
-
        function changeType() {
                return $this->changeType;
        }
diff --git a/classes/Hooks.php b/classes/Hooks.php
index 0b43ca9..58c623e 100644
--- a/classes/Hooks.php
+++ b/classes/Hooks.php
@@ -247,8 +247,8 @@
        }
 
        static function modifyOAIQuery( &$tables, &$fields, &$conds,
-                                       &$options, &$join_conds ) {
-
+               &$options, &$join_conds
+       ) {
                $tables[] = 'thread';
 
                $join_conds['thread'] = array( 'left join', array( 
'thread_root=page_id' ) );
@@ -284,7 +284,7 @@
         */
        public static function onUserRename( $renameUserSQL ) {
                // Always use the job queue, talk page edits will take forever
-               foreach( self::$userTables as $table => $fields ) {
+               foreach ( self::$userTables as $table => $fields ) {
                        $renameUserSQL->tablesJob[$table] = $fields;
                }
                return true;
@@ -303,7 +303,7 @@
         */
        public static function onUserMergeAccountFields( &$updateFields ) {
                // array( tableName, idField, textField )
-               foreach( self::$userTables as $table => $fields ) {
+               foreach ( self::$userTables as $table => $fields ) {
                        $updateFields[] = array( $table, $fields[1], $fields[0] 
);
                }
                return true;
@@ -389,7 +389,7 @@
                if ( $updater instanceof PostgresUpdater ) {
                        $updater->addExtensionTable( 'thread', 
"$dir/lqt.pg.sql" );
                        $updater->addExtensionTable( 'thread_history',
-                               
"$dir/schema-changes/thread_history_table.pg.sql"  );
+                               
"$dir/schema-changes/thread_history_table.pg.sql" );
                        $updater->addExtensionTable( 
'thread_pending_relationship',
                                
"$dir/schema-changes/thread_pending_relationship.pg.sql" );
                        $updater->addExtensionTable( 'thread_reaction',
@@ -582,30 +582,31 @@
         * @return bool
         */
        static function onPageContentSaveComplete( &$article, &$user, $content, 
$summary,
-                       $minoredit, $watchthis, $sectionanchor, &$flags, 
$revision,
-                       &$status, $baseRevId ) {
-               if ( !$status->isGood() ) {
-                       // Failed
-                       return true;
-               }
+               $minoredit, $watchthis, $sectionanchor, &$flags, $revision,
+               &$status, $baseRevId
+       ) {
+               if ( !$status->isGood() ) {
+                       // Failed
+                       return true;
+               }
 
-               $title = $article->getTitle();
-               if ( $title->getNamespace() != NS_LQT_THREAD ) {
-                       // Not a thread
-                       return true;
-               }
+               $title = $article->getTitle();
+               if ( $title->getNamespace() != NS_LQT_THREAD ) {
+                       // Not a thread
+                       return true;
+               }
 
-               if ( !$baseRevId ) {
-                       // New page
-                       return true;
-               }
+               if ( !$baseRevId ) {
+                       // New page
+                       return true;
+               }
 
-               $thread = Threads::withRoot( $article );
+               $thread = Threads::withRoot( $article );
 
-               if ( !$thread ) {
-                       // No matching thread.
-                       return true;
-               }
+               if ( !$thread ) {
+                       // No matching thread.
+                       return true;
+               }
 
                LqtView::editMetadataUpdates(
                        array(
@@ -615,33 +616,33 @@
                        'text' => ContentHandler::getContentText( $content ),
                ) );
 
-               return true;
-       }
+               return true;
+       }
 
        /**
         * @param $title Title
         * @param $types
         * @return bool
         */
-       static function getProtectionTypes( $title, &$types ) {
-               $isLqtPage = LqtDispatch::isLqtPage( $title );
-               $isThread = $title->getNamespace() == NS_LQT_THREAD;
+       static function getProtectionTypes( $title, &$types ) {
+               $isLqtPage = LqtDispatch::isLqtPage( $title );
+               $isThread = $title->getNamespace() == NS_LQT_THREAD;
 
-               if ( !$isLqtPage && !$isThread ) {
-                       return true;
-               }
+               if ( !$isLqtPage && !$isThread ) {
+                       return true;
+               }
 
-               if ( $isLqtPage ) {
-                       $types[] = 'newthread';
-                       $types[] = 'reply';
-               }
+               if ( $isLqtPage ) {
+                       $types[] = 'newthread';
+                       $types[] = 'reply';
+               }
 
-               if ( $isThread ) {
-                       $types[] = 'reply';
-               }
+               if ( $isThread ) {
+                       $types[] = 'reply';
+               }
 
-               return true;
-       }
+               return true;
+       }
 
        /**
         * @param $vars sttsu
@@ -690,23 +691,24 @@
 
                $pageInfo['DiscussionThreading'] = array();
                $fields = array(
-                               'ThreadSubject',
-                               'ThreadParent',
-                               'ThreadAncestor',
-                               'ThreadPage',
-                               'ThreadID',
-                               'ThreadSummaryPage',
-                               'ThreadAuthor',
-                               'ThreadEditStatus',
-                               'ThreadType',
-                               'ThreadSignature',
-                       );
+                       'ThreadSubject',
+                       'ThreadParent',
+                       'ThreadAncestor',
+                       'ThreadPage',
+                       'ThreadID',
+                       'ThreadSummaryPage',
+                       'ThreadAuthor',
+                       'ThreadEditStatus',
+                       'ThreadType',
+                       'ThreadSignature',
+               );
 
                $skip = false;
 
                while ( $skip ? $reader->next() : $reader->read() ) {
                        if ( $reader->nodeType == XmlReader::END_ELEMENT &&
-                                       $reader->name == 'DiscussionThreading' 
) {
+                               $reader->name == 'DiscussionThreading'
+                       ) {
                                break;
                        }
 
@@ -750,12 +752,12 @@
                        }
                }
 
-               if ( ! isset( $pageInfo['DiscussionThreading'] ) ) {
-                       return true;
-               }
+               if ( ! isset( $pageInfo['DiscussionThreading'] ) ) {
+                       return true;
+               }
 
-               $statusValues = array_flip( self::$editedStati );
-               $typeValues = array_flip( self::$threadTypes );
+               $statusValues = array_flip( self::$editedStati );
+               $typeValues = array_flip( self::$threadTypes );
 
                $info = $pageInfo['DiscussionThreading'];
 
@@ -771,7 +773,7 @@
                }
 
                $thread = Thread::create( $root, $article, null, $type,
-                                               $subject, $summary, null, 
$signature );
+                       $subject, $summary, null, $signature );
 
                if ( isset( $info['ThreadSummaryPage'] ) ) {
                        $summaryPageName = $info['ThreadSummaryPage'];
@@ -781,7 +783,7 @@
                                $thread->setSummaryPage( $summaryPage );
                        } else {
                                self::addPendingRelationship( $thread->id(), 
'thread_summary_page',
-                                               $summaryPageName, 'article', 
$pendingRelationships );
+                                       $summaryPageName, 'article', 
$pendingRelationships );
                        }
                }
 
@@ -794,7 +796,7 @@
                                $thread->setSuperthread( $superthread );
                        } else {
                                self::addPendingRelationship( $thread->id(), 
'thread_parent',
-                                                               
$threadPageName, 'thread', $pendingRelationships );
+                                       $threadPageName, 'thread', 
$pendingRelationships );
                        }
                }
 
@@ -830,11 +832,11 @@
                $dbw = wfGetDB( DB_MASTER );
 
                $dbw->update( 'thread', array( 
$pendingRelationship['relationship'] => $articleID ),
-                               array( 'thread_id' => 
$pendingRelationship['thread'] ),
-                               __METHOD__ );
+                       array( 'thread_id' => $pendingRelationship['thread'] ),
+                       __METHOD__ );
 
                $dbw->delete( 'thread_pending_relationship',
-                               array( 'tpr_title' => 
$pendingRelationship['title'] ), __METHOD__ );
+                       array( 'tpr_title' => $pendingRelationship['title'] ), 
__METHOD__ );
        }
 
        /**
@@ -906,7 +908,7 @@
 
                $thread = Threads::withRoot( new Article( $title, 0 ) );
 
-               if ( ! $thread ) {
+               if ( !$thread ) {
                        return true;
                }
 
diff --git a/classes/Thread.php b/classes/Thread.php
index d483b31..c6da7e4 100644
--- a/classes/Thread.php
+++ b/classes/Thread.php
@@ -203,7 +203,7 @@
                        $reason = '';
                }
 
-               switch( $change_type ) {
+               switch ( $change_type ) {
                        case Threads::CHANGE_MOVED_TALKPAGE:
                                $log->addEntry( 'move', $this->title(), $reason,
                                        array( $original->getTitle(),
@@ -223,7 +223,6 @@
                                $oldParent = 
$change_object->dbVersion->isTopmostThread()
                                                ? ''
                                                : 
$change_object->dbVersion->superthread()->title();
-
 
                                $log->addEntry( 'merge', $this->title(), 
$reason,
                                        array( $oldParent, 
$change_object->superthread()->title() ) );
@@ -358,8 +357,8 @@
 
                $dbw = wfGetDB( DB_MASTER );
 
-               $dbw->delete( 'user_message_state', array( 'ums_thread' => 
$this->id() ),
-                                               __METHOD__ );
+               $dbw->delete( 'user_message_state', array( 'ums_thread' => 
$this->id() ),
+                       __METHOD__ );
 
                // Fix reply count.
                $t = $this->superthread();
@@ -767,7 +766,7 @@
        * Return the User object representing the author of the first revision
        * (or null, if the database is screwed up).
        */
-       public function loadOriginalAuthorFromRevision( ) {
+       public function loadOriginalAuthorFromRevision() {
                $this->dieIfHistorical();
 
                $dbr = wfGetDB( DB_SLAVE );
@@ -810,7 +809,7 @@
 
        // Lazy updates done whenever a thread is loaded.
        //  Much easier than running a long-running maintenance script.
-       public function doLazyUpdates( ) {
+       public function doLazyUpdates() {
                if ( $this->isHistorical() ) {
                        return; // Don't do lazy updates on stored historical 
threads.
                }
@@ -996,7 +995,9 @@
        public function checkReplies( $replies ) {
                // Fixes a bug where some history pages were not working, before
                //  superthread was properly instance-cached.
-               if ( $this->isHistorical() ) { return; }
+               if ( $this->isHistorical() ) {
+                       return;
+               }
                foreach ( $replies as $reply ) {
                        if ( ! $reply->hasSuperthread() ) {
                                throw new Exception( "Post " . $this->id() .
@@ -1190,7 +1191,7 @@
        }
 
        // The 'root' is the page in the Thread namespace corresponding to this 
thread.
-       public function root( ) {
+       public function root() {
                if ( !$this->rootId ) {
                        return null;
                }
@@ -1401,7 +1402,7 @@
 
                // Filter out article objects, there be dragons (or 
unserialization problems)
                $fields = array_diff( $fields, array( 'root', 'article', 
'summary', 'sleeping',
-                                                       'dbVersion' ) );
+                       'dbVersion' ) );
 
                return $fields;
        }
@@ -1422,7 +1423,8 @@
        public function rootRevision() {
                if ( !$this->isHistorical() ||
                        !isset( $this->topmostThread()->threadRevision ) ||
-                       ! $this->root() ) {
+                       ! $this->root()
+               ) {
                        return null;
                }
 
@@ -1440,7 +1442,7 @@
                $join_conds = array( 'page' => array( 'JOIN', 
'rev_page=page_id' ) );
 
                $row = $dbr->selectRow( array( 'revision', 'page' ), '*', 
$conds, __METHOD__,
-                               array( 'ORDER BY' => 'rev_timestamp DESC' ), 
$join_conds );
+                       array( 'ORDER BY' => 'rev_timestamp DESC' ), 
$join_conds );
 
                return $row->rev_id;
        }
@@ -1463,7 +1465,8 @@
                }
 
                foreach ( $this->replies() as $reply ) {
-                       if ( $obj = $reply->replyWithId( $id ) ) {
+                       $obj = $reply->replyWithId( $id );
+                       if ( $obj ) {
                                return $obj;
                        }
                }
@@ -1562,7 +1565,8 @@
                                if ( $t ) {
                                        break;
                                }
-                       } catch ( Exception $e ) { }
+                       } catch ( Exception $e ) {
+                       }
 
                        $subject = md5( mt_rand() ); // Just a random title
                        $ok = false;
diff --git a/classes/ThreadHistoryPager.php b/classes/ThreadHistoryPager.php
index db74c33..12102cc 100644
--- a/classes/ThreadHistoryPager.php
+++ b/classes/ThreadHistoryPager.php
@@ -68,7 +68,7 @@
 
                $row = $this->mCurrentRow;
 
-               switch( $name ) {
+               switch ( $name ) {
                        case 'th_timestamp':
                                $formatted = $wgLang->timeanddate( $value, true 
);
                                return $this->linkRenderer->makeLink(
@@ -112,7 +112,7 @@
 
                $msg = self::$change_names[$type];
 
-               switch( $type ) {
+               switch ( $type ) {
                        case Threads::CHANGE_EDITED_SUBJECT:
                                if ( $changeObject && $lastChangeObject ) {
                                        $args[] = $lastChangeObject->subject();
@@ -161,5 +161,7 @@
                return in_array( $name, $sortable_fields );
        }
 
-       public function getDefaultDirections() { return true; /* descending */ }
+       public function getDefaultDirections() {
+               return true; /* descending */
+       }
 }
diff --git a/classes/View.php b/classes/View.php
index 99dbdc0..67c1c70 100644
--- a/classes/View.php
+++ b/classes/View.php
@@ -249,9 +249,9 @@
        }
 
        static function talkpageLink( $title, $text = null , $method = null, 
$operand = null,
-                                       $includeFragment = true, $attribs = 
array(),
-                                       $options = array(), $perpetuateOffset = 
true )
-       {
+               $includeFragment = true, $attribs = array(),
+               $options = array(), $perpetuateOffset = true
+       ) {
                list( $title, $query ) = self::talkpageLinkData(
                        $title, $method, $operand,
                        $includeFragment,
@@ -273,8 +273,8 @@
         * @return array
         */
        static function talkpageLinkData( $title, $method = null, $operand = 
null,
-               $includeFragment = true, $perpetuateOffset = true )
-       {
+               $includeFragment = true, $perpetuateOffset = true
+       ) {
                global $wgRequest;
                $query = array();
 
@@ -326,15 +326,14 @@
         * @return
         */
        static function talkpageUrl( $title, $method = null, $operand = null,
-               $includeFragment = true, $perpetuateOffset = true )
-       {
+               $includeFragment = true, $perpetuateOffset = true
+       ) {
                list( $title, $query ) =
                        self::talkpageLinkData( $title, $method, $operand, 
$includeFragment,
                                                $perpetuateOffset );
 
                return $title->getLinkUrl( $query );
        }
-
 
        /**
         * Return a URL for the current page, including Title and query vars,
@@ -644,7 +643,6 @@
                                        array( 'class' => 'lqt-reply-form 
lqt-edit-form' ) );
                $this->output->addHTML( $html );
 
-
                try {
                        $t = $this->newReplyTitle( null, $thread );
                } catch ( Exception $excep ) {
@@ -927,8 +925,8 @@
 
        public function handleNonce( $submitted_nonce, $nonce_key ) {
                // Add a one-time random string to a hidden field. Store the 
random string
-               //      in memcached on submit and don't allow the edit to go 
ahead if it's already
-               //      been added.
+               // in memcached on submit and don't allow the edit to go ahead 
if it's already
+               // been added.
                if ( $submitted_nonce ) {
                        global $wgMemc;
 
@@ -1593,7 +1591,7 @@
                        $html = '';
 
                        // No way am I refactoring EditForm to return its 
output as HTML.
-                       //      so I'm just flushing the HTML and displaying it 
as-is.
+                       // so I'm just flushing the HTML and displaying it 
as-is.
                        $this->showPostEditingForm( $thread );
                        $html .= Xml::closeElement( 'div' );
                } elseif ( $showAnything ) {
@@ -1607,7 +1605,6 @@
                        $html .= Xml::closeElement( 'div' );
                        Hooks::run( 'LiquidThreadsShowPostThreadBody',
                                array( $thread, $this->request, &$html ) );
-
 
                        $html .= $this->showThreadToolbar( $thread );
                        $html .= $this->threadSignature( $thread );
@@ -1765,7 +1762,6 @@
        static function anchorName( $thread ) {
                return $thread->getAnchorName();
        }
-
 
        /**
         * Display a moved thread
@@ -2021,7 +2017,7 @@
                                ++$showCount;
                                if ( $showCount == 1 ) {
                                        // There's a post sep before each reply 
group to
-                                       //      separate from the parent thread.
+                                       // separate from the parent thread.
                                        $this->output->addHTML( $div );
                                }
 
@@ -2031,7 +2027,7 @@
 
                        // Handle must-show threads.
                        // FIXME this thread will be duplicated if somebody 
clicks the
-                       //      "show more" link (probably needs fixing in the 
JS)
+                       // "show more" link (probably needs fixing in the JS)
                        if ( $st->type() != Threads::TYPE_DELETED && !$shown &&
                                        array_key_exists( $st->id(), 
$mustShowThreads ) ) {
 
@@ -2060,8 +2056,8 @@
         * @throws Exception
         */
        function showThread( $thread, $levelNum = 1, $totalInLevel = 1,
-                       $options = array() ) {
-
+               $options = array()
+       ) {
                // Safeguard
                if ( $thread->type() & Threads::TYPE_DELETED ||
                                !$thread->root() ) {
@@ -2071,7 +2067,7 @@
                $this->threadNestingLevel++;
 
                // Figure out which threads *need* to be shown because they're 
involved in an
-               //      operation
+               // operation
                $mustShowOption = array();
                if ( isset( $options['mustShowThreads'] ) ) {
                        $mustShowOption = $options['mustShowThreads' ];
@@ -2227,7 +2223,7 @@
                                $cascadeOptions, $replyInterruption );
                } elseif ( $hasSubthreads && !$showThreads ) {
                        // If the thread has subthreads, but we don't want to 
show them, then
-                       //      show the reply form if necessary, and add the 
"Show X replies" link.
+                       // show the reply form if necessary, and add the "Show 
X replies" link.
                        if ( $replyTo ) {
                                $this->showReplyForm( $thread );
                        }
@@ -2243,7 +2239,7 @@
                        }
                } elseif ( $levelNum < $totalInLevel ) {
                        // If we have no replies, and we're not at the end of 
this level, add the post separator
-                       //      and a reply box if necessary.
+                       // and a reply box if necessary.
                        $this->output->addHTML(
                                Xml::tags( 'div', array( 'class' => 
'lqt-post-sep' ), '&#160;' ) );
 
@@ -2267,7 +2263,7 @@
                        }
                } elseif ( !$hasSubthreads && $replyTo ) {
                        // If we have no replies, we're at the end of this 
level, and we want to reply,
-                       //      show the reply box.
+                       // show the reply box.
                        $class = 'lqt-thread-replies lqt-thread-replies-' .
                                        $this->threadNestingLevel;
                        $html = Xml::openElement( 'div', array( 'class' => 
$class ) );
@@ -2286,16 +2282,15 @@
                }
 
                // I don't remember why this is here, commenting out.
-//             if ( $this->threadNestingLevel == 1 ) {
-//                     if ( !( $hasSubthreads && $showThreads && !$replyTo ) ) 
{
-//                             $this->showReplyBox( $thread );
-//                             $finishDiv = '';
-//                             $finishDiv .= Xml::tags( 'div', array( 'class' 
=> 'lqt-replies-finish' ),
-//                                     Xml::tags( 'div', array( 'class' => 
'lqt-replies-finish-corner' ), '&#160;' ) );
-//
-//                             $this->output->addHTML( $finishDiv );
-//                     }
-//             }
+               // if ( $this->threadNestingLevel == 1 ) {
+               //      if ( !( $hasSubthreads && $showThreads && !$replyTo ) ) 
{
+               //              $this->showReplyBox( $thread );
+               //              $finishDiv = '';
+               //              $finishDiv .= Xml::tags( 'div', [ 'class' => 
'lqt-replies-finish' ],
+               //                      Xml::tags( 'div', [ 'class' => 
'lqt-replies-finish-corner' ], '&#160;' ) );
+               //              $this->output->addHTML( $finishDiv );
+               //      }
+               // }
 
                $this->output->addHTML( Xml::closeElement( 'div' ) );
 
@@ -2316,9 +2311,10 @@
 
                $html = '';
                $html .= Xml::tags( 'div',
-                               array( 'class' => 'lqt-reply-form 
lqt-edit-form',
-                                       'style' => 'display: none;'      ),
-                               '' );
+                       array( 'class' => 'lqt-reply-form lqt-edit-form',
+                               'style' => 'display: none;' ),
+                       ''
+               );
 
                $this->output->addHTML( $html );
        }

-- 
To view, visit https://gerrit.wikimedia.org/r/357864
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I91a63277eae052dbb503f80b94cfd4fff3081941
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/LiquidThreads
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to