build: Update mediawiki-codesniffer to 0.6.0, add "composer fix"
authorKunal Mehta <legoktm@member.fsf.org>
Wed, 17 Feb 2016 10:31:52 +0000 (02:31 -0800)
committerKunal Mehta <legoktm@member.fsf.org>
Wed, 17 Feb 2016 10:54:42 +0000 (02:54 -0800)
* Fix errors spotted by new release
* Introduce "composer fix", which uses phpcbf to automatically fix some
errors spotted by phpcs.
* Drop $PHPCS_ARGS variable that didn't work on Windows, and add -s flag
* Remove rules from phpcs.xml that are now in MW-CS ruleset.

Change-Id: I13e2155695918c918b67497ac65b85a03897095e

25 files changed:
composer.json
includes/WebStart.php
includes/libs/MemoizedCallable.php
includes/libs/XmlTypeCheck.php
includes/page/Article.php
includes/resourceloader/ResourceLoader.php
includes/resourceloader/ResourceLoaderModule.php
includes/search/SearchSuggestionSet.php
languages/messages/MessagesFur.php
languages/messages/MessagesHy.php
languages/messages/MessagesKk_arab.php
languages/messages/MessagesKk_cyrl.php
languages/messages/MessagesKk_latn.php
languages/messages/MessagesKm.php
languages/messages/MessagesLi.php
languages/messages/MessagesMk.php
languages/messages/MessagesNds.php
languages/messages/MessagesNn.php
languages/messages/MessagesOs.php
languages/messages/MessagesRu.php
languages/messages/MessagesSr_el.php
languages/messages/MessagesVi.php
phpcs.xml
tests/phpunit/includes/PrefixSearchTest.php
tests/phpunit/includes/search/SearchEnginePrefixTest.php

index 5bec8e4..f114914 100644 (file)
@@ -41,7 +41,7 @@
        "require-dev": {
                "jakub-onderka/php-parallel-lint": "0.9.2",
                "justinrainbow/json-schema": "~1.3",
-               "mediawiki/mediawiki-codesniffer": "0.5.1",
+               "mediawiki/mediawiki-codesniffer": "0.6.0",
                "monolog/monolog": "~1.17.2",
                "nikic/php-parser": "1.4.1",
                "nmred/kafka-php": "0.1.5",
@@ -68,7 +68,8 @@
        },
        "scripts": {
                "lint": "parallel-lint --exclude vendor",
-               "phpcs": "phpcs -p $PHPCS_ARGS",
+               "phpcs": "phpcs -p -s",
+               "fix": "phpcbf",
                "pre-install-cmd": "ComposerHookHandler::onPreInstall",
                "pre-update-cmd": "ComposerHookHandler::onPreUpdate",
                "test": [
index 739c9eb..29ad456 100644 (file)
@@ -26,7 +26,6 @@
  * @file
  */
 
-
 # bug 15461: Make IE8 turn off content sniffing. Everybody else should ignore this
 # We're adding it here so that it's *always* set, even for alternate entry
 # points and when $wgOut gets disabled or overridden.
index 39faf3d..50e9732 100644 (file)
@@ -102,7 +102,7 @@ class MemoizedCallable {
         * @param array $args Parameters for memoized function or method.
         * @return mixed The memoized callable's return value.
         */
-       public function invokeArgs( Array $args = [] ) {
+       public function invokeArgs( array $args = [] ) {
                foreach ( $args as $arg ) {
                        if ( $arg !== null && !is_scalar( $arg ) ) {
                                throw new InvalidArgumentException(
@@ -144,7 +144,7 @@ class MemoizedCallable {
         * @param array $args
         * @param int $ttl
         */
-       public static function call( $callable, Array $args = [], $ttl = 3600 ) {
+       public static function call( $callable, array $args = [], $ttl = 3600 ) {
                $instance = new self( $callable, $ttl );
                return $instance->invokeArgs( $args );
        }
index b3ea08d..f057140 100644 (file)
@@ -132,7 +132,6 @@ class XmlTypeCheck {
                return $this->rootElement;
        }
 
-
        /**
         * @param string $fname the filename
         */
index 4e4b2d7..d6e7381 100644 (file)
@@ -2653,7 +2653,6 @@ class Article implements Page {
                );
        }
 
-
        /**
         * @param array $limit
         * @param array $expiry
index a2ff294..c689979 100644 (file)
@@ -172,7 +172,7 @@ class ResourceLoader implements LoggerAwareInterface {
         *  - (bool) cache: Whether to allow caching this data. Default: true.
         * @return string Filtered data, or a comment containing an error message
         */
-       public static function filter( $filter, $data, Array $options = [] ) {
+       public static function filter( $filter, $data, array $options = [] ) {
                if ( strpos( $data, ResourceLoader::FILTER_NOMIN ) !== false ) {
                        return $data;
                }
@@ -614,7 +614,7 @@ class ResourceLoader implements LoggerAwareInterface {
         * @param array $modules List of ResourceLoaderModule objects
         * @return string Hash
         */
-       public function getCombinedVersion( ResourceLoaderContext $context, Array $modules ) {
+       public function getCombinedVersion( ResourceLoaderContext $context, array $modules ) {
                if ( !$modules ) {
                        return '';
                }
@@ -1241,7 +1241,7 @@ MESSAGE;
         *
         * @param Array $array
         */
-       private static function trimArray( Array &$array ) {
+       private static function trimArray( array &$array ) {
                $i = count( $array );
                while ( $i-- ) {
                        if ( $array[$i] === null
index 8da1e21..13f13e6 100644 (file)
@@ -472,7 +472,7 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface {
         * @param array $filePaths
         * @return array
         */
-       public static function getRelativePaths( Array $filePaths ) {
+       public static function getRelativePaths( array $filePaths ) {
                global $IP;
                return array_map( function ( $path ) use ( $IP ) {
                        return RelPath\getRelativePath( $path, $IP );
@@ -486,7 +486,7 @@ abstract class ResourceLoaderModule implements LoggerAwareInterface {
         * @param array $filePaths
         * @return array
         */
-       public static function expandRelativePaths( Array $filePaths ) {
+       public static function expandRelativePaths( array $filePaths ) {
                global $IP;
                return array_map( function ( $path ) use ( $IP ) {
                        return RelPath\joinPath( $IP, $path );
index 4750181..5a24fd6 100644 (file)
@@ -203,7 +203,6 @@ class SearchSuggestionSet {
                return new SearchSuggestionSet( $suggestions );
        }
 
-
        /**
         * @return SearchSuggestionSet an empty suggestion set
         */
index bdd9028..8bb6c6c 100644 (file)
@@ -10,7 +10,6 @@
 
 $fallback = 'it';
 
-
 $namespaceNames = [
        NS_MEDIA            => 'Media',
        NS_SPECIAL          => 'Speciâl',
index dbe119d..28c3a4d 100644 (file)
@@ -40,7 +40,6 @@ $namespaceAliases = [
        'Սպասարկող' => NS_SPECIAL,
 ];
 
-
 $datePreferences = [
        'default',
        'mdy',
index 83606c0..a589ac2 100644 (file)
@@ -112,7 +112,6 @@ $namespaceAliases = [
        'ٴۇلگٴى_تالقىلاۋى'    => NS_TEMPLATE_TALK,
 ];
 
-
 $datePreferences = [
        'default',
        'mdy',
index 9cacf5a..37b4a15 100644 (file)
@@ -98,7 +98,6 @@ $namespaceAliases = [
        'سانات_تالقىلاۋى'    => NS_CATEGORY_TALK,
 ];
 
-
 $datePreferences = [
        'default',
        'mdy',
index f60696c..1f1289d 100644 (file)
@@ -93,7 +93,6 @@ $namespaceAliases = [
        'سانات_تالقىلاۋى'    => NS_CATEGORY_TALK,
 ];
 
-
 $datePreferences = [
        'default',
        'mdy',
index 53d07bf..6ae2e88 100644 (file)
@@ -60,7 +60,6 @@ $namespaceAliases = [
        'ការពិភាក្សាអំពីចំនាត់ថ្នាក់ក្រុម' => NS_CATEGORY_TALK,
 ];
 
-
 $digitTransformTable = [
        '0' => '០', # &#x17e0;
        '1' => '១', # &#x17e1;
index fd8f7c4..fe512b2 100644 (file)
@@ -23,7 +23,6 @@
 
 $fallback = 'nl';
 
-
 $namespaceNames = [
        NS_MEDIA            => 'Media',
        NS_SPECIAL          => 'Speciaal',
index 61f318c..cc76c61 100644 (file)
@@ -47,7 +47,6 @@ $namespaceAliases = [
        'Разговор_за_слика' => NS_FILE_TALK,
 ];
 
-
 $datePreferences = [
        'default',
        'dmy mk',
index 2274d11..8a18f2f 100644 (file)
@@ -85,7 +85,6 @@ $magicWords = [
        'grammar'                   => [ '0', 'GRAMMATIK:', 'GRAMMAR:' ],
 ];
 
-
 $bookstoreList = [
        'Verteken vun leverbore Böker'  => 'http://www.buchhandel.de/sixcms/list.php?page=buchhandel_profisuche_frameset&suchfeld=isbn&suchwert=$1=0&y=0',
        'abebooks.de'                   => 'http://www.abebooks.de/servlet/BookSearchPL?ph=2&isbn=$1',
index 2e5ce84..49987ad 100644 (file)
@@ -42,7 +42,6 @@
  * @see http://nn.wikipedia.org/w/index.php?title=Brukar:Dittaeva/LanguageNn.php&action=history
  */
 
-
 $datePreferences = [
        'default',
        'dmyt',
index 0ee5b31..26b3832 100644 (file)
@@ -148,7 +148,6 @@ $specialPageAliases = [
        'Withoutinterwiki'          => [ 'ÆнæИнтервики' ],
 ];
 
-
 $magicWords = [
        'redirect'                  => [ '0', '#ÆРВИТÆН', '#ÆРВЫСТ', '#РАРВЫСТ', '#перенаправление', '#перенапр', '#REDIRECT' ],
        'notoc'                     => [ '0', '__ÆНÆСÆР__', '__БЕЗ_ОГЛАВЛЕНИЯ__', '__БЕЗ_ОГЛ__', '__NOTOC__' ],
index c9841a2..c273654 100644 (file)
@@ -388,7 +388,6 @@ $magicWords = [
        'pagesincategory_files'     => [ '0', 'файлы', 'files' ],
 ];
 
-
 $dateFormats = [
        'mdy time' => 'H:i',
        'mdy date' => 'xg j, Y',
index 4c625b4..b03a482 100644 (file)
@@ -157,7 +157,6 @@ $dateFormats = [
        'h:mm d mon y both'         => 'G:i, j M Y',
 ];
 
-
 /* NOT USED IN STABLE VERSION */
 $magicWords = [
        'redirect'                  => [ '0', '#Preusmeri', '#preusmeri', '#PREUSMERI', '#Preusmjeri', '#preusmjeri', '#PREUSMJERI', '#redirect', '#REDIRECT' ],
index 9eb65f1..593f61a 100644 (file)
@@ -349,7 +349,6 @@ $datePreferenceMigrationMap = [
        'vi normal',
 ];
 
-
 $linkTrail = "/^([a-zàâçéèêîôûäëïöüùÇÉÂÊÎÔÛÄËÏÖÜÀÈÙ]+)(.*)$/sDu";
 $separatorTransformTable = [ ',' => '.', '.' => ',' ];
 
index bbf2f46..38c7aaa 100644 (file)
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -1,11 +1,6 @@
 <?xml version="1.0"?>
 <ruleset name="MediaWiki">
        <rule ref="vendor/mediawiki/mediawiki-codesniffer/MediaWiki" />
-       <rule ref="Generic.Arrays.DisallowLongArraySyntax" />
-       <rule ref="Generic.Functions.CallTimePassByReference.NotAllowed">
-               <!-- too many false positives, see T127163 -->
-               <severity>0</severity>
-       </rule>
        <rule ref="MediaWiki.NamingConventions.PrefixedGlobalFunctions">
                <properties>
                        <property name="ignoreList" type="array" value="bfNormalizeTitleStrReplace,bfNormalizeTitleStrTr,cdbShowHelp,codepointToUtf8,compare_point,cssfilter,escapeSingleString,findAuxFile,findFiles,getEscapedProfileUrl,getFileCommentFromSourceWiki,getFileUserFromSourceWiki,hexSequenceToUtf8,mccGetHelp,mccShowUsage,mimeTypeMatch,moveToExternal,NothingFunction,NothingFunctionData,resolveStub,resolveStubs,showUsage,splitFilename,utf8ToCodepoint,utf8ToHexSequence" />
index 55a23a6..6f4c300 100644 (file)
@@ -43,7 +43,7 @@ class PrefixSearchTest extends MediaWikiLangTestCase {
                $this->setMwGlobals( 'wgSpecialPages', [] );
        }
 
-       protected function searchProvision( Array $results = null ) {
+       protected function searchProvision( array $results = null ) {
                if ( $results === null ) {
                        $this->setMwGlobals( 'wgHooks', [] );
                } else {
@@ -149,7 +149,7 @@ class PrefixSearchTest extends MediaWikiLangTestCase {
         * @covers PrefixSearch::search
         * @covers PrefixSearch::searchBackend
         */
-       public function testSearch( Array $case ) {
+       public function testSearch( array $case ) {
                $this->searchProvision( null );
                $searcher = new StringPrefixSearch;
                $results = $searcher->search( $case['query'], 3 );
@@ -165,7 +165,7 @@ class PrefixSearchTest extends MediaWikiLangTestCase {
         * @covers PrefixSearch::search
         * @covers PrefixSearch::searchBackend
         */
-       public function testSearchWithOffset( Array $case ) {
+       public function testSearchWithOffset( array $case ) {
                $this->searchProvision( null );
                $searcher = new StringPrefixSearch;
                $results = $searcher->search( $case['query'], 3, [], 1 );
@@ -298,7 +298,7 @@ class PrefixSearchTest extends MediaWikiLangTestCase {
         * @dataProvider provideSearchBackend
         * @covers PrefixSearch::searchBackend
         */
-       public function testSearchBackend( Array $case ) {
+       public function testSearchBackend( array $case ) {
                $this->searchProvision( $case['provision'] );
                $searcher = new StringPrefixSearch;
                $results = $searcher->search( $case['query'], 3 );
index af6d70f..2a3a5fe 100644 (file)
@@ -50,7 +50,7 @@ class SearchEnginePrefixTest extends MediaWikiLangTestCase {
                $this->search->setNamespaces( [] );
        }
 
-       protected function searchProvision( Array $results = null ) {
+       protected function searchProvision( array $results = null ) {
                if ( $results === null ) {
                        $this->setMwGlobals( 'wgHooks', [] );
                } else {
@@ -155,7 +155,7 @@ class SearchEnginePrefixTest extends MediaWikiLangTestCase {
         * @dataProvider provideSearch
         * @covers SearchEngine::defaultPrefixSearch
         */
-       public function testSearch( Array $case ) {
+       public function testSearch( array $case ) {
                $this->search->setLimitOffset( 3 );
                $results = $this->search->defaultPrefixSearch( $case['query'] );
                $results = array_map( function( Title $t ) {
@@ -172,7 +172,7 @@ class SearchEnginePrefixTest extends MediaWikiLangTestCase {
         * @dataProvider provideSearch
         * @covers SearchEngine::defaultPrefixSearch
         */
-       public function testSearchWithOffset( Array $case ) {
+       public function testSearchWithOffset( array $case ) {
                $this->search->setLimitOffset( 3, 1 );
                $results = $this->search->defaultPrefixSearch( $case['query'] );
                $results = array_map( function( Title $t ) {
@@ -308,7 +308,7 @@ class SearchEnginePrefixTest extends MediaWikiLangTestCase {
         * @dataProvider provideSearchBackend
         * @covers PrefixSearch::searchBackend
         */
-       public function testSearchBackend( Array $case ) {
+       public function testSearchBackend( array $case ) {
                $search = $stub = $this->getMockBuilder( 'SearchEngine' )
                        ->setMethods( [ 'completionSearchBackend' ] )->getMock();