From 54190757bbaadf8ca087c3f861e833d29adad650 Mon Sep 17 00:00:00 2001 From: Umherirrender Date: Sat, 29 Jun 2019 17:17:33 +0200 Subject: [PATCH] Unpack arrays on variadic arguments This avoids extra handling in the function to unpack an array Change-Id: I93277599bc8125e23fca53d43a728fb7e9e39aad --- includes/LinkFilter.php | 2 +- includes/exception/MWException.php | 2 +- includes/exception/MWExceptionRenderer.php | 2 +- includes/logging/LogPager.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/LinkFilter.php b/includes/LinkFilter.php index 6ad9b31ab9..7e1b44d21a 100644 --- a/includes/LinkFilter.php +++ b/includes/LinkFilter.php @@ -292,7 +292,7 @@ class LinkFilter { // The constant prefix is smaller than el_index_60, so we use a LIKE // for a prefix search. return [ - "{$p}_index_60" . $db->buildLike( [ $index, $db->anyString() ] ), + "{$p}_index_60" . $db->buildLike( $index, $db->anyString() ), "{$p}_index" . $db->buildLike( $like ), ]; } diff --git a/includes/exception/MWException.php b/includes/exception/MWException.php index c16d9f7f8f..29227c8f80 100644 --- a/includes/exception/MWException.php +++ b/includes/exception/MWException.php @@ -79,7 +79,7 @@ class MWException extends Exception { $res = false; if ( $this->useMessageCache() ) { try { - $res = wfMessage( $key, $params )->text(); + $res = wfMessage( $key, ...$params )->text(); } catch ( Exception $e ) { } } diff --git a/includes/exception/MWExceptionRenderer.php b/includes/exception/MWExceptionRenderer.php index c52a867865..5515ef07d7 100644 --- a/includes/exception/MWExceptionRenderer.php +++ b/includes/exception/MWExceptionRenderer.php @@ -199,7 +199,7 @@ class MWExceptionRenderer { // FIXME: Keep logic in sync with MWException::msg. try { - $res = wfMessage( $key, $params )->text(); + $res = wfMessage( $key, ...$params )->text(); } catch ( Exception $e ) { $res = wfMsgReplaceArgs( $fallback, $params ); // If an exception happens inside message rendering, diff --git a/includes/logging/LogPager.php b/includes/logging/LogPager.php index 15b149e134..38710477cb 100644 --- a/includes/logging/LogPager.php +++ b/includes/logging/LogPager.php @@ -258,7 +258,7 @@ class LogPager extends ReverseChronologicalPager { $params[] = $db->anyString(); } array_pop( $params ); // Get rid of the last % we added. - $this->mConds[] = 'log_title' . $db->buildLike( $params ); + $this->mConds[] = 'log_title' . $db->buildLike( ...$params ); } elseif ( $pattern && !$wgMiserMode ) { $this->mConds[] = 'log_title' . $db->buildLike( $title->getDBkey(), $db->anyString() ); $this->pattern = $pattern; -- 2.20.1