$cache = ObjectCache::getLocalServerInstance( CACHE_ANYTHING );
$cacheKey = $cache->makeKey(
'first-letters',
- get_class( $this ),
+ static::class,
$this->locale,
$this->digitTransformLanguage->getCode(),
self::getICUVersion(),
*/
public function getContext() {
if ( $this->context === null ) {
- $class = get_class( $this );
+ $class = static::class;
wfDebug( __METHOD__ . " ($class): called and \$context is null. " .
"Using RequestContext::getMain() for sanity\n" );
$this->context = RequestContext::getMain();
"</p>\n";
} else {
$logId = WebRequest::getRequestId();
- $type = get_class( $this );
+ $type = static::class;
return "<div class=\"errorbox\">" .
'[' . $logId . '] ' .
gmdate( 'Y-m-d H:i:s' ) . ": " .
if ( $this->useOutputPage() ) {
$wgOut->prepareErrorPage( $this->getPageTitle() );
- $hookResult = $this->runHooks( get_class( $this ) );
+ $hookResult = $this->runHooks( static::class );
if ( $hookResult ) {
$wgOut->addHTML( $hookResult );
} else {
'<style>body { font-family: sans-serif; margin: 0; padding: 0.5em 2em; }</style>' .
"</head><body>\n";
- $hookResult = $this->runHooks( get_class( $this ) . 'Raw' );
+ $hookResult = $this->runHooks( static::class . 'Raw' );
if ( $hookResult ) {
echo $hookResult;
} else {
if ( defined( 'MW_API' ) ) {
// Unhandled API exception, we can't be sure that format printer is alive
- self::header( 'MediaWiki-API-Error: internal_api_error_' . get_class( $this ) );
+ self::header( 'MediaWiki-API-Error: internal_api_error_' . static::class );
wfHttpError( 500, 'Internal Server Error', $this->getText() );
} elseif ( self::isCommandLine() ) {
$message = $this->getText();
public function getTableRow( $value ) {
list( $errors, $errorClass ) = $this->getErrorsAndErrorClass( $value );
$inputHtml = $this->getInputHTML( $value );
- $fieldType = get_class( $this );
+ $fieldType = static::class;
$helptext = $this->getHelpTextHtmlTable( $this->getHelpText() );
$cellAttributes = [];
$rowAttributes = [];
public function getDiv( $value ) {
list( $errors, $errorClass ) = $this->getErrorsAndErrorClass( $value );
$inputHtml = $this->getInputHTML( $value );
- $fieldType = get_class( $this );
+ $fieldType = static::class;
$helptext = $this->getHelpTextHtmlDiv( $this->getHelpText() );
$cellAttributes = [];
$label = $this->getLabelHtml( $cellAttributes );
$infusable = false;
}
- $fieldType = get_class( $this );
+ $fieldType = static::class;
$help = $this->getHelpText();
$errors = $this->getErrorsRaw( $value );
foreach ( $errors as &$error ) {
public function getTableRow( $value ) {
list( $errors, $errorClass ) = $this->getErrorsAndErrorClass( $value );
$inputHtml = $this->getInputHTML( $value );
- $fieldType = get_class( $this );
+ $fieldType = static::class;
$helptext = $this->getHelpTextHtmlTable( $this->getHelpText() );
$cellAttributes = [ 'colspan' => 2 ];
protected $uniqueId;
public function __construct( $params ) {
- $this->uniqueId = get_class( $this ) . ++self::$counter . 'x';
+ $this->uniqueId = static::class . ++self::$counter . 'x';
parent::__construct( $params );
if ( empty( $this->mParams['fields'] ) || !is_array( $this->mParams['fields'] ) ) {
* @return string
*/
public function getName() {
- return str_replace( 'WebInstaller', '', get_class( $this ) );
+ return str_replace( 'WebInstaller', '', static::class );
}
/**
$this->type = $type;
$this->params = $params;
- $this->title = $title ?: Title::makeTitle( NS_SPECIAL, 'Badtitle/' . get_class( $this ) );
+ $this->title = $title ?: Title::makeTitle( NS_SPECIAL, 'Badtitle/' . static::class );
$this->opts = $opts;
}
*/
public function rotate( $file, $params ) {
return new MediaTransformError( 'thumbnail_error', 0, 0,
- get_class( $this ) . ' rotation not implemented' );
+ static::class . ' rotation not implemented' );
}
/**
*/
public function doQuery() {
# Use the child class name for profiling
- $fname = __METHOD__ . ' (' . get_class( $this ) . ')';
+ $fname = __METHOD__ . ' (' . static::class . ')';
$section = Profiler::instance()->scopedProfileIn( $fname );
// @todo This should probably compare to DIR_DESCENDING and DIR_ASCENDING constants
* @return string
*/
function getSqlComment() {
- return get_class( $this );
+ return static::class;
}
/**
* @return string
*/
public function __toString() {
- return get_class( $this );
+ return static::class;
}
/**
*/
protected function describeMessage() {
return wfMessage(
- 'sessionprovider-' . str_replace( '\\', '-', strtolower( get_class( $this ) ) )
+ 'sessionprovider-' . str_replace( '\\', '-', strtolower( static::class ) )
);
}
global $wgStylePath, $wgStyleVersion;
if ( $this->stylename === null ) {
- $class = get_class( $this );
+ $class = static::class;
throw new MWException( "$class::\$stylename must be set to use getSkinStylePath()" );
}
$tpl->set( 'charset', 'UTF-8' );
$tpl->setRef( 'wgScript', $wgScript );
$tpl->setRef( 'skinname', $this->skinname );
- $tpl->set( 'skinclass', get_class( $this ) );
+ $tpl->set( 'skinclass', static::class );
$tpl->setRef( 'skin', $this );
$tpl->setRef( 'stylename', $this->stylename );
$tpl->set( 'printable', $out->isPrintable() );
return 0;
}
- $fname = get_class( $this ) . '::recache';
+ $fname = static::class . '::recache';
$dbw = wfGetDB( DB_MASTER );
if ( !$dbw ) {
return false;
* @since 1.18
*/
public function reallyDoQuery( $limit, $offset = false ) {
- $fname = get_class( $this ) . "::reallyDoQuery";
+ $fname = static::class . '::reallyDoQuery';
$dbr = $this->getRecacheDB();
$query = $this->getQueryInfo();
$order = $this->getOrderFields();
public function getCachedTimestamp() {
if ( is_null( $this->cachedTimestamp ) ) {
$dbr = wfGetDB( DB_REPLICA );
- $fname = get_class( $this ) . '::getCachedTimestamp';
+ $fname = static::class . '::getCachedTimestamp';
$this->cachedTimestamp = $dbr->selectField( 'querycache_info', 'qci_timestamp',
[ 'qci_type' => $this->getName() ], $fname );
}
return $redirect;
} else {
- $class = get_class( $this );
+ $class = static::class;
throw new MWException( "RedirectSpecialPage $class doesn't redirect!" );
}
}
* @return bool Whether the HTML is valid
*/
public function validate( $text, &$errorStr ) {
- throw new \MWException( get_class( $this ) . " does not support validate()" );
+ throw new \MWException( static::class . ' does not support validate()' );
}
/**
function __construct() {
$this->mConverter = new FakeConverter( $this );
// Set the code to the name of the descendant
- if ( get_class( $this ) == 'Language' ) {
+ if ( static::class === 'Language' ) {
$this->mCode = 'en';
} else {
- $this->mCode = str_replace( '_', '-', strtolower( substr( get_class( $this ), 8 ) ) );
+ $this->mCode = str_replace( '_', '-', strtolower( substr( static::class, 8 ) ) );
}
self::getLocalisationCache();
}
* @throws MWException
*/
function loadDefaultTables() {
- $name = get_class( $this );
-
- throw new MWException( "Must implement loadDefaultTables() method in class $name" );
+ $class = static::class;
+ throw new MWException( "Must implement loadDefaultTables() method in class $class" );
}
/**
* @return string Absolute name of the temporary file
*/
protected function getNewTempFile() {
- $fileName = tempnam( wfTempDir(), 'MW_PHPUnit_' . get_class( $this ) . '_' );
+ $fileName = tempnam( wfTempDir(), 'MW_PHPUnit_' . static::class . '_' );
$this->tmpFiles[] = $fileName;
return $fileName;
if ( isset( $compatibility[$func] ) ) {
return call_user_func_array( [ $this, $compatibility[$func] ], $args );
} else {
- throw new MWException( "Called non-existent $func method on "
- . get_class( $this ) );
+ throw new MWException( "Called non-existent $func method on " . static::class );
}
}
}
public function testApiTestGroup() {
- $groups = PHPUnit_Util_Test::getGroups( get_class( $this ) );
+ $groups = PHPUnit_Util_Test::getGroups( static::class );
$constraint = PHPUnit_Framework_Assert::logicalOr(
$this->contains( 'medium' ),
$this->contains( 'large' )