Thiemo Kreuz (WMDE) has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/402794 )
Change subject: Add missing "use" to ChangeNotifier
......................................................................
Add missing "use" to ChangeNotifier
This is a direct follow up for what I learned in Ie0e0612. Phan reports
this as an error because of the missing "use" clause.
I'm also streamlining this code a bit, e.g. made an unused method private
(we strictly stick to "private by default" in our code bases).
Change-Id: Iafc1d41c7718a90b0df0fbc376be85f6078172ea
---
M repo/includes/Notifications/ChangeNotifier.php
1 file changed, 14 insertions(+), 16 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/94/402794/1
diff --git a/repo/includes/Notifications/ChangeNotifier.php
b/repo/includes/Notifications/ChangeNotifier.php
index bac9b57..d8ee0d2 100644
--- a/repo/includes/Notifications/ChangeNotifier.php
+++ b/repo/includes/Notifications/ChangeNotifier.php
@@ -2,6 +2,7 @@
namespace Wikibase\Repo\Notifications;
+use CentralIdLookup;
use InvalidArgumentException;
use Revision;
use User;
@@ -38,10 +39,14 @@
* @param EntityChangeFactory $changeFactory
* @param ChangeTransmitter[] $changeTransmitters
* @param CentralIdLookup|null $centralIdLookup CentralIdLookup, or
null if
- * this repository is not connected to a central user system (see
- * Wikibase\Lib\Changes\CentralIdLookupFactory).
+ * this repository is not connected to a central user system,
+ * @see Wikibase\Lib\Changes\CentralIdLookupFactory.
*/
- public function __construct( EntityChangeFactory $changeFactory, array
$changeTransmitters, $centralIdLookup ) {
+ public function __construct(
+ EntityChangeFactory $changeFactory,
+ array $changeTransmitters,
+ CentralIdLookup $centralIdLookup = null
+ ) {
Assert::parameterElementType(
ChangeTransmitter::class,
$changeTransmitters,
@@ -50,10 +55,6 @@
$this->changeFactory = $changeFactory;
$this->changeTransmitters = $changeTransmitters;
-
- // There is no type hint because it is a required parameter
that allows
- // nulls.
- Assert::parameterType( 'CentralIdLookup|null',
$centralIdLookup, '$centralIdLookup' );
$this->centralIdLookup = $centralIdLookup;
}
@@ -193,19 +194,16 @@
}
/**
- * Gets central user ID, or 0, from user
- *
* @param User $user Repository user
+ *
* @return int Central user ID, or 0
*/
- protected function getCentralUserId( User $user ) {
- if ( $this->centralIdLookup === null ) {
- return 0;
- } else {
- return $this->centralIdLookup->centralIdFromLocalUser(
- $user
- );
+ private function getCentralUserId( User $user ) {
+ if ( $this->centralIdLookup ) {
+ return $this->centralIdLookup->centralIdFromLocalUser(
$user );
}
+
+ return 0;
}
/**
--
To view, visit https://gerrit.wikimedia.org/r/402794
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Iafc1d41c7718a90b0df0fbc376be85f6078172ea
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Kreuz (WMDE) <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits