Make use of PHP's …::class feature

Change-Id: Ifbb70f7b9d54e2e2bb713c8a13668344ac880a72
This commit is contained in:
Thiemo Kreuz 2018-06-17 18:53:56 +02:00 committed by Umherirrender
parent 9e43e1988b
commit d04b3f2710
2 changed files with 11 additions and 9 deletions

View file

@ -1,5 +1,7 @@
<?php
use Wikibase\Client\Hooks\EchoNotificationsHandlers;
$IP = getenv( 'MW_INSTALL_PATH' );
if ( $IP === false ) {
$IP = __DIR__ . '/../../..';
@ -468,8 +470,8 @@ class GenerateSampleNotifications extends Maintenance {
}
private function generateWikibase( User $user, User $agent ) {
if ( !class_exists( 'Wikibase\Client\Hooks\EchoNotificationsHandlers' ) ) {
$this->output( 'class Wikibase\Client\Hooks\EchoNotificationsHandlers not found' );
if ( !class_exists( EchoNotificationsHandlers::class ) ) {
$this->output( 'Class EchoNotificationsHandlers not found' );
return;
}
@ -480,7 +482,7 @@ class GenerateSampleNotifications extends Maintenance {
$this->output( "{$agent->getName()} is connecting {$user->getName()}'s page {$title->getPrefixedText()} to an item\n" );
EchoEvent::create( [
'type' => Wikibase\Client\Hooks\EchoNotificationsHandlers::NOTIFICATION_TYPE,
'type' => EchoNotificationsHandlers::NOTIFICATION_TYPE,
'title' => $title,
'extra' => [
'url' => Title::newFromText( 'Item:Q1' )->getFullURL(),

View file

@ -10,7 +10,7 @@ class EchoTitleLocalCacheTest extends MediaWikiTestCase {
*/
public function testCreate() {
$cache = EchoTitleLocalCache::create();
$this->assertInstanceOf( 'EchoTitleLocalCache', $cache );
$this->assertInstanceOf( EchoTitleLocalCache::class, $cache );
return $cache;
}
@ -57,13 +57,13 @@ class EchoTitleLocalCacheTest extends MediaWikiTestCase {
// Requesting the first object, which is within the known targets, should
// not resolve the pending lookups.
$this->assertInstanceOf( 'Title', $cache->get( reset( $titleIds ) ) );
$this->assertGreaterThan( 0, count( $cache->getLookups() ) );
$this->assertInstanceOf( Title::class, $cache->get( reset( $titleIds ) ) );
$this->assertNotEmpty( $cache->getLookups() );
// Requesting the second object, which is not within the known targets, should
// resolve the pending lookups and reset the list to lookup.
$this->assertInstanceOf( 'Title', $cache->get( end( $titleIds ) ) );
$this->assertEquals( 0, count( $cache->getLookups() ) );
$this->assertInstanceOf( Title::class, $cache->get( end( $titleIds ) ) );
$this->assertEmpty( $cache->getLookups() );
}
/**
@ -90,7 +90,7 @@ class EchoTitleLocalCacheTest extends MediaWikiTestCase {
* @return Title
*/
protected function mockTitle() {
$title = $this->getMockBuilder( 'Title' )
$title = $this->getMockBuilder( Title::class )
->disableOriginalConstructor()
->getMock();