Clean up get_class($this) -> static::class in /includes/cache and /includes/libs

* get_class()        -> __CLASS__ (same as self::class)
* get_called_class() -> static::class
* get_class($this)   -> static::class

Change-Id: I22c62851bcc88405f4bdd77258d6e28ec1a14924
This commit is contained in:
Timo Tijhof 2017-03-06 18:14:14 -08:00 committed by Reedy
parent c52d268c43
commit 50a035cd6b
9 changed files with 12 additions and 13 deletions

View file

@ -242,7 +242,7 @@ abstract class FileCacheBase {
: IP::sanitizeRange( "$ip/16" );
# Bail out if a request already came from this range...
$key = wfMemcKey( get_class( $this ), 'attempt', $this->mType, $this->mKey, $ip );
$key = wfMemcKey( static::class, 'attempt', $this->mType, $this->mKey, $ip );
if ( $cache->get( $key ) ) {
return; // possibly the same user
}
@ -272,6 +272,6 @@ abstract class FileCacheBase {
* @return string
*/
protected function cacheMissKey() {
return wfMemcKey( get_class( $this ), 'misses', $this->mType, $this->mKey );
return wfMemcKey( static::class, 'misses', $this->mType, $this->mKey );
}
}

View file

@ -228,7 +228,7 @@ class LocalisationCache {
}
}
wfDebugLog( 'caches', get_class( $this ) . ": using store $storeClass" );
wfDebugLog( 'caches', static::class . ": using store $storeClass" );
if ( !empty( $conf['storeDirectory'] ) ) {
$storeConf['directory'] = $conf['storeDirectory'];
}

View file

@ -167,7 +167,7 @@ class FileBackendMultiWrite extends FileBackend {
// Do a consistency check to see if the backends are consistent...
$syncStatus = $this->consistencyCheck( $relevantPaths );
if ( !$syncStatus->isOK() ) {
wfDebugLog( 'FileOperation', get_class( $this ) .
wfDebugLog( 'FileOperation', static::class .
" failed sync check: " . FormatJson::encode( $relevantPaths ) );
// Try to resync the clone backends to the master on the spot...
if ( $this->autoResync === false
@ -378,7 +378,7 @@ class FileBackendMultiWrite extends FileBackend {
}
if ( !$status->isOK() ) {
wfDebugLog( 'FileOperation', get_class( $this ) .
wfDebugLog( 'FileOperation', static::class .
" failed to resync: " . FormatJson::encode( $paths ) );
}

View file

@ -360,7 +360,7 @@ abstract class FileBackendStore extends FileBackend {
$status->merge( $this->doConcatenate( $params ) );
$sec = microtime( true ) - $start_time;
if ( !$status->isOK() ) {
$this->logger->error( get_class( $this ) . "-{$this->name}" .
$this->logger->error( static::class . "-{$this->name}" .
" failed to concatenate " . count( $params['srcs'] ) . " file(s) [$sec sec]" );
}
}
@ -1123,7 +1123,7 @@ abstract class FileBackendStore extends FileBackend {
$subStatus->success[$i] = false;
++$subStatus->failCount;
}
$this->logger->error( get_class( $this ) . "-{$this->name} " .
$this->logger->error( static::class . "-{$this->name} " .
" stat failure; aborted operations: " . FormatJson::encode( $ops ) );
}

View file

@ -461,7 +461,7 @@ abstract class FileOp {
$params = $this->params;
$params['failedAction'] = $action;
try {
$this->logger->error( get_class( $this ) .
$this->logger->error( static::class .
" failed (batch #{$this->batchId}): " . FormatJson::encode( $params ) );
} catch ( Exception $e ) {
// bad config? debug log error?

View file

@ -679,7 +679,7 @@ abstract class BagOStuff implements IExpiringStore, LoggerAwareInterface {
protected function debug( $text ) {
if ( $this->debugMode ) {
$this->logger->debug( "{class} debug: $text", [
'class' => get_class( $this ),
'class' => static::class,
] );
}
}

View file

@ -3412,7 +3412,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
*/
public function __clone() {
$this->connLogger->warning(
"Cloning " . get_class( $this ) . " is not recomended; forking connection:\n" .
"Cloning " . static::class . " is not recomended; forking connection:\n" .
( new RuntimeException() )->getTraceAsString()
);

View file

@ -82,7 +82,7 @@ class ResultWrapper implements IResultWrapper {
*/
private function getDB() {
if ( !$this->db ) {
throw new RuntimeException( get_class( $this ) . ' needs a DB handle for iteration.' );
throw new RuntimeException( static::class . ' needs a DB handle for iteration.' );
}
return $this->db;

View file

@ -51,8 +51,7 @@ abstract class VirtualRESTService {
* @return string The name of the service behind this VRS object.
*/
public function getName() {
return isset( $this->params['name'] ) ? $this->params['name'] :
get_class( $this );
return isset( $this->params['name'] ) ? $this->params['name'] : static::class;
}
/**