Merge "Make use of PHP's list() feature where possible"

This commit is contained in:
jenkins-bot 2019-05-15 15:06:20 +00:00 committed by Gerrit Code Review
commit 915bea466e
3 changed files with 3 additions and 7 deletions

View file

@ -205,8 +205,7 @@ class AbuseFilterHooks {
$warning = $warning->inContentLanguage();
}
$filterDescription = $params[0];
$filter = $params[1];
list( $filterDescription, $filter ) = $params;
// The value is a nested structure keyed by filter id, which doesn't make sense when we only
// return the result from one filter. Flatten it to a plain array of actions.

View file

@ -793,9 +793,7 @@ class AbuseFilterViewEdit extends AbuseFilterView {
case 'block':
if ( $set && count( $parameters ) === 3 ) {
// Both blocktalk and custom block durations available
$blockTalk = $parameters[0];
$defaultAnonDuration = $parameters[1];
$defaultUserDuration = $parameters[2];
list( $blockTalk, $defaultAnonDuration, $defaultUserDuration ) = $parameters;
} else {
if ( $set && count( $parameters ) === 1 ) {
// Only blocktalk available

View file

@ -170,8 +170,7 @@ class AbuseFilterTokenizer {
// Numbers
if ( preg_match( self::RADIX_RE, $code, $matches, 0, $offset ) ) {
$token = $matches[0];
$input = $matches[1];
list( $token, $input ) = $matches;
$baseChar = $matches[2] ?? null;
// Sometimes the base char gets mixed in with the rest of it because
// the regex targets hex, too.