AntoniSiek has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/394324 )

Change subject: This commit partially fixes excludes from MobileFrontent 
extension
......................................................................

This commit partially fixes excludes from MobileFrontent extension

Rules that has been fully done:
- MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment
- MediaWiki.Usage.ExtendClassUsage.FunctionVarUsage
- MediaWiki.Commenting.FunctionComment

Rules that has been partially done:
- MediaWiki.Commenting.FunctionComment.MissingParamComment

Rules that hasn't been done:
- MediaWiki.Commenting.FunctionComment.MissingDocumentationProtected
- MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic

Bug: T170579
Change-Id: Id8919e1d3b557fd8e7f8a3a4eb20af271bafcf2c
---
M .phpcs.xml
M extension.json
M includes/MobileContext.php
M includes/MobileFormatter.php
M includes/MobileFrontend.body.php
M includes/MobileFrontend.hooks.php
M includes/MobileFrontend.skin.hooks.php
M includes/MobileUI.php
M includes/WMFBaseDomainExtractor.php
M includes/api/ApiMobileView.php
M includes/models/MobileCollection.php
M includes/models/MobilePage.php
M includes/modules/MFResourceLoaderParsedMessageModule.php
M includes/modules/MobileSiteModule.php
M includes/specials/MobileSpecialPage.php
M includes/specials/SpecialMobileContributions.php
M includes/specials/SpecialMobileDiff.php
M includes/specials/SpecialMobileEditWatchlist.php
M includes/specials/SpecialMobilePreferences.php
M includes/specials/SpecialMobileWatchlist.php
M includes/specials/SpecialNearby.php
M includes/specials/SpecialUploads.php
M tests/phpunit/MobileFormatterTest.php
M tests/phpunit/api/ApiMobileViewTest.php
M tests/phpunit/context/MobileContextShouldDisplayMobileViewIntegrationTest.php
M tests/phpunit/context/MobileContextWikibaseDescriptionsTest.php
M tests/phpunit/devices/AMFDeviceDetectorTest.php
M tests/phpunit/devices/CustomHeaderDeviceDetectorTest.php
M tests/phpunit/devices/DeviceDetectorServiceIntegrationTest.php
M tests/phpunit/devices/DeviceDetectorServiceTest.php
M tests/phpunit/devices/UADeviceDetectorTest.php
M tests/phpunit/diff/InlineDifferenceEngineTest.php
M tests/phpunit/specials/SpecialMobileLanguagesTest.php
33 files changed, 135 insertions(+), 94 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/24/394324/1

diff --git a/.phpcs.xml b/.phpcs.xml
index 600fc10..f1d36e0 100644
--- a/.phpcs.xml
+++ b/.phpcs.xml
@@ -6,9 +6,6 @@
                <exclude 
name="MediaWiki.Commenting.FunctionComment.MissingParamComment" />
                <exclude name="MediaWiki.Files.ClassMatchesFilename.NotMatch" />
                <exclude name="MediaWiki.Files.OneClassPerFile.MultipleFound" />
-               <exclude 
name="MediaWiki.NamingConventions.LowerCamelFunctionsName.FunctionName"/>
-               <exclude 
name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment"/>
-               <exclude 
name="MediaWiki.Usage.ExtendClassUsage.FunctionVarUsage"/>
        </rule>
        <rule ref="Generic.Files.LineLength">
                <exclude-pattern>MobileFrontend\.alias\.php</exclude-pattern>
diff --git a/extension.json b/extension.json
index 85f05ce..a0f6d8d 100644
--- a/extension.json
+++ b/extension.json
@@ -1146,8 +1146,8 @@
                "ResourceLoaderGetConfigVars": [
                        "MobileFrontendHooks::onResourceLoaderGetConfigVars"
                ],
-               "SpecialPage_initList": [
-                       "MobileFrontendHooks::onSpecialPage_initList"
+               "onSpecialPageInitList": [
+                       "MobileFrontendHooks::onSpecialPageInitList"
                ],
                "ListDefinedTags": [
                        "MobileFrontendHooks::onListDefinedTags"
@@ -1155,8 +1155,8 @@
                "ChangeTagsListActive": [
                        "MobileFrontendHooks::onListDefinedTags"
                ],
-               "RecentChange_save": [
-                       "MobileFrontendHooks::onRecentChange_save"
+               "onRecentChangeSave": [
+                       "MobileFrontendHooks::onRecentChangeSave"
                ],
                "AbuseFilter-generateUserVars": [
                        "MobileFrontendHooks::onAbuseFilterGenerateUserVars"
@@ -1195,7 +1195,7 @@
                        "MobileFrontendHooks::onOutputPageParserOutput"
                ],
                "HTMLFileCache::useFileCache": [
-                       "MobileFrontendHooks::onHTMLFileCache_useFileCache"
+                       "MobileFrontendHooks::onHTMLFileCacheUseFileCache"
                ],
                "LoginFormValidErrorMessages": [
                        "MobileFrontendHooks::onLoginFormValidErrorMessages"
diff --git a/includes/MobileContext.php b/includes/MobileContext.php
index 4f4e6af..e918d2a 100644
--- a/includes/MobileContext.php
+++ b/includes/MobileContext.php
@@ -835,7 +835,8 @@
         */
        protected function updateMobileUrlHost( &$parsedUrl ) {
                if ( IP::isIPAddress( $parsedUrl['host'] ) ) {
-                       return; // Do not update host when IP is used
+                       // Do not update host when IP is used
+                       return;
                }
                $mobileUrlHostTemplate = $this->parseMobileUrlTemplate( 'host' 
);
                if ( !strlen( $mobileUrlHostTemplate ) ) {
@@ -850,7 +851,8 @@
                        if ( strstr( $templateHostPart, '%h' ) ) {
                                $parsedHostPartKey = substr( $templateHostPart, 
2 );
                                if ( !array_key_exists( $parsedHostPartKey, 
$parsedHostParts ) ) {
-                                       return; // invalid pattern for this 
host, ignore
+                                       // invalid pattern for this host, ignore
+                                       return;
                                }
                                $targetHostParts[$key] = 
$parsedHostParts[$parsedHostPartKey];
                        } elseif ( isset( $parsedHostParts[$key] )
diff --git a/includes/MobileFormatter.php b/includes/MobileFormatter.php
index 34c6226..fd063c3 100644
--- a/includes/MobileFormatter.php
+++ b/includes/MobileFormatter.php
@@ -360,7 +360,7 @@
 
                                $parent = $list->parentNode;
                                $placeholder = $doc->createElement( 'a',
-                                       wfMessage( 
'mobile-frontend-references-list' ) );
+                                       $this->msg( 
'mobile-frontend-references-list' ) );
                                $placeholder->setAttribute( 'class', 
'mf-lazy-references-placeholder' );
                                // Note to render a reference we need to know 
only its reference
                                // Note: You can have multiple <references> tag 
on the same page, we render all of these in
@@ -528,7 +528,7 @@
                foreach ( $domElemsToReplace as $element ) {
                        $alt = $element->getAttribute( 'alt' );
                        if ( $alt === '' ) {
-                               $alt = '[' . wfMessage( 
'mobile-frontend-missing-image' )->inContentLanguage() . ']';
+                               $alt = '[' . $this->msg( 
'mobile-frontend-missing-image' )->inContentLanguage() . ']';
                        } else {
                                $alt = '[' . $alt . ']';
                        }
@@ -559,7 +559,7 @@
         * @return string Wiki text
         */
        protected function msg( $key ) {
-               return wfMessage( $key )->text();
+               return $this->msg( $key )->text();
        }
 
        /**
@@ -696,7 +696,7 @@
                                                $toc = $doc->createElement( 
'div' );
                                                $toc->setAttribute( 'id', 'toc' 
);
                                                $toc->setAttribute( 'class', 
'toc-mobile' );
-                                               $tocHeading = 
$doc->createElement( 'h2', wfMessage( 'toc' )->text() );
+                                               $tocHeading = 
$doc->createElement( 'h2', $this->msg( 'toc' )->text() );
                                                $toc->appendChild( $tocHeading 
);
                                                $sectionBody->appendChild( $toc 
);
                                        }
diff --git a/includes/MobileFrontend.body.php b/includes/MobileFrontend.body.php
index 8256a36..5636ba7 100644
--- a/includes/MobileFrontend.body.php
+++ b/includes/MobileFrontend.body.php
@@ -32,7 +32,7 @@
         *
         * @return string
         */
-       public static function DOMParse( OutputPage $out, $text = null ) {
+       public static function domParse( OutputPage $out, $text = null ) {
                $context = MobileContext::singleton();
                $config = $context->getMFConfig();
                $factory = new ContentProviderFactory();
@@ -70,7 +70,9 @@
 
                if ( $context->getContentTransformations() ) {
                        // Remove images if they're disabled from special 
pages, but don't transform otherwise
-                       $formatter->filterContent( /* remove defaults */ 
!$isSpecialPage,
+                       $formatter->filterContent(
+                               // remove defaults
+                               !$isSpecialPage,
                                $removeReferences, $removeImages, 
$showFirstParagraphBeforeInfobox );
                }
 
diff --git a/includes/MobileFrontend.hooks.php 
b/includes/MobileFrontend.hooks.php
index 7ece0ce..4f6f8a1 100644
--- a/includes/MobileFrontend.hooks.php
+++ b/includes/MobileFrontend.hooks.php
@@ -199,7 +199,7 @@
 
                // Perform a few extra changes if we are in mobile mode
                if ( $context->shouldDisplayMobileView() || $config->get( 
'MFAlwaysUseMobileFormatter' ) ) {
-                       $text = ExtMobileFrontend::DOMParse( $out, $text );
+                       $text = ExtMobileFrontend::domParse( $out, $text );
                }
 
                if ( $context->shouldDisplayMobileView() && 
!$title->isMainPage() && !$title->isSpecialPage() ) {
@@ -356,7 +356,8 @@
                $cookies[] = MobileContext::STOP_MOBILE_REDIRECT_COOKIE_NAME;
 
                if ( $context->shouldDisplayMobileView() || !$mobileUrlTemplate 
) {
-                       $cookies[] = MobileContext::OPTIN_COOKIE_NAME; // beta 
cookie
+                       // beta cookie
+                       $cookies[] = MobileContext::OPTIN_COOKIE_NAME;
                }
                // Redirect people who want so from HTTP to HTTPS. Ideally, 
should be
                // only for HTTP but we don't vary on protocol.
@@ -464,7 +465,7 @@
         * @param array &$list list of special page classes
         * @return bool hook return value
         */
-       public static function onSpecialPage_initList( &$list ) {
+       public static function onSpecialPageInitList( &$list ) {
                $ctx = MobileContext::singleton();
                // Perform substitutions of pages that are unsuitable for mobile
                // FIXME: Upstream these changes to core.
@@ -510,7 +511,7 @@
         * @param RecentChange $rc
         * @return bool
         */
-       public static function onRecentChange_save( RecentChange $rc ) {
+       public static function onRecentChangeSave( RecentChange $rc ) {
                $context = MobileContext::singleton();
                $userAgent = $context->getRequest()->getHeader( "User-agent" );
                $logType = $rc->getAttribute( 'rc_log_type' );
@@ -1096,7 +1097,7 @@
         *
         * @return bool
         */
-       public static function onHTMLFileCache_useFileCache() {
+       public static function onHTMLFileCacheUseFileCache() {
                return !MobileContext::singleton()->shouldDisplayMobileView();
        }
 
@@ -1139,13 +1140,19 @@
        public static function onLoginFormValidErrorMessages( &$messages ) {
                $messages = array_merge( $messages,
                        [
-                               'mobile-frontend-watchlist-signup-action', // 
watchstart sign up CTA
-                               'mobile-frontend-watchlist-purpose', // 
Watchlist and watchstar sign in CTA
-                               'mobile-frontend-donate-image-anon', // Uploads 
link
-                               'mobile-frontend-edit-login-action', // Edit 
button sign in CTA
-                               'mobile-frontend-edit-signup-action', // Edit 
button sign-up CTA
+                               // watchstart sign up CTA
+                               'mobile-frontend-watchlist-signup-action',
+                               // Watchlist and watchstar sign in CTA
+                               'mobile-frontend-watchlist-purpose',
+                               // Uploads link
+                               'mobile-frontend-donate-image-anon',
+                               // Edit button sign in CTA
+                               'mobile-frontend-edit-login-action',
+                               // Edit button sign-up CTA
+                               'mobile-frontend-edit-signup-action',
                                'mobile-frontend-donate-image-login-action',
-                               'mobile-frontend-generic-login-new', // default 
message
+                               // default message
+                               'mobile-frontend-generic-login-new',
                        ]
                );
        }
diff --git a/includes/MobileFrontend.skin.hooks.php 
b/includes/MobileFrontend.skin.hooks.php
index fbe446e..b46c423 100644
--- a/includes/MobileFrontend.skin.hooks.php
+++ b/includes/MobileFrontend.skin.hooks.php
@@ -67,7 +67,7 @@
         * Returns HTML of terms of use link or null if it shouldn't be 
displayed
         * Note: This is called by a hook in the WikimediaMessages extension.
         *
-        * @param Skin $sk
+        * @param Skin $sk Name of skin to use
         * @param string $urlMsgKey Key of i18n message containing terms of use 
URL (optional)
         * @return null|string
         */
@@ -136,7 +136,8 @@
                                'Creative Commons Attribution-Share Alike 3.0' 
=> 'CC BY-SA 3.0',
                                'Creative Commons Attribution Share Alike' => 
'CC BY-SA',
                                'Creative Commons Attribution 3.0' => 'CC BY 
3.0',
-                               'Creative Commons Attribution 2.5' => 'CC BY 
2.5', // Wikinews
+                               // Wikinews
+                               'Creative Commons Attribution 2.5' => 'CC BY 
2.5',
                                'Creative Commons Attribution' => 'CC BY',
                                'Creative Commons Attribution Non-Commercial 
Share Alike' => 'CC BY-NC-SA',
                                'Creative Commons Zero (Public Domain)' => 'CC0 
(Public Domain)',
diff --git a/includes/MobileUI.php b/includes/MobileUI.php
index fe7f204..f97d5d7 100644
--- a/includes/MobileUI.php
+++ b/includes/MobileUI.php
@@ -12,7 +12,7 @@
 
        /**
         * Get CSS classes for icons
-        * @param string $iconName
+        * @param string $iconName name of icon
         * @param string $iconType element or before
         * @param string $additionalClassNames additional class names you want 
to associate
         *  with the iconed element
@@ -115,7 +115,7 @@
 
        /**
         * Mark some html as being content
-        * @param string $html
+        * @param string $html HTML to process
         * @param string $className additional class names
         * @return string of html
         */
diff --git a/includes/WMFBaseDomainExtractor.php 
b/includes/WMFBaseDomainExtractor.php
index 624cb06..4169ae1 100644
--- a/includes/WMFBaseDomainExtractor.php
+++ b/includes/WMFBaseDomainExtractor.php
@@ -29,15 +29,19 @@
                'wikidata.org',
                'mediawiki.org',
                'wikimediafoundation.org',
-               'local.wmftest.net' // local vagrant instances
+               // local vagrant instances
+               'local.wmftest.net'
        ];
        /**
         * @var string[]
         */
        private $wmfMultiDomainWikiHosts = [
-               '.wikimedia.org', // commons, office, meta, outreach, 
wikimania, incubator, etc...
-               '.beta.wmflabs.org', // beta cluster
-               '.wmflabs.org' // all other labs
+                // commons, office, meta, outreach, wikimania, incubator, 
etc...
+               '.wikimedia.org',
+                // beta cluster
+               '.beta.wmflabs.org',
+               // all other labs
+               '.wmflabs.org'
        ];
 
        /**
diff --git a/includes/api/ApiMobileView.php b/includes/api/ApiMobileView.php
index dd0591d..771d09d 100644
--- a/includes/api/ApiMobileView.php
+++ b/includes/api/ApiMobileView.php
@@ -94,7 +94,8 @@
                $moduleName = $this->getModuleName();
 
                if ( $this->offset === 0 && $this->maxlen === 0 ) {
-                       $this->offset = -1; // Disable text splitting
+                       // Disable text splitting
+                       $this->offset = -1;
                } elseif ( $this->maxlen === 0 ) {
                        $this->maxlen = PHP_INT_MAX;
                }
@@ -351,9 +352,11 @@
         */
        private function stringSplitter( $text ) {
                if ( $this->offset < 0 ) {
-                       return $text; // NOOP - string splitting mode is off
+                        // NOOP - string splitting mode is off
+                       return $text;
                } elseif ( $this->maxlen < 0 ) {
-                       return ''; // Limit exceeded
+                       // Limit exceeded
+                       return '';
                }
                $textLen = mb_strlen( $text );
                $start = $this->offset;
@@ -770,7 +773,8 @@
                                        : $file->getWidth();
                        }
                        if ( !$resize ) {
-                               $resize['width'] = $resize['height'] = 50; // 
Default
+                               // Default
+                               $resize['width'] = $resize['height'] = 50;
                        }
                        $thumb = $file->transform( $resize );
                        if ( !$thumb ) {
diff --git a/includes/models/MobileCollection.php 
b/includes/models/MobileCollection.php
index 98959a2..8adcfb2 100644
--- a/includes/models/MobileCollection.php
+++ b/includes/models/MobileCollection.php
@@ -27,7 +27,7 @@
        /**
         * Adds a page to the collection.
         *
-        * @param MobilePage $page
+        * @param MobilePage $page Mobile page to be added to collection
         */
        public function add( MobilePage $page ) {
                $this->pages[] = $page;
diff --git a/includes/models/MobilePage.php b/includes/models/MobilePage.php
index 71ecbe8..502cf86 100644
--- a/includes/models/MobilePage.php
+++ b/includes/models/MobilePage.php
@@ -35,8 +35,8 @@
 
        /**
         * Constructor
-        * @param Title $title
-        * @param File|bool $file
+        * @param Title $title Title of Mobile Page
+        * @param File|bool $file Image of Mobile Page
         */
        public function __construct( Title $title, $file = false ) {
                $this->title = $title;
@@ -118,7 +118,7 @@
 
        /**
         * Get a placeholder div container for thumbnails
-        * @param string $className
+        * @param string $className name of image's class
         * @param string $iconClassName controls size of thumbnail, defaults to 
empty string
         * @return string
         */
diff --git a/includes/modules/MFResourceLoaderParsedMessageModule.php 
b/includes/modules/MFResourceLoaderParsedMessageModule.php
index 634796e..6bc7bae 100644
--- a/includes/modules/MFResourceLoaderParsedMessageModule.php
+++ b/includes/modules/MFResourceLoaderParsedMessageModule.php
@@ -36,7 +36,7 @@
        /**
         * Process messages which have been marked as needing parsing
         *
-        * @param ResourceLoaderContext $context
+        * @param ResourceLoaderContext $context Information about the state of 
a specific loader request.
         * @return string JavaScript code
         */
        public function addParsedMessages( ResourceLoaderContext $context ) {
@@ -81,7 +81,7 @@
 
        /**
         * Get the URL or URLs to load for this module's JS in debug mode.
-        * @param ResourceLoaderContext $context
+        * @param ResourceLoaderContext $context Information about the state of 
a specific loader request.
         * @return array list of urls
         * @see ResourceLoaderModule::getScriptURLsForDebug
         */
diff --git a/includes/modules/MobileSiteModule.php 
b/includes/modules/MobileSiteModule.php
index 9c39d30..d84342b 100644
--- a/includes/modules/MobileSiteModule.php
+++ b/includes/modules/MobileSiteModule.php
@@ -18,7 +18,7 @@
        /**
         * Get a list of pages used by this module.
         *
-        * @param ResourceLoaderContext $context
+        * @param ResourceLoaderContext $context Information about the state of 
a specific loader request.
         * @return array
         */
        protected function getPages( ResourceLoaderContext $context ) {
diff --git a/includes/specials/MobileSpecialPage.php 
b/includes/specials/MobileSpecialPage.php
index 2be1028..33a101a 100644
--- a/includes/specials/MobileSpecialPage.php
+++ b/includes/specials/MobileSpecialPage.php
@@ -92,7 +92,9 @@
                $out = $this->getOutput();
                $rl = $out->getResourceLoader();
                $title = $this->getPageTitle();
-               list( $name, /* $subpage */ ) = 
SpecialPageFactory::resolveAlias( $title->getDBkey() );
+               list( $name,
+                       // $subpage
+               ) = SpecialPageFactory::resolveAlias( $title->getDBkey() );
                $id = strtolower( $name );
                // FIXME: These names should be more specific
                $specialStyleModuleName = 'mobile.special.' . $id . '.styles';
diff --git a/includes/specials/SpecialMobileContributions.php 
b/includes/specials/SpecialMobileContributions.php
index 769f126..a991076 100644
--- a/includes/specials/SpecialMobileContributions.php
+++ b/includes/specials/SpecialMobileContributions.php
@@ -84,7 +84,7 @@
 
        /**
         * Render the contributions of user to page
-        * @param ResultWrapper $res
+        * @param ResultWrapper $res List of contributors
         */
        protected function showContributions( ResultWrapper $res ) {
                $numRows = $res->numRows();
@@ -122,7 +122,7 @@
 
        /**
         * Render the contribution of the pagerevision (time, bytes 
added/deleted, pagename comment)
-        * @param Revision $rev
+        * @param Revision $rev Revision informations
         */
        protected function showContributionsRow( Revision $rev ) {
                $user = $this->getUser();
diff --git a/includes/specials/SpecialMobileDiff.php 
b/includes/specials/SpecialMobileDiff.php
index d10e628..fd73c13 100644
--- a/includes/specials/SpecialMobileDiff.php
+++ b/includes/specials/SpecialMobileDiff.php
@@ -380,7 +380,8 @@
                $req = MobileContext::singleton()->getRequest();
                $rev2 = $req->getText( 'diff' );
                $rev1 = $req->getText( 'oldid' );
-               if ( $rev1 == 'prev' || $rev1 == 'next' ) { // Actually, both 
do the same, WTF
+               // Actually, both do the same, WTF
+               if ( $rev1 == 'prev' || $rev1 == 'next' ) {
                        $rev1 = '';
                }
                // redirect requests to the diff page to mobile view
diff --git a/includes/specials/SpecialMobileEditWatchlist.php 
b/includes/specials/SpecialMobileEditWatchlist.php
index 2ba13ad..156ce83 100644
--- a/includes/specials/SpecialMobileEditWatchlist.php
+++ b/includes/specials/SpecialMobileEditWatchlist.php
@@ -233,7 +233,7 @@
        }
 
        /**
-        * @param MobileCollection $collection
+        * @param MobileCollection $collection Mobile page list
         * @return string html representation of collection in watchlist view
         */
        protected function getViewHtml( MobileCollection $collection ) {
diff --git a/includes/specials/SpecialMobilePreferences.php 
b/includes/specials/SpecialMobilePreferences.php
index b0a78ec..7f3c722 100644
--- a/includes/specials/SpecialMobilePreferences.php
+++ b/includes/specials/SpecialMobilePreferences.php
@@ -57,7 +57,8 @@
                $this->setHeaders();
                $this->outputHeader();
                $out = $this->getOutput();
-               $out->disallowUserJs(); // Prevent hijacked user scripts from 
sniffing passwords etc.
+               // Prevent hijacked user scripts from sniffing passwords etc.
+               $out->disallowUserJs();
                $this->requireLogin( 'prefsnologintext2' );
                $this->checkReadOnly();
 
diff --git a/includes/specials/SpecialMobileWatchlist.php 
b/includes/specials/SpecialMobileWatchlist.php
index 004b8c0..21ad109 100644
--- a/includes/specials/SpecialMobileWatchlist.php
+++ b/includes/specials/SpecialMobileWatchlist.php
@@ -9,7 +9,8 @@
  * Implements the Watchlist special page
  */
 class SpecialMobileWatchlist extends MobileSpecialPageFeed {
-       const LIMIT = 50; // Performance-safe value with PageImages
+       // Performance-safe value with PageImages
+       const LIMIT = 50;
        const THUMB_SIZE = MobilePage::SMALL_IMAGE_WIDTH;
        const VIEW_OPTION_NAME = 'mfWatchlistView';
        const FILTER_OPTION_NAME = 'mfWatchlistFilter';
@@ -123,7 +124,8 @@
                                break;
                        case 'articles':
                                // @fixme content namespaces
-                               $conds[] = "$column = 0"; // Has to be unquoted 
or MySQL will filesort for wl_namespace
+                               // Has to be unquoted or MySQL will filesort 
for wl_namespace
+                               $conds[] = "$column = 0";
                                break;
                        case 'talk':
                                // check project talk, user talk and talk pages
@@ -139,7 +141,7 @@
 
        /**
         * Get the header for the watchlist page
-        * @param User $user
+        * @param User $user Current user
         * @param string|null $view the name of the view to show (optional)
         *  If absent user preferences will be consulted.
         * @return string Parsed HTML
diff --git a/includes/specials/SpecialNearby.php 
b/includes/specials/SpecialNearby.php
index f9f3966..956f2f6 100644
--- a/includes/specials/SpecialNearby.php
+++ b/includes/specials/SpecialNearby.php
@@ -47,7 +47,8 @@
                                ),
                                'noscript'
                        ) .
-                       Html::closeElement( 'div' ); // #mw-mf-nearby
+                       // #mw-mf-nearby
+                       Html::closeElement( 'div' );
 
                $output->addHTML( $html );
        }
diff --git a/includes/specials/SpecialUploads.php 
b/includes/specials/SpecialUploads.php
index 955c8df..3525f32 100644
--- a/includes/specials/SpecialUploads.php
+++ b/includes/specials/SpecialUploads.php
@@ -62,7 +62,7 @@
        /**
         * Generates HTML for the uploads page for the passed user.
         *
-        * @param User $user
+        * @param User $user User to get uploads page from
         * @return string
         */
        public function getUserUploadsPageHtml( User $user ) {
diff --git a/tests/phpunit/MobileFormatterTest.php 
b/tests/phpunit/MobileFormatterTest.php
index 3974697..83e3dc9 100644
--- a/tests/phpunit/MobileFormatterTest.php
+++ b/tests/phpunit/MobileFormatterTest.php
@@ -64,7 +64,8 @@
                $showFirstParagraphBeforeInfobox = false
        ) {
                $t = Title::newFromText( 'Mobile' );
-               $input = str_replace( "\r", '', $input ); // "yay" to Windows!
+               // "yay" to Windows!
+               $input = str_replace( "\r", '', $input );
                $mf = new MobileFormatter( MobileFormatter::wrapHTML( $input ), 
$t );
                if ( $callback ) {
                        $callback( $mf );
diff --git a/tests/phpunit/api/ApiMobileViewTest.php 
b/tests/phpunit/api/ApiMobileViewTest.php
index 91cb2fd..e4c00c1 100644
--- a/tests/phpunit/api/ApiMobileViewTest.php
+++ b/tests/phpunit/api/ApiMobileViewTest.php
@@ -121,7 +121,8 @@
                        [ [ 1, 2 ], [ 11 ], '1|1|2|1|11|2|1' ],
                        [ [ 1, 3, 4, 5 ], [], '1|3-5|4' ],
                        [ [ 10 ], [], '10-' ],
-                       [ [], [ '20-' ], '20-' ], # 
https://bugzilla.wikimedia.org/show_bug.cgi?id=61868
+                       # https://bugzilla.wikimedia.org/show_bug.cgi?id=61868
+                       [ [], [ '20-' ], '20-' ],
                ];
        }
 
@@ -335,13 +336,15 @@
                                        'sections' => 1,
                                        'onlyrequestedsections' => true,
 
-                                       'prop' => 'namespace', // When the 
namespace is requested...
+                                       // When the namespace is requested...
+                                       'prop' => 'namespace',
                                ] + $baseIn,
                                [
                                        'mainpage' => '',
                                        'sections' => [],
 
-                                       'ns' => 0, // ... then it is returned.
+                                       // ... then it is returned.
+                                       'ns' => 0,
                                ],
                        ]
                ];
@@ -420,7 +423,8 @@
                                        'text' => '',
                                        'prop' => 'thumb',
                                        'thumbwidth' => 200,
-                                       'type' => 'image/svg' // contrived but 
needed for testing
+                                       // contrived but needed for testing
+                                       'type' => 'image/svg'
                                ],
                                [
                                        'sections' => [],
@@ -437,7 +441,8 @@
                                        'text' => '',
                                        'prop' => 'thumb',
                                        'thumbheight' => 200,
-                                       'type' => 'image/svg' // contrived but 
needed for testing
+                                       // contrived but needed for testing
+                                       'type' => 'image/svg'
                                ],
                                [
                                        'sections' => [],
@@ -454,7 +459,8 @@
                                        'text' => '',
                                        'prop' => 'thumb',
                                        'thumbwidth' => 800,
-                                       'type' => 'image/svg' // contrived but 
needed for testing
+                                       // contrived but needed for testing
+                                       'type' => 'image/svg'
                                ],
                                [
                                        'sections' => [],
@@ -471,7 +477,8 @@
                                        'text' => '',
                                        'prop' => 'thumb',
                                        'thumbheight' => 800,
-                                       'type' => 'image/svg' // contrived but 
needed for testing
+                                       // contrived but needed for testing
+                                       'type' => 'image/svg'
                                ],
                                [
                                        'sections' => [],
@@ -560,7 +567,8 @@
                        'onlyrequestedsections' => '',
                        'sections' => 1,
                        'prop' => 'protection|pageprops',
-                       'pageprops' => 'foo', // intentionally nonexistent
+                       // intentionally nonexistent
+                       'pageprops' => 'foo',
                ] );
 
                $context = new RequestContext();
@@ -575,9 +583,11 @@
                $pageprops = $result['mobileview']['pageprops'];
 
                $this->assertTrue( $protection[ApiResult::META_TYPE] === 
'assoc' );
-               $this->assertTrue( count( $protection ) === 1 ); // the only 
element is the array type flag
+               // the only element is the array type flag
+               $this->assertTrue( count( $protection ) === 1 );
                $this->assertTrue( $pageprops[ApiResult::META_TYPE] === 'assoc' 
);
-               $this->assertTrue( count( $pageprops ) === 1 ); // the only 
element is the array type flag
+               // the only element is the array type flag
+               $this->assertTrue( count( $pageprops ) === 1 );
        }
 
        /**
diff --git 
a/tests/phpunit/context/MobileContextShouldDisplayMobileViewIntegrationTest.php 
b/tests/phpunit/context/MobileContextShouldDisplayMobileViewIntegrationTest.php
index 56bb8ff..33ac0ab 100644
--- 
a/tests/phpunit/context/MobileContextShouldDisplayMobileViewIntegrationTest.php
+++ 
b/tests/phpunit/context/MobileContextShouldDisplayMobileViewIntegrationTest.php
@@ -30,7 +30,7 @@
        /**
         * @covers MobileContext::shouldDisplayMobileView
         */
-       public function test_it_can_be_overridden() {
+       public function testItCanBeOverridden() {
                $this->context->setForceMobileView( true );
 
                $this->assertTrue( $this->context->shouldDisplayMobileView() );
diff --git a/tests/phpunit/context/MobileContextWikibaseDescriptionsTest.php 
b/tests/phpunit/context/MobileContextWikibaseDescriptionsTest.php
index 1188bf4..5c38b0b 100644
--- a/tests/phpunit/context/MobileContextWikibaseDescriptionsTest.php
+++ b/tests/phpunit/context/MobileContextWikibaseDescriptionsTest.php
@@ -28,14 +28,14 @@
        /**
         * @covers MobileContext::shouldShowWikibaseDescriptions
         */
-       public function test_showing_descriptions_is_disabled_by_default() {
+       public function testShowingDescriptionsIsDisabledByDefault() {
                $this->assertFalse( 
$this->context->shouldShowWikibaseDescriptions( 'search' ) );
        }
 
        /**
         * @covers MobileContext::shouldShowWikibaseDescriptions
         */
-       public function test_showing_descriptions_can_be_enabled() {
+       public function testShowingDescriptionsCanBeEnabled() {
                $this->setMwGlobals( [
                        'wgMFUseWikibase' => true,
                ] );
@@ -63,7 +63,7 @@
         *
         * @covers MobileContext::shouldShowWikibaseDescriptions
         */
-       public function test_it_throws_an_exception_if_feature_is_invalid( 
$feature ) {
+       public function testItThrowsAnExceptionIfFeatureIsInvalid( $feature ) {
                $this->context->shouldShowWikibaseDescriptions( $feature );
        }
 }
diff --git a/tests/phpunit/devices/AMFDeviceDetectorTest.php 
b/tests/phpunit/devices/AMFDeviceDetectorTest.php
index 28fa503..c887e11 100644
--- a/tests/phpunit/devices/AMFDeviceDetectorTest.php
+++ b/tests/phpunit/devices/AMFDeviceDetectorTest.php
@@ -76,7 +76,7 @@
                ];
        }
 
-       public function test_it_should_handle_no_AMF_environment_variables() {
+       public function testItShouldHandleNoAMFEnvironmentVariables() {
                $this->assertNull(
                        $this->detector->detectDeviceProperties( 
$this->request, [] )
                );
diff --git a/tests/phpunit/devices/CustomHeaderDeviceDetectorTest.php 
b/tests/phpunit/devices/CustomHeaderDeviceDetectorTest.php
index 117867d..82b04f3 100644
--- a/tests/phpunit/devices/CustomHeaderDeviceDetectorTest.php
+++ b/tests/phpunit/devices/CustomHeaderDeviceDetectorTest.php
@@ -37,13 +37,13 @@
                $this->request = new FauxRequest();
        }
 
-       public function test_is_null_when_custom_header_isnt_present() {
+       public function testIsNullWhenCustomHeaderIsntPresent() {
                $this->assertNull(
                        $this->detector->detectDeviceProperties( 
$this->request, [] )
                );
        }
 
-       public function test_isMobile_when_mobile_header_is_present() {
+       public function testIsMobileWhenMobileHeaderIsPresent() {
                $this->request->setHeader( 'FooHeader',  '' );
 
                $properties = $this->detector->detectDeviceProperties( 
$this->request, [] );
diff --git a/tests/phpunit/devices/DeviceDetectorServiceIntegrationTest.php 
b/tests/phpunit/devices/DeviceDetectorServiceIntegrationTest.php
index 50f8324..be96dd7 100644
--- a/tests/phpunit/devices/DeviceDetectorServiceIntegrationTest.php
+++ b/tests/phpunit/devices/DeviceDetectorServiceIntegrationTest.php
@@ -52,7 +52,7 @@
                );
        }
 
-       public function test_it_should_handle_requests_from_mobile_UAs() {
+       public function testItShouldHandleRequestsFromMobileUAs() {
                $this->whenTheRequestIsFromAMobileUA();
 
                $properties = $this->detectDeviceProperties();
@@ -61,14 +61,14 @@
                $this->assertFalse( $properties->isTabletDevice() );
        }
 
-       public function test_it_should_handle_a_request_from_desktop_browsers() 
{
+       public function testItShouldHandleARequestFromDesktopBrowsers() {
                $properties = $this->detectDeviceProperties();
 
                $this->assertFalse( $properties->isMobileDevice() );
                $this->assertFalse( $properties->isTabletDevice() );
        }
 
-       public function test_it_should_prioritize_the_custom_request_header() {
+       public function testItShouldPrioritizeTheCustomRequestHeader() {
                // @codingStandardsIgnoreStart
                // The custom header //should// either be M or ZERO, per
                // 
<https://github.com/wikimedia/operations-puppet/blob/2a2714c28eab25eed469375dc5322ea6a6ef85df/modules/varnish/templates/text-frontend.inc.vcl.erb#L74-L78>.
@@ -85,7 +85,7 @@
        /**
         * @FIXME Should this really be the case?
         */
-       public function 
test_it_should_prioritize_the_amf_environment_variables() {
+       public function testItShouldPrioritizeTheAmfEvironmentVariables() {
                $this->request->setHeader( 'X-Subdomain', 'M' );
 
                $this->server[ 'AMF_DEVICE_IS_TABLET' ] = 'true';
@@ -99,7 +99,7 @@
                $this->assertTrue( $properties->isTabletDevice() );
        }
 
-       public function test_it_should_handle_device_detection_being_disabled() 
{
+       public function testItShouldHandleDeviceDetectionBeingDisabled() {
                $this->setMwGlobals( 'wgMFAutodetectMobileView', false );
 
                $this->whenTheRequestIsFromAMobileUA();
diff --git a/tests/phpunit/devices/DeviceDetectorServiceTest.php 
b/tests/phpunit/devices/DeviceDetectorServiceTest.php
index e9844c5..452886a 100644
--- a/tests/phpunit/devices/DeviceDetectorServiceTest.php
+++ b/tests/phpunit/devices/DeviceDetectorServiceTest.php
@@ -44,7 +44,7 @@
                return new DeviceDetectorService( array_map( $childFactory, 
$results ) );
        }
 
-       public function test_it_should_handle_one_child() {
+       public function testItShouldHandleOneChild() {
                $expectedProperties = new DeviceProperties( true, false );
                $detector = $this->createDetector( [ $expectedProperties ] );
 
@@ -53,7 +53,7 @@
                $this->assertSame( $expectedProperties, $properties );
        }
 
-       public function test_it_should_handle_many_children() {
+       public function testItShouldHandleManyChildren() {
                $expectedProperties = new DeviceProperties( true, false );
                $detector = $this->createDetector( [
                        null,
@@ -66,7 +66,7 @@
                $this->assertSame( $expectedProperties, $properties );
        }
 
-       public function test_it_should_handle_zero_children() {
+       public function testItShouldHandleZeroChildren() {
                $detector = $this->createDetector( [] );
 
                $properties = $detector->detectDeviceProperties( 
$this->request, [] );
diff --git a/tests/phpunit/devices/UADeviceDetectorTest.php 
b/tests/phpunit/devices/UADeviceDetectorTest.php
index c4f9201..2c74ed9 100644
--- a/tests/phpunit/devices/UADeviceDetectorTest.php
+++ b/tests/phpunit/devices/UADeviceDetectorTest.php
@@ -150,7 +150,7 @@
        /**
         * @dataProvider provideMobileUserAgents
         */
-       public function test_it_classifies_mobile_UAs_as_mobile_devices( 
$userAgent ) {
+       public function testItClassifiesMobileUAsAsMobileDevices( $userAgent ) {
                $this->assertTrue(
                        $this->detectDeviceProperties( $userAgent )
                                ->isMobileDevice()
@@ -160,14 +160,14 @@
        /**
         * @dataProvider provideDesktopUserAgents
         */
-       public function test_it_doesnt_classify_desktop_UAs_as_mobile_devices( 
$userAgent ) {
+       public function testItDoesntClassifyDesktopUAsAsMobileDevices( 
$userAgent ) {
                $this->assertFalse(
                        $this->detectDeviceProperties( $userAgent )
                                ->isMobileDevice()
                );
        }
 
-       public function 
test_it_doesnt_classify_Samsung_Smart_TVs_as_mobile_devices() {
+       public function testItDoesntClassifySamsungSmartTVsAsMobileDevices() {
                $properties = $this->detectDeviceProperties(
                        // @codingStandardsIgnoreStart
                        'Mozilla/5.0 (SMART-TV; Linux; Tizen 2.3) 
AppleWebkit/538.1 (KHTML, like Gecko) SamsungBrowser/1.0 TV Safari/538.1'
@@ -190,7 +190,7 @@
        /**
         * @dataProvider provideMobileUserAgents
         */
-       public function test_it_doesnt_classify_mobile_UAs_as_tablets( 
$userAgent ) {
+       public function testItDoesntClassifyMobileUAsAsTablets( $userAgent ) {
                $this->assertFalse(
                        $this->detectDeviceProperties( $userAgent )
                                ->isTabletDevice()
@@ -200,7 +200,7 @@
        /**
         * @dataProvider provideTabletUserAgents
         */
-       public function test_it_classifies_tablet_UAs_as_tablets( $userAgent ) {
+       public function testItClassifiesTabletUAsAsTablets( $userAgent ) {
                $this->assertTrue(
                        $this->detectDeviceProperties( $userAgent )
                                ->isTabletDevice()
diff --git a/tests/phpunit/diff/InlineDifferenceEngineTest.php 
b/tests/phpunit/diff/InlineDifferenceEngineTest.php
index b1b84d1..530cdae 100644
--- a/tests/phpunit/diff/InlineDifferenceEngineTest.php
+++ b/tests/phpunit/diff/InlineDifferenceEngineTest.php
@@ -36,6 +36,7 @@
        }
 
        private function strip( $text ) {
-               return str_replace( "\r", '', $text ); // Windows, $@#!%#!
+               // Windows, $@#!%#!
+               return str_replace( "\r", '', $text );
        }
 }
diff --git a/tests/phpunit/specials/SpecialMobileLanguagesTest.php 
b/tests/phpunit/specials/SpecialMobileLanguagesTest.php
index 1f8d27c..173d4c9 100644
--- a/tests/phpunit/specials/SpecialMobileLanguagesTest.php
+++ b/tests/phpunit/specials/SpecialMobileLanguagesTest.php
@@ -53,7 +53,8 @@
                }
 
                return [
-                       [ // Works with one language
+                       // Works with one language
+                       [
                                [
                                        $input['es']
                                ],
@@ -61,7 +62,8 @@
                                        $expected['es']
                                ]
                        ],
-                       [ // Sorts two languages
+                       // Sorts two languages
+                       [
                                [
                                        $input['es'],
                                        $input['bs']
@@ -71,7 +73,8 @@
                                        $expected['es']
                                ]
                        ],
-                       [ // Should still sort correctly if already in correct 
order
+                       // Should still sort correctly if already in correct 
order
+                       [
                                [
                                        $input['bs'],
                                        $input['es']
@@ -81,7 +84,8 @@
                                        $expected['es']
                                ]
                        ],
-                       [ // Sorts languages case-insensitive
+                       // Sorts languages case-insensitive
+                       [
                                [
                                        $input['simple'],
                                        $input['de'],
@@ -95,7 +99,8 @@
                                        $expected['simple']
                                ]
                        ],
-                       [ // Should still sort correctly if already in correct 
order (mixed case)
+                       // Should still sort correctly if already in correct 
order (mixed case)
+                       [
                                [
                                        $input['bs'],
                                        $input['de'],

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id8919e1d3b557fd8e7f8a3a4eb20af271bafcf2c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: AntoniSiek <[email protected]>

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

Reply via email to