aboutsummaryrefslogtreecommitdiffstats
path: root/includes/specials/helpers/ImportReporter.php
diff options
context:
space:
mode:
authorAryeh Gregor <ayg@aryeh.name>2018-10-08 17:10:45 +0300
committerKrinkle <krinklemail@gmail.com>2019-04-12 20:17:01 +0000
commit7b4489e019092fd082e567cd79448f39677108c4 (patch)
treeb3aab8a03acea65e0689596b175a3b1f5039ca6c /includes/specials/helpers/ImportReporter.php
parent3ecbd79ebefa6b61affad06fec81321f1130cb62 (diff)
downloadmediawikicore-7b4489e019092fd082e567cd79448f39677108c4.tar.gz
mediawikicore-7b4489e019092fd082e567cd79448f39677108c4.zip
Get rid of unnecessary func_get_args() and friends
HHVM does not support variadic arguments with type hints. This is mostly not a big problem, because we can just drop the type hint, but for some reason PHPUnit adds a type hint of "array" when it creates mocks, so a class with a variadic method can't be mocked (at least in some cases). As such, I left alone all the classes that seem like someone might like to mock them, like Title and User. If anyone wants to mock them in the future, they'll have to switch back to func_get_args(). Some of the changes are definitely safe, like functions and test classes. In most cases, func_get_args() (and/or func_get_arg(), func_num_args() ) were only present because the code was written before we required PHP 5.6, and writing them as variadic functions is strictly superior. In some cases I left them alone, aside from HHVM compatibility: * Forwarding all arguments to another function. It's useful to keep func_get_args() here where we want to keep the list of expected arguments and their meanings in the function signature line for documentation purposes, but don't want to copy-paste a long line of argument names. * Handling deprecated calling conventions. * One or two miscellaneous cases where we're basically using the arguments individually but want to use them as an array as well for some reason. Change-Id: I066ec95a7beb7c0665146195a08e7cce1222c788
Diffstat (limited to 'includes/specials/helpers/ImportReporter.php')
-rw-r--r--includes/specials/helpers/ImportReporter.php7
1 files changed, 3 insertions, 4 deletions
diff --git a/includes/specials/helpers/ImportReporter.php b/includes/specials/helpers/ImportReporter.php
index c79e87c36e37..80638042b0bc 100644
--- a/includes/specials/helpers/ImportReporter.php
+++ b/includes/specials/helpers/ImportReporter.php
@@ -69,10 +69,10 @@ class ImportReporter extends ContextSource {
);
}
- function reportLogItem( /* ... */ ) {
+ function reportLogItem( ...$args ) {
$this->mLogItemCount++;
if ( is_callable( $this->mOriginalLogCallback ) ) {
- call_user_func_array( $this->mOriginalLogCallback, func_get_args() );
+ call_user_func_array( $this->mOriginalLogCallback, $args );
}
}
@@ -86,8 +86,7 @@ class ImportReporter extends ContextSource {
*/
public function reportPage( $title, $foreignTitle, $revisionCount,
$successCount, $pageInfo ) {
- $args = func_get_args();
- call_user_func_array( $this->mOriginalPageOutCallback, $args );
+ call_user_func_array( $this->mOriginalPageOutCallback, func_get_args() );
if ( $title === null ) {
# Invalid or non-importable title; a notice is already displayed