From 3b2d40f28de5631346277972861e391c389f6e46 Mon Sep 17 00:00:00 2001 From: libraryupgrader Date: Sun, 22 Dec 2019 02:14:03 +0000 Subject: [PATCH] build: Updating mediawiki/mediawiki-phan-config to 0.9.0 Depends-On: I9661ed8dd80cb827d7a1414c1eef952c0933a1f0 Change-Id: Ia34d9d9eade74cbb261dbfe4e39971de57cab888 --- composer.json | 2 +- includes/common/ApiScribuntoConsole.php | 1 + includes/common/Hooks.php | 2 +- includes/common/ScribuntoEngineBase.php | 6 +++--- includes/engines/LuaCommon/LanguageLibrary.php | 1 + includes/engines/LuaCommon/LuaEngine.php | 3 ++- includes/engines/LuaCommon/SiteLibrary.php | 4 ++-- includes/engines/LuaCommon/UstringLibrary.php | 1 + .../LuaCommon/lualib/ustring/make-tables.php | 1 + includes/engines/LuaSandbox/LuaSandboxEngine.php | 6 +++--- .../LuaStandalone/LuaStandaloneInterpreter.php | 15 ++++++++++----- 11 files changed, 26 insertions(+), 16 deletions(-) diff --git a/composer.json b/composer.json index 658a5bbb..3df81c61 100644 --- a/composer.json +++ b/composer.json @@ -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": [ { diff --git a/includes/common/ApiScribuntoConsole.php b/includes/common/ApiScribuntoConsole.php index 6c72d5c2..2676f08e 100644 --- a/includes/common/ApiScribuntoConsole.php +++ b/includes/common/ApiScribuntoConsole.php @@ -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'], diff --git a/includes/common/Hooks.php b/includes/common/Hooks.php index 1d9cf412..2eb616e6 100644 --- a/includes/common/Hooks.php +++ b/includes/common/Hooks.php @@ -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 diff --git a/includes/common/ScribuntoEngineBase.php b/includes/common/ScribuntoEngineBase.php index 8c985ba7..5c8e5016 100644 --- a/includes/common/ScribuntoEngineBase.php +++ b/includes/common/ScribuntoEngineBase.php @@ -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; diff --git a/includes/engines/LuaCommon/LanguageLibrary.php b/includes/engines/LuaCommon/LanguageLibrary.php index 73f7d519..ea0f0bf2 100644 --- a/includes/engines/LuaCommon/LanguageLibrary.php +++ b/includes/engines/LuaCommon/LanguageLibrary.php @@ -284,6 +284,7 @@ class Scribunto_LuaLanguageLibrary extends Scribunto_LuaLibraryBase { } } } + // @phan-suppress-next-line PhanTypeMismatchArgumentNullable gender always not null return [ $lang->gender( $gender, $forms ) ]; } diff --git a/includes/engines/LuaCommon/LuaEngine.php b/includes/engines/LuaCommon/LuaEngine.php index 440a10ec..bf6d390a 100644 --- a/includes/engines/LuaCommon/LuaEngine.php +++ b/includes/engines/LuaCommon/LuaEngine.php @@ -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 ); diff --git a/includes/engines/LuaCommon/SiteLibrary.php b/includes/engines/LuaCommon/SiteLibrary.php index 93822484..ceb888be 100644 --- a/includes/engines/LuaCommon/SiteLibrary.php +++ b/includes/engines/LuaCommon/SiteLibrary.php @@ -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')" diff --git a/includes/engines/LuaCommon/UstringLibrary.php b/includes/engines/LuaCommon/UstringLibrary.php index 82f1445a..b7ada6af 100644 --- a/includes/engines/LuaCommon/UstringLibrary.php +++ b/includes/engines/LuaCommon/UstringLibrary.php @@ -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 ); diff --git a/includes/engines/LuaCommon/lualib/ustring/make-tables.php b/includes/engines/LuaCommon/lualib/ustring/make-tables.php index feeb5fa1..6d66a54d 100755 --- a/includes/engines/LuaCommon/lualib/ustring/make-tables.php +++ b/includes/engines/LuaCommon/lualib/ustring/make-tables.php @@ -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] ); diff --git a/includes/engines/LuaSandbox/LuaSandboxEngine.php b/includes/engines/LuaSandbox/LuaSandboxEngine.php index da154621..b7aaa7c3 100644 --- a/includes/engines/LuaSandbox/LuaSandboxEngine.php +++ b/includes/engines/LuaSandbox/LuaSandboxEngine.php @@ -91,7 +91,7 @@ class Scribunto_LuaSandboxEngine extends Scribunto_LuaEngine { if ( $cumulativePercent <= 99 && $num <= 10 ) { // Map some regularly appearing internal names if ( preg_match( '/^$/', $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' ); diff --git a/includes/engines/LuaStandalone/LuaStandaloneInterpreter.php b/includes/engines/LuaStandalone/LuaStandaloneInterpreter.php index c46d5299..71749e54 100644 --- a/includes/engines/LuaStandalone/LuaStandaloneInterpreter.php +++ b/includes/engines/LuaStandalone/LuaStandaloneInterpreter.php @@ -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 {