Use static closures where safe to use

Created by I25a17fb22b6b669e817317a0f45051ae9c608208

Change-Id: Iadeca93606fdce46f50dc587774673b6d5ed8315
This commit is contained in:
Umherirrender 2021-05-04 19:34:58 +02:00
parent c4874aa65f
commit b34445b90a
2 changed files with 8 additions and 4 deletions

View file

@ -271,7 +271,7 @@ class LoginNotify implements LoggerAwareInterface {
// already checked the local wiki. // already checked the local wiki.
unset( $info[wfWikiID()] ); unset( $info[wfWikiID()] );
usort( $info, usort( $info,
function ( $a, $b ) { static function ( $a, $b ) {
// descending order // descending order
return $b['editCount'] - $a['editCount']; return $b['editCount'] - $a['editCount'];
} }

View file

@ -68,9 +68,13 @@ class PresentationModel extends EchoEventPresentationModel {
// If it's a bundle, pass it the bundle count as param // If it's a bundle, pass it the bundle count as param
if ( $this->isBundled() ) { if ( $this->isBundled() ) {
$msg = $this->msg( 'notification-new-bundled-header-login-fail' ); $msg = $this->msg( 'notification-new-bundled-header-login-fail' );
$totalAttempts = array_reduce( $this->getBundledEvents(), function ( $sum, EchoEvent $event ) { $totalAttempts = array_reduce(
return $sum + $event->getExtraParam( 'count', 0 ); $this->getBundledEvents(),
}, 0 ); static function ( $sum, EchoEvent $event ) {
return $sum + $event->getExtraParam( 'count', 0 );
},
0
);
$msg->params( $totalAttempts ); $msg->params( $totalAttempts );
} else { } else {
// If the bundle is read or user goes to Special:Notifications, show // If the bundle is read or user goes to Special:Notifications, show