Jonaskeutel has submitted this change and it was merged.
Change subject: Another round for Scrutinizer
......................................................................
Another round for Scrutinizer
(code duplication is still an issue, though)
Change-Id: Iff36ed396e29c900bab5813d298c7e5a64136d9d
---
M includes/ConstraintCheck/Checker/ConnectionChecker.php
M includes/ConstraintCheck/Helper/ConstraintReportHelper.php
M specials/SpecialConstraintReport.php
3 files changed, 17 insertions(+), 17 deletions(-)
Approvals:
Jonaskeutel: Verified; Looks good to me, approved
diff --git a/includes/ConstraintCheck/Checker/ConnectionChecker.php
b/includes/ConstraintCheck/Checker/ConnectionChecker.php
index 444bec3..ae370ff 100644
--- a/includes/ConstraintCheck/Checker/ConnectionChecker.php
+++ b/includes/ConstraintCheck/Checker/ConnectionChecker.php
@@ -199,7 +199,7 @@
$message = 'Target entity does not exist.';
return new CheckResult( $statement, 'Target required
claim', $parameters, CheckResult::STATUS_VIOLATION, $message );
}
- $targetEntityStatementsArray = $targetEntity->getStatements();
+ $targetEntityStatementList = $targetEntity->getStatements();
/*
* 'Target required claim' can be defined with
@@ -207,7 +207,7 @@
* b) a property and a number of items (each combination
forming an individual claim)
*/
if ( $itemArray[ 0 ] === '' ) {
- if ( $this->hasProperty( $targetEntityStatementsArray,
$property ) ) {
+ if ( $this->hasProperty( $targetEntityStatementList,
$property ) ) {
$message = '';
$status = CheckResult::STATUS_COMPLIANCE;
} else {
@@ -215,7 +215,7 @@
$status = CheckResult::STATUS_VIOLATION;
}
} else {
- if ( $this->hasClaim( $targetEntityStatementsArray,
$property, $itemArray ) ) {
+ if ( $this->hasClaim( $targetEntityStatementList,
$property, $itemArray ) ) {
$message = '';
$status = CheckResult::STATUS_COMPLIANCE;
} else {
@@ -266,9 +266,9 @@
$message = 'Target item does not exist.';
return new CheckResult( $statement, 'Symmetric',
$parameters, CheckResult::STATUS_VIOLATION, $message );
}
- $targetItemStatementsArray = $targetItem->getStatements();
+ $targetItemStatementList = $targetItem->getStatements();
- if ( $this->hasClaim( $targetItemStatementsArray,
$propertyId->getSerialization(), $entityIdSerialization ) ) {
+ if ( $this->hasClaim( $targetItemStatementList,
$propertyId->getSerialization(), $entityIdSerialization ) ) {
$message = '';
$status = CheckResult::STATUS_COMPLIANCE;
} else {
@@ -325,9 +325,9 @@
$message = 'Target item does not exist.';
return new CheckResult( $statement, 'Inverse',
$parameters, CheckResult::STATUS_VIOLATION, $message );
}
- $targetItemStatementsArray = $targetItem->getStatements();
+ $targetItemStatementList = $targetItem->getStatements();
- if ( $this->hasClaim( $targetItemStatementsArray, $property,
$entityIdSerialization ) ) {
+ if ( $this->hasClaim( $targetItemStatementList, $property,
$entityIdSerialization ) ) {
$message = '';
$status = CheckResult::STATUS_COMPLIANCE;
} else {
@@ -341,13 +341,13 @@
/**
* Checks if there is a statement with a claim using the given property.
*
- * @param array $statementsArray
+ * @param StatementList $statementList
* @param string $propertyIdSerialization
*
* @return boolean
*/
- private function hasProperty( $statementsArray,
$propertyIdSerialization ) {
- foreach ( $statementsArray as $statement ) {
+ private function hasProperty( $statementList, $propertyIdSerialization
) {
+ foreach ( $statementList as $statement ) {
if ( $statement->getPropertyId()->getSerialization()
=== $propertyIdSerialization ) {
return true;
}
@@ -358,14 +358,14 @@
/**
* Checks if there is a statement with a claim using the given property
and having one of the given items as its value.
*
- * @param array $statementsArray
+ * @param StatementList $statementList
* @param string $propertyIdSerialization
* @param string|array $itemIdSerializationOrArray
*
* @return boolean
*/
- private function hasClaim( $statementsArray, $propertyIdSerialization,
$itemIdSerializationOrArray ) {
- foreach ( $statementsArray as $statement ) {
+ private function hasClaim( $statementList, $propertyIdSerialization,
$itemIdSerializationOrArray ) {
+ foreach ( $statementList as $statement ) {
if ( $statement->getPropertyId()->getSerialization()
=== $propertyIdSerialization ) {
if ( is_string( $itemIdSerializationOrArray ) )
{ // string
$itemIdSerializationArray = array (
$itemIdSerializationOrArray );
diff --git a/includes/ConstraintCheck/Helper/ConstraintReportHelper.php
b/includes/ConstraintCheck/Helper/ConstraintReportHelper.php
index 03ccec2..8d29d1f 100644
--- a/includes/ConstraintCheck/Helper/ConstraintReportHelper.php
+++ b/includes/ConstraintCheck/Helper/ConstraintReportHelper.php
@@ -34,7 +34,7 @@
* @return array
*/
public function stringToArray( $templateString ) {
- if ( is_null( $templateString ) or $templateString === '' ) {
+ if ( is_null( $templateString ) || $templateString === '' ) {
return array ( '' );
} else {
return explode( ',', $this->removeBrackets(
str_replace( ' ', '', $templateString ) ) );
@@ -62,7 +62,7 @@
/**
* Helps set/format a single parameter depending on its type.
*
- * @param array $parameter
+ * @param string $parameter
* @param string $type
*
* @return array
diff --git a/specials/SpecialConstraintReport.php
b/specials/SpecialConstraintReport.php
index 074bd8b..2f4ca3e 100755
--- a/specials/SpecialConstraintReport.php
+++ b/specials/SpecialConstraintReport.php
@@ -53,7 +53,7 @@
*/
private $entityTitleLookup;
- function __construct() {
+ public function __construct() {
parent::__construct( 'ConstraintReport' );
$this->entityTitleLookup =
WikibaseRepo::getDefaultInstance()->getEntityTitleLookup();
@@ -232,7 +232,7 @@
}
} else {
// Cases where we format a DataValue
- return parent::formatDataValues( $value, $linking );
+ return $this->formatDataValues( $value, $linking );
}
}
--
To view, visit https://gerrit.wikimedia.org/r/206128
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Iff36ed396e29c900bab5813d298c7e5a64136d9d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikidataQualityConstraints
Gerrit-Branch: master
Gerrit-Owner: Andreasburmeister <[email protected]>
Gerrit-Reviewer: Jonaskeutel <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits