Thiemo Kreuz (WMDE) has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/402800 )

Change subject: Remove not needed CentralIdLookupFactory::getInstance
......................................................................

Remove not needed CentralIdLookupFactory::getInstance

This method makes it look like this class is following the singleton
pattern, but it isn't (and shouldn't). I assume it was introduced for
convenience. But the (almost) same can be achieved with a pair of
brackets.

Change-Id: If0538f8894bab31ff73ce5a5266822b7f6af2193
---
M client/includes/WikibaseClient.php
M lib/includes/Changes/CentralIdLookupFactory.php
M repo/Wikibase.hooks.php
M repo/includes/WikibaseRepo.php
4 files changed, 3 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/00/402800/1

diff --git a/client/includes/WikibaseClient.php 
b/client/includes/WikibaseClient.php
index 3d9748b..2d2493f 100644
--- a/client/includes/WikibaseClient.php
+++ b/client/includes/WikibaseClient.php
@@ -1184,7 +1184,7 @@
                                $this->siteLookup,
                                $this->settings->getSetting( 'siteGlobalID' )
                        ),
-                       
CentralIdLookupFactory::getInstance()->getCentralIdLookup()
+                       ( new CentralIdLookupFactory() )->getCentralIdLookup()
                );
        }
 
diff --git a/lib/includes/Changes/CentralIdLookupFactory.php 
b/lib/includes/Changes/CentralIdLookupFactory.php
index 4abc085..8e7b07d 100644
--- a/lib/includes/Changes/CentralIdLookupFactory.php
+++ b/lib/includes/Changes/CentralIdLookupFactory.php
@@ -12,15 +12,6 @@
 class CentralIdLookupFactory {
 
        /**
-        * Returns an instance of the factory
-        *
-        * @return CentralIdLookupFactory
-        */
-       public static function getInstance() {
-               return new CentralIdLookupFactory();
-       }
-
-       /**
         * Returns a CentralIdLookup that is safe to use for cross-wiki 
propagation, or
         * null.
         *
diff --git a/repo/Wikibase.hooks.php b/repo/Wikibase.hooks.php
index d56e039..915365d 100644
--- a/repo/Wikibase.hooks.php
+++ b/repo/Wikibase.hooks.php
@@ -339,7 +339,7 @@
                        if ( $change ) {
                                $changeStore = 
WikibaseRepo::getDefaultInstance()->getStore()->getChangeStore();
 
-                               $centralIdLookup = 
CentralIdLookupFactory::getInstance()->getCentralIdLookup();
+                               $centralIdLookup = ( new 
CentralIdLookupFactory() )->getCentralIdLookup();
                                if ( $centralIdLookup === null ) {
                                        $centralUserId = 0;
                                } else {
diff --git a/repo/includes/WikibaseRepo.php b/repo/includes/WikibaseRepo.php
index 8697d04..8c0990d 100644
--- a/repo/includes/WikibaseRepo.php
+++ b/repo/includes/WikibaseRepo.php
@@ -1258,7 +1258,7 @@
                return new ChangeNotifier(
                        $this->getEntityChangeFactory(),
                        $transmitters,
-                       
CentralIdLookupFactory::getInstance()->getCentralIdLookup()
+                       ( new CentralIdLookupFactory() )->getCentralIdLookup()
                );
        }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/402800
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If0538f8894bab31ff73ce5a5266822b7f6af2193
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Kreuz (WMDE) <thiemo.kr...@wikimedia.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to