diff --git a/includes/Engines/LuaCommon/LuaEngine.php b/includes/Engines/LuaCommon/LuaEngine.php index aaabcfe0..3ae3b064 100644 --- a/includes/Engines/LuaCommon/LuaEngine.php +++ b/includes/Engines/LuaCommon/LuaEngine.php @@ -13,6 +13,7 @@ use MWException; use ObjectCache; use Parser; use PPFrame; +use TextContent; use Title; use Wikimedia\ScopedCallback; @@ -927,7 +928,7 @@ abstract class LuaEngine extends ScribuntoEngineBase { } if ( is_scalar( $input ) ) { - $input = str_replace( [ "\r\n", "\r" ], "\n", $input ); + $input = TextContent::normalizeLineEndings( $input ); $dom = $this->parser->getPreprocessor()->preprocessToObj( $input, $frame->depth ? Parser::PTD_FOR_INCLUSION : 0 ); } else { diff --git a/includes/Engines/LuaCommon/UstringLibrary.php b/includes/Engines/LuaCommon/UstringLibrary.php index e8f16282..b959e649 100644 --- a/includes/Engines/LuaCommon/UstringLibrary.php +++ b/includes/Engines/LuaCommon/UstringLibrary.php @@ -584,11 +584,7 @@ class UstringLibrary extends LibraryBase { if ( $i >= $len ) { break; } - if ( isset( $brcharsets[$pat[$i]] ) ) { - $re .= $brcharsets[$pat[$i]]; - } else { - $re .= preg_quote( $pat[$i], '/' ); - } + $re .= $brcharsets[$pat[$i]] ?? preg_quote( $pat[$i], '/' ); } elseif ( $i + 2 < $len && $pat[$i + 1] === '-' && $pat[$i + 2] !== ']' && $pat[$i + 2] !== '%' ) { diff --git a/includes/Hooks.php b/includes/Hooks.php index d933a43f..6e40c2a0 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -412,7 +412,7 @@ class Hooks { /** * @param Article $article - * @param bool &$outputDone + * @param bool|ParserOutput|null &$outputDone * @param bool &$pcache * @return bool */ diff --git a/includes/ScribuntoException.php b/includes/ScribuntoException.php index ddaedba1..042af5c8 100644 --- a/includes/ScribuntoException.php +++ b/includes/ScribuntoException.php @@ -31,11 +31,7 @@ class ScribuntoException extends MWException { * @param array $params */ public function __construct( $messageName, $params = [] ) { - if ( isset( $params['args'] ) ) { - $this->messageArgs = $params['args']; - } else { - $this->messageArgs = []; - } + $this->messageArgs = $params['args'] ?? []; if ( isset( $params['module'] ) && isset( $params['line'] ) ) { $codeLocation = false; if ( isset( $params['title'] ) ) {