mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Scribunto
synced 2024-11-11 17:01:00 +00:00
Apply some minor PHP code modernizations
* Make use of the ?? syntax. * Use an upstream function. * Fix an incomplete type hint. Change-Id: I7b1916418f4b1e65cc8396cfd646224f55c137a4
This commit is contained in:
parent
408f4d0bc6
commit
912324993f
|
@ -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 {
|
||||
|
|
|
@ -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] !== '%'
|
||||
) {
|
||||
|
|
|
@ -412,7 +412,7 @@ class Hooks {
|
|||
|
||||
/**
|
||||
* @param Article $article
|
||||
* @param bool &$outputDone
|
||||
* @param bool|ParserOutput|null &$outputDone
|
||||
* @param bool &$pcache
|
||||
* @return bool
|
||||
*/
|
||||
|
|
|
@ -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'] ) ) {
|
||||
|
|
Loading…
Reference in a new issue