Use ::class for class name
This works also for non-existing classes, because it is resolved on compile time Change-Id: Id3132341856fb1eb20e8b494bb4acdfe3a394db6
This commit is contained in:
parent
898da36a0b
commit
cfcb3e4785
8 changed files with 9 additions and 9 deletions
|
|
@ -80,7 +80,7 @@ class RedisConnectionPool implements LoggerAwareInterface {
|
|||
* @throws Exception
|
||||
*/
|
||||
protected function __construct( array $options, $id ) {
|
||||
if ( !class_exists( 'Redis' ) ) {
|
||||
if ( !class_exists( Redis::class ) ) {
|
||||
throw new RuntimeException(
|
||||
__CLASS__ . ' requires a Redis client library. ' .
|
||||
'See https://www.mediawiki.org/wiki/Redis#Setup' );
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ class UserMailer {
|
|||
private static function isMailMimeUsable() {
|
||||
static $usable = null;
|
||||
if ( $usable === null ) {
|
||||
$usable = class_exists( 'Mail_mime' );
|
||||
$usable = class_exists( Mail_mime::class );
|
||||
}
|
||||
return $usable;
|
||||
}
|
||||
|
|
@ -213,7 +213,7 @@ class UserMailer {
|
|||
private static function isMailUsable() {
|
||||
static $usable = null;
|
||||
if ( $usable === null ) {
|
||||
$usable = class_exists( 'Mail' );
|
||||
$usable = class_exists( Mail::class );
|
||||
}
|
||||
|
||||
return $usable;
|
||||
|
|
|
|||
|
|
@ -1912,7 +1912,7 @@ MESSAGE;
|
|||
// When called from the installer, it is possible that a required PHP extension
|
||||
// is missing (at least for now; see T49564). If this is the case, throw an
|
||||
// exception (caught by the installer) to prevent a fatal error later on.
|
||||
if ( !class_exists( 'Less_Parser' ) ) {
|
||||
if ( !class_exists( Less_Parser::class ) ) {
|
||||
throw new MWException( 'MediaWiki requires the less.php parser' );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ class CheckLess extends Maintenance {
|
|||
self::requireTestsAutoloader();
|
||||
|
||||
// If phpunit isn't available by autoloader try pulling it in
|
||||
if ( !class_exists( 'PHPUnit\\Framework\\TestCase' ) ) {
|
||||
if ( !class_exists( PHPUnit\Framework\TestCase::class ) ) {
|
||||
require_once 'PHPUnit/Autoload.php';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ class RandomImageGenerator {
|
|||
} else {
|
||||
// figure out how to write images
|
||||
global $wgExiv2Command;
|
||||
if ( class_exists( 'Imagick' ) && $wgExiv2Command && is_executable( $wgExiv2Command ) ) {
|
||||
if ( class_exists( Imagick::class ) && $wgExiv2Command && is_executable( $wgExiv2Command ) ) {
|
||||
return 'writeImageWithApi';
|
||||
} elseif ( $wgUseImageMagick
|
||||
&& $wgImageMagickConvertCommand
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ class LegacyLoggerTest extends MediaWikiIntegrationTestCase {
|
|||
],
|
||||
];
|
||||
|
||||
if ( class_exists( '\Monolog\Logger' ) ) {
|
||||
if ( class_exists( \Monolog\Logger::class ) ) {
|
||||
$tests[] = [
|
||||
\Monolog\Logger::INFO,
|
||||
$dest + [ 'level' => LogLevel::INFO ],
|
||||
|
|
|
|||
|
|
@ -2066,7 +2066,7 @@ class LanguageIntegrationTest extends LanguageClassesTestCase {
|
|||
* @covers Language::isKnownLanguageTag
|
||||
*/
|
||||
public function testIsKnownLanguageTag_cldr() {
|
||||
if ( !class_exists( 'LanguageNames' ) ) {
|
||||
if ( !class_exists( LanguageNames::class ) ) {
|
||||
$this->markTestSkipped( 'The LanguageNames class is not available. '
|
||||
. 'The CLDR extension is probably not installed.' );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -331,7 +331,7 @@ class PHPUnitMaintClass {
|
|||
|
||||
$this->forceFormatServerArgv();
|
||||
|
||||
if ( !class_exists( 'PHPUnit\\Framework\\TestCase' ) ) {
|
||||
if ( !class_exists( PHPUnit\Framework\TestCase::class ) ) {
|
||||
echo "PHPUnit not found. Please install it and other dev dependencies by
|
||||
running `composer install` in MediaWiki root directory.\n";
|
||||
exit( 1 );
|
||||
|
|
|
|||
Loading…
Reference in a new issue