Umherirrender has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/359403 )
Change subject: Fix indentation and some spaces
......................................................................
Fix indentation and some spaces
Change-Id: I9f7051b766fc469ece775338bcb87c92eb468799
---
M api/RunCrossCheck.php
M includes/CrossCheck/Result/CrossCheckResult.php
M includes/DumpMetaInformation/DumpMetaInformation.php
M includes/ExternalValidationServices.php
M phpcs.xml
M tests/phpunit/CrossCheck/Comparer/DispatchingDataValueComparerTest.php
M tests/phpunit/CrossCheck/Comparer/EntityIdValueComparerTest.php
M tests/phpunit/CrossCheck/Comparer/MonolingualTextValueComparerTest.php
M tests/phpunit/CrossCheck/Comparer/MultilingualTextValueComparerTest.php
M tests/phpunit/CrossCheck/Result/CrossCheckResultListTest.php
M tests/phpunit/CrossCheck/ValueParser/MultilingualTextValueParserTest.php
11 files changed, 86 insertions(+), 76 deletions(-)
git pull
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityExternalValidation
refs/changes/03/359403/1
diff --git a/api/RunCrossCheck.php b/api/RunCrossCheck.php
index 7492ae4..43ddd33 100644
--- a/api/RunCrossCheck.php
+++ b/api/RunCrossCheck.php
@@ -91,9 +91,16 @@
* @param SerializerFactory $serializerFactory
* @param ApiHelperFactory $apiHelperFactory
*/
- public function __construct( ApiMain $main, $name, $prefix = '',
EntityIdParser $entityIdParser,
-
StatementGuidValidator $statementGuidValidator, CrossCheckInteractor
$crossCheckInteractor,
-
SerializerFactory $serializerFactory, ApiHelperFactory $apiHelperFactory ) {
+ public function __construct(
+ ApiMain $main,
+ $name,
+ $prefix = '',
+ EntityIdParser $entityIdParser,
+ StatementGuidValidator $statementGuidValidator,
+ CrossCheckInteractor $crossCheckInteractor,
+ SerializerFactory $serializerFactory,
+ ApiHelperFactory $apiHelperFactory
+ ) {
parent::__construct( $main, $name, $prefix );
$this->entityIdParser = $entityIdParser;
diff --git a/includes/CrossCheck/Result/CrossCheckResult.php
b/includes/CrossCheck/Result/CrossCheckResult.php
index d7e6629..39d04d6 100644
--- a/includes/CrossCheck/Result/CrossCheckResult.php
+++ b/includes/CrossCheck/Result/CrossCheckResult.php
@@ -65,12 +65,14 @@
* @param ReferenceResult $referenceResult
* @throws InvalidArgumentException
*/
- public function __construct( PropertyId $propertyId,
- $claimGuid,
- $externalId,
-
DumpMetaInformation $dumpMetaInformation,
-
ComparisonResult $comparisonResult,
-
ReferenceResult $referenceResult ) {
+ public function __construct(
+ PropertyId $propertyId,
+ $claimGuid,
+ $externalId,
+ DumpMetaInformation $dumpMetaInformation,
+ ComparisonResult $comparisonResult,
+ ReferenceResult $referenceResult
+ ) {
Assert::parameterType( 'string', $claimGuid, '$claimGuid' );
Assert::parameterType( 'string', $externalId, '$externalId' );
diff --git a/includes/DumpMetaInformation/DumpMetaInformation.php
b/includes/DumpMetaInformation/DumpMetaInformation.php
index 6f30f7f..8d4ce84 100644
--- a/includes/DumpMetaInformation/DumpMetaInformation.php
+++ b/includes/DumpMetaInformation/DumpMetaInformation.php
@@ -83,14 +83,16 @@
*
* @throws InvalidArgumentException
*/
- public function __construct( $dumpId,
- ItemId
$sourceItemId,
- array
$identifierPropertyIds,
- $importDate,
- $languageCode,
- $sourceUrl,
- $size,
- ItemId
$licenseItemId ) {
+ public function __construct(
+ $dumpId,
+ ItemId $sourceItemId,
+ array $identifierPropertyIds,
+ $importDate,
+ $languageCode,
+ $sourceUrl,
+ $size,
+ ItemId $licenseItemId
+ ) {
Assert::parameterElementType(
PropertyId::class,
$identifierPropertyIds,
@@ -172,7 +174,7 @@
Assert::parameterType( 'string', $dumpId, '$dumpId' );
$length = strlen( $dumpId );
if ( $length < 1 || $length > 25 ) {
- throw new InvalidArgumentException('$dumpId must be
between 1 and 25 characters.');
+ throw new InvalidArgumentException( '$dumpId must be
between 1 and 25 characters.' );
}
$this->dumpId = $dumpId;
diff --git a/includes/ExternalValidationServices.php
b/includes/ExternalValidationServices.php
index 4c6a362..7b4bef3 100644
--- a/includes/ExternalValidationServices.php
+++ b/includes/ExternalValidationServices.php
@@ -85,7 +85,7 @@
public static function getDefaultInstance() {
static $instance = null;
- if ($instance === null) {
+ if ( $instance === null ) {
$wikibaseRepo = WikibaseRepo::getDefaultInstance();
$instance = new self( $wikibaseRepo );
@@ -98,7 +98,7 @@
* @return CrossChecker
*/
public function getCrossChecker() {
- if ($this->crossChecker === null) {
+ if ( $this->crossChecker === null ) {
$this->crossChecker = new CrossChecker(
$this->wikibaseRepo->getEntityLookup(),
$this->getComparativeValueParserFactory(),
@@ -116,11 +116,11 @@
* @return CrossCheckInteractor
*/
public function getCrossCheckInteractor() {
- if ($this->crossCheckInteractor === null) {
+ if ( $this->crossCheckInteractor === null ) {
$this->crossCheckInteractor = new CrossCheckInteractor(
$this->wikibaseRepo->getEntityLookup(),
$this->wikibaseRepo->getStatementGuidParser(),
- $this->getCrossChecker());
+ $this->getCrossChecker() );
}
return $this->crossCheckInteractor;
@@ -130,7 +130,7 @@
* @return ComparativeValueParserFactory
*/
public function getComparativeValueParserFactory() {
- if ($this->comparativeValueParserFactory === null) {
+ if ( $this->comparativeValueParserFactory === null ) {
$this->comparativeValueParserFactory = new
ComparativeValueParserFactory(
$this->wikibaseRepo->getDataTypeDefinitions(),
new StringNormalizer()
@@ -144,7 +144,7 @@
* @return DataValueComparerFactory
*/
public function getDataValueComparerFactory() {
- if ($this->dataValueComparerFactory === null) {
+ if ( $this->dataValueComparerFactory === null ) {
$this->dataValueComparerFactory = new
DataValueComparerFactory(
$this->wikibaseRepo->getStore()->getTermIndex(),
$this->wikibaseRepo->getStringNormalizer()
@@ -158,7 +158,7 @@
* @return DumpMetaInformationLookup
*/
public function getDumpMetaInformationLookup() {
- if ($this->dumpMetaInformationLookup === null) {
+ if ( $this->dumpMetaInformationLookup === null ) {
$this->dumpMetaInformationLookup = new
SqlDumpMetaInformationRepo();
}
@@ -169,7 +169,7 @@
* @return DumpMetaInformationStore
*/
public function getDumpMetaInformationStore() {
- if ($this->dumpMetaInformationStore === null) {
+ if ( $this->dumpMetaInformationStore === null ) {
$this->dumpMetaInformationStore = new
SqlDumpMetaInformationRepo();
}
@@ -180,7 +180,7 @@
* @return ExternalDataRepo
*/
public function getExternalDataRepo() {
- if ($this->externalDataRepo === null) {
+ if ( $this->externalDataRepo === null ) {
$this->externalDataRepo = new ExternalDataRepo();
}
@@ -191,9 +191,9 @@
* @return SerializerFactory
*/
public function getSerializerFactory() {
- if ($this->serializerFactory === null) {
+ if ( $this->serializerFactory === null ) {
$dataValueSerializer = new DataValueSerializer();
- $dataModelSerializerFactory = new
\Wikibase\DataModel\SerializerFactory($dataValueSerializer);
+ $dataModelSerializerFactory = new
\Wikibase\DataModel\SerializerFactory( $dataValueSerializer );
$this->serializerFactory = new SerializerFactory(
$dataValueSerializer,
$dataModelSerializerFactory->newReferenceSerializer()
diff --git a/phpcs.xml b/phpcs.xml
index 60c6e53..e1dc479 100644
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -3,7 +3,6 @@
<rule ref="vendor/wikibase/wikibase-codesniffer/Wikibase">
<!-- FIXME: The following should all be fixed. -->
<exclude
name="MediaWiki.ControlStructures.AssignmentInControlStructures" />
- <exclude name="MediaWiki.WhiteSpace.SpaceyParenthesis" />
</rule>
<!-- Exceptions -->
diff --git
a/tests/phpunit/CrossCheck/Comparer/DispatchingDataValueComparerTest.php
b/tests/phpunit/CrossCheck/Comparer/DispatchingDataValueComparerTest.php
index 8228d24..bb0cc20 100644
--- a/tests/phpunit/CrossCheck/Comparer/DispatchingDataValueComparerTest.php
+++ b/tests/phpunit/CrossCheck/Comparer/DispatchingDataValueComparerTest.php
@@ -119,15 +119,15 @@
$mock = $this->getMock( DataValueComparer::class );
$mock->expects( $this->any() )
- ->method( 'compare' )
- ->will( $this->returnValue( $comparisonResult ) );
+ ->method( 'compare' )
+ ->will( $this->returnValue( $comparisonResult ) );
$mock->expects( $this->any() )
- ->method( 'canCompare' )
- ->will( $this->returnCallback(
- function ( DataValue $value, DataValue
$comparativeValue ) use ( $acceptedType ) {
- return $value->getType() ===
$acceptedType && $comparativeValue->getType() == $acceptedType;
- }
- ) );
+ ->method( 'canCompare' )
+ ->will( $this->returnCallback(
+ function ( DataValue $value, DataValue
$comparativeValue ) use ( $acceptedType ) {
+ return $value->getType() ===
$acceptedType && $comparativeValue->getType() == $acceptedType;
+ }
+ ) );
return $mock;
}
diff --git a/tests/phpunit/CrossCheck/Comparer/EntityIdValueComparerTest.php
b/tests/phpunit/CrossCheck/Comparer/EntityIdValueComparerTest.php
index ca07191..4682894 100644
--- a/tests/phpunit/CrossCheck/Comparer/EntityIdValueComparerTest.php
+++ b/tests/phpunit/CrossCheck/Comparer/EntityIdValueComparerTest.php
@@ -103,7 +103,7 @@
$terms = [];
if ( $id->getSerialization() === 'Q1' )
{
if ( in_array(
TermIndexEntry::TYPE_LABEL, $termTypes ) ) {
- if ( in_array( 'en',
$languageCodes) ) {
+ if ( in_array( 'en',
$languageCodes ) ) {
$terms[] = new
TermIndexEntry( [
'termType' => TermIndexEntry::TYPE_LABEL,
'termLanguage' => 'en',
@@ -111,7 +111,7 @@
'entityId' => $id,
] );
}
- if ( in_array( 'de',
$languageCodes) ) {
+ if ( in_array( 'de',
$languageCodes ) ) {
$terms[] = new
TermIndexEntry( [
'termType' => TermIndexEntry::TYPE_LABEL,
'termLanguage' => 'de',
@@ -121,7 +121,7 @@
}
}
if ( in_array(
TermIndexEntry::TYPE_ALIAS, $termTypes ) ) {
- if ( in_array( 'en',
$languageCodes) ) {
+ if ( in_array( 'en',
$languageCodes ) ) {
$terms[] = new
TermIndexEntry( [
'termType' => TermIndexEntry::TYPE_ALIAS,
'termLanguage' => 'en',
@@ -135,7 +135,7 @@
'entityId' => $id,
] );
}
- if ( in_array( 'de',
$languageCodes) ) {
+ if ( in_array( 'de',
$languageCodes ) ) {
$terms[] = new
TermIndexEntry( [
'termType' => TermIndexEntry::TYPE_ALIAS,
'termLanguage' => 'de',
@@ -158,7 +158,7 @@
->method( 'compareWithArray' )
->will( $this->returnCallback(
function ( $value, array $values ) {
- if ( in_array( $value, $values ) ) {
+ if ( in_array( $value, $values ) ) {
return
ComparisonResult::STATUS_MATCH;
} else {
return
ComparisonResult::STATUS_MISMATCH;
diff --git
a/tests/phpunit/CrossCheck/Comparer/MonolingualTextValueComparerTest.php
b/tests/phpunit/CrossCheck/Comparer/MonolingualTextValueComparerTest.php
index bd87b93..e619763 100644
--- a/tests/phpunit/CrossCheck/Comparer/MonolingualTextValueComparerTest.php
+++ b/tests/phpunit/CrossCheck/Comparer/MonolingualTextValueComparerTest.php
@@ -77,16 +77,16 @@
->setMethods( [ 'compare' ] )
->getMock();
$stringComparer->expects( $this->any() )
- ->method( 'compare' )
- ->will( $this->returnCallback(
-
function ( $value1, $value2 ) {
-
if ( $value1 === $value2 ) {
-
return ComparisonResult::STATUS_MATCH;
-
} else {
-
return ComparisonResult::STATUS_MISMATCH;
-
}
- }
- ) );
+ ->method( 'compare' )
+ ->will( $this->returnCallback(
+ function ( $value1, $value2 ) {
+ if ( $value1 === $value2 ) {
+ return
ComparisonResult::STATUS_MATCH;
+ } else {
+ return
ComparisonResult::STATUS_MISMATCH;
+ }
+ }
+ ) );
return new MonolingualTextValueComparer( $stringComparer );
}
diff --git
a/tests/phpunit/CrossCheck/Comparer/MultilingualTextValueComparerTest.php
b/tests/phpunit/CrossCheck/Comparer/MultilingualTextValueComparerTest.php
index 886ea48..23a0ace 100644
--- a/tests/phpunit/CrossCheck/Comparer/MultilingualTextValueComparerTest.php
+++ b/tests/phpunit/CrossCheck/Comparer/MultilingualTextValueComparerTest.php
@@ -89,36 +89,36 @@
ComparisonResult::STATUS_MATCH,
$localValueEn,
new MultilingualTextValue( [
-
new MonolingualTextValue( 'de', 'bar' ),
-
new MonolingualTextValue( 'en', 'foo' )
-
] )
+ new MonolingualTextValue( 'de', 'bar' ),
+ new MonolingualTextValue( 'en', 'foo' )
+ ] )
],
[
ComparisonResult::STATUS_MISMATCH,
$localValueEn,
new MultilingualTextValue( [
-
new MonolingualTextValue( 'de', 'foo' ),
-
new MonolingualTextValue( 'en', 'bar' )
-
] )
+ new MonolingualTextValue( 'de', 'foo' ),
+ new MonolingualTextValue( 'en', 'bar' )
+ ] )
],
[
ComparisonResult::STATUS_MISMATCH,
$localValueEn,
new MultilingualTextValue( [
-
new MonolingualTextValue( 'de', 'foo' ),
-
new MonolingualTextValue( 'en', 'bar' )
-
] )
+ new MonolingualTextValue( 'de', 'foo' ),
+ new MonolingualTextValue( 'en', 'bar' )
+ ] )
],
[
ComparisonResult::STATUS_MISMATCH,
new MultilingualTextValue( [
-
new MonolingualTextValue( 'de', 'foobar' ),
-
new MonolingualTextValue( 'en', 'foobar' )
-
] ),
+ new MonolingualTextValue( 'de',
'foobar' ),
+ new MonolingualTextValue( 'en',
'foobar' )
+ ] ),
new MultilingualTextValue( [
-
new MonolingualTextValue( 'de', 'foo' ),
-
new MonolingualTextValue( 'en', 'foo' )
-
] )
+ new MonolingualTextValue( 'de', 'foo' ),
+ new MonolingualTextValue( 'en', 'foo' )
+ ] )
],
// Languages does not match
[
diff --git a/tests/phpunit/CrossCheck/Result/CrossCheckResultListTest.php
b/tests/phpunit/CrossCheck/Result/CrossCheckResultListTest.php
index 1101c4f..34dd112 100644
--- a/tests/phpunit/CrossCheck/Result/CrossCheckResultListTest.php
+++ b/tests/phpunit/CrossCheck/Result/CrossCheckResultListTest.php
@@ -170,11 +170,11 @@
private function getCrossCheckResultMock( PropertyId $propertyId,
$status, $referencesMissing ) {
// Mock ComparisonResult
$comparisonResultMock = $this->getMockBuilder(
ComparisonResult::class )
-
->disableOriginalConstructor()
- ->getMock();
+ ->disableOriginalConstructor()
+ ->getMock();
$comparisonResultMock->expects( $this->any() )
- ->method( 'getStatus' )
- ->will( $this->returnValue(
$status ) );
+ ->method( 'getStatus' )
+ ->will( $this->returnValue( $status ) );
// Mock ReferenceResult
$referenceResult = $this->getMockBuilder(
ReferenceResult::class )
@@ -192,8 +192,8 @@
->method( 'getPropertyId' )
->will( $this->returnValue( $propertyId ) );
$crossCheckResultMock->expects( $this->any() )
- ->method(
'getComparisonResult' )
- ->will(
$this->returnValue( $comparisonResultMock ) );
+ ->method( 'getComparisonResult' )
+ ->will( $this->returnValue( $comparisonResultMock ) );
$crossCheckResultMock->expects( $this->any() )
->method( 'getReferenceResult' )
->will( $this->returnValue( $referenceResult ) );
diff --git
a/tests/phpunit/CrossCheck/ValueParser/MultilingualTextValueParserTest.php
b/tests/phpunit/CrossCheck/ValueParser/MultilingualTextValueParserTest.php
index 09027c1..83d7cfd 100644
--- a/tests/phpunit/CrossCheck/ValueParser/MultilingualTextValueParserTest.php
+++ b/tests/phpunit/CrossCheck/ValueParser/MultilingualTextValueParserTest.php
@@ -45,8 +45,8 @@
$valueParserMock = $this->getMock( ValueParser::class );
$valueParserMock->expects( $this->any() )
- ->method( 'parse' )
- ->will( $this->returnValue( new MonolingualTextValue(
'en', 'foo' ) ) );
+ ->method( 'parse' )
+ ->will( $this->returnValue( new MonolingualTextValue(
'en', 'foo' ) ) );
return new MultilingualTextValueParser( $valueParserMock );
}
--
To view, visit https://gerrit.wikimedia.org/r/359403
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I9f7051b766fc469ece775338bcb87c92eb468799
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseQualityExternalValidation
Gerrit-Branch: master
Gerrit-Owner: Umherirrender <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits