aboutsummaryrefslogtreecommitdiffstats
path: root/includes/api
diff options
context:
space:
mode:
Diffstat (limited to 'includes/api')
-rw-r--r--includes/api/ApiAuthManagerHelper.php8
-rw-r--r--includes/api/ApiBase.php4
-rw-r--r--includes/api/ApiBlock.php2
-rw-r--r--includes/api/ApiFormatXml.php4
-rw-r--r--includes/api/ApiMain.php4
-rw-r--r--includes/api/ApiParse.php4
-rw-r--r--includes/api/ApiQueryBacklinks.php2
-rw-r--r--includes/api/ApiQueryBacklinksprop.php2
-rw-r--r--includes/api/ApiQueryContributors.php2
-rw-r--r--includes/api/ApiQueryFileRepoInfo.php4
-rw-r--r--includes/api/ApiQueryImageInfo.php6
-rw-r--r--includes/api/ApiQueryInfo.php4
-rw-r--r--includes/api/ApiQueryPrefixSearch.php2
-rw-r--r--includes/api/ApiQuerySearch.php2
-rw-r--r--includes/api/ApiQuerySiteinfo.php2
-rw-r--r--includes/api/ApiQueryTags.php2
-rw-r--r--includes/api/ApiQueryUsers.php2
-rw-r--r--includes/api/ApiRemoveAuthenticationData.php2
-rw-r--r--includes/api/ApiRollback.php2
-rw-r--r--includes/api/ApiTokens.php2
-rw-r--r--includes/api/ApiWatch.php2
-rw-r--r--includes/api/Validator/ApiParamValidator.php2
22 files changed, 33 insertions, 33 deletions
diff --git a/includes/api/ApiAuthManagerHelper.php b/includes/api/ApiAuthManagerHelper.php
index 141378634421..594b070766e4 100644
--- a/includes/api/ApiAuthManagerHelper.php
+++ b/includes/api/ApiAuthManagerHelper.php
@@ -129,7 +129,7 @@ class ApiAuthManagerHelper {
public static function blacklistAuthenticationRequests( array $reqs, array $blacklist ) {
if ( $blacklist ) {
$blacklist = array_flip( $blacklist );
- $reqs = array_filter( $reqs, function ( $req ) use ( $blacklist ) {
+ $reqs = array_filter( $reqs, static function ( $req ) use ( $blacklist ) {
return !isset( $blacklist[get_class( $req )] );
} );
}
@@ -156,7 +156,7 @@ class ApiAuthManagerHelper {
if ( $wantedRequests !== null ) {
$reqs = array_filter(
$reqs,
- function ( AuthenticationRequest $req ) use ( $wantedRequests ) {
+ static function ( AuthenticationRequest $req ) use ( $wantedRequests ) {
return isset( $wantedRequests[$req->getUniqueId()] );
}
);
@@ -168,7 +168,7 @@ class ApiAuthManagerHelper {
foreach ( $reqs as $req ) {
$info = (array)$req->getFieldInfo();
$fields += $info;
- $sensitive += array_filter( $info, function ( $opts ) {
+ $sensitive += array_filter( $info, static function ( $opts ) {
return !empty( $opts['sensitive'] );
} );
}
@@ -335,7 +335,7 @@ class ApiAuthManagerHelper {
$ret = array_intersect_key( $field, $copy );
if ( isset( $field['options'] ) ) {
- $ret['options'] = array_map( function ( $msg ) use ( $module ) {
+ $ret['options'] = array_map( static function ( $msg ) use ( $module ) {
return $msg->setContext( $module )->plain();
}, $field['options'] );
ApiResult::setArrayType( $ret['options'], 'assoc' );
diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php
index 41eb0d6aab38..84e64a1710b5 100644
--- a/includes/api/ApiBase.php
+++ b/includes/api/ApiBase.php
@@ -1260,7 +1260,7 @@ abstract class ApiBase extends ContextSource {
$min = min( $min, $row->min_id );
$max = max( $max, $row->max_id );
}
- return array_filter( $ids, function ( $id ) use ( $min, $max ) {
+ return array_filter( $ids, static function ( $id ) use ( $min, $max ) {
return ( is_int( $id ) && $id >= 0 || ctype_digit( $id ) )
&& $id >= $min && $id <= $max;
} );
@@ -2058,7 +2058,7 @@ abstract class ApiBase extends ContextSource {
return $value;
}
- $values = array_map( function ( $v ) {
+ $values = array_map( static function ( $v ) {
return '<kbd>' . wfEscapeWikiText( $v ) . '</kbd>';
}, $allowedValues );
$this->dieWithError( [
diff --git a/includes/api/ApiBlock.php b/includes/api/ApiBlock.php
index a86cb07946c0..bc3eababb989 100644
--- a/includes/api/ApiBlock.php
+++ b/includes/api/ApiBlock.php
@@ -128,7 +128,7 @@ class ApiBlock extends ApiBase {
$pageRestrictions[] = PageRestriction::newFromTitle( $title );
}
- $namespaceRestrictions = array_map( function ( $id ) {
+ $namespaceRestrictions = array_map( static function ( $id ) {
return new NamespaceRestriction( 0, $id );
}, (array)$params['namespacerestrictions'] );
$restrictions = array_merge( $pageRestrictions, $namespaceRestrictions );
diff --git a/includes/api/ApiFormatXml.php b/includes/api/ApiFormatXml.php
index 777ec1ca5bae..6f7d5ce769b5 100644
--- a/includes/api/ApiFormatXml.php
+++ b/includes/api/ApiFormatXml.php
@@ -58,7 +58,7 @@ class ApiFormatXml extends ApiFormatBase {
$result->addValue( null, 'xmlns', self::$namespace, ApiResult::NO_SIZE_CHECK );
}
$data = $result->getResultData( null, [
- 'Custom' => function ( &$data, &$metadata ) {
+ 'Custom' => static function ( &$data, &$metadata ) {
if ( isset( $metadata[ApiResult::META_TYPE] ) ) {
// We want to use non-BC for BCassoc to force outputting of _idx.
switch ( $metadata[ApiResult::META_TYPE] ) {
@@ -247,7 +247,7 @@ class ApiFormatXml extends ApiFormatBase {
return '_' . preg_replace_callback(
"/[^$nc]/uS",
- function ( $m ) {
+ static function ( $m ) {
return sprintf( '.%X.', UtfNormal\Utils::utf8ToCodepoint( $m[0] ) );
},
str_replace( '.', '.2E.', $name )
diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php
index e79e4635a6a1..ffc6f96b7d5f 100644
--- a/includes/api/ApiMain.php
+++ b/includes/api/ApiMain.php
@@ -1344,7 +1344,7 @@ class ApiMain extends ApiBase {
}
if ( $ifNoneMatch && $etag !== null ) {
$test = substr( $etag, 0, 2 ) === 'W/' ? substr( $etag, 2 ) : $etag;
- $match = array_map( function ( $s ) {
+ $match = array_map( static function ( $s ) {
return substr( $s, 0, 2 ) === 'W/' ? substr( $s, 2 ) : $s;
}, $ifNoneMatch );
$return304 = in_array( $test, $match, true );
@@ -1967,7 +1967,7 @@ class ApiMain extends ApiBase {
$rightMsg = $this->msg( $rightMsg['msg'], $rightMsg['params'] )->parse();
$help['permissions'] .= Html::rawElement( 'dd', null, $rightMsg );
- $groups = array_map( function ( $group ) {
+ $groups = array_map( static function ( $group ) {
return $group == '*' ? 'all' : $group;
}, $this->getPermissionManager()->getGroupsWithPermission( $right ) );
diff --git a/includes/api/ApiParse.php b/includes/api/ApiParse.php
index e4eb4dce1ddc..078096d64bc0 100644
--- a/includes/api/ApiParse.php
+++ b/includes/api/ApiParse.php
@@ -60,7 +60,7 @@ class ApiParse extends ApiBase {
) {
$worker = new PoolCounterWorkViaCallback( 'ApiParser', $this->getPoolKey(),
[
- 'doWork' => function () use ( $content, $title, $revId, $popts ) {
+ 'doWork' => static function () use ( $content, $title, $revId, $popts ) {
return $content->getParserOutput( $title, $revId, $popts );
},
'error' => function () {
@@ -79,7 +79,7 @@ class ApiParse extends ApiBase {
) {
$worker = new PoolCounterWorkViaCallback( 'ApiParser', $this->getPoolKey(),
[
- 'doWork' => function () use ( $page, $revId, $popts, $suppressCache ) {
+ 'doWork' => static function () use ( $page, $revId, $popts, $suppressCache ) {
return $page->getParserOutput( $popts, $revId, $suppressCache );
},
'error' => function () {
diff --git a/includes/api/ApiQueryBacklinks.php b/includes/api/ApiQueryBacklinks.php
index a57f9f4e0b31..ed1a8f3c1ba3 100644
--- a/includes/api/ApiQueryBacklinks.php
+++ b/includes/api/ApiQueryBacklinks.php
@@ -449,7 +449,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
if ( $resultPageSet === null ) {
// Try to add the result data in one go and pray that it fits
$code = $this->bl_code;
- $data = array_map( function ( $arr ) use ( $code ) {
+ $data = array_map( static function ( $arr ) use ( $code ) {
if ( isset( $arr['redirlinks'] ) ) {
$arr['redirlinks'] = array_values( $arr['redirlinks'] );
ApiResult::setIndexedTagName( $arr['redirlinks'], $code );
diff --git a/includes/api/ApiQueryBacklinksprop.php b/includes/api/ApiQueryBacklinksprop.php
index 6ec9425ee57c..29d0d7954ea4 100644
--- a/includes/api/ApiQueryBacklinksprop.php
+++ b/includes/api/ApiQueryBacklinksprop.php
@@ -123,7 +123,7 @@ class ApiQueryBacklinksprop extends ApiQueryGeneratorBase {
$bl_namespace = $settings['to_namespace'];
$bl_title = "{$p}_to";
- $titles = array_filter( $titles, function ( $t ) use ( $bl_namespace ) {
+ $titles = array_filter( $titles, static function ( $t ) use ( $bl_namespace ) {
return $t->getNamespace() === $bl_namespace;
} );
$map = array_intersect_key( $map, [ $bl_namespace => true ] );
diff --git a/includes/api/ApiQueryContributors.php b/includes/api/ApiQueryContributors.php
index 18a97aa21d61..e1ce170a2c49 100644
--- a/includes/api/ApiQueryContributors.php
+++ b/includes/api/ApiQueryContributors.php
@@ -58,7 +58,7 @@ class ApiQueryContributors extends ApiQueryBase {
$cont = explode( '|', $params['continue'] );
$this->dieContinueUsageIf( count( $cont ) != 2 );
$cont_page = (int)$cont[0];
- $pages = array_filter( $pages, function ( $v ) use ( $cont_page ) {
+ $pages = array_filter( $pages, static function ( $v ) use ( $cont_page ) {
return $v >= $cont_page;
} );
}
diff --git a/includes/api/ApiQueryFileRepoInfo.php b/includes/api/ApiQueryFileRepoInfo.php
index 9da020f281e6..37e227e099da 100644
--- a/includes/api/ApiQueryFileRepoInfo.php
+++ b/includes/api/ApiQueryFileRepoInfo.php
@@ -54,7 +54,7 @@ class ApiQueryFileRepoInfo extends ApiQueryBase {
$foreignTargets = $conf->get( 'ForeignUploadTargets' );
$repoGroup->forEachForeignRepo(
- function ( FileRepo $repo ) use ( &$repos, $props, $foreignTargets ) {
+ static function ( FileRepo $repo ) use ( &$repos, $props, $foreignTargets ) {
$repoProps = $repo->getInfo();
$repoProps['canUpload'] = in_array( $repoProps['name'], $foreignTargets );
@@ -94,7 +94,7 @@ class ApiQueryFileRepoInfo extends ApiQueryBase {
$props = [];
$repoGroup = $this->getInitialisedRepoGroup();
- $repoGroup->forEachForeignRepo( function ( FileRepo $repo ) use ( &$props ) {
+ $repoGroup->forEachForeignRepo( static function ( FileRepo $repo ) use ( &$props ) {
$props = array_merge( $props, array_keys( $repo->getInfo() ) );
} );
diff --git a/includes/api/ApiQueryImageInfo.php b/includes/api/ApiQueryImageInfo.php
index 4b47fa5577bf..8468b3c93caf 100644
--- a/includes/api/ApiQueryImageInfo.php
+++ b/includes/api/ApiQueryImageInfo.php
@@ -88,7 +88,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
}
$user = $this->getUser();
- $findTitles = array_map( function ( $title ) use ( $user ) {
+ $findTitles = array_map( static function ( $title ) use ( $user ) {
return [
'title' => $title,
'private' => $user,
@@ -401,11 +401,11 @@ class ApiQueryImageInfo extends ApiQueryBase {
// Handle external callers who don't pass revdelUser
if ( isset( $opts['revdelUser'] ) && $opts['revdelUser'] ) {
$revdelUser = $opts['revdelUser'];
- $canShowField = function ( $field ) use ( $file, $revdelUser ) {
+ $canShowField = static function ( $field ) use ( $file, $revdelUser ) {
return $file->userCan( $field, $revdelUser );
};
} else {
- $canShowField = function ( $field ) use ( $file ) {
+ $canShowField = static function ( $field ) use ( $file ) {
return !$file->isDeleted( $field );
};
}
diff --git a/includes/api/ApiQueryInfo.php b/includes/api/ApiQueryInfo.php
index 782a1e079101..a4f7160c5064 100644
--- a/includes/api/ApiQueryInfo.php
+++ b/includes/api/ApiQueryInfo.php
@@ -1016,7 +1016,7 @@ class ApiQueryInfo extends ApiQueryBase {
$timestamps[$row->page_namespace][$row->page_title] = (int)$revTimestamp - $age;
}
$titlesWithThresholds = array_map(
- function ( LinkTarget $target ) use ( $timestamps ) {
+ static function ( LinkTarget $target ) use ( $timestamps ) {
return [
$target, $timestamps[$target->getNamespace()][$target->getDBkey()]
];
@@ -1029,7 +1029,7 @@ class ApiQueryInfo extends ApiQueryBase {
$titlesWithThresholds = array_merge(
$titlesWithThresholds,
array_map(
- function ( LinkTarget $target ) {
+ static function ( LinkTarget $target ) {
return [ $target, null ];
},
$this->missing
diff --git a/includes/api/ApiQueryPrefixSearch.php b/includes/api/ApiQueryPrefixSearch.php
index ae6b8dcb9de1..a88874df0667 100644
--- a/includes/api/ApiQueryPrefixSearch.php
+++ b/includes/api/ApiQueryPrefixSearch.php
@@ -63,7 +63,7 @@ class ApiQueryPrefixSearch extends ApiQueryGeneratorBase {
}
if ( $resultPageSet ) {
- $resultPageSet->setRedirectMergePolicy( function ( array $current, array $new ) {
+ $resultPageSet->setRedirectMergePolicy( static function ( array $current, array $new ) {
if ( !isset( $current['index'] ) || $new['index'] < $current['index'] ) {
$current['index'] = $new['index'];
}
diff --git a/includes/api/ApiQuerySearch.php b/includes/api/ApiQuerySearch.php
index e35e4a7a8fd8..7b79aab0bed7 100644
--- a/includes/api/ApiQuerySearch.php
+++ b/includes/api/ApiQuerySearch.php
@@ -200,7 +200,7 @@ class ApiQuerySearch extends ApiQueryGeneratorBase {
'query', $this->getModuleName()
], 'p' );
} else {
- $resultPageSet->setRedirectMergePolicy( function ( $current, $new ) {
+ $resultPageSet->setRedirectMergePolicy( static function ( $current, $new ) {
if ( !isset( $current['index'] ) || $new['index'] < $current['index'] ) {
$current['index'] = $new['index'];
}
diff --git a/includes/api/ApiQuerySiteinfo.php b/includes/api/ApiQuerySiteinfo.php
index ad4cab4a1dc7..227a84935724 100644
--- a/includes/api/ApiQuerySiteinfo.php
+++ b/includes/api/ApiQuerySiteinfo.php
@@ -826,7 +826,7 @@ class ApiQuerySiteinfo extends ApiQueryBase {
public function appendExtensionTags( $property ) {
$tags = array_map(
- function ( $item ) {
+ static function ( $item ) {
return "<$item>";
},
MediaWikiServices::getInstance()->getParser()->getTags()
diff --git a/includes/api/ApiQueryTags.php b/includes/api/ApiQueryTags.php
index f104383ae456..0f949cae16ff 100644
--- a/includes/api/ApiQueryTags.php
+++ b/includes/api/ApiQueryTags.php
@@ -57,7 +57,7 @@ class ApiQueryTags extends ApiQueryBase {
# Fetch defined tags that aren't past the continuation
if ( $params['continue'] !== null ) {
$cont = $params['continue'];
- $tags = array_filter( $tags, function ( $v ) use ( $cont ) {
+ $tags = array_filter( $tags, static function ( $v ) use ( $cont ) {
return $v >= $cont;
} );
}
diff --git a/includes/api/ApiQueryUsers.php b/includes/api/ApiQueryUsers.php
index 1b74d117be8b..4b7ec7acb665 100644
--- a/includes/api/ApiQueryUsers.php
+++ b/includes/api/ApiQueryUsers.php
@@ -215,7 +215,7 @@ class ApiQueryUsers extends ApiQueryBase {
}
if ( isset( $this->prop['groupmemberships'] ) ) {
- $data[$key]['groupmemberships'] = array_map( function ( $ugm ) {
+ $data[$key]['groupmemberships'] = array_map( static function ( $ugm ) {
return [
'group' => $ugm->getGroup(),
'expiry' => ApiResult::formatExpiry( $ugm->getExpiry() ),
diff --git a/includes/api/ApiRemoveAuthenticationData.php b/includes/api/ApiRemoveAuthenticationData.php
index f5b0ed62bd6a..07144857933b 100644
--- a/includes/api/ApiRemoveAuthenticationData.php
+++ b/includes/api/ApiRemoveAuthenticationData.php
@@ -64,7 +64,7 @@ class ApiRemoveAuthenticationData extends ApiBase {
: [];
$reqs = array_filter(
$manager->getAuthenticationRequests( $this->authAction, $this->getUser() ),
- function ( AuthenticationRequest $req ) use ( $params, $blacklist ) {
+ static function ( AuthenticationRequest $req ) use ( $params, $blacklist ) {
return $req->getUniqueId() === $params['request'] &&
!isset( $blacklist[get_class( $req )] );
}
diff --git a/includes/api/ApiRollback.php b/includes/api/ApiRollback.php
index d9f4e0cdbcd5..e526c40623a9 100644
--- a/includes/api/ApiRollback.php
+++ b/includes/api/ApiRollback.php
@@ -72,7 +72,7 @@ class ApiRollback extends ApiBase {
$trxLimits = $this->getConfig()->get( 'TrxProfilerLimits' );
$trxProfiler = Profiler::instance()->getTransactionProfiler();
$trxProfiler->redefineExpectations( $trxLimits['POST'], $fname );
- DeferredUpdates::addCallableUpdate( function () use ( $trxProfiler, $trxLimits, $fname ) {
+ DeferredUpdates::addCallableUpdate( static function () use ( $trxProfiler, $trxLimits, $fname ) {
$trxProfiler->redefineExpectations( $trxLimits['PostSend-POST'], $fname );
} );
diff --git a/includes/api/ApiTokens.php b/includes/api/ApiTokens.php
index bc37a4e22b40..6c9ff5deeacd 100644
--- a/includes/api/ApiTokens.php
+++ b/includes/api/ApiTokens.php
@@ -74,7 +74,7 @@ class ApiTokens extends ApiBase {
$request = $this->getRequest();
foreach ( ApiQueryTokens::getTokenTypeSalts() as $name => $salt ) {
if ( !isset( $types[$name] ) ) {
- $types[$name] = function ( User $user ) use ( $salt, $request ) {
+ $types[$name] = static function ( User $user ) use ( $salt, $request ) {
return ApiQueryTokens::getToken( $user, $request->getSession(), $salt )->toString();
};
}
diff --git a/includes/api/ApiWatch.php b/includes/api/ApiWatch.php
index cb21431f161b..fe8b9c7f0427 100644
--- a/includes/api/ApiWatch.php
+++ b/includes/api/ApiWatch.php
@@ -83,7 +83,7 @@ class ApiWatch extends ApiBase {
ApiResult::setIndexedTagName( $res, 'w' );
} else {
// dont allow use of old title parameter with new pageset parameters.
- $extraParams = array_keys( array_filter( $pageSet->extractRequestParams(), function ( $x ) {
+ $extraParams = array_keys( array_filter( $pageSet->extractRequestParams(), static function ( $x ) {
return $x !== null && $x !== false;
} ) );
diff --git a/includes/api/Validator/ApiParamValidator.php b/includes/api/Validator/ApiParamValidator.php
index edc972d73dea..873ac4cb5e69 100644
--- a/includes/api/Validator/ApiParamValidator.php
+++ b/includes/api/Validator/ApiParamValidator.php
@@ -310,7 +310,7 @@ class ApiParamValidator {
}
$keys = implode( '|', array_map(
- function ( $key ) {
+ static function ( $key ) {
return preg_quote( $key, '/' );
},
array_keys( $settings[ApiBase::PARAM_TEMPLATE_VARS] )