mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Scribunto
synced 2024-11-11 17:01:00 +00:00
Use PHP 7's ?? syntax
Change-Id: I768782b8acbc1776e29886d330358553675e272b
This commit is contained in:
parent
822d34c2a3
commit
f308135df3
|
@ -128,8 +128,7 @@ abstract class ScribuntoEngineBase {
|
|||
* @return mixed
|
||||
*/
|
||||
public function getOption( $optionName ) {
|
||||
return isset( $this->options[$optionName] )
|
||||
? $this->options[$optionName] : null;
|
||||
return $this->options[$optionName] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -241,7 +241,7 @@ abstract class Scribunto_LuaEngine extends ScribuntoEngineBase {
|
|||
$oldExpandCache = $this->expandCache;
|
||||
$this->currentFrames = [
|
||||
'current' => $frame,
|
||||
'parent' => isset( $frame->parent ) ? $frame->parent : null,
|
||||
'parent' => $frame->parent ?? null,
|
||||
];
|
||||
$this->expandCache = [];
|
||||
|
||||
|
@ -374,7 +374,7 @@ abstract class Scribunto_LuaEngine extends ScribuntoEngineBase {
|
|||
# Prepending an "@" to the chunk name makes Lua think it is a filename
|
||||
$module = $this->getInterpreter()->loadString( $code, '@' . basename( $fileName ) );
|
||||
$ret = $this->getInterpreter()->callFunction( $module );
|
||||
return isset( $ret[0] ) ? $ret[0] : null;
|
||||
return $ret[0] ?? null;
|
||||
}
|
||||
|
||||
public function getGeSHiLanguage() {
|
||||
|
@ -441,8 +441,8 @@ abstract class Scribunto_LuaEngine extends ScribuntoEngineBase {
|
|||
$ret = $this->getInterpreter()->callFunction( $func, $contentInit, $contentExe );
|
||||
|
||||
return [
|
||||
'return' => isset( $ret[0] ) ? $ret[0] : null,
|
||||
'print' => isset( $ret[1] ) ? $ret[1] : '',
|
||||
'return' => $ret[0] ?? null,
|
||||
'print' => $ret[1] ?? '',
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -803,7 +803,7 @@ class Scribunto_LuaUstringLibrary extends Scribunto_LuaLibraryBase {
|
|||
if ( $anypos ) {
|
||||
$m = array_shift( $captures );
|
||||
}
|
||||
$x = isset( $m['m1'] ) ? $m['m1'] : $m[0];
|
||||
$x = $m['m1'] ?? $m[0];
|
||||
if ( !isset( $repl[$x] ) || $repl[$x] === null ) {
|
||||
return $m[0];
|
||||
}
|
||||
|
|
|
@ -213,9 +213,7 @@ class Scribunto_LuaStandaloneInterpreter extends Scribunto_LuaInterpreter {
|
|||
|
||||
$this->engine = $engine;
|
||||
$this->enableDebug = !empty( $options['debug'] );
|
||||
$this->logger = isset( $options['logger'] )
|
||||
? $options['logger']
|
||||
: new NullLogger();
|
||||
$this->logger = $options['logger'] ?? new NullLogger();
|
||||
|
||||
$pipes = null;
|
||||
$cmd = wfEscapeShellArg(
|
||||
|
|
Loading…
Reference in a new issue