Jackmcbarn has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/221144

Change subject: Fix some PHPCS issues
......................................................................

Fix some PHPCS issues

Change-Id: I5a44d07553d45bc01db070c99856b35a3d275bd1
---
M Scribunto.magic.php
M common/Base.php
M common/Common.php
M common/Hooks.php
M engines/LuaCommon/LanguageLibrary.php
M engines/LuaCommon/LuaCommon.php
M engines/LuaCommon/MessageLibrary.php
M engines/LuaCommon/UstringLibrary.php
M engines/LuaStandalone/LuaStandaloneEngine.php
M tests/engines/LuaCommon/CommonTest.php
M tests/engines/LuaCommon/LuaEngineTestBase.php
M tests/engines/LuaCommon/LuaInterpreterTest.php
M tests/engines/LuaCommon/TitleLibraryTest.php
M tests/engines/LuaCommon/UstringLibraryTest.php
14 files changed, 26 insertions(+), 26 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Scribunto 
refs/changes/44/221144/1

diff --git a/Scribunto.magic.php b/Scribunto.magic.php
index 6d13049..6040985 100644
--- a/Scribunto.magic.php
+++ b/Scribunto.magic.php
@@ -128,4 +128,4 @@
 /** Traditional Chinese (中文(繁體)‎) */
 $magicWords['zh-hant'] = array(
        'invoke' => array( 0, '調動' ),
-);
\ No newline at end of file
+);
diff --git a/common/Base.php b/common/Base.php
index d1f014f..9fa6907 100644
--- a/common/Base.php
+++ b/common/Base.php
@@ -248,7 +248,7 @@
         * @deprecated
         * @return string
         */
-       public function getLimitReport(){
+       public function getLimitReport() {
                return '';
        }
 
@@ -258,7 +258,7 @@
         * @param $output ParserOutput ParserOutput object in which to add 
limit data
         * @return null
         */
-       public function reportLimitData( ParserOutput $output ){
+       public function reportLimitData( ParserOutput $output ) {
        }
 
        /**
@@ -271,7 +271,7 @@
         * @param $localize bool
         * @return bool
         */
-       public function formatLimitData( $key, &$value, &$report, $isHTML, 
$localize ){
+       public function formatLimitData( $key, &$value, &$report, $isHTML, 
$localize ) {
                return true;
        }
 }
diff --git a/common/Common.php b/common/Common.php
index afaec7e..25716ec 100644
--- a/common/Common.php
+++ b/common/Common.php
@@ -20,7 +20,8 @@
        /**
         * Create a new engine object with default parameters
         *
-        * @param $extraOptions array Extra options to pass to the constructor, 
in addition to the configured options
+        * @param $extraOptions array Extra options to pass to the constructor,
+        * in addition to the configured options
         * @throws MWException
         * @return ScribuntoEngineBase
         */
diff --git a/common/Hooks.php b/common/Hooks.php
index f45d9fd..da1f6be 100644
--- a/common/Hooks.php
+++ b/common/Hooks.php
@@ -94,11 +94,13 @@
                        $engine = Scribunto::getParserEngine( $parser );
                        $title = Title::makeTitleSafe( NS_MODULE, $moduleName );
                        if ( !$title || Scribunto::isDocPage( $title ) ) {
-                               throw new ScribuntoException( 
'scribunto-common-nosuchmodule', array( 'args' => array( $moduleName ) ) );
+                               throw new ScribuntoException( 
'scribunto-common-nosuchmodule',
+                                       array( 'args' => array( $moduleName ) ) 
);
                        }
                        $module = $engine->fetchModuleFromParser( $title );
                        if ( !$module ) {
-                               throw new ScribuntoException( 
'scribunto-common-nosuchmodule', array( 'args' => array( $moduleName ) ) );
+                               throw new ScribuntoException( 
'scribunto-common-nosuchmodule',
+                                       array( 'args' => array( $moduleName ) ) 
);
                        }
                        $functionName = trim( $frame->expand( $args[1] ) );
 
@@ -112,7 +114,7 @@
                        $childFrame = $frame->newChild( $args, $title, 
$bits['index'] === '' ? 0 : 1 );
                        $result = $module->invoke( $functionName, $childFrame );
                        return UtfNormal::cleanUp( strval( $result ) );
-               } catch( ScribuntoException $e ) {
+               } catch ( ScribuntoException $e ) {
                        $trace = $e->getScriptTraceHtml( array( 'msgOptions' => 
array( 'content' ) ) );
                        $html = Html::element( 'p', array(), $e->getMessage() );
                        if ( $trace !== false ) {
diff --git a/engines/LuaCommon/LanguageLibrary.php 
b/engines/LuaCommon/LanguageLibrary.php
index 31e49ae..232a253 100644
--- a/engines/LuaCommon/LanguageLibrary.php
+++ b/engines/LuaCommon/LanguageLibrary.php
@@ -94,7 +94,7 @@
        }
 
        function getFallbacksFor( $code ) {
-               $this->checkType( 'getFallbacksFor', 1, $code , 'string' );
+               $this->checkType( 'getFallbacksFor', 1, $code, 'string' );
                $ret = Language::getFallbacksFor( $code );
                // Make 1-based
                if ( count( $ret ) ) {
diff --git a/engines/LuaCommon/LuaCommon.php b/engines/LuaCommon/LuaCommon.php
index c7316a5..08e94c3 100644
--- a/engines/LuaCommon/LuaCommon.php
+++ b/engines/LuaCommon/LuaCommon.php
@@ -187,7 +187,7 @@
         *
         * @return array
         */
-       public abstract function getPerformanceCharacteristics();
+       abstract public function getPerformanceCharacteristics();
 
        /**
         * Get the current interpreter object
@@ -524,7 +524,7 @@
         */
        protected function getFrameById( $frameId ) {
                if ( $frameId === 'empty' ) {
-                       return  
$this->getParser()->getPreprocessor()->newFrame();
+                       return 
$this->getParser()->getPreprocessor()->newFrame();
                } elseif ( isset( $this->currentFrames[$frameId] ) ) {
                        return $this->currentFrames[$frameId];
                } else {
diff --git a/engines/LuaCommon/MessageLibrary.php 
b/engines/LuaCommon/MessageLibrary.php
index 0ef9338..ba426e6 100644
--- a/engines/LuaCommon/MessageLibrary.php
+++ b/engines/LuaCommon/MessageLibrary.php
@@ -38,7 +38,7 @@
                try {
                        $msg = $this->makeMessage( $data, true );
                        return array( $msg->plain() );
-               } catch( MWException $ex ) {
+               } catch ( MWException $ex ) {
                        throw new Scribunto_LuaError( "msg:plain() failed (" . 
$ex->getMessage() . ")" );
                }
        }
@@ -51,7 +51,7 @@
                try {
                        $msg = $this->makeMessage( $data, false );
                        return array( call_user_func( array( $msg, $what ) ) );
-               } catch( MWException $ex ) {
+               } catch ( MWException $ex ) {
                        throw new Scribunto_LuaError( "msg:$what() failed (" . 
$ex->getMessage() . ")" );
                }
        }
diff --git a/engines/LuaCommon/UstringLibrary.php 
b/engines/LuaCommon/UstringLibrary.php
index 4862fde..8bf93aa 100644
--- a/engines/LuaCommon/UstringLibrary.php
+++ b/engines/LuaCommon/UstringLibrary.php
@@ -437,7 +437,7 @@
                return $this->patternRegexCache->get( $cacheKey );
        }
 
-       private function bracketedCharSetToRegex( $pat, $i, $len, $brcharsets ){
+       private function bracketedCharSetToRegex( $pat, $i, $len, $brcharsets ) 
{
                $ii = $i + 1;
                $re = '[';
                $i++;
@@ -445,7 +445,7 @@
                        $re .= '^';
                        $i++;
                }
-               for ( ; $i < $len && $pat[$i] !== ']'; $i++ ) {
+               for (; $i < $len && $pat[$i] !== ']'; $i++ ) {
                        if ( $pat[$i] === '%' ) {
                                $i++;
                                if ( $i >= $len ) {
diff --git a/engines/LuaStandalone/LuaStandaloneEngine.php 
b/engines/LuaStandalone/LuaStandaloneEngine.php
index ccf2be6..4202d25 100644
--- a/engines/LuaStandalone/LuaStandaloneEngine.php
+++ b/engines/LuaStandalone/LuaStandaloneEngine.php
@@ -343,7 +343,7 @@
        }
 
        public function callFunction( $func /* ... */ ) {
-               if ( !($func instanceof 
Scribunto_LuaStandaloneInterpreterFunction) ) {
+               if ( !( $func instanceof 
Scribunto_LuaStandaloneInterpreterFunction ) ) {
                        throw new MWException( __METHOD__.': invalid function 
type' );
                }
                if ( $func->interpreterId !== $this->id ) {
diff --git a/tests/engines/LuaCommon/CommonTest.php 
b/tests/engines/LuaCommon/CommonTest.php
index 03144c1..e9fd013 100644
--- a/tests/engines/LuaCommon/CommonTest.php
+++ b/tests/engines/LuaCommon/CommonTest.php
@@ -273,7 +273,7 @@
                $loadcount = 0;
                $interpreter->callFunction(
                        $interpreter->loadString( 'mw.markLoaded = ...', 
'fortest' ),
-                       $interpreter->wrapPHPFunction( function () use 
(&$loadcount) {
+                       $interpreter->wrapPHPFunction( function () use ( 
&$loadcount ) {
                                $loadcount++;
                        } )
                );
@@ -343,8 +343,6 @@
        }
 
        public function testCallParserFunction() {
-               global $wgContLang;
-
                $engine = $this->getEngine();
                $parser = $engine->getParser();
 
diff --git a/tests/engines/LuaCommon/LuaEngineTestBase.php 
b/tests/engines/LuaCommon/LuaEngineTestBase.php
index 4d7817c..a7552a6 100644
--- a/tests/engines/LuaCommon/LuaEngineTestBase.php
+++ b/tests/engines/LuaCommon/LuaEngineTestBase.php
@@ -189,7 +189,7 @@
        }
 
        public function templateCallback( $title, $parser ) {
-               if ( isset($this->extraModules[$title->getFullText()]) ) {
+               if ( isset( $this->extraModules[$title->getFullText()] ) ) {
                        return array(
                                'text' => 
$this->extraModules[$title->getFullText()],
                                'finalTitle' => $title,
diff --git a/tests/engines/LuaCommon/LuaInterpreterTest.php 
b/tests/engines/LuaCommon/LuaInterpreterTest.php
index 1c15289..d45ab25 100644
--- a/tests/engines/LuaCommon/LuaInterpreterTest.php
+++ b/tests/engines/LuaCommon/LuaInterpreterTest.php
@@ -1,7 +1,7 @@
 <?php
 
 abstract class Scribunto_LuaInterpreterTest extends MediaWikiTestCase {
-       protected abstract function newInterpreter( $opts = array() );
+       abstract protected function newInterpreter( $opts = array() );
 
        protected function setUp() {
                parent::setUp();
diff --git a/tests/engines/LuaCommon/TitleLibraryTest.php 
b/tests/engines/LuaCommon/TitleLibraryTest.php
index dc78666..9a8d499 100644
--- a/tests/engines/LuaCommon/TitleLibraryTest.php
+++ b/tests/engines/LuaCommon/TitleLibraryTest.php
@@ -82,7 +82,6 @@
                $title->mCascadeSources = array();
                $title->mCascadingRestrictions = array();
 
-
                // Note this depends on every iteration of the data provider 
running with a clean parser
                
$this->getEngine()->getParser()->getOptions()->setExpensiveParserFunctionLimit( 
10 );
 
diff --git a/tests/engines/LuaCommon/UstringLibraryTest.php 
b/tests/engines/LuaCommon/UstringLibraryTest.php
index 5a71a01..3e24a5d 100644
--- a/tests/engines/LuaCommon/UstringLibraryTest.php
+++ b/tests/engines/LuaCommon/UstringLibraryTest.php
@@ -92,7 +92,7 @@
 
        public function rewind() {
                if ( $this->file ) {
-                       rewind($this->file);
+                       rewind( $this->file );
                }
                $this->key = 0;
                $this->next();
@@ -100,9 +100,9 @@
 
        public function valid() {
                if ( $this->file ) {
-                       $v=!feof($this->file);
+                       $v = !feof( $this->file );
                } else {
-                       $v=$this->key < count( self::$static );
+                       $v = $this->key < count( self::$static );
                }
                return $v;
        }
@@ -113,7 +113,7 @@
 
        public function next() {
                $this->current = array( null, null, null, null, null, null );
-               while( $this->valid() ) {
+               while ( $this->valid() ) {
                        if ( $this->file ) {
                                $line = fgets( $this->file );
                        } else {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5a44d07553d45bc01db070c99856b35a3d275bd1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Scribunto
Gerrit-Branch: master
Gerrit-Owner: Jackmcbarn <jackmcb...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to