[MediaWiki-commits] [Gerrit] mediawiki/core[REL1_27]: Remove &$this usage

2017-08-27 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/374094 )

Change subject: Remove &$this usage
..


Remove &$this usage

Replaced &$this to avoid PHP 7.1 warning of passing $this by reference

Bug: T153505
Change-Id: I3e9bc59dc8cefac0108482afeb9cc9a274e2e54b
---
M includes/user/User.php
1 file changed, 33 insertions(+), 12 deletions(-)

Approvals:
  Reedy: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/user/User.php b/includes/user/User.php
index 6c6404b..9b956b4 100644
--- a/includes/user/User.php
+++ b/includes/user/User.php
@@ -1638,9 +1638,10 @@
$this->mAllowUsertalk = false;
}
 
+   // Avoid PHP 7.1 warning of passing $this by reference
+   $user = $this;
// Extensions
-   Hooks::run( 'GetBlockedStatus', [ &$this ] );
-
+   Hooks::run( 'GetBlockedStatus', [ &$user ] );
}
 
/**
@@ -1774,9 +1775,11 @@
 * @return bool True if a rate limiter was tripped
 */
public function pingLimiter( $action = 'edit', $incrBy = 1 ) {
+   // Avoid PHP 7.1 warning of passing $this by reference
+   $user = $this;
// Call the 'PingLimiter' hook
$result = false;
-   if ( !Hooks::run( 'PingLimiter', [ &$this, $action, &$result, 
$incrBy ] ) ) {
+   if ( !Hooks::run( 'PingLimiter', [ &$user, $action, &$result, 
$incrBy ] ) ) {
return $result;
}
 
@@ -2007,9 +2010,11 @@
} elseif ( !$ip ) {
$ip = $this->getRequest()->getIP();
}
+   // Avoid PHP 7.1 warning of passing $this by reference
+   $user = $this;
$blocked = false;
$block = null;
-   Hooks::run( 'UserIsBlockedGlobally', [ &$this, $ip, &$blocked, 
&$block ] );
+   Hooks::run( 'UserIsBlockedGlobally', [ &$user, $ip, &$blocked, 
&$block ] );
 
if ( $blocked && $block === null ) {
// back-compat: UserIsBlockedGlobally didn't have 
$block param first
@@ -2030,7 +2035,9 @@
if ( $this->mLocked !== null ) {
return $this->mLocked;
}
-   $authUser = AuthManager::callLegacyAuthPlugin( 
'getUserInstance', [ &$this ], null );
+   // Avoid PHP 7.1 warning of passing $this by reference
+   $user = $this;
+   $authUser = AuthManager::callLegacyAuthPlugin( 
'getUserInstance', [ &$user ], null );
$this->mLocked = $authUser && $authUser->isLocked();
Hooks::run( 'UserIsLocked', [ $this, &$this->mLocked ] );
return $this->mLocked;
@@ -2047,7 +2054,9 @@
}
$this->getBlockedStatus();
if ( !$this->mHideName ) {
-   $authUser = AuthManager::callLegacyAuthPlugin( 
'getUserInstance', [ &$this ], null );
+   // Avoid PHP 7.1 warning of passing $this by reference
+   $user = $this;
+   $authUser = AuthManager::callLegacyAuthPlugin( 
'getUserInstance', [ &$user ], null );
$this->mHideName = $authUser && $authUser->isHidden();
Hooks::run( 'UserIsHidden', [ $this, &$this->mHideName 
] );
}
@@ -2166,8 +2175,10 @@
 * @return array
 */
public function getNewMessageLinks() {
+   // Avoid PHP 7.1 warning of passing $this by reference
+   $user = $this;
$talks = [];
-   if ( !Hooks::run( 'UserRetrieveNewTalks', [ &$this, &$talks ] ) 
) {
+   if ( !Hooks::run( 'UserRetrieveNewTalks', [ &$user, &$talks ] ) 
) {
return $talks;
} elseif ( !$this->getNewtalk() ) {
return [];
@@ -3179,8 +3190,10 @@
$this->getGroups(), // explicit groups
$this->getAutomaticGroups( $recache ) // 
implicit groups
) );
+   // Avoid PHP 7.1 warning of passing $this by reference
+   $user = $this;
// Hook for additional groups
-   Hooks::run( 'UserEffectiveGroups', [ &$this, 
&$this->mEffectiveGroups ] );
+   Hooks::run( 'UserEffectiveGroups', [ &$user, 
&$this->mEffectiveGroups ] );
// Force reindexation of groups when a hook has unset 
one of them
$this->mEffectiveGroups = array_values( array_unique( 
$this->mEffectiveGroups ) );
}
@@ -3531,7 +3544,9 @@
 
// If we're working on user's talk page, we should update the

[MediaWiki-commits] [Gerrit] mediawiki/core[REL1_27]: Remove &$this usage

2017-08-27 Thread Reedy (Code Review)
Reedy has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/374094 )

Change subject: Remove &$this usage
..

Remove &$this usage

Replaced &$this to avoid PHP 7.1 warning of passing $this by reference

Bug: T153505
Change-Id: I3e9bc59dc8cefac0108482afeb9cc9a274e2e54b
---
M includes/user/User.php
1 file changed, 33 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/94/374094/1

diff --git a/includes/user/User.php b/includes/user/User.php
index 6c6404b..9b956b4 100644
--- a/includes/user/User.php
+++ b/includes/user/User.php
@@ -1638,9 +1638,10 @@
$this->mAllowUsertalk = false;
}
 
+   // Avoid PHP 7.1 warning of passing $this by reference
+   $user = $this;
// Extensions
-   Hooks::run( 'GetBlockedStatus', [ &$this ] );
-
+   Hooks::run( 'GetBlockedStatus', [ &$user ] );
}
 
/**
@@ -1774,9 +1775,11 @@
 * @return bool True if a rate limiter was tripped
 */
public function pingLimiter( $action = 'edit', $incrBy = 1 ) {
+   // Avoid PHP 7.1 warning of passing $this by reference
+   $user = $this;
// Call the 'PingLimiter' hook
$result = false;
-   if ( !Hooks::run( 'PingLimiter', [ &$this, $action, &$result, 
$incrBy ] ) ) {
+   if ( !Hooks::run( 'PingLimiter', [ &$user, $action, &$result, 
$incrBy ] ) ) {
return $result;
}
 
@@ -2007,9 +2010,11 @@
} elseif ( !$ip ) {
$ip = $this->getRequest()->getIP();
}
+   // Avoid PHP 7.1 warning of passing $this by reference
+   $user = $this;
$blocked = false;
$block = null;
-   Hooks::run( 'UserIsBlockedGlobally', [ &$this, $ip, &$blocked, 
&$block ] );
+   Hooks::run( 'UserIsBlockedGlobally', [ &$user, $ip, &$blocked, 
&$block ] );
 
if ( $blocked && $block === null ) {
// back-compat: UserIsBlockedGlobally didn't have 
$block param first
@@ -2030,7 +2035,9 @@
if ( $this->mLocked !== null ) {
return $this->mLocked;
}
-   $authUser = AuthManager::callLegacyAuthPlugin( 
'getUserInstance', [ &$this ], null );
+   // Avoid PHP 7.1 warning of passing $this by reference
+   $user = $this;
+   $authUser = AuthManager::callLegacyAuthPlugin( 
'getUserInstance', [ &$user ], null );
$this->mLocked = $authUser && $authUser->isLocked();
Hooks::run( 'UserIsLocked', [ $this, &$this->mLocked ] );
return $this->mLocked;
@@ -2047,7 +2054,9 @@
}
$this->getBlockedStatus();
if ( !$this->mHideName ) {
-   $authUser = AuthManager::callLegacyAuthPlugin( 
'getUserInstance', [ &$this ], null );
+   // Avoid PHP 7.1 warning of passing $this by reference
+   $user = $this;
+   $authUser = AuthManager::callLegacyAuthPlugin( 
'getUserInstance', [ &$user ], null );
$this->mHideName = $authUser && $authUser->isHidden();
Hooks::run( 'UserIsHidden', [ $this, &$this->mHideName 
] );
}
@@ -2166,8 +2175,10 @@
 * @return array
 */
public function getNewMessageLinks() {
+   // Avoid PHP 7.1 warning of passing $this by reference
+   $user = $this;
$talks = [];
-   if ( !Hooks::run( 'UserRetrieveNewTalks', [ &$this, &$talks ] ) 
) {
+   if ( !Hooks::run( 'UserRetrieveNewTalks', [ &$user, &$talks ] ) 
) {
return $talks;
} elseif ( !$this->getNewtalk() ) {
return [];
@@ -3179,8 +3190,10 @@
$this->getGroups(), // explicit groups
$this->getAutomaticGroups( $recache ) // 
implicit groups
) );
+   // Avoid PHP 7.1 warning of passing $this by reference
+   $user = $this;
// Hook for additional groups
-   Hooks::run( 'UserEffectiveGroups', [ &$this, 
&$this->mEffectiveGroups ] );
+   Hooks::run( 'UserEffectiveGroups', [ &$user, 
&$this->mEffectiveGroups ] );
// Force reindexation of groups when a hook has unset 
one of them
$this->mEffectiveGroups = array_values( array_unique( 
$this->mEffectiveGroups ) );
}
@@ -3531,7 +3544,9 @@
 
// If we're working on user's talk page, we should update the