Get rid of unnecessary func_get_args() and friends
authorAryeh Gregor <ayg@aryeh.name>
Mon, 8 Oct 2018 14:10:45 +0000 (17:10 +0300)
committerKrinkle <krinklemail@gmail.com>
Fri, 12 Apr 2019 20:17:01 +0000 (20:17 +0000)
commit7b4489e019092fd082e567cd79448f39677108c4
treeb3aab8a03acea65e0689596b175a3b1f5039ca6c
parent3ecbd79ebefa6b61affad06fec81321f1130cb62
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
31 files changed:
img_auth.php
includes/SiteConfiguration.php
includes/api/ApiAuthManagerHelper.php
includes/exception/MWException.php
includes/exception/MWExceptionRenderer.php
includes/htmlform/HTMLFormField.php
includes/import/WikiImporter.php
includes/installer/CliInstaller.php
includes/installer/Installer.php
includes/installer/WebInstaller.php
includes/libs/ArrayUtils.php
includes/libs/DeferredStringifier.php
includes/libs/MemoizedCallable.php
includes/libs/filebackend/FileBackend.php
includes/libs/jsminplus.php
includes/media/MediaTransformError.php
includes/media/ThumbnailImage.php
includes/parser/CoreParserFunctions.php
includes/parser/Preprocessor_DOM.php
includes/parser/Preprocessor_Hash.php
includes/shell/Command.php
includes/specials/helpers/ImportReporter.php
maintenance/storage/recompressTracked.php
tests/phpunit/includes/Storage/NameTableStoreTest.php
tests/phpunit/includes/api/query/ApiQueryTestBase.php
tests/phpunit/includes/auth/UserDataAuthenticationRequestTest.php
tests/phpunit/includes/changes/CategoryMembershipChangeTest.php
tests/phpunit/includes/libs/ArrayUtilsTest.php
tests/phpunit/includes/poolcounter/PoolCounterTest.php
tests/phpunit/includes/watcheditem/WatchedItemQueryServiceUnitTest.php
tests/phpunit/includes/watcheditem/WatchedItemStoreUnitTest.php