Since 5.4, $this works inside closures.
Change-Id: I6987f76a1e33d6d7ab020a57186e5477186bbf2e
);
};
- $that = $this;
$applyMatchingFiles = function ( ResultWrapper $res, &$searchSet, &$finalFiles )
- use ( $that, $fileMatchesSearch, $flags )
+ use ( $fileMatchesSearch, $flags )
{
global $wgContLang;
- $info = $that->getInfo();
+ $info = $this->getInfo();
foreach ( $res as $row ) {
- $file = $that->newFileFromRow( $row );
+ $file = $this->newFileFromRow( $row );
// There must have been a search for this DB key, but this has to handle the
// cases were title capitalization is different on the client and repo wikis.
$dbKeysLook = [ strtr( $file->getName(), ' ', '_' ) ];
// Thumbnailing a very large file could result in network saturation if
// everyone does it at once.
if ( $this->getSize() >= 1e7 ) { // 10MB
- $that = $this;
$work = new PoolCounterWorkViaCallback( 'GetLocalFileCopy', sha1( $this->getName() ),
[
- 'doWork' => function () use ( $that ) {
- return $that->getLocalRefPath();
+ 'doWork' => function () {
+ return $this->getLocalRefPath();
}
]
);
}
// Update the DB post-send if the page has not cached since now
- $that = $this;
$latest = $this->getLatest();
DeferredUpdates::addCallableUpdate(
- function () use ( $that, $retval, $latest ) {
- $that->insertRedirectEntry( $retval, $latest );
+ function () use ( $retval, $latest ) {
+ $this->insertRedirectEntry( $retval, $latest );
},
DeferredUpdates::POSTSEND,
wfGetDB( DB_MASTER )
function buildSidebar() {
global $wgEnableSidebarCache, $wgSidebarCacheExpiry;
- $that = $this;
- $callback = function () use ( $that ) {
+ $callback = function () {
$bar = [];
- $that->addToSidebar( $bar, 'sidebar' );
- Hooks::run( 'SkinBuildSidebar', [ $that, &$bar ] );
+ $this->addToSidebar( $bar, 'sidebar' );
+ Hooks::run( 'SkinBuildSidebar', [ $this, &$bar ] );
return $bar;
};
* @dataProvider provideModifyQuery
*/
public function testModifyQuery( $filterDefinitions, $expectedValues, $input ) {
- $self = $this;
-
$queryCallable = function (
$className,
$ctx,
&$query_options,
&$join_conds,
$actualSelectedValues
- ) use ( $self, $expectedValues ) {
- $self->assertSame(
+ ) use ( $expectedValues ) {
+ $this->assertSame(
$expectedValues,
$actualSelectedValues
);