[MediaWiki-commits] [Gerrit] Unify top factory getter implementations - change (mediawiki...Wikibase)

2014-12-05 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Unify top factory getter implementations
..


Unify top factory getter implementations

The fact that the variables can be null should be documented in my
opinion.

The fact that they are null by default should be written down
explicitely, in my opinion.

The check should be done with === null, in my opinion, not with
! (it's not a bool) and not with isset.

Change-Id: Ib5bb23de7b32b03706ea8126434b05b35efdf9da
---
M client/includes/WikibaseClient.php
M repo/includes/WikibaseRepo.php
2 files changed, 110 insertions(+), 105 deletions(-)

Approvals:
  Daniel Kinzler: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/client/includes/WikibaseClient.php 
b/client/includes/WikibaseClient.php
index a287040..2819a19 100644
--- a/client/includes/WikibaseClient.php
+++ b/client/includes/WikibaseClient.php
@@ -69,11 +69,6 @@
 final class WikibaseClient {
 
/**
-* @var PropertyDataTypeLookup
-*/
-   private $propertyDataTypeLookup;
-
-   /**
 * @var SettingsArray
 */
private $settings;
@@ -84,62 +79,67 @@
private $contentLanguage;
 
/**
-* @var DataTypeFactory
-*/
-   private $dataTypeFactory = null;
-
-   /**
-* @var EntityIdParser
-*/
-   private $entityIdParser = null;
-
-   /**
-* @var LanguageFallbackChainFactory
-*/
-   private $languageFallbackChainFactory = null;
-
-   /**
-* @var ClientStore
-*/
-   private $store = null;
-
-   /**
-* @var StringNormalizer
-*/
-   private $stringNormalizer;
-
-   /**
-* @var Site
-*/
-   private $site = null;
-
-   /**
-* @var string
-*/
-   private $siteGroup = null;
-
-   /**
-* @var OutputFormatSnakFormatterFactory
-*/
-   private $snakFormatterFactory;
-
-   /**
-* @var OutputFormatValueFormatterFactory
-*/
-   private $valueFormatterFactory;
-
-   /**
-* @var SiteStore
+* @var SiteStore|null
 */
private $siteStore;
 
/**
-* @var LangLinkHandler
+* @var PropertyDataTypeLookup|null
+*/
+   private $propertyDataTypeLookup = null;
+
+   /**
+* @var DataTypeFactory|null
+*/
+   private $dataTypeFactory = null;
+
+   /**
+* @var EntityIdParser|null
+*/
+   private $entityIdParser = null;
+
+   /**
+* @var LanguageFallbackChainFactory|null
+*/
+   private $languageFallbackChainFactory = null;
+
+   /**
+* @var ClientStore|null
+*/
+   private $store = null;
+
+   /**
+* @var StringNormalizer|null
+*/
+   private $stringNormalizer = null;
+
+   /**
+* @var Site|null
+*/
+   private $site = null;
+
+   /**
+* @var string|null
+*/
+   private $siteGroup = null;
+
+   /**
+* @var OutputFormatSnakFormatterFactory|null
+*/
+   private $snakFormatterFactory = null;
+
+   /**
+* @var OutputFormatValueFormatterFactory|null
+*/
+   private $valueFormatterFactory = null;
+
+   /**
+* @var LangLinkHandler|null
 */
private $langLinkHandler = null;
 
/**
-* @var NamespaceChecker
+* @var NamespaceChecker|null
 */
private $namespaceChecker = null;
 
@@ -148,7 +148,7 @@
 *
 * @param SettingsArray $settings
 * @param Language $contentLanguage
-* @param SiteStore $siteStore
+* @param SiteStore|null $siteStore
 */
public function __construct(
SettingsArray $settings,
@@ -279,12 +279,11 @@
 * @return ClientStore
 */
public function getStore() {
-   // NOTE: $repoDatabase is null per default, meaning no direct 
access to the repo's database.
-   // If $repoDatabase is false, the local wiki IS the repository.
-   // Otherwise, $repoDatabase needs to be a logical database name 
that LBFactory understands.
-   $repoDatabase = $this-settings-getSetting( 'repoDatabase' );
-
if ( $this-store === null ) {
+   // NOTE: $repoDatabase is null per default, meaning no 
direct access to the repo's
+   // database. If $repoDatabase is false, the local wiki 
IS the repository. Otherwise,
+   // $repoDatabase needs to be a logical database name 
that LBFactory understands.
+   $repoDatabase = $this-settings-getSetting( 
'repoDatabase' );
$this-store = new DirectSqlStore(
$this-getEntityContentDataCodec(),

[MediaWiki-commits] [Gerrit] Unify top factory getter implementations - change (mediawiki...Wikibase)

2014-11-12 Thread WMDE
Thiemo Mättig (WMDE) has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/172703

Change subject: Unify top factory getter implementations
..

Unify top factory getter implementations

The fact that the variables can be null should be documented in my
opinion.

The fact that they are null by default should be written down
explicitely, in my opinion.

The check should be done with === null, in my opinion, not with
! (it's not a bool) and not with isset.

Change-Id: Ib5bb23de7b32b03706ea8126434b05b35efdf9da
---
M client/includes/WikibaseClient.php
M repo/includes/WikibaseRepo.php
2 files changed, 77 insertions(+), 72 deletions(-)


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

diff --git a/client/includes/WikibaseClient.php 
b/client/includes/WikibaseClient.php
index 5161ee8..fcd51e0 100644
--- a/client/includes/WikibaseClient.php
+++ b/client/includes/WikibaseClient.php
@@ -65,11 +65,6 @@
 final class WikibaseClient {
 
/**
-* @var PropertyDataTypeLookup
-*/
-   public $propertyDataTypeLookup;
-
-   /**
 * @var SettingsArray
 */
private $settings;
@@ -80,62 +75,67 @@
private $contentLanguage;
 
/**
-* @var DataTypeFactory
+* @var SiteStore|null
+*/
+   private $siteStore = null;
+
+   /**
+* @var DataTypeFactory|null
 */
private $dataTypeFactory = null;
 
/**
-* @var EntityIdParser
+* @var EntityIdParser|null
 */
private $entityIdParser = null;
 
/**
-* @var LanguageFallbackChainFactory
+* @var PropertyDataTypeLookup|null
+*/
+   public $propertyDataTypeLookup = null;
+
+   /**
+* @var LanguageFallbackChainFactory|null
 */
private $languageFallbackChainFactory = null;
 
/**
-* @var ClientStore
+* @var ClientStore|null
 */
private $store = null;
 
/**
-* @var StringNormalizer
+* @var StringNormalizer|null
 */
-   private $stringNormalizer;
+   private $stringNormalizer = null;
 
/**
-* @var Site
+* @var Site|null
 */
private $site = null;
 
/**
-* @var string
+* @var string|null
 */
private $siteGroup = null;
 
/**
-* @var OutputFormatSnakFormatterFactory
+* @var OutputFormatSnakFormatterFactory|null
 */
-   private $snakFormatterFactory;
+   private $snakFormatterFactory = null;
 
/**
-* @var OutputFormatValueFormatterFactory
+* @var OutputFormatValueFormatterFactory|null
 */
-   private $valueFormatterFactory;
+   private $valueFormatterFactory = null;
 
/**
-* @var SiteStore
-*/
-   private $siteStore;
-
-   /**
-* @var LangLinkHandler
+* @var LangLinkHandler|null
 */
private $langLinkHandler = null;
 
/**
-* @var NamespaceChecker
+* @var NamespaceChecker|null
 */
private $namespaceChecker = null;
 
@@ -144,7 +144,7 @@
 *
 * @param SettingsArray $settings
 * @param Language $contentLanguage
-* @param SiteStore $siteStore
+* @param SiteStore|null $siteStore
 */
public function __construct(
SettingsArray $settings,
@@ -268,12 +268,11 @@
 * @return ClientStore
 */
public function getStore() {
-   // NOTE: $repoDatabase is null per default, meaning no direct 
access to the repo's database.
-   // If $repoDatabase is false, the local wiki IS the repository.
-   // Otherwise, $repoDatabase needs to be a logical database name 
that LBFactory understands.
-   $repoDatabase = $this-settings-getSetting( 'repoDatabase' );
-
if ( $this-store === null ) {
+   // NOTE: $repoDatabase is null per default, meaning no 
direct access to the repo's
+   // database. If $repoDatabase is false, the local wiki 
IS the repository. Otherwise,
+   // $repoDatabase needs to be a logical database name 
that LBFactory understands.
+   $repoDatabase = $this-settings-getSetting( 
'repoDatabase' );
$this-store = new DirectSqlStore(
$this-getEntityContentDataCodec(),
$this-getContentLanguage(),
@@ -439,7 +438,7 @@
 * @return string
 */
public function getSiteGroup() {
-   if ( !$this-siteGroup ) {
+   if ( $this-siteGroup === null ) {
$this-siteGroup = $this-newSiteGroup();
}
 
@@ -453,7 +452,7 @@
 * @return