Stop doing $that = $this in includes/user
authorRicordisamoa <ricordisamoa@openmailbox.org>
Wed, 10 Feb 2016 22:52:46 +0000 (23:52 +0100)
committerRicordisamoa <ricordisamoa@openmailbox.org>
Wed, 10 Feb 2016 22:52:46 +0000 (23:52 +0100)
Closures support $this as of PHP 5.4

Change-Id: If79be54276fe2a35bdd004908cfc160e6636f7c5

includes/user/User.php

index da63075..749ec46 100644 (file)
@@ -3485,22 +3485,21 @@ class User implements IDBAccessObject {
                                return;
                        }
 
-                       $that = $this;
                        // Try to update the DB post-send and only if needed...
-                       DeferredUpdates::addCallableUpdate( function() use ( $that, $title, $oldid ) {
-                               if ( !$that->getNewtalk() ) {
+                       DeferredUpdates::addCallableUpdate( function() use ( $title, $oldid ) {
+                               if ( !$this->getNewtalk() ) {
                                        return; // no notifications to clear
                                }
 
                                // Delete the last notifications (they stack up)
-                               $that->setNewtalk( false );
+                               $this->setNewtalk( false );
 
                                // If there is a new, unseen, revision, use its timestamp
                                $nextid = $oldid
                                        ? $title->getNextRevisionID( $oldid, Title::GAID_FOR_UPDATE )
                                        : null;
                                if ( $nextid ) {
-                                       $that->setNewtalk( true, Revision::newFromId( $nextid ) );
+                                       $this->setNewtalk( true, Revision::newFromId( $nextid ) );
                                }
                        } );
                }
@@ -4871,9 +4870,8 @@ class User implements IDBAccessObject {
         * Deferred version of incEditCountImmediate()
         */
        public function incEditCount() {
-               $that = $this;
-               wfGetDB( DB_MASTER )->onTransactionPreCommitOrIdle( function() use ( $that ) {
-                       $that->incEditCountImmediate();
+               wfGetDB( DB_MASTER )->onTransactionPreCommitOrIdle( function() {
+                       $this->incEditCountImmediate();
                } );
        }