Make phpcs-strict pass on includes/ (5/~10)
authorSiebrand Mazeland <siebrand@kitano.nl>
Sun, 11 May 2014 15:59:57 +0000 (17:59 +0200)
committerReedy <reedy@wikimedia.org>
Sun, 11 May 2014 19:35:32 +0000 (19:35 +0000)
Change-Id: I259f3f11cfc22f3ed1693f9ebd5bd80491b8a6e8

includes/AutoLoader.php
includes/Message.php
includes/SiteStats.php
includes/SkinTemplate.php
includes/Title.php
includes/libs/JavaScriptMinifier.php
includes/libs/jsminplus.php
includes/libs/lessc.inc.php
includes/specials/SpecialEditWatchlist.php
includes/specials/SpecialWatchlist.php

index 0ee8225..cb1a052 100644 (file)
@@ -135,7 +135,7 @@ $wgAutoloadLocalClasses = array(
        'MagicWordArray' => 'includes/MagicWord.php',
        'MailAddress' => 'includes/UserMailer.php',
        'MediaWiki' => 'includes/Wiki.php',
-       'MediaWiki_I18N' => 'includes/SkinTemplate.php',
+       'MediaWikiI18N' => 'includes/SkinTemplate.php',
        'MediaWikiVersionFetcher' => 'includes/MediaWikiVersionFetcher.php',
        'Message' => 'includes/Message.php',
        'MessageBlobStore' => 'includes/MessageBlobStore.php',
index 179aca7..8d4058e 100644 (file)
@@ -963,7 +963,7 @@ class Message {
                $out = MessageCache::singleton()->parse(
                        $string,
                        $this->title,
-                        /*linestart*/true,
+                       /*linestart*/true,
                        $this->interface,
                        $this->language
                );
index 4685c3e..4e737d1 100644 (file)
  * Static accessor class for site_stats and related things
  */
 class SiteStats {
-       static $row, $loaded = false;
-       static $jobs;
-       static $pageCount = array();
-       static $groupMemberCounts = array();
+       /** @var bool|ResultWrapper */
+       private static $row;
+
+       /** @var bool */
+       private static $loaded = false;
+
+       /** @var int */
+       private static $jobs;
+
+       /** @var int[] */
+       private static $pageCount = array();
+
+       /** @var int[] */
+       private static $groupMemberCounts = array();
 
        static function recache() {
                self::load( true );
@@ -190,7 +200,10 @@ class SiteStats {
                if ( !isset( self::$jobs ) ) {
                        $dbr = wfGetDB( DB_SLAVE );
                        self::$jobs = array_sum( JobQueueGroup::singleton()->getQueueSizes() );
-                       /* Zero rows still do single row read for row that doesn't exist, but people are annoyed by that */
+                       /**
+                        * Zero rows still do single row read for row that doesn't exist,
+                        * but people are annoyed by that
+                        */
                        if ( self::$jobs == 1 ) {
                                self::$jobs = 0;
                        }
index 24854d8..e8fa944 100644 (file)
  * @private
  * @ingroup Skins
  */
-class MediaWiki_I18N {
-       var $_context = array();
+class MediaWikiI18N {
+       private $context = array();
 
        function set( $varName, $value ) {
-               $this->_context[$varName] = $value;
+               $this->context[$varName] = $value;
        }
 
        function translate( $value ) {
@@ -46,7 +46,7 @@ class MediaWiki_I18N {
                while ( preg_match( '/\$([0-9]*?)/sm', $value, $m ) ) {
                        list( $src, $var ) = $m;
                        wfSuppressWarnings();
-                       $varValue = $this->_context[$var];
+                       $varValue = $this->context[$var];
                        wfRestoreWarnings();
                        $value = str_replace( $src, $varValue, $value );
                }
@@ -68,35 +68,29 @@ class MediaWiki_I18N {
  * @ingroup Skins
  */
 class SkinTemplate extends Skin {
-       /**#@+
-        * @private
-        */
-
        /**
-        * Name of our skin, it probably needs to be all lower case.  Child classes
-        * should override the default.
+        * @var string Name of our skin, it probably needs to be all lower case.
+        *   Child classes should override the default.
         */
-       var $skinname = 'monobook';
+       public $skinname = 'monobook';
 
        /**
-        * Stylesheets set to use.  Subdirectory in skins/ where various stylesheets
-        * are located.  Child classes should override the default.
+        * @var string Stylesheets set to use. Subdirectory in skins/ where various
+        *   stylesheets are located.  Child classes should override the default.
         */
-       var $stylename = 'monobook';
+       public $stylename = 'monobook';
 
        /**
-        * For QuickTemplate, the name of the subclass which will actually fill the
-        * template.  Child classes should override the default.
+        * @var string For QuickTemplate, the name of the subclass which will
+        *   actually fill the template.  Child classes should override the default.
         */
-       var $template = 'QuickTemplate';
+       public $template = 'QuickTemplate';
 
        /**
-        * Whether this skin use OutputPage::headElement() to generate the "<head>"
-        * tag
+        * @var bool Whether this skin use OutputPage::headElement() to generate
+        *   the "<head>" tag.
         */
-       var $useHeadElement = false;
-
-       /**#@-*/
+       public $useHeadElement = false;
 
        /**
         * Add specific styles for this skin
@@ -187,7 +181,10 @@ class SkinTemplate extends Skin {
                                        'lang' => $ilInterwikiCodeBCP47,
                                        'hreflang' => $ilInterwikiCodeBCP47,
                                );
-                               wfRunHooks( 'SkinTemplateGetLanguageLink', array( &$languageLink, $languageLinkTitle, $this->getTitle() ) );
+                               wfRunHooks(
+                                       'SkinTemplateGetLanguageLink',
+                                       array( &$languageLink, $languageLinkTitle, $this->getTitle() )
+                               );
                                $languageLinks[] = $languageLink;
                        }
                }
@@ -402,7 +399,8 @@ class SkinTemplate extends Skin {
                // that interface elements are in a different language.
                $tpl->set( 'userlangattributes', '' );
                $tpl->set( 'specialpageattributes', '' ); # obsolete
-               // Used by VectorBeta to insert HTML before content but after the heading for the page title. Defaults to empty string.
+               // Used by VectorBeta to insert HTML before content but after the
+               // heading for the page title. Defaults to empty string.
                $tpl->set( 'prebodyhtml', '' );
 
                if ( $userLangCode !== $wgContLang->getHtmlCode() || $userLangDir !== $wgContLang->getDir() ) {
@@ -561,9 +559,14 @@ class SkinTemplate extends Skin {
                // and output printfooter and debughtml separately
                $tpl->set( 'bodycontent', $tpl->data['bodytext'] );
 
-               // Append printfooter and debughtml onto bodytext so that skins that were already
-               // using bodytext before they were split out don't suddenly start not outputting information
-               $tpl->data['bodytext'] .= Html::rawElement( 'div', array( 'class' => 'printfooter' ), "\n{$tpl->data['printfooter']}" ) . "\n";
+               // Append printfooter and debughtml onto bodytext so that skins that
+               // were already using bodytext before they were split out don't suddenly
+               // start not outputting information.
+               $tpl->data['bodytext'] .= Html::rawElement(
+                       'div',
+                       array( 'class' => 'printfooter' ),
+                       "\n{$tpl->data['printfooter']}"
+               ) . "\n";
                $tpl->data['bodytext'] .= $tpl->data['debughtml'];
 
                // allow extensions adding stuff after the page content.
@@ -733,7 +736,8 @@ class SkinTemplate extends Skin {
                        $login_url = array(
                                'text' => $this->msg( $loginlink )->text(),
                                'href' => self::makeSpecialUrl( 'Userlogin', $returnto ),
-                               'active' => $title->isSpecial( 'Userlogin' ) && ( $loginlink == 'nav-login-createaccount' || !$is_signup ),
+                               'active' => $title->isSpecial( 'Userlogin' )
+                                       && ( $loginlink == 'nav-login-createaccount' || !$is_signup ),
                        );
                        $createaccount_url = array(
                                'text' => $this->msg( 'pt-createaccount' )->text(),
@@ -875,9 +879,10 @@ class SkinTemplate extends Skin {
         * links, however these are usually automatically generated by SkinTemplate
         * itself and are not necessary when using a hook. The only things these may
         * matter to are people modifying content_navigation after it's initial creation:
-        * - id: A "preferred" id, most skins are best off outputting this preferred id for best compatibility
+        * - id: A "preferred" id, most skins are best off outputting this preferred
+        *   id for best compatibility.
         * - tooltiponly: This is set to true for some tabs in cases where the system
-        *                believes that the accesskey should not be added to the tab.
+        *   believes that the accesskey should not be added to the tab.
         *
         * @return array
         */
@@ -974,7 +979,9 @@ class SkinTemplate extends Skin {
                                wfProfileIn( __METHOD__ . '-edit' );
 
                                // Checks if user can edit the current page if it exists or create it otherwise
-                               if ( $title->quickUserCan( 'edit', $user ) && ( $title->exists() || $title->quickUserCan( 'create', $user ) ) ) {
+                               if ( $title->quickUserCan( 'edit', $user )
+                                       && ( $title->exists() || $title->quickUserCan( 'create', $user ) )
+                               ) {
                                        // Builds CSS class for talk page links
                                        $isTalkClass = $isTalk ? ' istalk' : '';
                                        // Whether the user is editing the page
@@ -985,14 +992,22 @@ class SkinTemplate extends Skin {
                                                && ( ( $isTalk && $this->isRevisionCurrent() ) || $out->showNewSectionLink() );
                                        $section = $request->getVal( 'section' );
 
-                                       if ( $title->exists() || ( $title->getNamespace() == NS_MEDIAWIKI && $title->getDefaultMessageText() !== false ) ) {
+                                       if ( $title->exists()
+                                               || ( $title->getNamespace() == NS_MEDIAWIKI
+                                                       && $title->getDefaultMessageText() !== false
+                                               )
+                                       ) {
                                                $msgKey = $isForeignFile ? 'edit-local' : 'edit';
                                        } else {
                                                $msgKey = $isForeignFile ? 'create-local' : 'create';
                                        }
                                        $content_navigation['views']['edit'] = array(
-                                               'class' => ( $isEditing && ( $section !== 'new' || !$showNewSection ) ? 'selected' : '' ) . $isTalkClass,
-                                               'text' => wfMessageFallback( "$skname-view-$msgKey", $msgKey )->setContext( $this->getContext() )->text(),
+                                               'class' => ( $isEditing && ( $section !== 'new' || !$showNewSection )
+                                                       ? 'selected'
+                                                       : ''
+                                               ) . $isTalkClass,
+                                               'text' => wfMessageFallback( "$skname-view-$msgKey", $msgKey )
+                                                       ->setContext( $this->getContext() )->text(),
                                                'href' => $title->getLocalURL( $this->editUrlOptions() ),
                                                'primary' => !$isForeignFile, // don't collapse this in vector
                                        );
@@ -1003,7 +1018,8 @@ class SkinTemplate extends Skin {
                                                //$content_navigation['actions']['addsection']
                                                $content_navigation['views']['addsection'] = array(
                                                        'class' => ( $isEditing && $section == 'new' ) ? 'selected' : false,
-                                                       'text' => wfMessageFallback( "$skname-action-addsection", 'addsection' )->setContext( $this->getContext() )->text(),
+                                                       'text' => wfMessageFallback( "$skname-action-addsection", 'addsection' )
+                                                               ->setContext( $this->getContext() )->text(),
                                                        'href' => $title->getLocalURL( 'action=edit&section=new' )
                                                );
                                        }
@@ -1012,7 +1028,8 @@ class SkinTemplate extends Skin {
                                        // Adds view source view link
                                        $content_navigation['views']['viewsource'] = array(
                                                'class' => ( $onPage && $action == 'edit' ) ? 'selected' : false,
-                                               'text' => wfMessageFallback( "$skname-action-viewsource", 'viewsource' )->setContext( $this->getContext() )->text(),
+                                               'text' => wfMessageFallback( "$skname-action-viewsource", 'viewsource' )
+                                                       ->setContext( $this->getContext() )->text(),
                                                'href' => $title->getLocalURL( $this->editUrlOptions() ),
                                                'primary' => true, // don't collapse this in vector
                                        );
@@ -1025,7 +1042,8 @@ class SkinTemplate extends Skin {
                                        // Adds history view link
                                        $content_navigation['views']['history'] = array(
                                                'class' => ( $onPage && $action == 'history' ) ? 'selected' : false,
-                                               'text' => wfMessageFallback( "$skname-view-history", 'history_short' )->setContext( $this->getContext() )->text(),
+                                               'text' => wfMessageFallback( "$skname-view-history", 'history_short' )
+                                                       ->setContext( $this->getContext() )->text(),
                                                'href' => $title->getLocalURL( 'action=history' ),
                                                'rel' => 'archives',
                                        );
@@ -1033,7 +1051,8 @@ class SkinTemplate extends Skin {
                                        if ( $title->quickUserCan( 'delete', $user ) ) {
                                                $content_navigation['actions']['delete'] = array(
                                                        'class' => ( $onPage && $action == 'delete' ) ? 'selected' : false,
-                                                       'text' => wfMessageFallback( "$skname-action-delete", 'delete' )->setContext( $this->getContext() )->text(),
+                                                       'text' => wfMessageFallback( "$skname-action-delete", 'delete' )
+                                                               ->setContext( $this->getContext() )->text(),
                                                        'href' => $title->getLocalURL( 'action=delete' )
                                                );
                                        }
@@ -1042,7 +1061,8 @@ class SkinTemplate extends Skin {
                                                $moveTitle = SpecialPage::getTitleFor( 'Movepage', $title->getPrefixedDBkey() );
                                                $content_navigation['actions']['move'] = array(
                                                        'class' => $this->getTitle()->isSpecial( 'Movepage' ) ? 'selected' : false,
-                                                       'text' => wfMessageFallback( "$skname-action-move", 'move' )->setContext( $this->getContext() )->text(),
+                                                       'text' => wfMessageFallback( "$skname-action-move", 'move' )
+                                                               ->setContext( $this->getContext() )->text(),
                                                        'href' => $moveTitle->getLocalURL()
                                                );
                                        }
@@ -1052,7 +1072,8 @@ class SkinTemplate extends Skin {
                                                $n = $title->isDeleted();
                                                if ( $n ) {
                                                        $undelTitle = SpecialPage::getTitleFor( 'Undelete' );
-                                                       // If the user can't undelete but can view deleted history show them a "View .. deleted" tab instead
+                                                       // If the user can't undelete but can view deleted
+                                                       // history show them a "View .. deleted" tab instead.
                                                        $msgKey = $user->isAllowed( 'undelete' ) ? 'undelete' : 'viewdeleted';
                                                        $content_navigation['actions']['undelete'] = array(
                                                                'class' => $this->getTitle()->isSpecial( 'Undelete' ) ? 'selected' : false,
@@ -1070,7 +1091,8 @@ class SkinTemplate extends Skin {
                                        $mode = $title->isProtected() ? 'unprotect' : 'protect';
                                        $content_navigation['actions'][$mode] = array(
                                                'class' => ( $onPage && $action == $mode ) ? 'selected' : false,
-                                               'text' => wfMessageFallback( "$skname-action-$mode", $mode )->setContext( $this->getContext() )->text(),
+                                               'text' => wfMessageFallback( "$skname-action-$mode", $mode )
+                                                       ->setContext( $this->getContext() )->text(),
                                                'href' => $title->getLocalURL( "action=$mode" )
                                        );
                                }
@@ -1375,7 +1397,7 @@ abstract class QuickTemplate {
         */
        function __construct() {
                $this->data = array();
-               $this->translator = new MediaWiki_I18N();
+               $this->translator = new MediaWikiI18N();
        }
 
        /**
@@ -1411,7 +1433,7 @@ abstract class QuickTemplate {
        }
 
        /**
-        * @param MediaWiki_I18N $t
+        * @param MediaWikiI18N $t
         */
        public function setTranslator( &$t ) {
                $this->translator = &$t;
@@ -1556,11 +1578,15 @@ abstract class BaseTemplate extends QuickTemplate {
                wfProfileIn( __METHOD__ );
 
                $toolbox = array();
-               if ( isset( $this->data['nav_urls']['whatlinkshere'] ) && $this->data['nav_urls']['whatlinkshere'] ) {
+               if ( isset( $this->data['nav_urls']['whatlinkshere'] )
+                       && $this->data['nav_urls']['whatlinkshere']
+               ) {
                        $toolbox['whatlinkshere'] = $this->data['nav_urls']['whatlinkshere'];
                        $toolbox['whatlinkshere']['id'] = 't-whatlinkshere';
                }
-               if ( isset( $this->data['nav_urls']['recentchangeslinked'] ) && $this->data['nav_urls']['recentchangeslinked'] ) {
+               if ( isset( $this->data['nav_urls']['recentchangeslinked'] )
+                       && $this->data['nav_urls']['recentchangeslinked']
+               ) {
                        $toolbox['recentchangeslinked'] = $this->data['nav_urls']['recentchangeslinked'];
                        $toolbox['recentchangeslinked']['msg'] = 'recentchangeslinked-toolbox';
                        $toolbox['recentchangeslinked']['id'] = 't-recentchangeslinked';
@@ -1576,7 +1602,9 @@ abstract class BaseTemplate extends QuickTemplate {
                                $toolbox['feeds']['links'][$key]['class'] = 'feedlink';
                        }
                }
-               foreach ( array( 'contributions', 'log', 'blockip', 'emailuser', 'userrights', 'upload', 'specialpages' ) as $special ) {
+               foreach ( array( 'contributions', 'log', 'blockip', 'emailuser',
+                       'userrights', 'upload', 'specialpages' ) as $special
+               ) {
                        if ( isset( $this->data['nav_urls'][$special] ) && $this->data['nav_urls'][$special] ) {
                                $toolbox[$special] = $this->data['nav_urls'][$special];
                                $toolbox[$special]['id'] = "t-$special";
@@ -1844,7 +1872,9 @@ abstract class BaseTemplate extends QuickTemplate {
                        }
                        while ( count( $wrapper ) > 0 ) {
                                $element = array_pop( $wrapper );
-                               $html = Html::rawElement( $element['tag'], isset( $element['attributes'] ) ? $element['attributes'] : null, $html );
+                               $html = Html::rawElement( $element['tag'], isset( $element['attributes'] )
+                                       ? $element['attributes']
+                                       : null, $html );
                        }
                }
 
@@ -1880,7 +1910,9 @@ abstract class BaseTemplate extends QuickTemplate {
                                        $attrs['class'] = $options['link-class'];
                                }
                        }
-                       $html = Html::rawElement( isset( $attrs['href'] ) ? 'a' : $options['link-fallback'], $attrs, $html );
+                       $html = Html::rawElement( isset( $attrs['href'] )
+                               ? 'a'
+                               : $options['link-fallback'], $attrs, $html );
                }
 
                return $html;
index 065a488..67958ff 100644 (file)
@@ -145,7 +145,7 @@ class Title {
        private $mNotificationTimestamp = array();
 
        /** @var bool Whether a page has any subpages */
-       var $mHasSubpages;
+       private $mHasSubpages;
 
        /** @var bool The (string) language code of the page's language and content code. */
        private $mPageLanguage = false;
index 998805a..2990782 100644 (file)
@@ -1,4 +1,5 @@
 <?php
+// @codingStandardsIgnoreFile File external to MediaWiki. Ignore coding conventions checks.
 /**
  * JavaScript Minifier
  *
index f250217..ed0382c 100644 (file)
@@ -1,4 +1,5 @@
 <?php
+// @codingStandardsIgnoreFile File external to MediaWiki. Ignore coding conventions checks.
 /**
  * JSMinPlus version 1.4
  *
index e57dbcf..37723d5 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-
+// @codingStandardsIgnoreFile File external to MediaWiki. Ignore coding conventions checks.
 /**
  * lessphp v0.4.0@2cc77e3c7b
  * http://leafo.net/lessphp
index 86433ca..ebbef17 100644 (file)
@@ -199,17 +199,17 @@ class SpecialEditWatchlist extends UnlistedSpecialPage {
                return true;
        }
 
-      public function submitClear( $data ) {
+       public function submitClear( $data ) {
                $current = $this->getWatchlist();
                $this->clearWatchlist();
                $this->getUser()->invalidateCache();
-                       $this->successMessage = $this->msg( 'watchlistedit-clear-done' )->parse();
+               $this->successMessage = $this->msg( 'watchlistedit-clear-done' )->parse();
                $this->successMessage .= ' ' . $this->msg( 'watchlistedit-clear-removed' )
                        ->numParams( count( $current ) )->parse();
                $this->showTitles( $current, $this->successMessage );
 
                return true;
-}
+       }
 
        /**
         * Print out a list of linked titles
index bae5ab3..490e81f 100644 (file)
@@ -51,7 +51,7 @@ class SpecialWatchlist extends ChangesListSpecialPage {
                        if ( $mode === SpecialEditWatchlist::EDIT_RAW ) {
                                $title = SpecialPage::getTitleFor( 'EditWatchlist', 'raw' );
                        } elseif ( $mode === SpecialEditWatchlist::EDIT_CLEAR ) {
-                                $title = SpecialPage::getTitleFor( 'EditWatchlist', 'clear' );
+                               $title = SpecialPage::getTitleFor( 'EditWatchlist', 'clear' );
                        } else {
                                $title = SpecialPage::getTitleFor( 'EditWatchlist' );
                        }