mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Scribunto
synced 2024-11-27 17:50:06 +00:00
build: Updating mediawiki/mediawiki-phan-config to 0.9.0
Depends-On: I9661ed8dd80cb827d7a1414c1eef952c0933a1f0 Change-Id: Ia34d9d9eade74cbb261dbfe4e39971de57cab888
This commit is contained in:
parent
26513da3c3
commit
3b2d40f28d
|
@ -5,7 +5,7 @@
|
|||
"mediawiki/lua-sandbox": "3.0.1",
|
||||
"mediawiki/minus-x": "0.3.2",
|
||||
"jakub-onderka/php-console-highlighter": "0.3.2",
|
||||
"mediawiki/mediawiki-phan-config": "0.8.0"
|
||||
"mediawiki/mediawiki-phan-config": "0.9.0"
|
||||
},
|
||||
"repositories": [
|
||||
{
|
||||
|
|
|
@ -60,6 +60,7 @@ class ApiScribuntoConsole extends ApiBase {
|
|||
}
|
||||
$result = $this->runConsole( [
|
||||
'title' => $title,
|
||||
// @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset
|
||||
'content' => $newSession['content'],
|
||||
'prevQuestions' => $session['questions'],
|
||||
'question' => $params['question'],
|
||||
|
|
|
@ -210,7 +210,7 @@ class ScribuntoHooks {
|
|||
}
|
||||
|
||||
$cacheVersion = '1';
|
||||
$key = $cache->makeGlobalKey( __METHOD__, $cacheVersion, $threshold );
|
||||
$key = $cache->makeGlobalKey( __METHOD__, $cacheVersion, (string)$threshold );
|
||||
|
||||
// This is a classic "read-update-write" critical section with no
|
||||
// mutual exclusion, but the only consequence is that some samples
|
||||
|
|
|
@ -33,7 +33,7 @@ abstract class ScribuntoEngineBase {
|
|||
const MEM_PEAK_BYTES = 2;
|
||||
|
||||
/**
|
||||
* @var Title
|
||||
* @var Title|null
|
||||
*/
|
||||
protected $title;
|
||||
|
||||
|
@ -43,12 +43,12 @@ abstract class ScribuntoEngineBase {
|
|||
protected $options;
|
||||
|
||||
/**
|
||||
* @var ScribuntoModuleBase[]
|
||||
* @var (ScribuntoModuleBase|null)[]
|
||||
*/
|
||||
protected $modules = [];
|
||||
|
||||
/**
|
||||
* @var Parser
|
||||
* @var Parser|null
|
||||
*/
|
||||
protected $parser;
|
||||
|
||||
|
|
|
@ -284,6 +284,7 @@ class Scribunto_LuaLanguageLibrary extends Scribunto_LuaLibraryBase {
|
|||
}
|
||||
}
|
||||
}
|
||||
// @phan-suppress-next-line PhanTypeMismatchArgumentNullable gender always not null
|
||||
return [ $lang->gender( $gender, $forms ) ];
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ abstract class Scribunto_LuaEngine extends ScribuntoEngineBase {
|
|||
protected $loaded = false;
|
||||
|
||||
/**
|
||||
* @var Scribunto_LuaInterpreter
|
||||
* @var Scribunto_LuaInterpreter|null
|
||||
*/
|
||||
protected $interpreter;
|
||||
|
||||
|
@ -739,6 +739,7 @@ abstract class Scribunto_LuaEngine extends ScribuntoEngineBase {
|
|||
* @throws MWException
|
||||
* @throws Scribunto_LuaError
|
||||
* @return array
|
||||
* @suppress PhanImpossibleCondition
|
||||
*/
|
||||
public function callParserFunction( $frameId, $function, $args ) {
|
||||
$frame = $this->getFrameById( $frameId );
|
||||
|
|
|
@ -177,9 +177,9 @@ class Scribunto_LuaSiteLibrary extends Scribunto_LuaLibraryBase {
|
|||
$this->checkTypeOptional( 'interwikiMap', 1, $filter, 'string', null );
|
||||
$local = null;
|
||||
if ( $filter === 'local' ) {
|
||||
$local = 1;
|
||||
$local = '1';
|
||||
} elseif ( $filter === '!local' ) {
|
||||
$local = 0;
|
||||
$local = '0';
|
||||
} elseif ( $filter !== null ) {
|
||||
throw new Scribunto_LuaError(
|
||||
"bad argument #1 to 'interwikiMap' (unknown filter '$filter')"
|
||||
|
|
|
@ -866,6 +866,7 @@ class Scribunto_LuaUstringLibrary extends Scribunto_LuaLibraryBase {
|
|||
}
|
||||
|
||||
$count = 0;
|
||||
// @phan-suppress-next-line PhanTypeMismatchArgumentNullableInternal
|
||||
$s2 = preg_replace_callback( $re, $cb, $s, $n, $count );
|
||||
if ( $s2 === null ) {
|
||||
self::handlePCREError( preg_last_error(), $pattern );
|
||||
|
|
|
@ -127,6 +127,7 @@ foreach ( $pats as $k => $pp ) {
|
|||
$check[] = sprintf( "pats[0x%02x][k]", ord( $p ) );
|
||||
}
|
||||
}
|
||||
// @phan-suppress-next-line PhanImpossibleConditionInGlobalScope
|
||||
if ( $ranges[$k] ) {
|
||||
$body = "\tlocal c = tonumber( k ) or 0/0;\n";
|
||||
$check = array_merge( $check, $ranges[$k] );
|
||||
|
|
|
@ -91,7 +91,7 @@ class Scribunto_LuaSandboxEngine extends Scribunto_LuaEngine {
|
|||
if ( $cumulativePercent <= 99 && $num <= 10 ) {
|
||||
// Map some regularly appearing internal names
|
||||
if ( preg_match( '/^<mw.lua:(\d+)>$/', $name, $m ) ) {
|
||||
$line = $this->getMwLuaLine( $m[1] );
|
||||
$line = $this->getMwLuaLine( (int)$m[1] );
|
||||
if ( preg_match( '/^\s*(local\s+)?function ([a-zA-Z0-9_.]*)/', $line, $m ) ) {
|
||||
$name = $m[2] . ' ' . $name;
|
||||
}
|
||||
|
@ -177,8 +177,8 @@ class Scribunto_LuaSandboxEngine extends Scribunto_LuaEngine {
|
|||
$pct = clone $percentMsg;
|
||||
$pct->params( $line[2] );
|
||||
$report .= Html::openElement( 'tr' ) .
|
||||
Html::element( 'td', null, $name ) .
|
||||
Html::rawElement( 'td', null, $location ) .
|
||||
Html::element( 'td', [], $name ) .
|
||||
Html::rawElement( 'td', [], $location ) .
|
||||
Html::rawElement( 'td', [ 'align' => 'right' ], $ms->parse() ) .
|
||||
Html::rawElement( 'td', [ 'align' => 'right' ], $pct->parse() ) .
|
||||
Html::closeElement( 'tr' );
|
||||
|
|
|
@ -107,8 +107,8 @@ class Scribunto_LuaStandaloneInterpreter extends Scribunto_LuaInterpreter {
|
|||
$options['luaPath'],
|
||||
__DIR__ . '/mw_main.lua',
|
||||
dirname( dirname( __DIR__ ) ),
|
||||
$this->id,
|
||||
PHP_INT_SIZE
|
||||
(string)$this->id,
|
||||
(string)PHP_INT_SIZE
|
||||
);
|
||||
if ( php_uname( 's' ) == 'Linux' ) {
|
||||
// Limit memory and CPU
|
||||
|
@ -116,9 +116,9 @@ class Scribunto_LuaStandaloneInterpreter extends Scribunto_LuaInterpreter {
|
|||
'exec', # proc_open() passes $cmd to 'sh -c' on Linux, so add an 'exec' to bypass it
|
||||
'/bin/sh',
|
||||
__DIR__ . '/lua_ulimit.sh',
|
||||
$options['cpuLimit'], # soft limit (SIGXCPU)
|
||||
$options['cpuLimit'] + 1, # hard limit
|
||||
intval( $options['memoryLimit'] / 1024 ),
|
||||
(string)$options['cpuLimit'], # soft limit (SIGXCPU)
|
||||
(string)( $options['cpuLimit'] + 1 ), # hard limit
|
||||
(string)intval( $options['memoryLimit'] / 1024 ),
|
||||
$cmd );
|
||||
}
|
||||
|
||||
|
@ -148,6 +148,7 @@ class Scribunto_LuaStandaloneInterpreter extends Scribunto_LuaInterpreter {
|
|||
[
|
||||
[ 'pipe', 'r' ],
|
||||
[ 'pipe', 'w' ],
|
||||
// @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset
|
||||
[ 'file', $options['errorFile'], 'a' ]
|
||||
],
|
||||
$pipes );
|
||||
|
@ -354,6 +355,7 @@ class Scribunto_LuaStandaloneInterpreter extends Scribunto_LuaInterpreter {
|
|||
|
||||
return [
|
||||
'op' => 'return',
|
||||
// @phan-suppress-next-line PhanTypeMismatchArgumentNullableInternal result always array
|
||||
'nvalues' => count( $result ),
|
||||
'values' => $result
|
||||
];
|
||||
|
@ -589,11 +591,14 @@ class Scribunto_LuaStandaloneInterpreter extends Scribunto_LuaInterpreter {
|
|||
$status['termsig'] = $status['exitcode'] - 128;
|
||||
}
|
||||
|
||||
// @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset
|
||||
if ( $status['signaled'] ) {
|
||||
// @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset
|
||||
if ( defined( 'SIGXCPU' ) && $status['termsig'] === SIGXCPU ) {
|
||||
$this->exitError = $this->engine->newException( 'scribunto-common-timeout' );
|
||||
} else {
|
||||
$this->exitError = $this->engine->newException( 'scribunto-luastandalone-signal',
|
||||
// @phan-suppress-next-line PhanTypePossiblyInvalidDimOffset
|
||||
[ 'args' => [ $status['termsig'] ] ] );
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue