Bene has uploaded a new change for review.

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

Change subject: Switch ChangeOps to EntityDocument
......................................................................

Switch ChangeOps to EntityDocument

Change all type hints in ChangeOp and its implementations to
EntityDocument. This allows us to get rid of Entity in other places as
well. As Entity currently implements EntityDocument, this isn't a breaking
change to users of ChangeOp (only to its derivatives).

Change-Id: I62f1a8e042672c58702ff6598fbe0918641e38c2
---
M repo/includes/ChangeOp/ChangeOp.php
M repo/includes/ChangeOp/ChangeOpAliases.php
M repo/includes/ChangeOp/ChangeOpBase.php
M repo/includes/ChangeOp/ChangeOpDescription.php
M repo/includes/ChangeOp/ChangeOpLabel.php
M repo/includes/ChangeOp/ChangeOpMainSnak.php
M repo/includes/ChangeOp/ChangeOpQualifier.php
M repo/includes/ChangeOp/ChangeOpQualifierRemove.php
M repo/includes/ChangeOp/ChangeOpReference.php
M repo/includes/ChangeOp/ChangeOpReferenceRemove.php
M repo/includes/ChangeOp/ChangeOpRemoveStatement.php
M repo/includes/ChangeOp/ChangeOpSiteLink.php
M repo/includes/ChangeOp/ChangeOpStatement.php
M repo/includes/ChangeOp/ChangeOpStatementRank.php
M repo/includes/ChangeOp/ChangeOps.php
15 files changed, 96 insertions(+), 73 deletions(-)


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

diff --git a/repo/includes/ChangeOp/ChangeOp.php 
b/repo/includes/ChangeOp/ChangeOp.php
index b27cd6e..2acdd71 100644
--- a/repo/includes/ChangeOp/ChangeOp.php
+++ b/repo/includes/ChangeOp/ChangeOp.php
@@ -3,7 +3,7 @@
 namespace Wikibase\ChangeOp;
 
 use ValueValidators\Result;
-use Wikibase\DataModel\Entity\Entity;
+use Wikibase\DataModel\Entity\EntityDocument;
 use Wikibase\Summary;
 
 /**
@@ -25,22 +25,22 @@
         * Validates the current ChangeOp. This indicates whether this ChangeOp 
is valid
         * with respect to the given entity.
         *
-        * @param Entity $entity
+        * @param EntityDocument $entity
         *
         * @return Result
         */
-       public function validate( Entity $entity );
+       public function validate( EntityDocument $entity );
 
        /**
         * Applies the change represented by this ChangeOp to the given Entity.
         *
         * @since 0.5
         *
-        * @param Entity $entity
+        * @param EntityDocument $entity
         * @param Summary|null $summary
         *
         * @throws ChangeOpException
         */
-       public function apply( Entity $entity, Summary $summary = null );
+       public function apply( EntityDocument $entity, Summary $summary = null 
);
 
 }
diff --git a/repo/includes/ChangeOp/ChangeOpAliases.php 
b/repo/includes/ChangeOp/ChangeOpAliases.php
index 361b3ee..1f260a7 100644
--- a/repo/includes/ChangeOp/ChangeOpAliases.php
+++ b/repo/includes/ChangeOp/ChangeOpAliases.php
@@ -4,8 +4,9 @@
 
 use InvalidArgumentException;
 use ValueValidators\Result;
-use Wikibase\DataModel\Entity\Entity;
+use Wikibase\DataModel\Entity\EntityDocument;
 use Wikibase\DataModel\Term\Fingerprint;
+use Wikibase\DataModel\Term\FingerprintHolder;
 use Wikibase\Repo\Validators\TermValidatorFactory;
 use Wikibase\Summary;
 
@@ -99,7 +100,11 @@
        /**
         * @see ChangeOp::apply()
         */
-       public function apply( Entity $entity, Summary $summary = null ) {
+       public function apply( EntityDocument $entity, Summary $summary = null 
) {
+               if ( !( $entity instanceof FingerprintHolder ) ) {
+                       throw new InvalidArgumentException( '$entity must be a 
FingerprintHolder' );
+               }
+
                $fingerprint = $entity->getFingerprint();
 
                $this->updateSummary( $summary, $this->action, 
$this->languageCode, $this->aliases );
@@ -115,12 +120,12 @@
         *
         * @since 0.5
         *
-        * @param Entity $entity
+        * @param EntityDocument $entity
         *
         * @throws ChangeOpException
         * @return Result
         */
-       public function validate( Entity $entity ) {
+       public function validate( EntityDocument $entity ) {
                $languageValidator = 
$this->termValidatorFactory->getLanguageValidator();
                $termValidator = 
$this->termValidatorFactory->getLabelValidator( $entity->getType() );
 
diff --git a/repo/includes/ChangeOp/ChangeOpBase.php 
b/repo/includes/ChangeOp/ChangeOpBase.php
index 975b489..b09b1b2 100644
--- a/repo/includes/ChangeOp/ChangeOpBase.php
+++ b/repo/includes/ChangeOp/ChangeOpBase.php
@@ -4,7 +4,7 @@
 
 use InvalidArgumentException;
 use ValueValidators\Result;
-use Wikibase\DataModel\Entity\Entity;
+use Wikibase\DataModel\Entity\EntityDocument;
 use Wikibase\Summary;
 
 /**
@@ -41,12 +41,12 @@
         *
         * @since 0.5
         *
-        * @param Entity $entity
+        * @param EntityDocument $entity
         *
         * @throws ChangeOpException
         * @return Result
         */
-       public function validate( Entity $entity ) {
+       public function validate( EntityDocument $entity ) {
                return Result::newSuccess();
        }
 
diff --git a/repo/includes/ChangeOp/ChangeOpDescription.php 
b/repo/includes/ChangeOp/ChangeOpDescription.php
index ce6542c..6beaeb6 100644
--- a/repo/includes/ChangeOp/ChangeOpDescription.php
+++ b/repo/includes/ChangeOp/ChangeOpDescription.php
@@ -4,8 +4,9 @@
 
 use InvalidArgumentException;
 use ValueValidators\Result;
-use Wikibase\DataModel\Entity\Entity;
+use Wikibase\DataModel\Entity\EntityDocument;
 use Wikibase\DataModel\Term\Fingerprint;
+use Wikibase\DataModel\Term\FingerprintHolder;
 use Wikibase\Repo\Validators\TermValidatorFactory;
 use Wikibase\Summary;
 
@@ -74,7 +75,11 @@
        /**
         * @see ChangeOp::apply()
         */
-       public function apply( Entity $entity, Summary $summary = null ) {
+       public function apply( EntityDocument $entity, Summary $summary = null 
) {
+               if ( !( $entity instanceof FingerprintHolder ) ) {
+                       throw new InvalidArgumentException( '$entity must be a 
FingerprintHolder' );
+               }
+
                $fingerprint = $entity->getFingerprint();
 
                if ( $fingerprint->getDescriptions()->hasTermForLanguage( 
$this->languageCode ) ) {
@@ -99,11 +104,15 @@
         *
         * @since 0.5
         *
-        * @param Entity $entity
+        * @param EntityDocument $entity
         *
         * @return Result
         */
-       public function validate( Entity $entity ) {
+       public function validate( EntityDocument $entity ) {
+               if ( !( $entity instanceof FingerprintHolder ) ) {
+                       throw new InvalidArgumentException( '$entity must be a 
FingerprintHolder' );
+               }
+
                $languageValidator = 
$this->termValidatorFactory->getLanguageValidator();
                $termValidator = 
$this->termValidatorFactory->getDescriptionValidator();
                $fingerprintValidator = 
$this->termValidatorFactory->getFingerprintValidator( $entity->getType() );
diff --git a/repo/includes/ChangeOp/ChangeOpLabel.php 
b/repo/includes/ChangeOp/ChangeOpLabel.php
index da7da15..8e8475e 100644
--- a/repo/includes/ChangeOp/ChangeOpLabel.php
+++ b/repo/includes/ChangeOp/ChangeOpLabel.php
@@ -4,8 +4,9 @@
 
 use InvalidArgumentException;
 use ValueValidators\Result;
-use Wikibase\DataModel\Entity\Entity;
+use Wikibase\DataModel\Entity\EntityDocument;
 use Wikibase\DataModel\Term\Fingerprint;
+use Wikibase\DataModel\Term\FingerprintHolder;
 use Wikibase\Repo\Validators\TermValidatorFactory;
 use Wikibase\Summary;
 
@@ -74,10 +75,14 @@
        /**
         * @see ChangeOp::apply()
         *
-        * @param Entity $entity
+        * @param EntityDocument $entity
         * @param Summary|null $summary
         */
-       public function apply( Entity $entity, Summary $summary = null ) {
+       public function apply( EntityDocument $entity, Summary $summary = null 
) {
+               if ( !( $entity instanceof FingerprintHolder ) ) {
+                       throw new InvalidArgumentException( '$entity must be a 
FingerprintHolder' );
+               }
+
                $fingerprint = $entity->getFingerprint();
 
                if ( $fingerprint->getLabels()->hasTermForLanguage( 
$this->languageCode ) ) {
@@ -102,11 +107,15 @@
         *
         * @since 0.5
         *
-        * @param Entity $entity
+        * @param EntityDocument $entity
         *
         * @return Result
         */
-       public function validate( Entity $entity ) {
+       public function validate( EntityDocument $entity ) {
+               if ( !( $entity instanceof FingerprintHolder ) ) {
+                       throw new InvalidArgumentException( '$entity must be a 
FingerprintHolder' );
+               }
+
                $languageValidator = 
$this->termValidatorFactory->getLanguageValidator();
                $termValidator = 
$this->termValidatorFactory->getLabelValidator( $entity->getType() );
                $fingerprintValidator = 
$this->termValidatorFactory->getFingerprintValidator( $entity->getType() );
diff --git a/repo/includes/ChangeOp/ChangeOpMainSnak.php 
b/repo/includes/ChangeOp/ChangeOpMainSnak.php
index 3548869..4d7e37d 100644
--- a/repo/includes/ChangeOp/ChangeOpMainSnak.php
+++ b/repo/includes/ChangeOp/ChangeOpMainSnak.php
@@ -4,7 +4,7 @@
 
 use InvalidArgumentException;
 use ValueValidators\Result;
-use Wikibase\DataModel\Entity\Entity;
+use Wikibase\DataModel\Entity\EntityDocument;
 use Wikibase\DataModel\Entity\EntityId;
 use Wikibase\DataModel\Services\Statement\GuidGenerator;
 use Wikibase\DataModel\Snak\Snak;
@@ -79,7 +79,7 @@
         * - a new claim with $snak as mainsnak gets added when $claimGuid is 
empty and $snak is set
         * - the claim's mainsnak gets set to $snak when $claimGuid and $snak 
are set
         */
-       public function apply( Entity $entity, Summary $summary = null ) {
+       public function apply( EntityDocument $entity, Summary $summary = null 
) {
                if ( !( $entity instanceof StatementListHolder ) ) {
                        throw new InvalidArgumentException( '$entity must be a 
StatementListHolder' );
                }
@@ -149,12 +149,12 @@
         *
         * @since 0.5
         *
-        * @param Entity $entity
+        * @param EntityDocument $entity
         *
         * @throws ChangeOpException
         * @return Result
         */
-       public function validate( Entity $entity ) {
+       public function validate( EntityDocument $entity ) {
                return $this->snakValidator->validate( $this->snak );
        }
 
diff --git a/repo/includes/ChangeOp/ChangeOpQualifier.php 
b/repo/includes/ChangeOp/ChangeOpQualifier.php
index 610e2d3..5769563 100644
--- a/repo/includes/ChangeOp/ChangeOpQualifier.php
+++ b/repo/includes/ChangeOp/ChangeOpQualifier.php
@@ -4,7 +4,7 @@
 
 use InvalidArgumentException;
 use ValueValidators\Result;
-use Wikibase\DataModel\Entity\Entity;
+use Wikibase\DataModel\Entity\EntityDocument;
 use Wikibase\DataModel\Snak\Snak;
 use Wikibase\DataModel\Snak\SnakList;
 use Wikibase\DataModel\Statement\StatementListHolder;
@@ -73,7 +73,7 @@
         * - a new qualifier gets added when $snakHash is empty and $snak is set
         * - the qualifier gets set to $snak when $snakHash and $snak are set
         */
-       public function apply( Entity $entity, Summary $summary = null ) {
+       public function apply( EntityDocument $entity, Summary $summary = null 
) {
                if ( !( $entity instanceof StatementListHolder ) ) {
                        throw new InvalidArgumentException( '$entity must be a 
StatementListHolder' );
                }
@@ -151,12 +151,12 @@
         *
         * @since 0.5
         *
-        * @param Entity $entity
+        * @param EntityDocument $entity
         *
         * @throws ChangeOpException
         * @return Result
         */
-       public function validate( Entity $entity ) {
+       public function validate( EntityDocument $entity ) {
                return $this->snakValidator->validate( $this->snak );
        }
 
diff --git a/repo/includes/ChangeOp/ChangeOpQualifierRemove.php 
b/repo/includes/ChangeOp/ChangeOpQualifierRemove.php
index 04cb57a..56206a8 100644
--- a/repo/includes/ChangeOp/ChangeOpQualifierRemove.php
+++ b/repo/includes/ChangeOp/ChangeOpQualifierRemove.php
@@ -4,7 +4,7 @@
 
 use InvalidArgumentException;
 use ValueValidators\Result;
-use Wikibase\DataModel\Entity\Entity;
+use Wikibase\DataModel\Entity\EntityDocument;
 use Wikibase\DataModel\Snak\Snak;
 use Wikibase\DataModel\Snak\SnakList;
 use Wikibase\DataModel\Statement\StatementListHolder;
@@ -55,7 +55,7 @@
        /**
         * @see ChangeOp::apply()
         */
-       public function apply( Entity $entity, Summary $summary = null ) {
+       public function apply( EntityDocument $entity, Summary $summary = null 
) {
                if ( !( $entity instanceof StatementListHolder ) ) {
                        throw new InvalidArgumentException( '$entity must be a 
StatementListHolder' );
                }
@@ -105,12 +105,12 @@
         *
         * @since 0.5
         *
-        * @param Entity $entity
+        * @param EntityDocument $entity
         *
         * @throws ChangeOpException
         * @return Result
         */
-       public function validate( Entity $entity ) {
+       public function validate( EntityDocument $entity ) {
                //TODO: move validation logic from apply() here.
                return parent::validate( $entity );
        }
diff --git a/repo/includes/ChangeOp/ChangeOpReference.php 
b/repo/includes/ChangeOp/ChangeOpReference.php
index 420fdc7..80b0994 100644
--- a/repo/includes/ChangeOp/ChangeOpReference.php
+++ b/repo/includes/ChangeOp/ChangeOpReference.php
@@ -4,7 +4,7 @@
 
 use InvalidArgumentException;
 use ValueValidators\Result;
-use Wikibase\DataModel\Entity\Entity;
+use Wikibase\DataModel\Entity\EntityDocument;
 use Wikibase\DataModel\Reference;
 use Wikibase\DataModel\ReferenceList;
 use Wikibase\DataModel\Snak\Snak;
@@ -95,7 +95,7 @@
         * - a new reference gets added when $referenceHash is empty and 
$reference is set
         * - the reference gets set to $reference when $referenceHash and 
$reference are set
         */
-       public function apply( Entity $entity, Summary $summary = null ) {
+       public function apply( EntityDocument $entity, Summary $summary = null 
) {
                if ( !( $entity instanceof StatementListHolder ) ) {
                        throw new InvalidArgumentException( '$entity must be a 
StatementListHolder' );
                }
@@ -187,12 +187,12 @@
         *
         * @since 0.5
         *
-        * @param Entity $entity
+        * @param EntityDocument $entity
         *
         * @throws ChangeOpException
         * @return Result
         */
-       public function validate( Entity $entity ) {
+       public function validate( EntityDocument $entity ) {
                return $this->snakValidator->validateReference( 
$this->reference );
        }
 
diff --git a/repo/includes/ChangeOp/ChangeOpReferenceRemove.php 
b/repo/includes/ChangeOp/ChangeOpReferenceRemove.php
index 3b23ef7..aecc891 100644
--- a/repo/includes/ChangeOp/ChangeOpReferenceRemove.php
+++ b/repo/includes/ChangeOp/ChangeOpReferenceRemove.php
@@ -4,7 +4,7 @@
 
 use InvalidArgumentException;
 use ValueValidators\Result;
-use Wikibase\DataModel\Entity\Entity;
+use Wikibase\DataModel\Entity\EntityDocument;
 use Wikibase\DataModel\ReferenceList;
 use Wikibase\DataModel\Snak\Snak;
 use Wikibase\DataModel\Statement\StatementListHolder;
@@ -55,7 +55,7 @@
        /**
         * @see ChangeOp::apply()
         */
-       public function apply( Entity $entity, Summary $summary = null ) {
+       public function apply( EntityDocument $entity, Summary $summary = null 
) {
                if ( !( $entity instanceof StatementListHolder ) ) {
                        throw new InvalidArgumentException( '$entity must be a 
StatementListHolder' );
                }
@@ -114,12 +114,12 @@
         *
         * @since 0.5
         *
-        * @param Entity $entity
+        * @param EntityDocument $entity
         *
         * @throws ChangeOpException
         * @return Result
         */
-       public function validate( Entity $entity ) {
+       public function validate( EntityDocument $entity ) {
                //TODO: move validation logic from apply() here.
                return parent::validate( $entity );
        }
diff --git a/repo/includes/ChangeOp/ChangeOpRemoveStatement.php 
b/repo/includes/ChangeOp/ChangeOpRemoveStatement.php
index a569a43..dbf2d9f 100644
--- a/repo/includes/ChangeOp/ChangeOpRemoveStatement.php
+++ b/repo/includes/ChangeOp/ChangeOpRemoveStatement.php
@@ -4,7 +4,7 @@
 
 use InvalidArgumentException;
 use ValueValidators\Result;
-use Wikibase\DataModel\Entity\Entity;
+use Wikibase\DataModel\Entity\EntityDocument;
 use Wikibase\DataModel\Snak\Snak;
 use Wikibase\DataModel\Statement\StatementListHolder;
 use Wikibase\Summary;
@@ -51,13 +51,13 @@
        /**
         * @see ChangeOp::apply
         *
-        * @param Entity $entity
+        * @param EntityDocument $entity
         * @param Summary|null $summary
         *
         * @throws InvalidArgumentException
         * @throws ChangeOpException
         */
-       public function apply( Entity $entity, Summary $summary = null ) {
+       public function apply( EntityDocument $entity, Summary $summary = null 
) {
                if ( !( $entity instanceof StatementListHolder ) ) {
                        throw new InvalidArgumentException( '$entity must be a 
StatementListHolder' );
                }
@@ -91,12 +91,12 @@
         *
         * @since 0.5
         *
-        * @param Entity $entity
+        * @param EntityDocument $entity
         *
         * @throws ChangeOpException
         * @return Result
         */
-       public function validate( Entity $entity ) {
+       public function validate( EntityDocument $entity ) {
                //TODO: move validation logic from apply() here.
                return parent::validate( $entity );
        }
diff --git a/repo/includes/ChangeOp/ChangeOpSiteLink.php 
b/repo/includes/ChangeOp/ChangeOpSiteLink.php
index d41f067..790aefd 100644
--- a/repo/includes/ChangeOp/ChangeOpSiteLink.php
+++ b/repo/includes/ChangeOp/ChangeOpSiteLink.php
@@ -4,7 +4,7 @@
 
 use InvalidArgumentException;
 use ValueValidators\Result;
-use Wikibase\DataModel\Entity\Entity;
+use Wikibase\DataModel\Entity\EntityDocument;
 use Wikibase\DataModel\Entity\Item;
 use Wikibase\DataModel\Entity\ItemId;
 use Wikibase\DataModel\SiteLinkList;
@@ -129,7 +129,7 @@
        /**
         * @see ChangeOp::apply
         */
-       public function apply( Entity $entity, Summary $summary = null ) {
+       public function apply( EntityDocument $entity, Summary $summary = null 
) {
                if ( !( $entity instanceof Item ) ) {
                        throw new InvalidArgumentException( 'ChangeOpSiteLink 
can only be applied to Item instances' );
                }
@@ -174,12 +174,12 @@
         *
         * @since 0.5
         *
-        * @param Entity $entity
+        * @param EntityDocument $entity
         *
         * @throws ChangeOpException
         * @return Result
         */
-       public function validate( Entity $entity ) {
+       public function validate( EntityDocument $entity ) {
                //TODO: move validation logic from apply() here.
                return parent::validate( $entity );
        }
diff --git a/repo/includes/ChangeOp/ChangeOpStatement.php 
b/repo/includes/ChangeOp/ChangeOpStatement.php
index 751136e..22ab656 100644
--- a/repo/includes/ChangeOp/ChangeOpStatement.php
+++ b/repo/includes/ChangeOp/ChangeOpStatement.php
@@ -6,7 +6,7 @@
 use OutOfBoundsException;
 use ValueValidators\Result;
 use Wikibase\DataModel\ByPropertyIdArray;
-use Wikibase\DataModel\Entity\Entity;
+use Wikibase\DataModel\Entity\EntityDocument;
 use Wikibase\DataModel\Services\Statement\GuidGenerator;
 use Wikibase\DataModel\Services\Statement\StatementGuidParser;
 use Wikibase\DataModel\Services\Statement\StatementGuidValidator;
@@ -91,12 +91,16 @@
        /**
         * @see ChangeOp::apply
         *
-        * @param Entity $entity
+        * @param EntityDocument $entity
         * @param Summary|null $summary
         *
         * @throws ChangeOpException
         */
-       public function apply( Entity $entity, Summary $summary = null ) {
+       public function apply( EntityDocument $entity, Summary $summary = null 
) {
+               if ( !( $entity instanceof StatementListHolder ) ) {
+                       throw new InvalidArgumentException( '$entity must be a 
StatementListHolder' );
+               }
+
                if ( $this->statement->getGuid() === null ) {
                        $this->statement->setGuid( 
$this->guidGenerator->newGuid( $entity->getId() ) );
                }
@@ -109,23 +113,19 @@
                        throw new ChangeOpException( "Claim GUID invalid for 
given entity" );
                }
 
-               $this->applyClaimToEntity( $entity, $summary );
+               $this->applyStatementToEntity( $entity, $summary );
        }
 
        /**
-        * @param Entity $entity
+        * @param StatementListHolder $statementListHolder
         * @param Summary|null $summary
         *
         * @throws InvalidArgumentException
         */
-       private function applyClaimToEntity( Entity $entity, Summary $summary = 
null ) {
-               if ( !( $entity instanceof StatementListHolder ) ) {
-                       throw new InvalidArgumentException( '$entity must be a 
StatementListHolder' );
-               }
-
-               $statements = $this->removeStatement( 
$entity->getStatements()->toArray(), $summary );
+       private function applyStatementToEntity( StatementListHolder 
$statementListHolder, Summary $summary = null ) {
+               $statements = $this->removeStatement( 
$statementListHolder->getStatements()->toArray(), $summary );
                $statements = $this->addStatement( $statements );
-               $entity->setStatements( new StatementList( $statements ) );
+               $statementListHolder->setStatements( new StatementList( 
$statements ) );
        }
 
        /**
@@ -214,12 +214,12 @@
         *
         * @since 0.5
         *
-        * @param Entity $entity
+        * @param EntityDocument $entity
         *
         * @throws ChangeOpException
         * @return Result
         */
-       public function validate( Entity $entity ) {
+       public function validate( EntityDocument $entity ) {
                return $this->snakValidator->validateClaimSnaks( 
$this->statement );
        }
 
diff --git a/repo/includes/ChangeOp/ChangeOpStatementRank.php 
b/repo/includes/ChangeOp/ChangeOpStatementRank.php
index a9d0dae..cadedbb 100644
--- a/repo/includes/ChangeOp/ChangeOpStatementRank.php
+++ b/repo/includes/ChangeOp/ChangeOpStatementRank.php
@@ -4,7 +4,7 @@
 
 use InvalidArgumentException;
 use ValueValidators\Result;
-use Wikibase\DataModel\Entity\Entity;
+use Wikibase\DataModel\Entity\EntityDocument;
 use Wikibase\DataModel\Snak\Snak;
 use Wikibase\DataModel\Statement\StatementListHolder;
 use Wikibase\StatementRankSerializer;
@@ -55,7 +55,7 @@
        /**
         * @see ChangeOp::apply()
         */
-       public function apply( Entity $entity, Summary $summary = null ) {
+       public function apply( EntityDocument $entity, Summary $summary = null 
) {
                if ( !( $entity instanceof StatementListHolder ) ) {
                        throw new InvalidArgumentException( '$entity must be a 
StatementListHolder' );
                }
@@ -102,12 +102,12 @@
         *
         * @since 0.5
         *
-        * @param Entity $entity
+        * @param EntityDocument $entity
         *
         * @throws ChangeOpException
         * @return Result
         */
-       public function validate( Entity $entity ) {
+       public function validate( EntityDocument $entity ) {
                //TODO: move validation logic from apply() here.
                return parent::validate( $entity );
        }
diff --git a/repo/includes/ChangeOp/ChangeOps.php 
b/repo/includes/ChangeOp/ChangeOps.php
index 4ad2e5e..a846b0d 100644
--- a/repo/includes/ChangeOp/ChangeOps.php
+++ b/repo/includes/ChangeOp/ChangeOps.php
@@ -4,7 +4,7 @@
 
 use InvalidArgumentException;
 use ValueValidators\Result;
-use Wikibase\DataModel\Entity\Entity;
+use Wikibase\DataModel\Entity\EntityDocument;
 use Wikibase\Summary;
 
 /**
@@ -74,12 +74,12 @@
         *
         * @since 0.4
         *
-        * @param Entity $entity
+        * @param EntityDocument $entity
         * @param Summary|null $summary
         *
         * @throws ChangeOpException
         */
-       public function apply( Entity $entity, Summary $summary = null ) {
+       public function apply( EntityDocument $entity, Summary $summary = null 
) {
                foreach ( $this->changeOps as $changeOp ) {
                        $changeOp->apply( $entity, $summary );
                }
@@ -90,12 +90,12 @@
         *
         * @since 0.5
         *
-        * @param Entity $entity
+        * @param EntityDocument $entity
         *
         * @throws ChangeOpException
         * @return Result
         */
-       public function validate( Entity $entity ) {
+       public function validate( EntityDocument $entity ) {
                $result = Result::newSuccess();
                // deep clone of $entity to avoid side-effects
                $entity = unserialize( serialize( $entity ) );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I62f1a8e042672c58702ff6598fbe0918641e38c2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Bene <[email protected]>

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

Reply via email to