Thiemo Mättig (WMDE) has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/356357 )
Change subject: Make use of the …::class feature
......................................................................
Make use of the …::class feature
Change-Id: I1d24e7730cc9561d2c3c2444131ca4d8ecc2ce44
---
M includes/Hooks.php
M includes/Range.php
M maintenance/CheckModelVersions.php
M maintenance/CleanDuplicateScores.php
M maintenance/DumpThresholds.php
M maintenance/PopulateDatabase.php
M maintenance/PurgeScoreCache.php
M tests/phpunit/includes/StatsTest.php
8 files changed, 13 insertions(+), 12 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ORES
refs/changes/57/356357/1
diff --git a/includes/Hooks.php b/includes/Hooks.php
index 1f7b78d..4c8311c 100644
--- a/includes/Hooks.php
+++ b/includes/Hooks.php
@@ -563,7 +563,7 @@
* Hook into Special:Contributions filters
*
* @param SpecialContributions $page
- * @param string HTML[] $filters
+ * @param string[] &$filters HTML
*/
public static function onSpecialContributionsGetFormFilters(
SpecialContributions $page,
@@ -812,7 +812,7 @@
if ( $wgOresExtensionStatus === 'beta' ) {
return $user &&
$user->isLoggedIn() &&
- class_exists( 'BetaFeatures' ) &&
+ class_exists( BetaFeatures::class ) &&
BetaFeatures::isFeatureEnabled( $user,
'ores-enabled' );
}
diff --git a/includes/Range.php b/includes/Range.php
index 0cce96a..5eb3980 100644
--- a/includes/Range.php
+++ b/includes/Range.php
@@ -5,7 +5,6 @@
/**
* Represents a range defined by two values: min and max
*
- * Class Range
* @package ORES
*/
class Range {
diff --git a/maintenance/CheckModelVersions.php
b/maintenance/CheckModelVersions.php
index 2851a38..9f12e3d 100644
--- a/maintenance/CheckModelVersions.php
+++ b/maintenance/CheckModelVersions.php
@@ -72,5 +72,5 @@
}
-$maintClass = 'ORES\CheckModelVersions';
+$maintClass = CheckModelVersions::class;
require_once RUN_MAINTENANCE_IF_MAIN;
diff --git a/maintenance/CleanDuplicateScores.php
b/maintenance/CleanDuplicateScores.php
index d6edee2..1add144 100644
--- a/maintenance/CleanDuplicateScores.php
+++ b/maintenance/CleanDuplicateScores.php
@@ -62,5 +62,5 @@
}
-$maintClass = 'ORES\CleanDuplicateScores';
+$maintClass = CleanDuplicateScores::class;
require_once RUN_MAINTENANCE_IF_MAIN;
diff --git a/maintenance/DumpThresholds.php b/maintenance/DumpThresholds.php
index 05eeb8c..e3a01da 100644
--- a/maintenance/DumpThresholds.php
+++ b/maintenance/DumpThresholds.php
@@ -49,5 +49,5 @@
}
-$maintClass = 'ORES\DumpThresholds';
+$maintClass = DumpThresholds::class;
require_once RUN_MAINTENANCE_IF_MAIN;
diff --git a/maintenance/PopulateDatabase.php b/maintenance/PopulateDatabase.php
index a4062a1..eeb2bad 100644
--- a/maintenance/PopulateDatabase.php
+++ b/maintenance/PopulateDatabase.php
@@ -118,5 +118,5 @@
}
-$maintClass = 'ORES\PopulateDatabase';
+$maintClass = PopulateDatabase::class;
require_once RUN_MAINTENANCE_IF_MAIN;
diff --git a/maintenance/PurgeScoreCache.php b/maintenance/PurgeScoreCache.php
index 49a69ee..eeaa703 100644
--- a/maintenance/PurgeScoreCache.php
+++ b/maintenance/PurgeScoreCache.php
@@ -56,5 +56,5 @@
}
-$maintClass = 'ORES\PurgeScoreCache';
+$maintClass = PurgeScoreCache::class;
require_once RUN_MAINTENANCE_IF_MAIN;
diff --git a/tests/phpunit/includes/StatsTest.php
b/tests/phpunit/includes/StatsTest.php
index e5ca2a1..68899da 100644
--- a/tests/phpunit/includes/StatsTest.php
+++ b/tests/phpunit/includes/StatsTest.php
@@ -4,6 +4,8 @@
use MediaWiki\Logger\LoggerFactory;
use ORES;
+use ORES\Api;
+use Psr\Log\LoggerInterface;
use WANObjectCache;
/**
@@ -21,7 +23,7 @@
}
private function getLoggerMock() {
- return $this->getMockBuilder( 'Psr\Log\LoggerInterface' )
+ return $this->getMockBuilder( LoggerInterface::class )
->setMethods( [
'emergency',
'alert',
@@ -37,7 +39,7 @@
}
public function testGetThresholds_modelConfigNotFound() {
- $api = $this->getMockBuilder( 'ORES\Api' )->getMock();
+ $api = $this->getMockBuilder( Api::class )->getMock();
$logger = $this->getLoggerMock();
$stats = new ORES\Stats( $api, WANObjectCache::newEmpty(),
$logger );
@@ -50,7 +52,7 @@
}
public function testGetThresholds_everythingGoesWrong() {
- $api = $this->getMockBuilder( 'ORES\Api' )->getMock();
+ $api = $this->getMockBuilder( Api::class )->getMock();
$api->method( 'request' )
->with( [ 'model_info' => 'test_stats' ], 'goodfaith' )
->willReturn( 'this is not the stat object you were
expecting...' );
@@ -77,7 +79,7 @@
}
public function testGetThresholds_filtersConfig() {
- $api = $this->getMockBuilder( 'ORES\Api' )->getMock();
+ $api = $this->getMockBuilder( Api::class )->getMock();
$api->method( 'request' )
->with( [ 'model_info' => 'test_stats' ], 'damaging' )
->willReturn( [
--
To view, visit https://gerrit.wikimedia.org/r/356357
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1d24e7730cc9561d2c3c2444131ca4d8ecc2ce44
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ORES
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits