diff --git a/.gitignore b/.gitignore index 5ae2dd25..f453a613 100644 --- a/.gitignore +++ b/.gitignore @@ -22,4 +22,3 @@ project.index ## Sublime sublime-* sftp-config.json -tests/phan/issues diff --git a/.phan/config.php b/.phan/config.php new file mode 100644 index 00000000..aa85e632 --- /dev/null +++ b/.phan/config.php @@ -0,0 +1,30 @@ +scribunto_engine + 'PhanUndeclaredProperty', + ] +); + +return $cfg; diff --git a/Scribunto.php b/Scribunto.php index e75bab9d..a990b257 100644 --- a/Scribunto.php +++ b/Scribunto.php @@ -1,5 +1,5 @@ validate( $title ); if ( $validateStatus->isOK() ) { return true; diff --git a/includes/engines/LuaCommon/LuaCommon.php b/includes/engines/LuaCommon/LuaCommon.php index 0faa1b3d..827e3bcd 100644 --- a/includes/engines/LuaCommon/LuaCommon.php +++ b/includes/engines/LuaCommon/LuaCommon.php @@ -567,7 +567,7 @@ abstract class Scribunto_LuaEngine extends ScribuntoEngineBase { $module = $this->fetchModuleFromParser( $title ); if ( $module ) { - /** @suppress PhanUndeclaredMethod */ + // @phan-suppress-next-line PhanUndeclaredMethod return [ $module->getInitChunk() ]; } else { return []; @@ -1045,27 +1045,27 @@ class Scribunto_LuaError extends ScribuntoException { } if ( strval( $info['namewhat'] ) !== '' ) { - $function = wfMessage( 'scribunto-lua-in-function', wfEscapeWikiText( $info['name'] ) ); + $functionMsg = wfMessage( 'scribunto-lua-in-function', wfEscapeWikiText( $info['name'] ) ); in_array( 'content', $msgOptions ) ? - $function = $function->inContentLanguage()->plain() : - $function = $function->plain(); + $function = $functionMsg->inContentLanguage()->plain() : + $function = $functionMsg->plain(); } elseif ( $info['what'] == 'main' ) { - $function = wfMessage( 'scribunto-lua-in-main' ); + $functionMsg = wfMessage( 'scribunto-lua-in-main' ); in_array( 'content', $msgOptions ) ? - $function = $function->inContentLanguage()->plain() : - $function = $function->plain(); + $function = $functionMsg->inContentLanguage()->plain() : + $function = $functionMsg->plain(); } else { // C function, tail call, or a Lua function where Lua can't // guess the name $function = '?'; } - $backtraceLine = wfMessage( 'scribunto-lua-backtrace-line' ) + $backtraceLineMsg = wfMessage( 'scribunto-lua-backtrace-line' ) ->rawParams( "$src" ) ->params( $function ); in_array( 'content', $msgOptions ) ? - $backtraceLine = $backtraceLine->inContentLanguage()->parse() : - $backtraceLine = $backtraceLine->parse(); + $backtraceLine = $backtraceLineMsg->inContentLanguage()->parse() : + $backtraceLine = $backtraceLineMsg->parse(); $s .= "
  • $backtraceLine
  • "; } diff --git a/includes/engines/LuaCommon/UstringLibrary.php b/includes/engines/LuaCommon/UstringLibrary.php index a053a5a9..82f1445a 100644 --- a/includes/engines/LuaCommon/UstringLibrary.php +++ b/includes/engines/LuaCommon/UstringLibrary.php @@ -476,6 +476,7 @@ class Scribunto_LuaUstringLibrary extends Scribunto_LuaLibraryBase { // Because %f considers the beginning and end of the string // to be \0, determine if $re2 matches that and take it // into account with "^" and "$". + // @phan-suppress-next-line PhanParamSuspiciousOrder if ( preg_match( "/$re2/us", "\0" ) ) { $re .= "(?formatSize( $value ); break; } @@ -130,7 +131,7 @@ class Scribunto_LuaStandaloneInterpreter extends Scribunto_LuaInterpreter { public $enableDebug; /** - * @var resource + * @var resource|bool */ public $proc; @@ -684,6 +685,9 @@ class Scribunto_LuaStandaloneInterpreter extends Scribunto_LuaInterpreter { proc_terminate( $this->proc ); while ( true ) { $status = proc_get_status( $this->proc ); + // XXX: Should proc_get_status docs be changed so that + // its documented as possibly returning false? + // @phan-suppress-next-line PhanTypeComparisonFromArray if ( $status === false ) { // WTF? Let the caller throw an appropriate error. return; diff --git a/tests/phan/config.php b/tests/phan/config.php deleted file mode 100644 index b5392165..00000000 --- a/tests/phan/config.php +++ /dev/null @@ -1,33 +0,0 @@ -scribunto_engine - 'PhanUndeclaredProperty', - // \Scribunto_LuaInterpreter::callFunction() - 'PhanParamTooMany', - // our version of phan doesn't support inheriting doc yet - 'PhanParamSignatureMismatch', - ] -); - -return $cfg;