Thiemo Mättig (WMDE) has uploaded a new change for review.
https://gerrit.wikimedia.org/r/277994
Change subject: Fix and add soft (PHPDoc) type hints
......................................................................
Fix and add soft (PHPDoc) type hints
This is a pure documentation patch, exclusively touching @param and @var
type hints, but not changing code (except for splitting a line).
Change-Id: I646fcd2fd08a0c8a3b92b4a5f09963580cdc3e55
---
M client/includes/Hooks/OtherProjectsSidebarGenerator.php
M client/includes/Usage/NullSubscriptionManager.php
M client/tests/phpunit/includes/Changes/WikiPageUpdaterTest.php
M client/tests/phpunit/includes/DataAccess/PropertyParserFunction/RunnerTest.php
M
client/tests/phpunit/includes/DataAccess/PropertyParserFunction/StatementGroupRendererFactoryTest.php
M
client/tests/phpunit/includes/DataAccess/Scribunto/Scribunto_LuaWikibaseEntityLibraryTest.php
M client/tests/phpunit/includes/Hooks/DataUpdateHookHandlersTest.php
M
client/tests/phpunit/includes/Store/Sql/ConsistentReadConnectionManagerTest.php
M repo/tests/phpunit/includes/Actions/HistoryEntityActionTest.php
M repo/tests/phpunit/includes/Notifications/ChangeNotifierTest.php
M view/tests/phpunit/ItemViewTest.php
M view/tests/phpunit/Module/TemplateModuleTest.php
M view/tests/phpunit/PropertyViewTest.php
13 files changed, 42 insertions(+), 31 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/94/277994/1
diff --git a/client/includes/Hooks/OtherProjectsSidebarGenerator.php
b/client/includes/Hooks/OtherProjectsSidebarGenerator.php
index e832722..4d1b912 100644
--- a/client/includes/Hooks/OtherProjectsSidebarGenerator.php
+++ b/client/includes/Hooks/OtherProjectsSidebarGenerator.php
@@ -188,7 +188,7 @@
/**
* @param Title $title
*
- * @return Item|null
+ * @return ItemId|null
*/
private function getItemId( Title $title ) {
$siteLink = new SiteLink( $this->localSiteId,
$title->getPrefixedText() );
diff --git a/client/includes/Usage/NullSubscriptionManager.php
b/client/includes/Usage/NullSubscriptionManager.php
index 04cff86..f6154dc 100644
--- a/client/includes/Usage/NullSubscriptionManager.php
+++ b/client/includes/Usage/NullSubscriptionManager.php
@@ -13,24 +13,16 @@
class NullSubscriptionManager implements SubscriptionManager {
/**
- * Subscribes the given subscriber to notifications about changes on
the specified entities.
- *
- * @param string $subscriber Global site ID of the subscriber
- * @param EntityId[] $entityIds The entities to subscribe to.
- *
- * @throws UsageTrackerException
+ * @param string $subscriber
+ * @param EntityId[] $entityIds
*/
public function subscribe( $subscriber, array $entityIds ) {
// NO-OP
}
/**
- * Unsubscribes the given subscriber from notifications about changes
on the specified entities.
- *
- * @param string $subscriber Global site ID of the subscriber
- * @param EntityId[] $entityIds The entities to subscribe to.
- *
- * @throws UsageTrackerException
+ * @param string $subscriber
+ * @param EntityId[] $entityIds
*/
public function unsubscribe( $subscriber, array $entityIds ) {
// NO-OP
diff --git a/client/tests/phpunit/includes/Changes/WikiPageUpdaterTest.php
b/client/tests/phpunit/includes/Changes/WikiPageUpdaterTest.php
index fe8a6ab..32ad2b1 100644
--- a/client/tests/phpunit/includes/Changes/WikiPageUpdaterTest.php
+++ b/client/tests/phpunit/includes/Changes/WikiPageUpdaterTest.php
@@ -5,6 +5,7 @@
use Job;
use JobQueueGroup;
use PHPUnit_Framework_Assert;
+use PHPUnit_Framework_MockObject_MockObject;
use RecentChange;
use RefreshLinksJob;
use Title;
@@ -29,7 +30,7 @@
class WikiPageUpdaterTest extends \MediaWikiTestCase {
/**
- * @return JobQueueGroup
+ * @return JobQueueGroup|PHPUnit_Framework_MockObject_MockObject
*/
private function getJobQueueGroupMock() {
$jobQueueGroup = $this->getMockBuilder( JobQueueGroup::class )
@@ -40,7 +41,7 @@
}
/**
- * @return RecentChangeFactory
+ * @return RecentChangeFactory|PHPUnit_Framework_MockObject_MockObject
*/
private function getRCFactoryMock() {
$rcFactory = $this->getMockBuilder( RecentChangeFactory::class )
@@ -55,7 +56,7 @@
}
/**
- * @return RecentChangesDuplicateDetector
+ * @return
RecentChangesDuplicateDetector|PHPUnit_Framework_MockObject_MockObject
*/
private function getRCDupeDetectorMock() {
$rcDupeDetector = $this->getMockBuilder(
RecentChangesDuplicateDetector::class )
@@ -68,7 +69,7 @@
/**
* @param string $text
*
- * @return Title
+ * @return Title|PHPUnit_Framework_MockObject_MockObject
*/
private function getTitleMock( $text ) {
$title = $this->getMockBuilder( Title::class )
diff --git
a/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/RunnerTest.php
b/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/RunnerTest.php
index 8a69602..7bd9345 100644
---
a/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/RunnerTest.php
+++
b/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/RunnerTest.php
@@ -180,6 +180,11 @@
return new RestrictedEntityLookup( $this->getMock(
EntityLookup::class ), 200 );
}
+ /**
+ * @param ItemId $itemId
+ *
+ * @return SiteLinkLookup
+ */
private function getSiteLinkLookup( ItemId $itemId ) {
$siteLinkLookup = $this->getMockBuilder( SiteLinkLookup::class )
->getMock();
diff --git
a/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/StatementGroupRendererFactoryTest.php
b/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/StatementGroupRendererFactoryTest.php
index c0bad46..9f2c044 100644
---
a/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/StatementGroupRendererFactoryTest.php
+++
b/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/StatementGroupRendererFactoryTest.php
@@ -221,7 +221,7 @@
}
/**
- * @return SnakFormatter
+ * @return OutputFormatSnakFormatterFactory
*/
private function getSnakFormatterFactory() {
$snakFormatter = $this->getMockBuilder( SnakFormatter::class )
diff --git
a/client/tests/phpunit/includes/DataAccess/Scribunto/Scribunto_LuaWikibaseEntityLibraryTest.php
b/client/tests/phpunit/includes/DataAccess/Scribunto/Scribunto_LuaWikibaseEntityLibraryTest.php
index 254f326..bba09cb 100644
---
a/client/tests/phpunit/includes/DataAccess/Scribunto/Scribunto_LuaWikibaseEntityLibraryTest.php
+++
b/client/tests/phpunit/includes/DataAccess/Scribunto/Scribunto_LuaWikibaseEntityLibraryTest.php
@@ -3,6 +3,7 @@
namespace Wikibase\Client\Tests\DataAccess\Scribunto;
use LuaSandboxFunction;
+use Scribunto_LuaEngine;
use Scribunto_LuaStandaloneInterpreterFunction;
use Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseEntityLibrary;
use Wikibase\Client\WikibaseClient;
diff --git a/client/tests/phpunit/includes/Hooks/DataUpdateHookHandlersTest.php
b/client/tests/phpunit/includes/Hooks/DataUpdateHookHandlersTest.php
index 38004c6..e79c67a 100644
--- a/client/tests/phpunit/includes/Hooks/DataUpdateHookHandlersTest.php
+++ b/client/tests/phpunit/includes/Hooks/DataUpdateHookHandlersTest.php
@@ -163,7 +163,7 @@
}
/**
- * @param array[]|null $usages
+ * @param EntityUsage[]|null $usages
* @param string $timestamp
*
* @return ParserOutput
diff --git
a/client/tests/phpunit/includes/Store/Sql/ConsistentReadConnectionManagerTest.php
b/client/tests/phpunit/includes/Store/Sql/ConsistentReadConnectionManagerTest.php
index cd9f808..acb6681 100644
---
a/client/tests/phpunit/includes/Store/Sql/ConsistentReadConnectionManagerTest.php
+++
b/client/tests/phpunit/includes/Store/Sql/ConsistentReadConnectionManagerTest.php
@@ -4,6 +4,7 @@
use IDatabase;
use LoadBalancer;
+use PHPUnit_Framework_MockObject_MockObject;
use Wikibase\Client\Store\Sql\ConsistentReadConnectionManager;
/**
@@ -19,14 +20,14 @@
class ConsistentReadConnectionManagerTest extends \PHPUnit_Framework_TestCase {
/**
- * @return IDatabase
+ * @return IDatabase|PHPUnit_Framework_MockObject_MockObject
*/
private function getConnectionMock() {
return $this->getMock( IDatabase::class );
}
/**
- * @return LoadBalancer
+ * @return LoadBalancer|PHPUnit_Framework_MockObject_MockObject
*/
private function getLoadBalancerMock() {
$lb = $this->getMockBuilder( LoadBalancer::class )
diff --git a/repo/tests/phpunit/includes/Actions/HistoryEntityActionTest.php
b/repo/tests/phpunit/includes/Actions/HistoryEntityActionTest.php
index 9de9c44..7098a13 100644
--- a/repo/tests/phpunit/includes/Actions/HistoryEntityActionTest.php
+++ b/repo/tests/phpunit/includes/Actions/HistoryEntityActionTest.php
@@ -30,7 +30,7 @@
/**
* @param string $title
*
- * @return Article
+ * @return Article|PHPUnit_Framework_MockObject_MockObject
*/
private function getPage( $title ) {
$page = $this->getMockBuilder( Article::class )
@@ -44,7 +44,7 @@
}
/**
- * @return OutputPage
+ * @return OutputPage|PHPUnit_Framework_MockObject_MockObject
*/
private function getOutput() {
$output = $this->getMockBuilder( OutputPage::class )
diff --git a/repo/tests/phpunit/includes/Notifications/ChangeNotifierTest.php
b/repo/tests/phpunit/includes/Notifications/ChangeNotifierTest.php
index 7d1d5b2..b30bd94 100644
--- a/repo/tests/phpunit/includes/Notifications/ChangeNotifierTest.php
+++ b/repo/tests/phpunit/includes/Notifications/ChangeNotifierTest.php
@@ -10,7 +10,6 @@
use Wikibase\DataModel\Entity\EntityRedirect;
use Wikibase\DataModel\Entity\Item;
use Wikibase\DataModel\Entity\ItemId;
-use Wikibase\EntityContent;
use Wikibase\ItemContent;
use Wikibase\Repo\Notifications\ChangeNotifier;
use Wikibase\Repo\Notifications\ChangeTransmitter;
@@ -46,7 +45,7 @@
/**
* @param ItemId $id
*
- * @return EntityContent
+ * @return ItemContent
*/
private function makeItemContent( ItemId $id ) {
$item = new Item( $id );
@@ -60,7 +59,7 @@
* @param ItemId $target
*
* @throws RuntimeException
- * @return EntityContent
+ * @return ItemContent
*/
protected function makeItemRedirectContent( ItemId $id, ItemId $target
) {
$title = Title::newFromText( $target->getSerialization() );
@@ -236,7 +235,9 @@
$parent = $this->makeRevision( $oldContent, $user, $revisionId
- 1, $timestamp );
$content = $this->makeItemContent( $oldContent->getEntityId() );
- $content->getEntity()->setLabel( 'en', 'Foo' );
+ /** @var Item $item */
+ $item = $content->getEntity();
+ $item->setLabel( 'en', 'Foo' );
$revision = $this->makeRevision( $content, $user, $revisionId,
$timestamp, $revisionId - 1 );
$notifier = $this->getChangeNotifier();
diff --git a/view/tests/phpunit/ItemViewTest.php
b/view/tests/phpunit/ItemViewTest.php
index f41f6f2..438d0ed 100644
--- a/view/tests/phpunit/ItemViewTest.php
+++ b/view/tests/phpunit/ItemViewTest.php
@@ -5,6 +5,7 @@
use Wikibase\DataModel\Entity\EntityId;
use Wikibase\DataModel\Entity\Item;
use Wikibase\DataModel\Entity\ItemId;
+use Wikibase\DataModel\Statement\Statement;
use Wikibase\DataModel\Statement\StatementList;
use Wikibase\View\EntityTermsView;
use Wikibase\View\ItemView;
@@ -30,6 +31,12 @@
*/
class ItemViewTest extends EntityViewTest {
+ /**
+ * @param EntityId|ItemId $id
+ * @param Statement[] $statements
+ *
+ * @return Item
+ */
protected function makeEntity( EntityId $id, array $statements =
array() ) {
$item = new Item( $id );
@@ -46,7 +53,7 @@
*
* @param int|string $n
*
- * @return EntityId
+ * @return ItemId
*/
protected function makeEntityId( $n ) {
return new ItemId( "Q$n" );
diff --git a/view/tests/phpunit/Module/TemplateModuleTest.php
b/view/tests/phpunit/Module/TemplateModuleTest.php
index 239a226..983ee43 100644
--- a/view/tests/phpunit/Module/TemplateModuleTest.php
+++ b/view/tests/phpunit/Module/TemplateModuleTest.php
@@ -49,6 +49,9 @@
$this->assertNotEquals( $oldSummary['mtime'],
$newSummary['mtime'] );
}
+ /**
+ * @return ResourceLoaderContext
+ */
private function getResourceLoaderContext() {
$context = $this->getMockBuilder( ResourceLoaderContext::class )
->disableOriginalConstructor()
diff --git a/view/tests/phpunit/PropertyViewTest.php
b/view/tests/phpunit/PropertyViewTest.php
index 3f56ae2..0a3a75f 100644
--- a/view/tests/phpunit/PropertyViewTest.php
+++ b/view/tests/phpunit/PropertyViewTest.php
@@ -33,10 +33,10 @@
class PropertyViewTest extends EntityViewTest {
/**
- * @param EntityId $id
+ * @param EntityId|PropertyId $id
* @param Statement[] $statements
*
- * @return EntityDocument
+ * @return Property
*/
protected function makeEntity( EntityId $id, array $statements =
array() ) {
$property = Property::newFromType( 'string' );
@@ -55,7 +55,7 @@
*
* @param int|string $n
*
- * @return EntityId
+ * @return PropertyId
*/
protected function makeEntityId( $n ) {
return new PropertyId( "P$n" );
--
To view, visit https://gerrit.wikimedia.org/r/277994
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I646fcd2fd08a0c8a3b92b4a5f09963580cdc3e55
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