mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Scribunto
synced 2024-11-30 19:14:22 +00:00
Merge "Fix some PHPCS issues"
This commit is contained in:
commit
cfb77778c8
|
@ -248,7 +248,7 @@ abstract class ScribuntoEngineBase {
|
|||
* @deprecated
|
||||
* @return string
|
||||
*/
|
||||
public function getLimitReport(){
|
||||
public function getLimitReport() {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
@ -258,7 +258,7 @@ abstract class ScribuntoEngineBase {
|
|||
* @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 @@ abstract class ScribuntoEngineBase {
|
|||
* @param $localize bool
|
||||
* @return bool
|
||||
*/
|
||||
public function formatLimitData( $key, &$value, &$report, $isHTML, $localize ){
|
||||
public function formatLimitData( $key, &$value, &$report, $isHTML, $localize ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,8 @@ class Scribunto {
|
|||
/**
|
||||
* 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
|
||||
*/
|
||||
|
|
|
@ -94,11 +94,13 @@ class ScribuntoHooks {
|
|||
$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 @@ class ScribuntoHooks {
|
|||
$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 ) {
|
||||
|
|
|
@ -94,7 +94,7 @@ class Scribunto_LuaLanguageLibrary extends Scribunto_LuaLibraryBase {
|
|||
}
|
||||
|
||||
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 ) ) {
|
||||
|
|
|
@ -187,7 +187,7 @@ abstract class Scribunto_LuaEngine extends ScribuntoEngineBase {
|
|||
*
|
||||
* @return array
|
||||
*/
|
||||
public abstract function getPerformanceCharacteristics();
|
||||
abstract public function getPerformanceCharacteristics();
|
||||
|
||||
/**
|
||||
* Get the current interpreter object
|
||||
|
|
|
@ -38,7 +38,7 @@ class Scribunto_LuaMessageLibrary extends Scribunto_LuaLibraryBase {
|
|||
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 @@ class Scribunto_LuaMessageLibrary extends Scribunto_LuaLibraryBase {
|
|||
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() . ")" );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -437,7 +437,7 @@ class Scribunto_LuaUstringLibrary extends Scribunto_LuaLibraryBase {
|
|||
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 @@ class Scribunto_LuaUstringLibrary extends Scribunto_LuaLibraryBase {
|
|||
$re .= '^';
|
||||
$i++;
|
||||
}
|
||||
for ( ; $i < $len && $pat[$i] !== ']'; $i++ ) {
|
||||
for (; $i < $len && $pat[$i] !== ']'; $i++ ) {
|
||||
if ( $pat[$i] === '%' ) {
|
||||
$i++;
|
||||
if ( $i >= $len ) {
|
||||
|
|
|
@ -343,7 +343,7 @@ class Scribunto_LuaStandaloneInterpreter extends Scribunto_LuaInterpreter {
|
|||
}
|
||||
|
||||
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 ) {
|
||||
|
|
|
@ -273,7 +273,7 @@ class Scribunto_LuaCommonTests extends Scribunto_LuaEngineTestBase {
|
|||
$loadcount = 0;
|
||||
$interpreter->callFunction(
|
||||
$interpreter->loadString( 'mw.markLoaded = ...', 'fortest' ),
|
||||
$interpreter->wrapPHPFunction( function () use (&$loadcount) {
|
||||
$interpreter->wrapPHPFunction( function () use ( &$loadcount ) {
|
||||
$loadcount++;
|
||||
} )
|
||||
);
|
||||
|
@ -343,8 +343,6 @@ class Scribunto_LuaCommonTests extends Scribunto_LuaEngineTestBase {
|
|||
}
|
||||
|
||||
public function testCallParserFunction() {
|
||||
global $wgContLang;
|
||||
|
||||
$engine = $this->getEngine();
|
||||
$parser = $engine->getParser();
|
||||
|
||||
|
|
|
@ -189,7 +189,7 @@ abstract class Scribunto_LuaEngineTestBase extends MediaWikiLangTestCase {
|
|||
}
|
||||
|
||||
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,
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -82,7 +82,6 @@ class Scribunto_LuaTitleLibraryTests extends Scribunto_LuaEngineTestBase {
|
|||
$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 );
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ class UstringLibraryNormalizationTestProvider extends Scribunto_LuaDataProvider
|
|||
|
||||
public function rewind() {
|
||||
if ( $this->file ) {
|
||||
rewind($this->file);
|
||||
rewind( $this->file );
|
||||
}
|
||||
$this->key = 0;
|
||||
$this->next();
|
||||
|
@ -100,9 +100,9 @@ class UstringLibraryNormalizationTestProvider extends Scribunto_LuaDataProvider
|
|||
|
||||
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 @@ class UstringLibraryNormalizationTestProvider extends Scribunto_LuaDataProvider
|
|||
|
||||
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 {
|
||||
|
|
Loading…
Reference in a new issue