Thiemo Mättig (WMDE) has uploaded a new change for review.

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

Change subject: Make use of EntityId::__toString for readability
......................................................................

Make use of EntityId::__toString for readability

I believe this increases the readability of the code. EntityId does have
a well defined __toString method. Technically, __toString can change because
it's made for debugging and messages presented to the user. That's exactly
what I'm using it for in this patch. This and in test setups/mocks/dummies.

Practically, Entity::__toString is extremely unlikely to change. There is
nothing else in this object. But even with such a guarantee, __toString
should not be used in production code to form identifiers and such.

Change-Id: I8d309410109e2e3149e6d76f1b760eaa06190cb7
---
M client/includes/LangLinkHandler.php
M client/includes/ParserOutput/ClientParserOutputDataUpdater.php
M 
client/tests/phpunit/includes/DataAccess/WikibaseDataAccessTestItemSetUpHelper.php
M client/tests/phpunit/includes/specials/SpecialPagesWithBadgesTest.php
M lib/includes/store/sql/TermSqlIndex.php
M lib/tests/phpunit/Interactors/TermIndexSearchInteractorTest.php
M lib/tests/phpunit/MockRepository.php
M lib/tests/phpunit/formatters/EntityIdLinkFormatterTest.php
M lib/tests/phpunit/formatters/EntityIdPlainLinkFormatterTest.php
M lib/tests/phpunit/formatters/EntityIdTitleFormatterTest.php
M lib/tests/phpunit/formatters/VocabularyUriFormatterTest.php
M lib/tests/phpunit/formatters/WikibaseValueFormatterBuildersTest.php
M lib/tests/phpunit/store/LanguageFallbackLabelDescriptionLookupFactoryTest.php
M lib/tests/phpunit/store/TermIndexTest.php
M repo/includes/Dumpers/JsonDumpGenerator.php
M repo/includes/Dumpers/RdfDumpGenerator.php
M repo/includes/EditEntity.php
M repo/includes/PropertyDataTypeChanger.php
M repo/includes/UpdateRepo/UpdateRepoJob.php
M repo/includes/api/CreateClaim.php
M repo/includes/api/EntityLoadingHelper.php
M repo/includes/api/SetQualifier.php
M repo/includes/store/sql/PropertyInfoTableBuilder.php
M repo/includes/store/sql/WikiPageEntityStore.php
M repo/tests/phpunit/includes/Dumpers/JsonDumpGeneratorTest.php
M repo/tests/phpunit/includes/Hooks/LinkBeginHookHandlerTest.php
M repo/tests/phpunit/includes/Interactors/ItemMergeInteractorTest.php
M repo/tests/phpunit/includes/Interactors/RedirectCreationInteractorTest.php
M repo/tests/phpunit/includes/api/ResultBuilderTest.php
M repo/tests/phpunit/includes/specials/SpecialListPropertiesTest.php
M repo/tests/phpunit/maintenance/dumpJsonTest.php
31 files changed, 51 insertions(+), 63 deletions(-)


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

diff --git a/client/includes/LangLinkHandler.php 
b/client/includes/LangLinkHandler.php
index ca4112d..a696e70 100644
--- a/client/includes/LangLinkHandler.php
+++ b/client/includes/LangLinkHandler.php
@@ -115,8 +115,7 @@
                                $links = iterator_to_array( 
$item->getSiteLinkList() );
                                $links = $this->indexLinksBySiteId( $links );
                        } else {
-                               wfWarn( __METHOD__ . ": Could not load item " . 
$itemId->getSerialization()
-                                       . " for " . $title->getFullText() );
+                               wfWarn( __METHOD__ . ": Could not load item 
$itemId for " . $title->getFullText() );
                        }
                }
 
diff --git a/client/includes/ParserOutput/ClientParserOutputDataUpdater.php 
b/client/includes/ParserOutput/ClientParserOutputDataUpdater.php
index e9fb5e2..b4a7d60 100644
--- a/client/includes/ParserOutput/ClientParserOutputDataUpdater.php
+++ b/client/includes/ParserOutput/ClientParserOutputDataUpdater.php
@@ -130,10 +130,8 @@
 
                if ( !$item || !$item->getSiteLinkList()->hasLinkWithSiteId( 
$this->siteId ) ) {
                        // Probably some sort of race condition or data 
inconsistency, better log a warning
-                       wfLogWarning(
-                               'According to a SiteLinkLookup ' . 
$itemId->getSerialization() .
-                               ' is linked to ' . $this->siteId . ' while it 
is not or it does not exist.'
-                       );
+                       wfLogWarning( "According to a SiteLinkLookup $itemId is 
linked to " . $this->siteId
+                               . ' while it is not or it does not exist.' );
 
                        return;
                }
diff --git 
a/client/tests/phpunit/includes/DataAccess/WikibaseDataAccessTestItemSetUpHelper.php
 
b/client/tests/phpunit/includes/DataAccess/WikibaseDataAccessTestItemSetUpHelper.php
index ac147b3..a7a77db 100644
--- 
a/client/tests/phpunit/includes/DataAccess/WikibaseDataAccessTestItemSetUpHelper.php
+++ 
b/client/tests/phpunit/includes/DataAccess/WikibaseDataAccessTestItemSetUpHelper.php
@@ -147,7 +147,7 @@
         */
        private function createTestItem( ItemId $id, array $labels, array 
$statements = null, array $siteLinks = null ) {
                $item = new Item( $id );
-               $item->getFingerprint()->setDescription( 'de', 'Description of 
' . $id->getSerialization() );
+               $item->getFingerprint()->setDescription( 'de', "Description of 
$id" );
 
                foreach ( $labels as $lang => $label ) {
                        $item->setLabel( $lang, $label );
diff --git 
a/client/tests/phpunit/includes/specials/SpecialPagesWithBadgesTest.php 
b/client/tests/phpunit/includes/specials/SpecialPagesWithBadgesTest.php
index 3e17659..67ec877 100644
--- a/client/tests/phpunit/includes/specials/SpecialPagesWithBadgesTest.php
+++ b/client/tests/phpunit/includes/specials/SpecialPagesWithBadgesTest.php
@@ -31,7 +31,7 @@
                $labelLookup->expects( $this->any() )
                        ->method( 'getLabel' )
                        ->will( $this->returnCallback( function( ItemId $id ) {
-                               return new Term( 'en', 'Label of ' . 
$id->getSerialization() );
+                               return new Term( 'en', "Label of $id" );
                        } ) );
 
                return $labelLookup;
diff --git a/lib/includes/store/sql/TermSqlIndex.php 
b/lib/includes/store/sql/TermSqlIndex.php
index a3a0ade..97b677e 100644
--- a/lib/includes/store/sql/TermSqlIndex.php
+++ b/lib/includes/store/sql/TermSqlIndex.php
@@ -263,7 +263,7 @@
 
                $uniqueKeyFields = array( 'term_entity_type', 'term_entity_id', 
'term_language', 'term_type', 'term_text' );
 
-               wfDebugLog( __CLASS__, __FUNCTION__ . ': deleting terms for ' . 
$entityId->getSerialization() );
+               wfDebugLog( __CLASS__, __FUNCTION__ . ": deleting terms for 
$entityId" );
 
                $success = true;
                foreach ( $terms as $term ) {
diff --git a/lib/tests/phpunit/Interactors/TermIndexSearchInteractorTest.php 
b/lib/tests/phpunit/Interactors/TermIndexSearchInteractorTest.php
index ea06766..9f26d5d 100644
--- a/lib/tests/phpunit/Interactors/TermIndexSearchInteractorTest.php
+++ b/lib/tests/phpunit/Interactors/TermIndexSearchInteractorTest.php
@@ -86,7 +86,7 @@
                        ->will( $this->returnCallback( function( EntityId 
$entityId, $languageCodes ) {
                                $labels = array();
                                foreach ( $languageCodes as $languageCode ) {
-                                       $labels[$languageCode] = 'label-' . 
$languageCode . '-' . $entityId->getSerialization();
+                                       $labels[$languageCode] = 
"label-$languageCode-$entityId";
                                }
                                return $labels;
                        }
@@ -96,8 +96,7 @@
                        ->will( $this->returnCallback( function( EntityId 
$entityId, $languageCodes ) {
                                $descriptions = array();
                                foreach ( $languageCodes as $languageCode ) {
-                                       $descriptions[$languageCode] =
-                                               'description-' . $languageCode 
. '-' . $entityId->getSerialization();
+                                       $descriptions[$languageCode] = 
"description-$languageCode-$entityId";
                                }
                                return $descriptions;
                        }
@@ -106,7 +105,7 @@
        }
 
        private function getExpectedDisplayTerm( EntityId $entityId, $termType 
) {
-               return new TermFallback( 'pt', $termType . '-pt-' . 
$entityId->getSerialization(), 'pt', 'pt' );
+               return new TermFallback( 'pt', "$termType-pt-$entityId", 'pt', 
'pt' );
        }
 
        /**
diff --git a/lib/tests/phpunit/MockRepository.php 
b/lib/tests/phpunit/MockRepository.php
index 4e35177..2b648d6 100644
--- a/lib/tests/phpunit/MockRepository.php
+++ b/lib/tests/phpunit/MockRepository.php
@@ -504,7 +504,7 @@
 
                if ( $baseRevisionId !== false && !$this->hasEntity( $entityId 
) ) {
                        //TODO: find correct message key to use with status??
-                       throw new StorageException( 'No base revision found for 
' . $entityId->getSerialization() );
+                       throw new StorageException( "No base revision found for 
$entityId" );
                }
 
                if ( $baseRevisionId !== false && $this->getEntityRevision( 
$entityId )->getRevisionId() !== $baseRevisionId ) {
diff --git a/lib/tests/phpunit/formatters/EntityIdLinkFormatterTest.php 
b/lib/tests/phpunit/formatters/EntityIdLinkFormatterTest.php
index d7084b9..5c41e03 100644
--- a/lib/tests/phpunit/formatters/EntityIdLinkFormatterTest.php
+++ b/lib/tests/phpunit/formatters/EntityIdLinkFormatterTest.php
@@ -50,9 +50,9 @@
        public function getTitleForId( EntityId $entityId ) {
                switch ( $entityId->getEntityType() ) {
                        case Item::ENTITY_TYPE:
-                               return Title::makeTitle( NS_MAIN, 'ITEM-TEST--' 
. $entityId->getSerialization() );
+                               return Title::makeTitle( NS_MAIN, 
"ITEM-TEST--$entityId" );
                        case Property::ENTITY_TYPE:
-                               return Title::makeTitle( NS_MAIN, 
'PROPERTY-TEST--' . $entityId->getSerialization() );
+                               return Title::makeTitle( NS_MAIN, 
"PROPERTY-TEST--$entityId" );
                        default:
                                throw new LogicException( "oops!" );
                }
diff --git a/lib/tests/phpunit/formatters/EntityIdPlainLinkFormatterTest.php 
b/lib/tests/phpunit/formatters/EntityIdPlainLinkFormatterTest.php
index 04bc730..1c072d2 100644
--- a/lib/tests/phpunit/formatters/EntityIdPlainLinkFormatterTest.php
+++ b/lib/tests/phpunit/formatters/EntityIdPlainLinkFormatterTest.php
@@ -51,9 +51,9 @@
        public function getTitleForId( EntityId $entityId ) {
                switch ( $entityId->getEntityType() ) {
                        case Item::ENTITY_TYPE:
-                               return Title::makeTitle( NS_MAIN, 'ITEM-TEST--' 
. $entityId->getSerialization() );
+                               return Title::makeTitle( NS_MAIN, 
"ITEM-TEST--$entityId" );
                        case Property::ENTITY_TYPE:
-                               return Title::makeTitle( NS_MAIN, 
'PROPERTY-TEST--' . $entityId->getSerialization() );
+                               return Title::makeTitle( NS_MAIN, 
"PROPERTY-TEST--$entityId" );
                        default:
                                throw new LogicException( "oops!" );
                }
diff --git a/lib/tests/phpunit/formatters/EntityIdTitleFormatterTest.php 
b/lib/tests/phpunit/formatters/EntityIdTitleFormatterTest.php
index c4f8ca9..befa8c1 100644
--- a/lib/tests/phpunit/formatters/EntityIdTitleFormatterTest.php
+++ b/lib/tests/phpunit/formatters/EntityIdTitleFormatterTest.php
@@ -52,9 +52,9 @@
        public function getTitleForId( EntityId $entityId ) {
                switch ( $entityId->getEntityType() ) {
                        case Item::ENTITY_TYPE:
-                               return Title::makeTitle( NS_MAIN, 'ITEM-TEST--' 
. $entityId->getSerialization() );
+                               return Title::makeTitle( NS_MAIN, 
"ITEM-TEST--$entityId" );
                        case Property::ENTITY_TYPE:
-                               return Title::makeTitle( NS_MAIN, 
'PROPERTY-TEST--' . $entityId->getSerialization() );
+                               return Title::makeTitle( NS_MAIN, 
"PROPERTY-TEST--$entityId" );
                        default:
                                throw new LogicException( "oops!" );
                }
diff --git a/lib/tests/phpunit/formatters/VocabularyUriFormatterTest.php 
b/lib/tests/phpunit/formatters/VocabularyUriFormatterTest.php
index 1f892c6..a5a4ee3 100644
--- a/lib/tests/phpunit/formatters/VocabularyUriFormatterTest.php
+++ b/lib/tests/phpunit/formatters/VocabularyUriFormatterTest.php
@@ -46,7 +46,7 @@
                                if ( $id->getSerialization() === 'Q112233' ) {
                                        throw new 
LabelDescriptionLookupException( $id, 'No such label!' );
                                }
-                               return new Term( 'en', 'LABEL:' . 
$id->getSerialization() );
+                               return new Term( 'en', "LABEL:$id" );
                        } ) );
 
                $idParser = new BasicEntityIdParser();
diff --git 
a/lib/tests/phpunit/formatters/WikibaseValueFormatterBuildersTest.php 
b/lib/tests/phpunit/formatters/WikibaseValueFormatterBuildersTest.php
index 202acb3..a78b53b 100644
--- a/lib/tests/phpunit/formatters/WikibaseValueFormatterBuildersTest.php
+++ b/lib/tests/phpunit/formatters/WikibaseValueFormatterBuildersTest.php
@@ -60,9 +60,9 @@
                        ->will( $this->returnCallback( function ( EntityId $id, 
$language ) {
                                switch ( $language ) {
                                        case 'de':
-                                               return 'Name für ' . 
$id->getSerialization();
+                                               return "Name für $id";
                                        default:
-                                               return 'Label for ' . 
$id->getSerialization();
+                                               return "Label for $id";
                                }
                        } ) );
 
@@ -70,8 +70,8 @@
                        ->method( 'getLabels' )
                        ->will( $this->returnCallback( function( EntityId $id ) 
{
                                return array(
-                                       'de' => 'Name für ' . 
$id->getSerialization(),
-                                       'en' => 'Label for ' . 
$id->getSerialization(),
+                                       'de' => "Name für $id",
+                                       'en' => "Label for $id",
                                );
                        } ) );
 
diff --git 
a/lib/tests/phpunit/store/LanguageFallbackLabelDescriptionLookupFactoryTest.php 
b/lib/tests/phpunit/store/LanguageFallbackLabelDescriptionLookupFactoryTest.php
index 4202673..65b1145 100644
--- 
a/lib/tests/phpunit/store/LanguageFallbackLabelDescriptionLookupFactoryTest.php
+++ 
b/lib/tests/phpunit/store/LanguageFallbackLabelDescriptionLookupFactoryTest.php
@@ -25,13 +25,13 @@
                $termLookup->expects( $this->any() )
                        ->method( 'getLabel' )
                        ->will( $this->returnCallback( function( EntityId $id ) 
{
-                               return $id->getSerialization() . '\'s label';
+                               return "$id's label";
                        } ) );
 
                $termLookup->expects( $this->any() )
                        ->method( 'getLabels' )
                        ->will( $this->returnCallback( function( EntityId $id ) 
{
-                               return array( 'en' => $id->getSerialization() . 
'\'s label' );
+                               return array( 'en' => "$id's label" );
                        } ) );
 
                return $termLookup;
diff --git a/lib/tests/phpunit/store/TermIndexTest.php 
b/lib/tests/phpunit/store/TermIndexTest.php
index 9592e74..69343bf 100644
--- a/lib/tests/phpunit/store/TermIndexTest.php
+++ b/lib/tests/phpunit/store/TermIndexTest.php
@@ -366,7 +366,7 @@
                $matchedTerms = $lookup->getMatchingTerms( array( $abc ), 
array( TermIndexEntry::TYPE_LABEL ), Item::ENTITY_TYPE );
                foreach ( $matchedTerms as $matchedTerm ) {
                        if ( $matchedTerm->getEntityId() === $id ) {
-                               $this->fail( 'Failed to delete term or entity: 
' . $id->getSerialization() );
+                               $this->fail( "Failed to delete term or entity: 
$id" );
                        }
                }
        }
diff --git a/repo/includes/Dumpers/JsonDumpGenerator.php 
b/repo/includes/Dumpers/JsonDumpGenerator.php
index d15e7de..d80e9dc 100644
--- a/repo/includes/Dumpers/JsonDumpGenerator.php
+++ b/repo/includes/Dumpers/JsonDumpGenerator.php
@@ -134,10 +134,10 @@
                        $entity = $this->entityLookup->getEntity( $entityId );
 
                        if ( !$entity ) {
-                               throw new EntityLookupException( $entityId, 
'Entity not found: ' . $entityId->getSerialization() );
+                               throw new EntityLookupException( $entityId, 
"Entity not found: $entityId" );
                        }
                } catch ( MWContentSerializationException $ex ) {
-                       throw new StorageException( 'Deserialization error for 
' . $entityId->getSerialization() );
+                       throw new StorageException( "Deserialization error for 
$entityId" );
                } catch ( RevisionedUnresolvedRedirectException $e ) {
                        // Redirects aren't supposed to be in the JSON dumps
                        return null;
diff --git a/repo/includes/Dumpers/RdfDumpGenerator.php 
b/repo/includes/Dumpers/RdfDumpGenerator.php
index 4c16b2a..bf7270d 100644
--- a/repo/includes/Dumpers/RdfDumpGenerator.php
+++ b/repo/includes/Dumpers/RdfDumpGenerator.php
@@ -101,7 +101,7 @@
                        $entityRevision = 
$this->entityRevisionLookup->getEntityRevision( $entityId );
 
                        if ( !$entityRevision ) {
-                               throw new EntityLookupException( $entityId, 
'Entity not found: ' . $entityId->getSerialization() );
+                               throw new EntityLookupException( $entityId, 
"Entity not found: $entityId" );
                        }
 
                        $this->rdfBuilder->addEntityRevisionInfo(
@@ -115,7 +115,7 @@
                        );
 
                } catch ( MWContentSerializationException $ex ) {
-                       throw new StorageException( 'Deserialization error for 
' . $entityId->getSerialization() );
+                       throw new StorageException( "Deserialization error for 
$entityId" );
                } catch ( RevisionedUnresolvedRedirectException $e ) {
                        if ( $e->getRevisionId() > 0 ) {
                                $this->rdfBuilder->addEntityRevisionInfo(
diff --git a/repo/includes/EditEntity.php b/repo/includes/EditEntity.php
index 30d2980..66d1362 100644
--- a/repo/includes/EditEntity.php
+++ b/repo/includes/EditEntity.php
@@ -348,8 +348,7 @@
                                $this->baseRev = 
$this->entityRevisionLookup->getEntityRevision( $id, $baseRevId );
 
                                if ( $this->baseRev === null ) {
-                                       throw new MWException( 'Base revision 
ID not found: rev ' . $baseRevId
-                                               . ' of ' . 
$id->getSerialization() );
+                                       throw new MWException( "Base revision 
ID not found: rev $baseRevId of $id" );
                                }
                        }
                }
diff --git a/repo/includes/PropertyDataTypeChanger.php 
b/repo/includes/PropertyDataTypeChanger.php
index db57074..8ebf9af 100644
--- a/repo/includes/PropertyDataTypeChanger.php
+++ b/repo/includes/PropertyDataTypeChanger.php
@@ -67,7 +67,7 @@
                );
 
                if ( $entityRevision === null ) {
-                       throw new StorageException( "Could not load property: " 
. $propertyId->getSerialization() );
+                       throw new StorageException( "Could not load property: 
$propertyId" );
                }
 
                /* @var $property Property */
diff --git a/repo/includes/UpdateRepo/UpdateRepoJob.php 
b/repo/includes/UpdateRepo/UpdateRepoJob.php
index 229fa2d..d0b3068 100644
--- a/repo/includes/UpdateRepo/UpdateRepoJob.php
+++ b/repo/includes/UpdateRepo/UpdateRepoJob.php
@@ -124,7 +124,7 @@
                } catch ( StorageException $ex ) {
                        wfDebugLog(
                                'UpdateRepo',
-                               __FUNCTION__ . ": EntityRevision couldn't be 
loaded for " . $itemId->getSerialization() . ": " . $ex->getMessage()
+                               __FUNCTION__ . ": EntityRevision couldn't be 
loaded for $itemId: " . $ex->getMessage()
                        );
 
                        return null;
@@ -134,10 +134,7 @@
                        return $entityRevision->getEntity();
                }
 
-               wfDebugLog(
-                       'UpdateRepo',
-                       __FUNCTION__ . ": EntityRevision not found for " . 
$itemId->getSerialization()
-               );
+               wfDebugLog( 'UpdateRepo', __FUNCTION__ . ": EntityRevision not 
found for $itemId" );
                return null;
        }
 
@@ -165,8 +162,8 @@
                );
 
                if ( !$status->isOK() ) {
-                       wfDebugLog( 'UpdateRepo', __FUNCTION__ . ': attemptSave 
for '
-                               . $itemId->getSerialization() . ' failed: ' . 
$status->getMessage()->text() );
+                       wfDebugLog( 'UpdateRepo', __FUNCTION__ . ": attemptSave 
for $itemId failed: "
+                               . $status->getMessage()->text() );
                }
 
                return $status->isOK();
diff --git a/repo/includes/api/CreateClaim.php 
b/repo/includes/api/CreateClaim.php
index 5a77d38..dbdfe9c 100644
--- a/repo/includes/api/CreateClaim.php
+++ b/repo/includes/api/CreateClaim.php
@@ -66,7 +66,7 @@
                $propertyId = $this->modificationHelper->getEntityIdFromString( 
$params['property'] );
                if ( !( $propertyId instanceof PropertyId ) ) {
                        $this->errorReporter->dieError(
-                               $propertyId->getSerialization() . ' does not 
appear to be a property ID',
+                               "$propertyId does not appear to be a property 
ID",
                                'param-illegal'
                        );
                }
diff --git a/repo/includes/api/EntityLoadingHelper.php 
b/repo/includes/api/EntityLoadingHelper.php
index 51a3cda..6bf7588 100644
--- a/repo/includes/api/EntityLoadingHelper.php
+++ b/repo/includes/api/EntityLoadingHelper.php
@@ -62,8 +62,9 @@
 
                        if ( !$revision ) {
                                $this->errorReporter->dieError(
-                                       'Entity ' . 
$entityId->getSerialization() . ' not found',
-                                       'cant-load-entity-content' );
+                                       "Entity $entityId not found",
+                                       'cant-load-entity-content'
+                               );
                        }
 
                        return $revision;
diff --git a/repo/includes/api/SetQualifier.php 
b/repo/includes/api/SetQualifier.php
index d735c3d..8059692 100644
--- a/repo/includes/api/SetQualifier.php
+++ b/repo/includes/api/SetQualifier.php
@@ -138,7 +138,7 @@
                $propertyId = $this->modificationHelper->getEntityIdFromString( 
$params['property'] );
                if ( !( $propertyId instanceof PropertyId ) ) {
                        $this->errorReporter->dieError(
-                               $propertyId->getSerialization() . ' does not 
appear to be a property ID',
+                               "$propertyId does not appear to be a property 
ID",
                                'param-illegal'
                        );
                }
diff --git a/repo/includes/store/sql/PropertyInfoTableBuilder.php 
b/repo/includes/store/sql/PropertyInfoTableBuilder.php
index cf623e2..52a34f3 100644
--- a/repo/includes/store/sql/PropertyInfoTableBuilder.php
+++ b/repo/includes/store/sql/PropertyInfoTableBuilder.php
@@ -247,9 +247,7 @@
                $property = $this->entityLookup->getEntity( $id );
 
                if ( !( $property instanceof Property ) ) {
-                       throw new RuntimeException(
-                               'EntityLookup did not return a Property for id 
' . $id->getSerialization()
-                       );
+                       throw new RuntimeException( "EntityLookup did not 
return a Property for id $id" );
                }
 
                $info = $this->propertyInfoBuilder->buildPropertyInfo( 
$property );
diff --git a/repo/includes/store/sql/WikiPageEntityStore.php 
b/repo/includes/store/sql/WikiPageEntityStore.php
index 746f024..86cc604 100644
--- a/repo/includes/store/sql/WikiPageEntityStore.php
+++ b/repo/includes/store/sql/WikiPageEntityStore.php
@@ -264,7 +264,7 @@
                $ok = $page->doDeleteArticle( $reason, false, 0, true, $error, 
$user );
 
                if ( !$ok ) {
-                       throw new StorageException( 'Faield to delete ' . 
$entityId->getSerialization(). ': ' . $error );
+                       throw new StorageException( "Failed to delete 
$entityId: $error" );
                }
 
                $this->dispatcher->dispatch( 'entityDeleted', $entityId );
diff --git a/repo/tests/phpunit/includes/Dumpers/JsonDumpGeneratorTest.php 
b/repo/tests/phpunit/includes/Dumpers/JsonDumpGeneratorTest.php
index 0580d69..8bc9818 100644
--- a/repo/tests/phpunit/includes/Dumpers/JsonDumpGeneratorTest.php
+++ b/repo/tests/phpunit/includes/Dumpers/JsonDumpGeneratorTest.php
@@ -95,7 +95,7 @@
                        throw new InvalidArgumentException( 'Unsupported entity 
type ' . $id->getEntityType() );
                }
 
-               $entity->setLabel( 'en', 'label:' . $id->getSerialization() );
+               $entity->setLabel( 'en', "label:$id" );
 
                return $entity;
        }
@@ -329,10 +329,7 @@
                $deserializer = 
$this->deserializerFactory->newEntityDeserializer();
                $actualEntity = $deserializer->deserialize( $data );
 
-               $this->assertTrue(
-                       $expectedEntity->equals( $actualEntity ),
-                       'Round trip failed for ' . $id->getSerialization()
-               );
+               $this->assertTrue( $expectedEntity->equals( $actualEntity ), 
"Round trip failed for $id" );
        }
 
        public function typeFilterProvider() {
diff --git a/repo/tests/phpunit/includes/Hooks/LinkBeginHookHandlerTest.php 
b/repo/tests/phpunit/includes/Hooks/LinkBeginHookHandlerTest.php
index 4940410..fa84aa9 100644
--- a/repo/tests/phpunit/includes/Hooks/LinkBeginHookHandlerTest.php
+++ b/repo/tests/phpunit/includes/Hooks/LinkBeginHookHandlerTest.php
@@ -261,7 +261,7 @@
                                        return array();
                                }
 
-                               throw new StorageException( 'No such entity: ' 
. $id->getSerialization() );
+                               throw new StorageException( "No such entity: 
$id" );
                        } ) );
 
                $termLookup->expects( $this->any() )
@@ -275,7 +275,7 @@
                                        return array();
                                }
 
-                               throw new StorageException( 'No such entity: ' 
. $id->getSerialization() );
+                               throw new StorageException( "No such entity: 
$id" );
                        } ) );
 
                return $termLookup;
diff --git 
a/repo/tests/phpunit/includes/Interactors/ItemMergeInteractorTest.php 
b/repo/tests/phpunit/includes/Interactors/ItemMergeInteractorTest.php
index 7100365..eba3ee9 100644
--- a/repo/tests/phpunit/includes/Interactors/ItemMergeInteractorTest.php
+++ b/repo/tests/phpunit/includes/Interactors/ItemMergeInteractorTest.php
@@ -308,11 +308,11 @@
                );
        }
 
-       private function assertRedirectWorks( $expectedFrom, $fromId, $toId ) {
+       private function assertRedirectWorks( $expectedFrom, ItemId $fromId, 
ItemId $toId ) {
                if ( empty( $expectedFrom ) ) {
                        try {
                                $this->testHelper->getEntity( $fromId );
-                               $this->fail( 'getEntity( ' . 
$fromId->getSerialization() . ' ) did not throw an UnresolvedRedirectException' 
);
+                               $this->fail( "getEntity( $fromId ) did not 
throw an UnresolvedRedirectException" );
                        } catch ( RevisionedUnresolvedRedirectException $ex ) {
                                $this->assertEquals( $toId->getSerialization(), 
$ex->getRedirectTargetId()->getSerialization() );
                        }
diff --git 
a/repo/tests/phpunit/includes/Interactors/RedirectCreationInteractorTest.php 
b/repo/tests/phpunit/includes/Interactors/RedirectCreationInteractorTest.php
index fa886b0..5132950 100644
--- a/repo/tests/phpunit/includes/Interactors/RedirectCreationInteractorTest.php
+++ b/repo/tests/phpunit/includes/Interactors/RedirectCreationInteractorTest.php
@@ -164,7 +164,7 @@
 
                try {
                        $this->mockRepository->getEntity( $fromId );
-                       $this->fail( 'getEntity( ' . 
$fromId->getSerialization() . ' ) did not throw an UnresolvedRedirectException' 
);
+                       $this->fail( "getEntity( $fromId ) did not throw an 
UnresolvedRedirectException" );
                } catch ( RevisionedUnresolvedRedirectException $ex ) {
                        $this->assertEquals( $toId->getSerialization(), 
$ex->getRedirectTargetId()->getSerialization() );
                }
diff --git a/repo/tests/phpunit/includes/api/ResultBuilderTest.php 
b/repo/tests/phpunit/includes/api/ResultBuilderTest.php
index 6e60a59..d81b022 100644
--- a/repo/tests/phpunit/includes/api/ResultBuilderTest.php
+++ b/repo/tests/phpunit/includes/api/ResultBuilderTest.php
@@ -67,7 +67,7 @@
                $mockPropertyDataTypeLookup->expects( $this->any() )
                        ->method( 'getDataTypeIdForProperty' )
                        ->will( $this->returnCallback( function( PropertyId $id 
) {
-                               return 'DtIdFor_' . $id->getSerialization();
+                               return "DtIdFor_$id";
                        } ) );
 
                $serializerFactory = new SerializerFactory(
diff --git a/repo/tests/phpunit/includes/specials/SpecialListPropertiesTest.php 
b/repo/tests/phpunit/includes/specials/SpecialListPropertiesTest.php
index 5b2399d..c4b2880 100644
--- a/repo/tests/phpunit/includes/specials/SpecialListPropertiesTest.php
+++ b/repo/tests/phpunit/includes/specials/SpecialListPropertiesTest.php
@@ -75,7 +75,7 @@
                $lookup->expects( $this->any() )
                        ->method( 'getLabels' )
                        ->will( $this->returnCallback( function( PropertyId $id 
) {
-                               return array( 'en' => 'Property with label ' . 
$id->getSerialization() );
+                               return array( 'en' => "Property with label $id" 
);
                        } ) );
                return $lookup;
        }
diff --git a/repo/tests/phpunit/maintenance/dumpJsonTest.php 
b/repo/tests/phpunit/maintenance/dumpJsonTest.php
index 9a21491..8df5f1d 100644
--- a/repo/tests/phpunit/maintenance/dumpJsonTest.php
+++ b/repo/tests/phpunit/maintenance/dumpJsonTest.php
@@ -161,7 +161,7 @@
                                if ( $id->getSerialization() === 'P999' ) {
                                        throw new 
PropertyDataTypeLookupException( $id );
                                }
-                               return 'DtIdFor_' . $id->getSerialization();
+                               return "DtIdFor_$id";
                        } ) );
                return $mockDataTypeLookup;
        }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8d309410109e2e3149e6d76f1b760eaa06190cb7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>

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

Reply via email to