jenkins-bot has submitted this change and it was merged.
Change subject: Use short variable name $id in very short scopes
......................................................................
Use short variable name $id in very short scopes
Uncle Bob says: "short scope, short variable names".
Change-Id: I370a60453f2a6c4f525c25164f4b608f0f66b369
---
M client/includes/Usage/Sql/EntityUsageTable.php
M client/includes/api/PageTerms.php
M
client/tests/phpunit/includes/DataAccess/Scribunto/ScribuntoLuaWikibaseInProcessEntityCacheTest.php
M client/tests/phpunit/includes/specials/SpecialPagesWithBadgesTest.php
M lib/tests/phpunit/formatters/EntityIdHtmlLinkFormatterTest.php
M lib/tests/phpunit/formatters/WikibaseValueFormatterBuildersTest.php
M lib/tests/phpunit/store/LanguageFallbackLabelDescriptionLookupFactoryTest.php
M repo/tests/phpunit/includes/IO/EntityIdReaderTest.php
M repo/tests/phpunit/includes/ItemDisambiguationTest.php
M repo/tests/phpunit/includes/api/ResultBuilderTest.php
M repo/tests/phpunit/includes/specials/SpecialGoToLinkedPageTest.php
M repo/tests/phpunit/includes/specials/SpecialListPropertiesTest.php
M repo/tests/phpunit/includes/store/sql/EntityPerPageIdPagerTest.php
M repo/tests/phpunit/includes/store/sql/WikiPageEntityRedirectLookupTest.php
M repo/tests/phpunit/maintenance/dumpJsonTest.php
M repo/tests/phpunit/maintenance/dumpRdfTest.php
16 files changed, 43 insertions(+), 47 deletions(-)
Approvals:
Hoo man: Looks good to me, approved
jenkins-bot: Verified
diff --git a/client/includes/Usage/Sql/EntityUsageTable.php
b/client/includes/Usage/Sql/EntityUsageTable.php
index 8294f75..433eef3 100644
--- a/client/includes/Usage/Sql/EntityUsageTable.php
+++ b/client/includes/Usage/Sql/EntityUsageTable.php
@@ -270,8 +270,8 @@
* @return string[]
*/
private function getEntityIdStrings( array $entityIds ) {
- return array_map( function( EntityId $entityId ) {
- return $entityId->getSerialization();
+ return array_map( function( EntityId $id ) {
+ return $id->getSerialization();
}, $entityIds );
}
diff --git a/client/includes/api/PageTerms.php
b/client/includes/api/PageTerms.php
index e8c852b..43f50a2 100644
--- a/client/includes/api/PageTerms.php
+++ b/client/includes/api/PageTerms.php
@@ -146,8 +146,8 @@
*/
private function getEntityToPageMap( array $entityIds ) {
$entityIdsStrings = array_map(
- function ( EntityId $entityId ) {
- return $entityId->getSerialization();
+ function( EntityId $id ) {
+ return $id->getSerialization();
},
$entityIds
);
diff --git
a/client/tests/phpunit/includes/DataAccess/Scribunto/ScribuntoLuaWikibaseInProcessEntityCacheTest.php
b/client/tests/phpunit/includes/DataAccess/Scribunto/ScribuntoLuaWikibaseInProcessEntityCacheTest.php
index 6182033..a21150d 100644
---
a/client/tests/phpunit/includes/DataAccess/Scribunto/ScribuntoLuaWikibaseInProcessEntityCacheTest.php
+++
b/client/tests/phpunit/includes/DataAccess/Scribunto/ScribuntoLuaWikibaseInProcessEntityCacheTest.php
@@ -39,8 +39,8 @@
$entityLookup->expects( $phpunit->exactly( 20 ) )
->method( 'getEntity' )
->will( $phpunit->returnCallback(
- function( ItemId $itemId ) {
- return new Item( $itemId );
+ function( ItemId $id ) {
+ return new Item( $id );
}
) );
diff --git
a/client/tests/phpunit/includes/specials/SpecialPagesWithBadgesTest.php
b/client/tests/phpunit/includes/specials/SpecialPagesWithBadgesTest.php
index fa9293a..00514ea 100644
--- a/client/tests/phpunit/includes/specials/SpecialPagesWithBadgesTest.php
+++ b/client/tests/phpunit/includes/specials/SpecialPagesWithBadgesTest.php
@@ -31,8 +31,8 @@
$labelLookup = $this->getMock(
'Wikibase\DataModel\Services\Lookup\LabelDescriptionLookup' );
$labelLookup->expects( $this->any() )
->method( 'getLabel' )
- ->will( $this->returnCallback( function( ItemId $itemId
) {
- return new Term( 'en', 'Label of ' .
$itemId->getSerialization() );
+ ->will( $this->returnCallback( function( ItemId $id ) {
+ return new Term( 'en', 'Label of ' .
$id->getSerialization() );
} ) );
return $labelLookup;
diff --git a/lib/tests/phpunit/formatters/EntityIdHtmlLinkFormatterTest.php
b/lib/tests/phpunit/formatters/EntityIdHtmlLinkFormatterTest.php
index b6d19ce..dcf142c 100644
--- a/lib/tests/phpunit/formatters/EntityIdHtmlLinkFormatterTest.php
+++ b/lib/tests/phpunit/formatters/EntityIdHtmlLinkFormatterTest.php
@@ -64,9 +64,9 @@
$entityTitleLookup = $this->getMock(
'Wikibase\Lib\Store\EntityTitleLookup' );
$entityTitleLookup->expects( $this->any() )
->method( 'getTitleForId' )
- ->will( $this->returnCallback( function ( EntityId
$entityId ) use ( $exists ) {
- $title = Title::newFromText(
$entityId->getSerialization() );
- $title->resetArticleID( $exists ?
$entityId->getNumericId() : 0 );
+ ->will( $this->returnCallback( function ( EntityId $id
) use ( $exists ) {
+ $title = Title::newFromText(
$id->getSerialization() );
+ $title->resetArticleID( $exists ?
$id->getNumericId() : 0 );
return $title;
} )
diff --git
a/lib/tests/phpunit/formatters/WikibaseValueFormatterBuildersTest.php
b/lib/tests/phpunit/formatters/WikibaseValueFormatterBuildersTest.php
index 6ec9572..b1009f6 100644
--- a/lib/tests/phpunit/formatters/WikibaseValueFormatterBuildersTest.php
+++ b/lib/tests/phpunit/formatters/WikibaseValueFormatterBuildersTest.php
@@ -57,21 +57,21 @@
$termLookup->expects( $this->any() )
->method( 'getLabel' )
- ->will( $this->returnCallback( function ( EntityId
$entityId, $language ) {
+ ->will( $this->returnCallback( function ( EntityId $id,
$language ) {
switch ( $language ) {
case 'de':
- return 'Name für ' .
$entityId->getSerialization();
+ return 'Name für ' .
$id->getSerialization();
default:
- return 'Label for ' .
$entityId->getSerialization();
+ return 'Label for ' .
$id->getSerialization();
}
} ) );
$termLookup->expects( $this->any() )
->method( 'getLabels' )
- ->will( $this->returnCallback( function ( EntityId
$entityId ) {
+ ->will( $this->returnCallback( function( EntityId $id )
{
return array(
- 'de' => 'Name für ' .
$entityId->getSerialization(),
- 'en' => 'Label for ' .
$entityId->getSerialization(),
+ 'de' => 'Name für ' .
$id->getSerialization(),
+ 'en' => 'Label for ' .
$id->getSerialization(),
);
} ) );
diff --git
a/lib/tests/phpunit/store/LanguageFallbackLabelDescriptionLookupFactoryTest.php
b/lib/tests/phpunit/store/LanguageFallbackLabelDescriptionLookupFactoryTest.php
index f040312..f68e08e 100644
---
a/lib/tests/phpunit/store/LanguageFallbackLabelDescriptionLookupFactoryTest.php
+++
b/lib/tests/phpunit/store/LanguageFallbackLabelDescriptionLookupFactoryTest.php
@@ -20,14 +20,14 @@
$termLookup = $this->getMock(
'Wikibase\DataModel\Services\Lookup\TermLookup' );
$termLookup->expects( $this->any() )
->method( 'getLabel' )
- ->will( $this->returnCallback( function( EntityId
$entityId ) {
- return $entityId->getSerialization() . '\'s
label';
+ ->will( $this->returnCallback( function( EntityId $id )
{
+ return $id->getSerialization() . '\'s label';
} ) );
$termLookup->expects( $this->any() )
->method( 'getLabels' )
- ->will( $this->returnCallback( function( EntityId
$entityId ) {
- return array( 'en' =>
$entityId->getSerialization() . '\'s label' );
+ ->will( $this->returnCallback( function( EntityId $id )
{
+ return array( 'en' => $id->getSerialization() .
'\'s label' );
} ) );
return $termLookup;
diff --git a/repo/tests/phpunit/includes/IO/EntityIdReaderTest.php
b/repo/tests/phpunit/includes/IO/EntityIdReaderTest.php
index a6641ee..2898530 100644
--- a/repo/tests/phpunit/includes/IO/EntityIdReaderTest.php
+++ b/repo/tests/phpunit/includes/IO/EntityIdReaderTest.php
@@ -34,11 +34,9 @@
}
protected function getIdStrings( array $entityIds ) {
- $ids = array_map( function ( EntityId $entityId ) {
- return $entityId->getSerialization();
+ return array_map( function( EntityId $id ) {
+ return $id->getSerialization();
}, $entityIds );
-
- return $ids;
}
protected function assertEqualIds( array $expected,array $actual, $msg
= null ) {
diff --git a/repo/tests/phpunit/includes/ItemDisambiguationTest.php
b/repo/tests/phpunit/includes/ItemDisambiguationTest.php
index d140fc1..d71ce77 100644
--- a/repo/tests/phpunit/includes/ItemDisambiguationTest.php
+++ b/repo/tests/phpunit/includes/ItemDisambiguationTest.php
@@ -33,8 +33,8 @@
$entityIdFormatter = $this->getMock(
'Wikibase\Lib\Store\EntityTitleLookup' );
$entityIdFormatter->expects( $this->any() )
->method( 'getTitleForId' )
- ->will( $this->returnCallback( function( ItemId $itemId
) {
- return Title::makeTitle( NS_MAIN,
$itemId->getSerialization() );
+ ->will( $this->returnCallback( function( ItemId $id ) {
+ return Title::makeTitle( NS_MAIN,
$id->getSerialization() );
} ) );
return $entityIdFormatter;
}
diff --git a/repo/tests/phpunit/includes/api/ResultBuilderTest.php
b/repo/tests/phpunit/includes/api/ResultBuilderTest.php
index 035166a..dc50e9e 100644
--- a/repo/tests/phpunit/includes/api/ResultBuilderTest.php
+++ b/repo/tests/phpunit/includes/api/ResultBuilderTest.php
@@ -66,8 +66,8 @@
$mockPropertyDataTypeLookup = $this->getMock(
'\Wikibase\DataModel\Services\Lookup\PropertyDataTypeLookup' );
$mockPropertyDataTypeLookup->expects( $this->any() )
->method( 'getDataTypeIdForProperty' )
- ->will( $this->returnCallback( function( PropertyId
$propertyId ) {
- return 'DtIdFor_' .
$propertyId->getSerialization();
+ ->will( $this->returnCallback( function( PropertyId $id
) {
+ return 'DtIdFor_' . $id->getSerialization();
} ) );
$serializerFactory = new SerializerFactory(
diff --git a/repo/tests/phpunit/includes/specials/SpecialGoToLinkedPageTest.php
b/repo/tests/phpunit/includes/specials/SpecialGoToLinkedPageTest.php
index c10be38..48d9d08 100644
--- a/repo/tests/phpunit/includes/specials/SpecialGoToLinkedPageTest.php
+++ b/repo/tests/phpunit/includes/specials/SpecialGoToLinkedPageTest.php
@@ -74,8 +74,8 @@
$mock = $this->getMock(
'Wikibase\DataModel\Services\Lookup\EntityRedirectLookup' );
$mock->expects( $this->any() )
->method( 'getRedirectForEntityId' )
- ->will( $this->returnCallback( function( ItemId $itemId
) {
- if ( $itemId->getSerialization() === 'Q24' ) {
+ ->will( $this->returnCallback( function( ItemId $id ) {
+ if ( $id->getSerialization() === 'Q24' ) {
return new ItemId( 'Q23' );
} else {
return null;
diff --git a/repo/tests/phpunit/includes/specials/SpecialListPropertiesTest.php
b/repo/tests/phpunit/includes/specials/SpecialListPropertiesTest.php
index 9990a6a..db16674 100644
--- a/repo/tests/phpunit/includes/specials/SpecialListPropertiesTest.php
+++ b/repo/tests/phpunit/includes/specials/SpecialListPropertiesTest.php
@@ -80,8 +80,8 @@
->method( 'prefetchTerms' );
$lookup->expects( $this->any() )
->method( 'getLabels' )
- ->will( $this->returnCallback( function( PropertyId
$propertyId ) {
- return array( 'en' => 'Property with label ' .
$propertyId->getSerialization() );
+ ->will( $this->returnCallback( function( PropertyId $id
) {
+ return array( 'en' => 'Property with label ' .
$id->getSerialization() );
} ) );
return $lookup;
}
diff --git a/repo/tests/phpunit/includes/store/sql/EntityPerPageIdPagerTest.php
b/repo/tests/phpunit/includes/store/sql/EntityPerPageIdPagerTest.php
index 0ce7084..45ffe78 100644
--- a/repo/tests/phpunit/includes/store/sql/EntityPerPageIdPagerTest.php
+++ b/repo/tests/phpunit/includes/store/sql/EntityPerPageIdPagerTest.php
@@ -81,11 +81,9 @@
}
protected function getIdStrings( array $entities ) {
- $ids = array_map( function ( EntityId $entityId ) {
- return $entityId->getSerialization();
+ return array_map( function( EntityId $id ) {
+ return $id->getSerialization();
}, $entities );
-
- return $ids;
}
protected function assertEqualIds( array $expected,array $actual, $msg
= null ) {
diff --git
a/repo/tests/phpunit/includes/store/sql/WikiPageEntityRedirectLookupTest.php
b/repo/tests/phpunit/includes/store/sql/WikiPageEntityRedirectLookupTest.php
index 2e89088..89dc909 100644
--- a/repo/tests/phpunit/includes/store/sql/WikiPageEntityRedirectLookupTest.php
+++ b/repo/tests/phpunit/includes/store/sql/WikiPageEntityRedirectLookupTest.php
@@ -123,8 +123,8 @@
$entityTitleLookup->expects( $this->any() )
->method( 'getTitleForId' )
- ->will( $this->returnCallback( function( EntityId
$entityId ) {
- return Title::makeTitle( NS_MAIN,
$entityId->getSerialization() );
+ ->will( $this->returnCallback( function( EntityId $id )
{
+ return Title::makeTitle( NS_MAIN,
$id->getSerialization() );
} ) );
return $entityTitleLookup;
diff --git a/repo/tests/phpunit/maintenance/dumpJsonTest.php
b/repo/tests/phpunit/maintenance/dumpJsonTest.php
index 0aefb12..9a21491 100644
--- a/repo/tests/phpunit/maintenance/dumpJsonTest.php
+++ b/repo/tests/phpunit/maintenance/dumpJsonTest.php
@@ -157,11 +157,11 @@
);
$mockDataTypeLookup->expects( $this->any() )
->method( 'getDataTypeIdForProperty' )
- ->will( $this->returnCallback( function( PropertyId
$propertyId ) {
- if ( $propertyId->getSerialization() === 'P999'
) {
- throw new
PropertyDataTypeLookupException( $propertyId );
+ ->will( $this->returnCallback( function( PropertyId $id
) {
+ if ( $id->getSerialization() === 'P999' ) {
+ throw new
PropertyDataTypeLookupException( $id );
}
- return 'DtIdFor_' .
$propertyId->getSerialization();
+ return 'DtIdFor_' . $id->getSerialization();
} ) );
return $mockDataTypeLookup;
}
diff --git a/repo/tests/phpunit/maintenance/dumpRdfTest.php
b/repo/tests/phpunit/maintenance/dumpRdfTest.php
index d0df403..e5903b0 100644
--- a/repo/tests/phpunit/maintenance/dumpRdfTest.php
+++ b/repo/tests/phpunit/maintenance/dumpRdfTest.php
@@ -176,11 +176,11 @@
);
$mockDataTypeLookup->expects( $this->any() )
->method( 'getDataTypeIdForProperty' )
- ->will( $this->returnCallback( function( PropertyId
$propertyId ) {
- if ( $propertyId->getSerialization() === 'P999'
) {
- throw new
PropertyDataTypeLookupException( $propertyId );
+ ->will( $this->returnCallback( function( PropertyId $id
) {
+ if ( $id->getSerialization() === 'P999' ) {
+ throw new
PropertyDataTypeLookupException( $id );
}
- return 'DtIdFor_' .
$propertyId->getSerialization();
+ return 'DtIdFor_' . $id->getSerialization();
} ) );
return $mockDataTypeLookup;
}
--
To view, visit https://gerrit.wikimedia.org/r/246287
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I370a60453f2a6c4f525c25164f4b608f0f66b369
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: Addshore <[email protected]>
Gerrit-Reviewer: Hoo man <[email protected]>
Gerrit-Reviewer: Jeroen De Dauw <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits