AnotherLadsgroup has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/367461 )
Change subject: Do not let Lexeme::setId accept int as Id ...................................................................... Do not let Lexeme::setId accept int as Id Bug: T151577 Change-Id: I3fd1e61bbbcd35cad2a775155f9a9d71b67623e6 --- M src/DataModel/Lexeme.php M tests/phpunit/composer/DataModel/LexemeTest.php 2 files changed, 2 insertions(+), 10 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikibaseLexeme refs/changes/61/367461/1 diff --git a/src/DataModel/Lexeme.php b/src/DataModel/Lexeme.php index 28e44cb..86152d5 100644 --- a/src/DataModel/Lexeme.php +++ b/src/DataModel/Lexeme.php @@ -106,15 +106,13 @@ } /** - * @param LexemeId|int $id + * @param LexemeId $id * * @throws InvalidArgumentException */ public function setId( $id ) { if ( $id instanceof LexemeId ) { $this->id = $id; - } elseif ( is_int( $id ) ) { - $this->id = new LexemeId( 'L' . $id ); } else { throw new InvalidArgumentException( '$id must be an instance of LexemeId or an integer.' diff --git a/tests/phpunit/composer/DataModel/LexemeTest.php b/tests/phpunit/composer/DataModel/LexemeTest.php index 8d0136c..9302a58 100644 --- a/tests/phpunit/composer/DataModel/LexemeTest.php +++ b/tests/phpunit/composer/DataModel/LexemeTest.php @@ -74,13 +74,6 @@ $this->assertSame( $id, $lexeme->getId() ); } - public function testSetNewIdAsInt() { - $lexeme = new Lexeme(); - $lexeme->setId( 1 ); - - $this->assertTrue( $lexeme->getId()->equals( new LexemeId( 'L1' ) ) ); - } - public function testOverrideId() { $lexeme = new Lexeme( new LexemeId( 'L1' ) ); $id = new LexemeId( 'L2' ); @@ -94,6 +87,7 @@ [ null ], [ false ], [ 1.0 ], + [ 1 ], [ 'L1' ], [ new ItemId( 'Q1' ) ], ]; -- To view, visit https://gerrit.wikimedia.org/r/367461 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3fd1e61bbbcd35cad2a775155f9a9d71b67623e6 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/WikibaseLexeme Gerrit-Branch: master Gerrit-Owner: AnotherLadsgroup <ladsgr...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits