Remove "Squiz.WhiteSpace.FunctionSpacing" from phpcs exclusions
authorReedy <reedy@wikimedia.org>
Sat, 11 May 2019 01:17:43 +0000 (02:17 +0100)
committerReedy <reedy@wikimedia.org>
Sat, 11 May 2019 01:44:26 +0000 (02:44 +0100)
Change-Id: I78b3315f26ab91b6b443f5b028a635552f82f5a3

31 files changed:
.phpcs.xml
includes/FormOptions.php
includes/MediaWikiServices.php
includes/WebStart.php
includes/actions/HistoryAction.php
includes/exception/MWException.php
includes/libs/objectcache/MultiWriteBagOStuff.php
includes/media/Exif.php
includes/pager/Pager.php
includes/parser/CoreParserFunctions.php
includes/parser/ParserCache.php
includes/parser/ParserOutput.php
includes/parser/RemexStripTagHandler.php
includes/specialpage/ChangesListSpecialPage.php
includes/specialpage/SpecialPage.php
includes/upload/exception/UploadChunkVerificationException.php
maintenance/doMaintenance.php
maintenance/removeInvalidEmails.php
maintenance/validateRegistrationFile.php
tests/phan/bin/postprocess-phan.php
tests/phpunit/ResourceLoaderTestCase.php
tests/phpunit/includes/FormOptionsTest.php
tests/phpunit/includes/OutputPageTest.php
tests/phpunit/includes/content/JsonContentTest.php
tests/phpunit/includes/resourceloader/ResourceLoaderImageTest.php
tests/phpunit/includes/resourceloader/ResourceLoaderWikiModuleTest.php
tests/phpunit/includes/specialpage/ChangesListSpecialPageTest.php
tests/phpunit/includes/title/NamespaceInfoTest.php
tests/phpunit/languages/classes/LanguageSrTest.php
tests/phpunit/languages/classes/LanguageUzTest.php
tests/phpunit/mocks/search/MockSearchResult.php

index f4567ac..a9c658a 100644 (file)
@@ -19,7 +19,6 @@
                <exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.NewLineComment" />
                <exclude name="MediaWiki.WhiteSpace.SpaceBeforeSingleLineComment.SingleSpaceBeforeSingleLineComment" />
                <exclude name="Squiz.Scope.MethodScope.Missing" />
-               <exclude name="Squiz.WhiteSpace.FunctionSpacing" />
        </rule>
        <rule ref="MediaWiki.NamingConventions.PrefixedGlobalFunctions">
                <properties>
index a6e01cc..0131855 100644 (file)
@@ -384,6 +384,7 @@ class FormOptions implements ArrayAccess {
         * @see https://www.php.net/manual/en/class.arrayaccess.php
         */
        /* @{ */
+
        /**
         * Whether the option exists.
         * @param string $name
index 9dbfc1b..eca5b9d 100644 (file)
@@ -226,6 +226,7 @@ class MediaWikiServices extends ServiceContainer {
        }
 
        /** @noinspection PhpDocSignatureInspection */
+
        /**
         * Salvages the state of any salvageable service instances in $other.
         *
index 878dd3e..c83fdea 100644 (file)
@@ -50,6 +50,7 @@ if ( !defined( 'MW_CONFIG_CALLBACK' ) ) {
                define( 'MW_CONFIG_FILE', "$IP/LocalSettings.php" );
        }
        if ( !is_readable( MW_CONFIG_FILE ) ) {
+
                function wfWebStartNoLocalSettings() {
                        # LocalSettings.php is the per-site customization file. If it does not exist
                        # the wiki installer needs to be launched or the generated file uploaded to
@@ -58,12 +59,14 @@ if ( !defined( 'MW_CONFIG_CALLBACK' ) ) {
                        require_once "$IP/includes/NoLocalSettings.php";
                        die();
                }
+
                define( 'MW_CONFIG_CALLBACK', 'wfWebStartNoLocalSettings' );
        }
 }
 
 // Custom setup for WebStart entry point
 if ( !defined( 'MW_SETUP_CALLBACK' ) ) {
+
        function wfWebStartSetup() {
                // Initialise output buffering
                // Check for previously set up buffers, to avoid a mix of gzip and non-gzip output.
@@ -71,6 +74,7 @@ if ( !defined( 'MW_SETUP_CALLBACK' ) ) {
                        ob_start( 'MediaWiki\\OutputHandler::handle' );
                }
        }
+
        define( 'MW_SETUP_CALLBACK', 'wfWebStartSetup' );
 }
 
index 658ee48..706241a 100644 (file)
@@ -139,6 +139,7 @@ class HistoryAction extends FormlessAction {
                }
                return $year && $month && $day ? $year . '-' . $month . '-' . $day : '';
        }
+
        /**
         * Print the history page for an article.
         */
index cb7ff19..c16d9f7 100644 (file)
@@ -252,6 +252,7 @@ class MWException extends Exception {
                        header( $header );
                }
        }
+
        private static function statusHeader( $code ) {
                if ( !headers_sent() ) {
                        HttpStatus::header( $code );
index adb9bb8..1ed91ea 100644 (file)
@@ -136,6 +136,7 @@ class MultiWriteBagOStuff extends BagOStuff {
 
                return $value;
        }
+
        public function set( $key, $value, $exptime = 0, $flags = 0 ) {
                return $this->doWrite(
                        $this->cacheIndexes,
@@ -205,6 +206,7 @@ class MultiWriteBagOStuff extends BagOStuff {
                // Only the first cache is locked
                return $this->caches[0]->unlock( $key );
        }
+
        /**
         * Delete objects expiring before a certain date.
         *
@@ -289,6 +291,7 @@ class MultiWriteBagOStuff extends BagOStuff {
        public function clearLastError() {
                $this->caches[0]->clearLastError();
        }
+
        /**
         * Apply a write method to the backing caches specified by $indexes (in order)
         *
index 0fde386..6dfa8d3 100644 (file)
@@ -548,6 +548,7 @@ class Exif {
        /**#@+
         * @return array
         */
+
        /**
         * Get $this->mRawExifData
         * @return array
index edec490..9cfbfbf 100644 (file)
@@ -31,5 +31,6 @@
  */
 interface Pager {
        function getNavigationBar();
+
        function getBody();
 }
index 7ce96be..0c745c9 100644 (file)
@@ -514,6 +514,7 @@ class CoreParserFunctions {
        public static function numberofusers( $parser, $raw = null ) {
                return self::formatRaw( SiteStats::users(), $raw, $parser->getFunctionLang() );
        }
+
        public static function numberofactiveusers( $parser, $raw = null ) {
                return self::formatRaw( SiteStats::activeUsers(), $raw, $parser->getFunctionLang() );
        }
@@ -545,6 +546,7 @@ class CoreParserFunctions {
                        $parser->getFunctionLang()
                );
        }
+
        public static function numberingroup( $parser, $name = '', $raw = null ) {
                return self::formatRaw(
                        SiteStats::numberingroup( strtolower( $name ) ),
@@ -569,6 +571,7 @@ class CoreParserFunctions {
                }
                return str_replace( '_', ' ', $t->getNsText() );
        }
+
        public static function namespacee( $parser, $title = null ) {
                $t = Title::newFromText( $title );
                if ( is_null( $t ) ) {
@@ -576,6 +579,7 @@ class CoreParserFunctions {
                }
                return wfUrlencode( $t->getNsText() );
        }
+
        public static function namespacenumber( $parser, $title = null ) {
                $t = Title::newFromText( $title );
                if ( is_null( $t ) ) {
@@ -583,6 +587,7 @@ class CoreParserFunctions {
                }
                return $t->getNamespace();
        }
+
        public static function talkspace( $parser, $title = null ) {
                $t = Title::newFromText( $title );
                if ( is_null( $t ) || !$t->canHaveTalkPage() ) {
@@ -590,6 +595,7 @@ class CoreParserFunctions {
                }
                return str_replace( '_', ' ', $t->getTalkNsText() );
        }
+
        public static function talkspacee( $parser, $title = null ) {
                $t = Title::newFromText( $title );
                if ( is_null( $t ) || !$t->canHaveTalkPage() ) {
@@ -597,6 +603,7 @@ class CoreParserFunctions {
                }
                return wfUrlencode( $t->getTalkNsText() );
        }
+
        public static function subjectspace( $parser, $title = null ) {
                $t = Title::newFromText( $title );
                if ( is_null( $t ) ) {
@@ -604,6 +611,7 @@ class CoreParserFunctions {
                }
                return str_replace( '_', ' ', $t->getSubjectNsText() );
        }
+
        public static function subjectspacee( $parser, $title = null ) {
                $t = Title::newFromText( $title );
                if ( is_null( $t ) ) {
@@ -626,6 +634,7 @@ class CoreParserFunctions {
                }
                return wfEscapeWikiText( $t->getText() );
        }
+
        public static function pagenamee( $parser, $title = null ) {
                $t = Title::newFromText( $title );
                if ( is_null( $t ) ) {
@@ -633,6 +642,7 @@ class CoreParserFunctions {
                }
                return wfEscapeWikiText( $t->getPartialURL() );
        }
+
        public static function fullpagename( $parser, $title = null ) {
                $t = Title::newFromText( $title );
                if ( is_null( $t ) || !$t->canHaveTalkPage() ) {
@@ -640,6 +650,7 @@ class CoreParserFunctions {
                }
                return wfEscapeWikiText( $t->getPrefixedText() );
        }
+
        public static function fullpagenamee( $parser, $title = null ) {
                $t = Title::newFromText( $title );
                if ( is_null( $t ) || !$t->canHaveTalkPage() ) {
@@ -647,6 +658,7 @@ class CoreParserFunctions {
                }
                return wfEscapeWikiText( $t->getPrefixedURL() );
        }
+
        public static function subpagename( $parser, $title = null ) {
                $t = Title::newFromText( $title );
                if ( is_null( $t ) ) {
@@ -654,6 +666,7 @@ class CoreParserFunctions {
                }
                return wfEscapeWikiText( $t->getSubpageText() );
        }
+
        public static function subpagenamee( $parser, $title = null ) {
                $t = Title::newFromText( $title );
                if ( is_null( $t ) ) {
@@ -661,6 +674,7 @@ class CoreParserFunctions {
                }
                return wfEscapeWikiText( $t->getSubpageUrlForm() );
        }
+
        public static function rootpagename( $parser, $title = null ) {
                $t = Title::newFromText( $title );
                if ( is_null( $t ) ) {
@@ -668,6 +682,7 @@ class CoreParserFunctions {
                }
                return wfEscapeWikiText( $t->getRootText() );
        }
+
        public static function rootpagenamee( $parser, $title = null ) {
                $t = Title::newFromText( $title );
                if ( is_null( $t ) ) {
@@ -675,6 +690,7 @@ class CoreParserFunctions {
                }
                return wfEscapeWikiText( wfUrlencode( str_replace( ' ', '_', $t->getRootText() ) ) );
        }
+
        public static function basepagename( $parser, $title = null ) {
                $t = Title::newFromText( $title );
                if ( is_null( $t ) ) {
@@ -682,6 +698,7 @@ class CoreParserFunctions {
                }
                return wfEscapeWikiText( $t->getBaseText() );
        }
+
        public static function basepagenamee( $parser, $title = null ) {
                $t = Title::newFromText( $title );
                if ( is_null( $t ) ) {
@@ -689,6 +706,7 @@ class CoreParserFunctions {
                }
                return wfEscapeWikiText( wfUrlencode( str_replace( ' ', '_', $t->getBaseText() ) ) );
        }
+
        public static function talkpagename( $parser, $title = null ) {
                $t = Title::newFromText( $title );
                if ( is_null( $t ) || !$t->canHaveTalkPage() ) {
@@ -696,6 +714,7 @@ class CoreParserFunctions {
                }
                return wfEscapeWikiText( $t->getTalkPage()->getPrefixedText() );
        }
+
        public static function talkpagenamee( $parser, $title = null ) {
                $t = Title::newFromText( $title );
                if ( is_null( $t ) || !$t->canHaveTalkPage() ) {
@@ -703,6 +722,7 @@ class CoreParserFunctions {
                }
                return wfEscapeWikiText( $t->getTalkPage()->getPrefixedURL() );
        }
+
        public static function subjectpagename( $parser, $title = null ) {
                $t = Title::newFromText( $title );
                if ( is_null( $t ) ) {
@@ -710,6 +730,7 @@ class CoreParserFunctions {
                }
                return wfEscapeWikiText( $t->getSubjectPage()->getPrefixedText() );
        }
+
        public static function subjectpagenamee( $parser, $title = null ) {
                $t = Title::newFromText( $title );
                if ( is_null( $t ) ) {
index 8e8cd98..2585872 100644 (file)
@@ -57,6 +57,7 @@ class ParserCache {
         * @var string
         */
        private $cacheEpoch;
+
        /**
         * Get an instance of this object
         *
index cc70713..ef22a1f 100644 (file)
@@ -498,6 +498,7 @@ class ParserOutput extends CacheTime {
        public function setNoGallery( $value ) {
                $this->mNoGallery = (bool)$value;
        }
+
        public function getNoGallery() {
                return $this->mNoGallery;
        }
@@ -628,12 +629,15 @@ class ParserOutput extends CacheTime {
        public function setNewSection( $value ) {
                $this->mNewSection = (bool)$value;
        }
+
        public function hideNewSection( $value ) {
                $this->mHideNewSection = (bool)$value;
        }
+
        public function getHideNewSection() {
                return (bool)$this->mHideNewSection;
        }
+
        public function getNewSection() {
                return (bool)$this->mNewSection;
        }
index 2d75c86..cb85627 100644 (file)
@@ -9,6 +9,7 @@ use RemexHtml\Tokenizer\Tokenizer;
  */
 class RemexStripTagHandler implements TokenHandler {
        private $text = '';
+
        public function getResult() {
                return $this->text;
        }
@@ -16,15 +17,19 @@ class RemexStripTagHandler implements TokenHandler {
        function startDocument( Tokenizer $t, $fns, $fn ) {
                // Do nothing.
        }
+
        function endDocument( $pos ) {
                // Do nothing.
        }
+
        function error( $text, $pos ) {
                // Do nothing.
        }
+
        function characters( $text, $start, $length, $sourceStart, $sourceLength ) {
                $this->text .= substr( $text, $start, $length );
        }
+
        function startTag( $name, Attributes $attrs, $selfClose, $sourceStart, $sourceLength ) {
                // Inject whitespace for typical block-level tags to
                // prevent merging unrelated<br>words.
@@ -32,6 +37,7 @@ class RemexStripTagHandler implements TokenHandler {
                        $this->text .= ' ';
                }
        }
+
        function endTag( $name, $sourceStart, $sourceLength ) {
                // Inject whitespace for typical block-level tags to
                // prevent merging unrelated<br>words.
@@ -39,9 +45,11 @@ class RemexStripTagHandler implements TokenHandler {
                        $this->text .= ' ';
                }
        }
+
        function doctype( $name, $public, $system, $quirks, $sourceStart, $sourceLength ) {
                // Do nothing.
        }
+
        function comment( $text, $sourceStart, $sourceLength ) {
                // Do nothing.
        }
index f4b574b..2470b41 100644 (file)
@@ -1190,6 +1190,7 @@ abstract class ChangesListSpecialPage extends SpecialPage {
        // to include data on filters that use the unstructured UI.  messageKeys is a
        // special top-level value, with the value being an array of the message keys to
        // send to the client.
+
        /**
         * Gets structured filter information needed by JS
         *
index bd0e24f..670a0b8 100644 (file)
@@ -162,6 +162,7 @@ class SpecialPage implements MessageLocalizer {
        }
 
        // @todo FIXME: Decide which syntax to use for this, and stick to it
+
        /**
         * Whether this special page is listed in Special:SpecialPages
         * @since 1.3 (r3583)
index cee8c03..d7733ab 100644 (file)
@@ -23,6 +23,7 @@
 
 class UploadChunkVerificationException extends MWException {
        public $msg;
+
        public function __construct( array $res ) {
                $this->msg = wfMessage( ...$res );
                parent::__construct( wfMessage( ...$res )
index 1c53fe8..94ae95d 100644 (file)
@@ -61,6 +61,7 @@ if ( !defined( 'MW_CONFIG_CALLBACK' ) && !defined( 'MW_CONFIG_FILE' ) ) {
 
 // Custom setup for Maintenance entry point
 if ( !defined( 'MW_SETUP_CALLBACK' ) ) {
+
        function wfMaintenanceSetup() {
                // phpcs:ignore MediaWiki.NamingConventions.ValidGlobalName.wgPrefix
                global $maintenance, $wgLocalisationCacheConf, $wgCacheDirectory;
@@ -75,6 +76,7 @@ if ( !defined( 'MW_SETUP_CALLBACK' ) ) {
 
                $maintenance->finalSetup();
        }
+
        define( 'MW_SETUP_CALLBACK', 'wfMaintenanceSetup' );
 }
 
index ec68ef2..bee8d69 100644 (file)
@@ -21,6 +21,7 @@ class RemoveInvalidEmails extends Maintenance {
                $this->addOption( 'commit', 'Whether to actually update the database', false, false );
                $this->setBatchSize( 500 );
        }
+
        public function execute() {
                $this->commit = $this->hasOption( 'commit' );
                $dbr = $this->getDB( DB_REPLICA );
index 0d6cfa2..a704d61 100644 (file)
@@ -11,6 +11,7 @@ class ValidateRegistrationFile extends Maintenance {
                        true
                );
        }
+
        public function execute() {
                $validator = new ExtensionJsonValidator( function ( $msg ) {
                        $this->fatalError( $msg );
index 3e80598..4f48f48 100644 (file)
@@ -106,6 +106,7 @@ class NoopSuppressor extends Suppressor {
        public function __construct( $mode ) {
                $this->mode = $mode;
        }
+
        public function suppress( $input ) {
                echo "Unsupported output mode: {$this->mode}\n$input";
                return true;
index 57f56f4..e9a8a1f 100644 (file)
@@ -137,6 +137,7 @@ class ResourceLoaderTestModule extends ResourceLoaderModule {
        public function isRaw() {
                return $this->isRaw;
        }
+
        public function isKnownEmpty( ResourceLoaderContext $context ) {
                return $this->isKnownEmpty;
        }
index 2ee8b98..da08670 100644 (file)
@@ -42,15 +42,19 @@ class FormOptionsTest extends MediaWikiTestCase {
        private function assertGuessBoolean( $data ) {
                $this->guess( FormOptions::BOOL, $data );
        }
+
        private function assertGuessInt( $data ) {
                $this->guess( FormOptions::INT, $data );
        }
+
        private function assertGuessFloat( $data ) {
                $this->guess( FormOptions::FLOAT, $data );
        }
+
        private function assertGuessString( $data ) {
                $this->guess( FormOptions::STRING, $data );
        }
+
        private function assertGuessArray( $data ) {
                $this->guess( FormOptions::ARR, $data );
        }
@@ -62,6 +66,7 @@ class FormOptionsTest extends MediaWikiTestCase {
                        FormOptions::guessType( $data )
                );
        }
+
        /* @} */
 
        /**
index ef8766a..afc6bb5 100644 (file)
@@ -25,6 +25,7 @@ class OutputPageTest extends MediaWikiTestCase {
                parent::setUp();
                ResourceLoader::clearCache();
        }
+
        protected function tearDown() {
                parent::tearDown();
                ResourceLoader::clearCache();
index 8546d96..8d6c3ae 100644 (file)
@@ -92,6 +92,7 @@ class JsonContentTest extends MediaWikiLangTestCase {
                        ->disableOriginalConstructor()
                        ->getMock();
        }
+
        private function getMockParserOptions() {
                return $this->getMockBuilder( ParserOptions::class )
                        ->disableOriginalConstructor()
index 35c3ef6..b0512fa 100644 (file)
@@ -129,6 +129,7 @@ class ResourceLoaderImageTestable extends ResourceLoaderImage {
        public function massageSvgPathdata( $svg ) {
                return parent::massageSvgPathdata( $svg );
        }
+
        // Stub, since we don't know if we even have a SVG handler, much less what exactly it'll output
        public function rasterize( $svg ) {
                return 'RASTERIZESTUB';
index ad8fa78..c1bdebe 100644 (file)
@@ -451,6 +451,7 @@ class ResourceLoaderWikiModuleTest extends ResourceLoaderTestCase {
 
 class TestResourceLoaderWikiModule extends ResourceLoaderWikiModule {
        public static $returnFetchTitleInfo = null;
+
        protected static function fetchTitleInfo( IDatabase $db, array $pages, $fname = null ) {
                $ret = self::$returnFetchTitleInfo;
                self::$returnFetchTitleInfo = null;
index f545948..968db42 100644 (file)
@@ -400,6 +400,7 @@ class ChangesListSpecialPageTest extends AbstractChangesListSpecialPageTestCase
                        $user
                );
        }
+
        public function testRcHidepatrolledFilter() {
                $user = $this->getTestSysop()->getUser();
                $this->assertConditions(
index 556c640..4e376e8 100644 (file)
@@ -601,6 +601,7 @@ class NamespaceInfoTest extends MediaWikiTestCase {
         * getSubject/Talk/Associated
         * %{
         */
+
        /**
         * @dataProvider provideSubjectTalk
         * @covers NamespaceInfo::getSubject
@@ -880,6 +881,7 @@ class NamespaceInfoTest extends MediaWikiTestCase {
 
        // No canonical namespace names
        // %{
+
        /**
         * @covers NamespaceInfo::getCanonicalNamespaces
         */
@@ -982,6 +984,7 @@ class NamespaceInfoTest extends MediaWikiTestCase {
 
        // Hook namespaces
        // %{
+
        /**
         * @return array Expected canonical namespaces
         */
@@ -1047,6 +1050,7 @@ class NamespaceInfoTest extends MediaWikiTestCase {
 
        // Extra namespaces
        // %{
+
        /**
         * @return NamespaceInfo
         */
@@ -1102,6 +1106,7 @@ class NamespaceInfoTest extends MediaWikiTestCase {
 
        // Canonical namespace caching
        // %{
+
        /**
         * @covers NamespaceInfo::getCanonicalNamespaces
         */
index c9f2f3e..8da7602 100644 (file)
@@ -238,6 +238,7 @@ class LanguageSrTest extends LanguageClassesTestCase {
        }
 
        # #### HELPERS #####################################################
+
        /**
         *Wrapper to verify text stay the same after applying conversion
         * @param string $text Text to convert
index 18b2031..abc63ee 100644 (file)
@@ -60,6 +60,7 @@ class LanguageUzTest extends LanguageClassesTestCase {
        }
 
        # #### HELPERS #####################################################
+
        /**
         * Wrapper to verify text stay the same after applying conversion
         * @param string $text Text to convert
index d92d39a..e92eb56 100644 (file)
@@ -7,6 +7,7 @@ class MockSearchResult extends SearchResult {
        public function isMissingRevision() {
                return $this->isMissingRevision;
        }
+
        public function setMissingRevision( $isMissingRevision ) {
                $this->isMissingRevision = $isMissingRevision;
                return $this;