Jeroen De Dauw has uploaded a new change for review.

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

Change subject: Improve type hints in ConnectionCheckerHelper
......................................................................

Improve type hints in ConnectionCheckerHelper

Change-Id: I990ffecb2fc4aad830e5d6d0ebbd467c5fa10394
---
M includes/ConstraintCheck/Helper/ConnectionCheckerHelper.php
1 file changed, 12 insertions(+), 4 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseQualityConstraints
 refs/changes/37/229637/1

diff --git a/includes/ConstraintCheck/Helper/ConnectionCheckerHelper.php 
b/includes/ConstraintCheck/Helper/ConnectionCheckerHelper.php
index 864fa7f..94c083a 100644
--- a/includes/ConstraintCheck/Helper/ConnectionCheckerHelper.php
+++ b/includes/ConstraintCheck/Helper/ConnectionCheckerHelper.php
@@ -2,6 +2,10 @@
 
 namespace WikibaseQuality\ConstraintReport\ConstraintCheck\Helper;
 
+use Wikibase\DataModel\Snak\PropertyValueSnak;
+use Wikibase\DataModel\Statement\Statement;
+use Wikibase\DataModel\Statement\StatementList;
+
 /**
  * Class for helper functions for the connection checkers.
  *
@@ -19,8 +23,8 @@
         *
         * @return boolean
         */
-       public function hasProperty( $statementList, $propertyIdSerialization ) 
{
-               foreach ( $statementList as $statement ) {
+       public function hasProperty( StatementList $statementList, 
$propertyIdSerialization ) {
+               foreach ( $statementList->toArray() as $statement ) {
                        if ( $statement->getPropertyId()->getSerialization() 
=== $propertyIdSerialization ) {
                                return true;
                        }
@@ -38,7 +42,7 @@
         * @return boolean
         */
        public function hasClaim( $statementList, $propertyIdSerialization, 
$itemIdSerializationOrArray ) {
-               foreach ( $statementList as $statement ) {
+               foreach ( $statementList->toArray() as $statement ) {
                        if ( $statement->getPropertyId()->getSerialization() 
=== $propertyIdSerialization ) {
                                if ( is_string( $itemIdSerializationOrArray ) ) 
{ // string
                                        $itemIdSerializationArray = array ( 
$itemIdSerializationOrArray );
@@ -53,8 +57,12 @@
                return false;
        }
 
-       private function arrayHasClaim( $statement, $itemIdSerializationArray ) 
{
+       private function arrayHasClaim( Statement $statement, 
$itemIdSerializationArray ) {
                $mainSnak = $statement->getMainSnak();
+
+               /**
+                * @var PropertyValueSnak $mainSnak
+                */
                if ( $mainSnak->getType() !== 'value' || 
$mainSnak->getDataValue()->getType() !== 'wikibase-entityid' ) {
                        return false;
                }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I990ffecb2fc4aad830e5d6d0ebbd467c5fa10394
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseQualityConstraints
Gerrit-Branch: master
Gerrit-Owner: Jeroen De Dauw <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to