* @since 1.20
*/
class UserCache {
- protected $cache = array(); // (uid => property => value)
- protected $typesCached = array(); // (uid => cache type => 1)
+ protected $cache = []; // (uid => property => value)
+ protected $typesCached = []; // (uid => cache type => 1)
/**
* @return UserCache
public function getProp( $userId, $prop ) {
if ( !isset( $this->cache[$userId][$prop] ) ) {
wfDebug( __METHOD__ . ": querying DB for prop '$prop' for user ID '$userId'.\n" );
- $this->doQuery( array( $userId ) ); // cache miss
+ $this->doQuery( [ $userId ] ); // cache miss
}
return isset( $this->cache[$userId][$prop] )
* @param array $options Option flags; include 'userpage' and 'usertalk'
* @param string $caller The calling method
*/
- public function doQuery( array $userIds, $options = array(), $caller = '' ) {
+ public function doQuery( array $userIds, $options = [], $caller = '' ) {
- $usersToCheck = array();
- $usersToQuery = array();
+ $usersToCheck = [];
+ $usersToQuery = [];
$userIds = array_unique( $userIds );
// Lookup basic info for users not yet loaded...
if ( count( $usersToQuery ) ) {
$dbr = wfGetDB( DB_SLAVE );
- $table = array( 'user' );
- $conds = array( 'user_id' => $usersToQuery );
- $fields = array( 'user_name', 'user_real_name', 'user_registration', 'user_id' );
+ $table = [ 'user' ];
+ $conds = [ 'user_id' => $usersToQuery ];
+ $fields = [ 'user_name', 'user_real_name', 'user_registration', 'user_id' ];
$comment = __METHOD__;
if ( strval( $caller ) !== '' ) {