Unpack arrays on variadic arguments
authorUmherirrender <umherirrender_de.wp@web.de>
Sat, 29 Jun 2019 15:17:33 +0000 (17:17 +0200)
committerUmherirrender <umherirrender_de.wp@web.de>
Sat, 31 Aug 2019 23:23:50 +0000 (23:23 +0000)
This avoids extra handling in the function to unpack an array

Change-Id: I93277599bc8125e23fca53d43a728fb7e9e39aad

includes/LinkFilter.php
includes/exception/MWException.php
includes/exception/MWExceptionRenderer.php
includes/logging/LogPager.php

index 6ad9b31..7e1b44d 100644 (file)
@@ -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 [
                // 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 ),
                ];
        }
                        "{$p}_index" . $db->buildLike( $like ),
                ];
        }
index c16d9f7..29227c8 100644 (file)
@@ -79,7 +79,7 @@ class MWException extends Exception {
                $res = false;
                if ( $this->useMessageCache() ) {
                        try {
                $res = false;
                if ( $this->useMessageCache() ) {
                        try {
-                               $res = wfMessage( $key, $params )->text();
+                               $res = wfMessage( $key, ...$params )->text();
                        } catch ( Exception $e ) {
                        }
                }
                        } catch ( Exception $e ) {
                        }
                }
index c52a867..5515ef0 100644 (file)
@@ -199,7 +199,7 @@ class MWExceptionRenderer {
 
                // FIXME: Keep logic in sync with MWException::msg.
                try {
 
                // 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,
                } catch ( Exception $e ) {
                        $res = wfMsgReplaceArgs( $fallback, $params );
                        // If an exception happens inside message rendering,
index 15b149e..3871047 100644 (file)
@@ -258,7 +258,7 @@ class LogPager extends ReverseChronologicalPager {
                                $params[] = $db->anyString();
                        }
                        array_pop( $params ); // Get rid of the last % we added.
                                $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;
                } elseif ( $pattern && !$wgMiserMode ) {
                        $this->mConds[] = 'log_title' . $db->buildLike( $title->getDBkey(), $db->anyString() );
                        $this->pattern = $pattern;