mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-24 14:13:54 +00:00
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:
parent
6be070e5a2
commit
20c6810039
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue