Use explicit variarg for VariableHolder functions

This is easier to read and to document, and it also allows typehints.

Change-Id: Ibd6642aa26e25a785faadf5139e64ea884ff4de2
This commit is contained in:
Daimona Eaytoy 2019-04-16 12:01:36 +02:00
parent 6be070e5a2
commit 20c6810039

View file

@ -147,11 +147,12 @@ class AbuseFilterVariableHolder {
}
/**
* @param AbuseFilterVariableHolder ...$holders
* @return AbuseFilterVariableHolder
*/
public static function merge() {
public static function merge( AbuseFilterVariableHolder ...$holders ) {
$newHolder = new AbuseFilterVariableHolder;
$newHolder->addHolders( ...func_get_args() );
$newHolder->addHolders( ...$holders );
return $newHolder;
}
@ -159,15 +160,10 @@ class AbuseFilterVariableHolder {
/**
* Merge any number of holders given as arguments into this holder.
*
* @throws MWException
* @param AbuseFilterVariableHolder ...$holders
*/
public function addHolders() {
$holders = func_get_args();
public function addHolders( AbuseFilterVariableHolder ...$holders ) {
foreach ( $holders as $addHolder ) {
if ( !is_object( $addHolder ) ) {
throw new MWException( 'Invalid argument to AbuseFilterVariableHolder::addHolders' );
}
$this->mVars = array_merge( $this->mVars, $addHolder->mVars );
}
}