diff --git a/src/Diff/Internal/FingerprintPatcher.php b/src/Diff/Internal/FingerprintPatcher.php index 29b22cb0..66f1be2c 100644 --- a/src/Diff/Internal/FingerprintPatcher.php +++ b/src/Diff/Internal/FingerprintPatcher.php @@ -4,12 +4,10 @@ use Diff\Patcher\PatcherException; use Wikibase\DataModel\Services\Diff\EntityDiff; +use Wikibase\DataModel\Services\Diff\TermListPatcher; use Wikibase\DataModel\Term\Fingerprint; /** - * TODO: Class should be public. - * TODO: Should this support actual edit conflict detection? - * * Package private. * * @since 1.0 diff --git a/src/Diff/Internal/SiteLinkListPatcher.php b/src/Diff/Internal/SiteLinkListPatcher.php index 5bb762e7..ef1bd80c 100644 --- a/src/Diff/Internal/SiteLinkListPatcher.php +++ b/src/Diff/Internal/SiteLinkListPatcher.php @@ -10,9 +10,6 @@ use Wikibase\DataModel\SiteLinkList; /** - * TODO: Class should be public. - * TODO: Should this support actual edit conflict detection? - * * Package private. * * @license GPL-2.0+ diff --git a/src/Diff/ItemDiffer.php b/src/Diff/ItemDiffer.php index 456a6ba7..eed4e120 100644 --- a/src/Diff/ItemDiffer.php +++ b/src/Diff/ItemDiffer.php @@ -7,7 +7,6 @@ use Wikibase\DataModel\Entity\EntityDocument; use Wikibase\DataModel\Entity\Item; use Wikibase\DataModel\Entity\ItemId; -use Wikibase\DataModel\Services\Diff\Internal\StatementListDiffer; use Wikibase\DataModel\SiteLinkList; /** diff --git a/src/Diff/ItemPatcher.php b/src/Diff/ItemPatcher.php index 5341d031..cbe486e0 100644 --- a/src/Diff/ItemPatcher.php +++ b/src/Diff/ItemPatcher.php @@ -7,7 +7,6 @@ use Wikibase\DataModel\Entity\Item; use Wikibase\DataModel\Services\Diff\Internal\FingerprintPatcher; use Wikibase\DataModel\Services\Diff\Internal\SiteLinkListPatcher; -use Wikibase\DataModel\Services\Diff\Internal\StatementListPatcher; /** * @since 1.0 @@ -76,10 +75,10 @@ private function patchItem( Item $item, EntityDiff $patch ) { ) ); } - $item->setStatements( $this->statementListPatcher->getPatchedStatementList( + $this->statementListPatcher->patchStatementList( $item->getStatements(), $patch->getClaimsDiff() - ) ); + ); } } diff --git a/src/Diff/PropertyDiffer.php b/src/Diff/PropertyDiffer.php index 5d580562..fee382f4 100644 --- a/src/Diff/PropertyDiffer.php +++ b/src/Diff/PropertyDiffer.php @@ -7,7 +7,6 @@ use InvalidArgumentException; use Wikibase\DataModel\Entity\EntityDocument; use Wikibase\DataModel\Entity\Property; -use Wikibase\DataModel\Services\Diff\Internal\StatementListDiffer; use Wikibase\DataModel\Statement\StatementList; /** diff --git a/src/Diff/PropertyPatcher.php b/src/Diff/PropertyPatcher.php index a0849f8c..b893db22 100644 --- a/src/Diff/PropertyPatcher.php +++ b/src/Diff/PropertyPatcher.php @@ -6,7 +6,6 @@ use Wikibase\DataModel\Entity\EntityDocument; use Wikibase\DataModel\Entity\Property; use Wikibase\DataModel\Services\Diff\Internal\FingerprintPatcher; -use Wikibase\DataModel\Services\Diff\Internal\StatementListPatcher; /** * @since 1.0 @@ -62,10 +61,10 @@ private function assertIsProperty( EntityDocument $property ) { private function patchProperty( Property $property, EntityDiff $patch ) { $this->fingerprintPatcher->patchFingerprint( $property->getFingerprint(), $patch ); - $property->setStatements( $this->statementListPatcher->getPatchedStatementList( + $this->statementListPatcher->patchStatementList( $property->getStatements(), $patch->getClaimsDiff() - ) ); + ); } } diff --git a/src/Diff/Internal/StatementListDiffer.php b/src/Diff/StatementListDiffer.php similarity index 90% rename from src/Diff/Internal/StatementListDiffer.php rename to src/Diff/StatementListDiffer.php index 27dbbd15..795d56fb 100644 --- a/src/Diff/Internal/StatementListDiffer.php +++ b/src/Diff/StatementListDiffer.php @@ -1,6 +1,6 @@ diff --git a/src/Diff/Internal/StatementListPatcher.php b/src/Diff/StatementListPatcher.php similarity index 81% rename from src/Diff/Internal/StatementListPatcher.php rename to src/Diff/StatementListPatcher.php index d007a1d6..1d022f53 100644 --- a/src/Diff/Internal/StatementListPatcher.php +++ b/src/Diff/StatementListPatcher.php @@ -1,6 +1,6 @@ @@ -103,19 +97,4 @@ private function changeStatement( StatementList $statements, $oldGuid, Statement } } - /** - * @deprecated since 3.6, use patchStatementList instead - * - * @param StatementList $statements - * @param Diff $patch - * - * @throws InvalidArgumentException - * @return StatementList - */ - public function getPatchedStatementList( StatementList $statements, Diff $patch ) { - $patched = clone $statements; - $this->patchStatementList( $patched, $patch ); - return $patched; - } - } diff --git a/src/Diff/Internal/TermListPatcher.php b/src/Diff/TermListPatcher.php similarity index 95% rename from src/Diff/Internal/TermListPatcher.php rename to src/Diff/TermListPatcher.php index 0e6378b6..5fdfcb18 100644 --- a/src/Diff/Internal/TermListPatcher.php +++ b/src/Diff/TermListPatcher.php @@ -1,6 +1,6 @@ diff --git a/tests/unit/Diff/Internal/StatementListPatcherTest.php b/tests/unit/Diff/StatementListPatcherTest.php similarity index 91% rename from tests/unit/Diff/Internal/StatementListPatcherTest.php rename to tests/unit/Diff/StatementListPatcherTest.php index 6d973304..9be39cf2 100644 --- a/tests/unit/Diff/Internal/StatementListPatcherTest.php +++ b/tests/unit/Diff/StatementListPatcherTest.php @@ -1,13 +1,13 @@ @@ -225,10 +225,10 @@ public function statementOrderProvider() { */ public function testStatementOrder( StatementList $statements, Diff $patch, array $expectedGuids ) { $patcher = new StatementListPatcher(); - $patchedStatements = $patcher->getPatchedStatementList( $statements, $patch ); + $patcher->patchStatementList( $statements, $patch ); $guids = array(); - foreach ( $patchedStatements->toArray() as $statement ) { + foreach ( $statements->toArray() as $statement ) { $guids[] = $statement->getGuid(); } $this->assertSame( $expectedGuids, $guids ); @@ -240,11 +240,14 @@ public function testGivenEmptyDiff_listIsReturnedAsIs() { $this->assertListResultsFromPatch( $statements, $statements, new Diff() ); } - private function assertListResultsFromPatch( StatementList $expected, StatementList $original, Diff $patch ) { + private function assertListResultsFromPatch( + StatementList $expected, + StatementList $statements, + Diff $patch + ) { $patcher = new StatementListPatcher(); - $clone = clone $original; - $this->assertEquals( $expected, $patcher->getPatchedStatementList( $original, $patch ) ); - $this->assertEquals( $clone, $original, 'original must not change' ); + $patcher->patchStatementList( $statements, $patch ); + $this->assertEquals( $expected, $statements ); } public function testFoo() { diff --git a/tests/unit/Diff/Internal/TermListPatcherTest.php b/tests/unit/Diff/TermListPatcherTest.php similarity index 95% rename from tests/unit/Diff/Internal/TermListPatcherTest.php rename to tests/unit/Diff/TermListPatcherTest.php index 505bfbd3..24bf9751 100644 --- a/tests/unit/Diff/Internal/TermListPatcherTest.php +++ b/tests/unit/Diff/TermListPatcherTest.php @@ -1,18 +1,18 @@