Thiemo Kreuz (WMDE) has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/398838 )
Change subject: Rename FormSet::add to set
......................................................................
Rename FormSet::add to set
It's literally a Set. Elements in a Set are, well, set.
Bug: T163724
Change-Id: I433ba6180dc41d3d0d87145c8da935dd22785b0b
---
M src/DataModel/FormSet.php
M src/DataModel/Lexeme.php
M src/DataModel/LexemePatchAccess.php
M src/DataModel/Serialization/LexemeDeserializer.php
M tests/phpunit/composer/DataModel/FormSetTest.php
M tests/phpunit/composer/ErisGenerators/FormSetGenerator.php
6 files changed, 11 insertions(+), 11 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseLexeme
refs/changes/38/398838/1
diff --git a/src/DataModel/FormSet.php b/src/DataModel/FormSet.php
index 055a7a6..c537d28 100644
--- a/src/DataModel/FormSet.php
+++ b/src/DataModel/FormSet.php
@@ -24,7 +24,7 @@
throw new \InvalidArgumentException( '$forms
must be an array of Forms' );
}
- $this->add( $form );
+ $this->set( $form );
}
}
@@ -60,7 +60,7 @@
return max( $numbers );
}
- public function add( Form $form ) {
+ public function set( Form $form ) {
$id = $form->getId()->getSerialization();
$this->forms[$id] = $form;
}
diff --git a/src/DataModel/Lexeme.php b/src/DataModel/Lexeme.php
index b2da84b..e392dad 100644
--- a/src/DataModel/Lexeme.php
+++ b/src/DataModel/Lexeme.php
@@ -341,7 +341,7 @@
$formId = new FormId( $this->id->getSerialization() . '-F' .
$this->nextFormId++ );
$form = new Form( $formId, $representations,
$grammaticalFeatures );
- $this->forms->add( $form );
+ $this->forms->set( $form );
return $form;
}
diff --git a/src/DataModel/LexemePatchAccess.php
b/src/DataModel/LexemePatchAccess.php
index 3608945..bf899c1 100644
--- a/src/DataModel/LexemePatchAccess.php
+++ b/src/DataModel/LexemePatchAccess.php
@@ -44,7 +44,7 @@
throw new InvalidArgumentException( "Cannot add Form
\"$formId\" again" );
}
- $this->forms->add( $form );
+ $this->forms->set( $form );
}
/**
diff --git a/src/DataModel/Serialization/LexemeDeserializer.php
b/src/DataModel/Serialization/LexemeDeserializer.php
index a2cd870..9437496 100644
--- a/src/DataModel/Serialization/LexemeDeserializer.php
+++ b/src/DataModel/Serialization/LexemeDeserializer.php
@@ -144,7 +144,7 @@
if ( array_key_exists( 'forms', $serialization ) ) {
foreach ( $serialization['forms'] as $formSerialization
) {
- $forms->add( $this->deserializeForm(
$formSerialization ) );
+ $forms->set( $this->deserializeForm(
$formSerialization ) );
}
}
diff --git a/tests/phpunit/composer/DataModel/FormSetTest.php
b/tests/phpunit/composer/DataModel/FormSetTest.php
index f4d8453..9abc6d2 100644
--- a/tests/phpunit/composer/DataModel/FormSetTest.php
+++ b/tests/phpunit/composer/DataModel/FormSetTest.php
@@ -62,22 +62,22 @@
$this->assertEquals( 3, $formSet->maxFormIdNumber() );
}
- public function testAddForm_EmptySet_FormIsAdded() {
+ public function testSetForm_EmptySet_FormIsAdded() {
$formSet = new FormSet();
$form = NewForm::havingId( 'F1' )->build();
- $formSet->add( $form );
+ $formSet->set( $form );
$this->assertEquals( [ $form ], $formSet->toArray() );
}
- public function
testAddForm_AddFormWithIdThatAlreadyPresentInTheSet_FormIsReplaced() {
+ public function
testSetForm_SetFormWithIdThatAlreadyPresentInTheSet_FormIsReplaced() {
$builder = NewForm::havingId( 'F1' );
$form1 = $builder->build();
$formSet = new FormSet( [ $form1 ] );
$form2 = $builder->build();
- $formSet->add( $form2 );
+ $formSet->set( $form2 );
$this->assertSame( $form2, $formSet->getById( $form1->getId() )
);
}
@@ -90,7 +90,7 @@
$this->assertEmpty( $formSet->toArray() );
}
- public function
testIndependentlyOnFormAdditionOrder_TwoSetsAreEqualIfTheyHaveTheSameForms() {
+ public function
testIndependentlyOnFormSettingOrder_TwoSetsAreEqualIfTheyHaveTheSameForms() {
$form1 = NewForm::havingId( 'F1' )->build();
$form2 = NewForm::havingId( 'F2' )->build();
diff --git a/tests/phpunit/composer/ErisGenerators/FormSetGenerator.php
b/tests/phpunit/composer/ErisGenerators/FormSetGenerator.php
index e637ab5..9b1405c 100644
--- a/tests/phpunit/composer/ErisGenerators/FormSetGenerator.php
+++ b/tests/phpunit/composer/ErisGenerators/FormSetGenerator.php
@@ -39,7 +39,7 @@
continue;
}
- $result->add( $form );
+ $result->set( $form );
}
return GeneratedValueSingle::fromJustValue( $result, 'FormSet'
);
--
To view, visit https://gerrit.wikimedia.org/r/398838
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I433ba6180dc41d3d0d87145c8da935dd22785b0b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseLexeme
Gerrit-Branch: master
Gerrit-Owner: Thiemo Kreuz (WMDE) <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits