Thiemo Mättig (WMDE) has uploaded a new change for review.
https://gerrit.wikimedia.org/r/245858
Change subject: Fix all incomplete/out of sync PHPDoc @param and @return tags
......................................................................
Fix all incomplete/out of sync PHPDoc @param and @return tags
As reported by PHPStorms code inspection.
Note that some IDEs are able to understand multi-dimensional array
type hints, but not all of them. I suggest to stay compatible with
a broad base of tools, not only tools that do support this.
Change-Id: Ieef0d272f8546b8b0bb87903fa4c9f9033c51ff3
---
M client/includes/Changes/ChangeRunCoalescer.php
M client/includes/ParserOutputDataUpdater.php
M client/includes/api/PageTerms.php
M client/tests/phpunit/MockClientStore.php
M client/tests/phpunit/includes/Changes/ChangeRunCoalescerTest.php
M
client/tests/phpunit/includes/DataAccess/PropertyParserFunction/LanguageAwareRendererTest.php
M
client/tests/phpunit/includes/DataAccess/Scribunto/SnakSerializationRendererTest.php
M client/tests/phpunit/includes/DataAccess/Scribunto/WikibaseLuaBindingsTest.php
M client/tests/phpunit/includes/Usage/UsageLookupContractTester.php
M client/tests/phpunit/includes/Usage/UsageTrackingSnakFormatterTest.php
M client/tests/phpunit/includes/Usage/UsageTrackingTermLookupTest.php
M client/tests/phpunit/includes/recentchanges/ExternalChangeFactoryTest.php
M lib/includes/store/LabelConflictFinder.php
M lib/includes/store/sql/TermSqlIndex.php
M lib/tests/phpunit/store/MockTermIndex.php
M purtle/src/RdfWriterBase.php
M repo/includes/ChangeOp/ChangeOpRemoveStatement.php
M repo/includes/EditEntityFactory.php
M repo/includes/Hooks/EditFilterHookRunner.php
M repo/includes/LabelDescriptionDuplicateDetector.php
M repo/includes/api/ResultBuilder.php
M repo/includes/rdf/RdfBuilder.php
M repo/includes/specials/SpecialGoToLinkedPage.php
M repo/includes/store/sql/EntityPerPageTable.php
M repo/includes/store/sql/SqlStore.php
M repo/tests/phpunit/MockEntityPerPage.php
M repo/tests/phpunit/includes/ChangeOp/ChangeOpSiteLinkTest.php
27 files changed, 59 insertions(+), 24 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/58/245858/1
diff --git a/client/includes/Changes/ChangeRunCoalescer.php
b/client/includes/Changes/ChangeRunCoalescer.php
index 99b681e..9157048 100644
--- a/client/includes/Changes/ChangeRunCoalescer.php
+++ b/client/includes/Changes/ChangeRunCoalescer.php
@@ -83,7 +83,7 @@
*
* @param EntityChange[] $changes
*
- * @return EntityChange[][] an associative array using entity IDs for
keys. Associated with each
+ * @return array[] an associative array using entity IDs for keys.
Associated with each
* entity ID is the list of changes performed on that entity.
*/
private function groupChangesByEntity( array $changes ) {
diff --git a/client/includes/ParserOutputDataUpdater.php
b/client/includes/ParserOutputDataUpdater.php
index 774659f..ff62b25 100644
--- a/client/includes/ParserOutputDataUpdater.php
+++ b/client/includes/ParserOutputDataUpdater.php
@@ -49,6 +49,8 @@
* @param SiteLinkLookup $siteLinkLookup
* @param EntityLookup $entityLookup
* @param string $siteId The global site ID for the local wiki
+ *
+ * @throws InvalidArgumentException
*/
public function __construct(
OtherProjectsSidebarGeneratorFactory
$otherProjectsSidebarGeneratorFactory,
diff --git a/client/includes/api/PageTerms.php
b/client/includes/api/PageTerms.php
index e8c852b..64bec97 100644
--- a/client/includes/api/PageTerms.php
+++ b/client/includes/api/PageTerms.php
@@ -159,7 +159,7 @@
* @param int[] $entityToPageMap
* @param TermIndexEntry[] $terms
*
- * @return array[][] An associative array, mapping pageId + entity type
to a list of strings.
+ * @return array[] An associative array, mapping pageId + entity type
to a list of strings.
*/
private function groupTermsByPageAndType( array $entityToPageMap, array
$terms ) {
$termsPerPage = array();
diff --git a/client/tests/phpunit/MockClientStore.php
b/client/tests/phpunit/MockClientStore.php
index 2b88494..43e3127 100644
--- a/client/tests/phpunit/MockClientStore.php
+++ b/client/tests/phpunit/MockClientStore.php
@@ -157,7 +157,7 @@
* @param EntityLookup|null $entityLookup
*/
public function setEntityLookup( EntityLookup $entityLookup = null ) {
- return self::$entityLookup = $entityLookup;
+ self::$entityLookup = $entityLookup;
}
/**
diff --git a/client/tests/phpunit/includes/Changes/ChangeRunCoalescerTest.php
b/client/tests/phpunit/includes/Changes/ChangeRunCoalescerTest.php
index 2bf9e16..c8ac12e 100644
--- a/client/tests/phpunit/includes/Changes/ChangeRunCoalescerTest.php
+++ b/client/tests/phpunit/includes/Changes/ChangeRunCoalescerTest.php
@@ -89,7 +89,6 @@
/**
* @param array $values
- * @param EntityDiff|null $diff
*
* @return EntityChange
*/
diff --git
a/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/LanguageAwareRendererTest.php
b/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/LanguageAwareRendererTest.php
index 9e576b7..c778431 100644
---
a/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/LanguageAwareRendererTest.php
+++
b/client/tests/phpunit/includes/DataAccess/PropertyParserFunction/LanguageAwareRendererTest.php
@@ -178,6 +178,8 @@
/**
* @param int $entityAccessLimit
+ *
+ * @return EntityLookup
*/
private function getEntityLookup( $entityAccessLimit ) {
$lookup = $this->getMock(
'Wikibase\DataModel\Services\Lookup\EntityLookup' );
diff --git
a/client/tests/phpunit/includes/DataAccess/Scribunto/SnakSerializationRendererTest.php
b/client/tests/phpunit/includes/DataAccess/Scribunto/SnakSerializationRendererTest.php
index 5da5b6d..fd2b178 100644
---
a/client/tests/phpunit/includes/DataAccess/Scribunto/SnakSerializationRendererTest.php
+++
b/client/tests/phpunit/includes/DataAccess/Scribunto/SnakSerializationRendererTest.php
@@ -45,8 +45,6 @@
}
/**
- * @param UsageAccumulator $usageAccumulator
- *
* @return SnakSerializationRenderer
*/
private function getSnakRenderer() {
diff --git
a/client/tests/phpunit/includes/DataAccess/Scribunto/WikibaseLuaBindingsTest.php
b/client/tests/phpunit/includes/DataAccess/Scribunto/WikibaseLuaBindingsTest.php
index c11e120..e6f9393 100644
---
a/client/tests/phpunit/includes/DataAccess/Scribunto/WikibaseLuaBindingsTest.php
+++
b/client/tests/phpunit/includes/DataAccess/Scribunto/WikibaseLuaBindingsTest.php
@@ -46,9 +46,11 @@
}
/**
- * @param EntityLookup|null $entityLookup
+ * @param EntityLookup $entityLookup
+ * @param SiteLinkLookup $siteLinkLookup
* @param UsageAccumulator|null $usageAccumulator
* @param ParserOptions|null $parserOptions
+ *
* @return WikibaseLuaBindings
*/
private function getWikibaseLuaBindings(
diff --git a/client/tests/phpunit/includes/Usage/UsageLookupContractTester.php
b/client/tests/phpunit/includes/Usage/UsageLookupContractTester.php
index 5e13706..6fa2070 100644
--- a/client/tests/phpunit/includes/Usage/UsageLookupContractTester.php
+++ b/client/tests/phpunit/includes/Usage/UsageLookupContractTester.php
@@ -31,6 +31,8 @@
/**
* @param UsageLookup $lookup The lookup under test
* @param callable $putUsagesCallback function( $pageId, EntityUsage[]
$usages, $timestamp )
+ *
+ * @throws InvalidArgumentException
*/
public function __construct( UsageLookup $lookup, $putUsagesCallback ) {
if ( !is_callable( $putUsagesCallback ) ) {
diff --git
a/client/tests/phpunit/includes/Usage/UsageTrackingSnakFormatterTest.php
b/client/tests/phpunit/includes/Usage/UsageTrackingSnakFormatterTest.php
index 66d6055..cef3a2b 100644
--- a/client/tests/phpunit/includes/Usage/UsageTrackingSnakFormatterTest.php
+++ b/client/tests/phpunit/includes/Usage/UsageTrackingSnakFormatterTest.php
@@ -25,6 +25,9 @@
class UsageTrackingSnakFormatterTest extends \MediaWikiTestCase {
/**
+ * @param string $method
+ * @param string $return
+ *
* @return SnakFormatter
*/
private function getMockSnakFormatter( $method, $return ) {
diff --git
a/client/tests/phpunit/includes/Usage/UsageTrackingTermLookupTest.php
b/client/tests/phpunit/includes/Usage/UsageTrackingTermLookupTest.php
index c89277f..a7ebba7 100644
--- a/client/tests/phpunit/includes/Usage/UsageTrackingTermLookupTest.php
+++ b/client/tests/phpunit/includes/Usage/UsageTrackingTermLookupTest.php
@@ -20,13 +20,17 @@
class UsageTrackingTermLookupTest extends \MediaWikiTestCase {
/**
+ * @param string $method Method name expected to be called once.
+ * @param ItemId $entityId Expected entity id.
+ * @param string|string[] $languageCode Expected language code or array
of language codes.
+ *
* @return TermLookup
*/
- private function getMockTermLookup( $method, $p1, $p2 ) {
+ private function getMockTermLookup( $method, ItemId $entityId,
$languageCode ) {
$mockLookup = $this->getMock(
'Wikibase\DataModel\Services\Lookup\TermLookup' );
$mockLookup->expects( $this->once() )
->method( $method )
- ->with( $p1, $p2 )
+ ->with( $entityId, $languageCode )
->will( $this->returnValue( 'TEST' ) );
return $mockLookup;
diff --git
a/client/tests/phpunit/includes/recentchanges/ExternalChangeFactoryTest.php
b/client/tests/phpunit/includes/recentchanges/ExternalChangeFactoryTest.php
index ebb8c17..55eabff 100644
--- a/client/tests/phpunit/includes/recentchanges/ExternalChangeFactoryTest.php
+++ b/client/tests/phpunit/includes/recentchanges/ExternalChangeFactoryTest.php
@@ -219,6 +219,7 @@
/**
* @param string $expectedComment
+ * @param string|null $commentHtml
* @param string $expectedType
*
* @return ExternalChange
@@ -231,6 +232,12 @@
);
}
+ /**
+ * @param string $comment
+ * @param string|null $commentHtml
+ *
+ * @return RevisionData
+ */
private function makeRevisionData( $comment, $commentHtml = null ) {
return new RevisionData(
'Cat',
@@ -258,6 +265,7 @@
/**
* @param string $comment
+ * @param string|null $commentHtml
* @param null|string|array $legacyComment
* @param null|string|array $compositeLegacyComment
* @param string $changeType
diff --git a/lib/includes/store/LabelConflictFinder.php
b/lib/includes/store/LabelConflictFinder.php
index 0bf259b..6cf3cba 100644
--- a/lib/includes/store/LabelConflictFinder.php
+++ b/lib/includes/store/LabelConflictFinder.php
@@ -25,7 +25,7 @@
*
* @param string $entityType The entity type to consider for conflicts.
* @param string[] $labels The labels to look for, with language codes
as keys.
- * @param string[][]|null $aliases The aliases to look for, with
language codes as keys. If null,
+ * @param array[]|null $aliases The aliases to look for, with language
codes as keys. If null,
* conflicts with aliases are not considered.
*
* @return TermIndexEntry[]
diff --git a/lib/includes/store/sql/TermSqlIndex.php
b/lib/includes/store/sql/TermSqlIndex.php
index 1f5c791..aad0e68 100644
--- a/lib/includes/store/sql/TermSqlIndex.php
+++ b/lib/includes/store/sql/TermSqlIndex.php
@@ -787,8 +787,9 @@
*
* @param string $entityType
* @param string[] $labels
- * @param string[][]|null $aliases
+ * @param array[]|null $aliases
*
+ * @throws InvalidArgumentException
* @return TermIndexEntry[]
*/
public function getLabelConflicts( $entityType, array $labels, array
$aliases = null ) {
@@ -904,7 +905,8 @@
}
/**
- * @param string[]|string[][] $textsByLanguage A list of texts, or a
list of lists of texts (keyed by language on the top level)
+ * @param string[]|array[] $textsByLanguage A list of texts, or a list
of lists of texts (keyed
+ * by language on the top level).
* @param string[] $types
*
* @throws InvalidArgumentException
diff --git a/lib/tests/phpunit/store/MockTermIndex.php
b/lib/tests/phpunit/store/MockTermIndex.php
index 29f31a2..9e0dec2 100644
--- a/lib/tests/phpunit/store/MockTermIndex.php
+++ b/lib/tests/phpunit/store/MockTermIndex.php
@@ -44,8 +44,9 @@
*
* @param string[] $entityType The relevant entity type
* @param string[] $labels The label to look for
- * @param string[][] $aliases
+ * @param array[] $aliases
*
+ * @throws InvalidArgumentException
* @return EntityId[]
*/
public function getLabelConflicts( $entityType, array $labels, array
$aliases = null ) {
diff --git a/purtle/src/RdfWriterBase.php b/purtle/src/RdfWriterBase.php
index c0f14df..ee1b3b9 100644
--- a/purtle/src/RdfWriterBase.php
+++ b/purtle/src/RdfWriterBase.php
@@ -143,11 +143,14 @@
*
* @param string $prefix
* @param string $iri The base IRI
+ *
+ * @throws LogicException
*/
public function prefix( $prefix, $iri ) {
if ( $this->prefixesLocked ) {
- throw new \LogicException( "Prefixes can not be added
after start()" );
+ throw new LogicException( 'Prefixes can not be added
after start()' );
}
+
$this->prefixes[$prefix] = $iri;
}
diff --git a/repo/includes/ChangeOp/ChangeOpRemoveStatement.php
b/repo/includes/ChangeOp/ChangeOpRemoveStatement.php
index 511b174..9876264 100644
--- a/repo/includes/ChangeOp/ChangeOpRemoveStatement.php
+++ b/repo/includes/ChangeOp/ChangeOpRemoveStatement.php
@@ -55,6 +55,7 @@
* @param Summary|null $summary
*
* @throws InvalidArgumentException
+ * @throws ChangeOpException
* @return bool
*/
public function apply( Entity $entity, Summary $summary = null ) {
diff --git a/repo/includes/EditEntityFactory.php
b/repo/includes/EditEntityFactory.php
index 78eab2f..cd58259 100644
--- a/repo/includes/EditEntityFactory.php
+++ b/repo/includes/EditEntityFactory.php
@@ -76,7 +76,7 @@
/**
* @param User $user the user performing the edit
- * @param Entity $newEntity the new entity object
+ * @param Entity $entity the new entity object
* @param int|bool $baseRevId the base revision ID for conflict
checking.
* Defaults to false, disabling conflict checks.
* `true` can be used to set the base revision to the latest
revision:
diff --git a/repo/includes/Hooks/EditFilterHookRunner.php
b/repo/includes/Hooks/EditFilterHookRunner.php
index 7661e08..2ccc51d 100644
--- a/repo/includes/Hooks/EditFilterHookRunner.php
+++ b/repo/includes/Hooks/EditFilterHookRunner.php
@@ -68,6 +68,7 @@
* @param User $user the user performing the edit
* @param string $summary The edit summary
*
+ * @throws RuntimeException
* @throws InvalidArgumentException
* @return Status
*/
diff --git a/repo/includes/LabelDescriptionDuplicateDetector.php
b/repo/includes/LabelDescriptionDuplicateDetector.php
index 23c0e27..1fcc2dc 100644
--- a/repo/includes/LabelDescriptionDuplicateDetector.php
+++ b/repo/includes/LabelDescriptionDuplicateDetector.php
@@ -44,11 +44,12 @@
* @param string $entityType The type of entity to search for conflicts.
* @param string[] $labels An associative array of labels,
* with language codes as the keys.
- * @param string[][]|null $aliases Aliases to be considered to be
conflicting with labels.
+ * @param array[]|null $aliases Aliases to be considered to be
conflicting with labels.
* Ignored if descriptions are given.
* @param EntityId|null $ignoreEntityId Conflicts with this entity will
be
* considered self-conflicts and ignored.
*
+ * @throws InvalidArgumentException
* @return Result
*/
public function detectLabelConflicts(
@@ -100,6 +101,7 @@
* @param EntityId|null $ignoreEntityId Conflicts with this entity will
be
* considered self-conflicts and ignored.
*
+ * @throws InvalidArgumentException
* @return Result
*/
public function detectLabelDescriptionConflicts(
diff --git a/repo/includes/api/ResultBuilder.php
b/repo/includes/api/ResultBuilder.php
index a9f6385..8b6c026 100644
--- a/repo/includes/api/ResultBuilder.php
+++ b/repo/includes/api/ResultBuilder.php
@@ -676,6 +676,8 @@
* Adds fake serialization to show a term has been removed
*
* @param string $language
+ * @param string $name
+ * @param string $tag
* @param array|string $path where the data is located
*/
private function addRemovedTerm( $language, $name, $tag, $path ) {
diff --git a/repo/includes/rdf/RdfBuilder.php b/repo/includes/rdf/RdfBuilder.php
index 4255c9c..fdfb121 100644
--- a/repo/includes/rdf/RdfBuilder.php
+++ b/repo/includes/rdf/RdfBuilder.php
@@ -143,6 +143,8 @@
}
/**
+ * @param string $full
+ *
* @return SnakRdfBuilder
*/
private function newSnakBuilder( $full ) {
diff --git a/repo/includes/specials/SpecialGoToLinkedPage.php
b/repo/includes/specials/SpecialGoToLinkedPage.php
index 216963b..fb1c463 100644
--- a/repo/includes/specials/SpecialGoToLinkedPage.php
+++ b/repo/includes/specials/SpecialGoToLinkedPage.php
@@ -79,6 +79,8 @@
* @param SiteStore $siteStore
* @param SiteLinkLookup $siteLinkLookup
* @param EntityRedirectLookup $redirectLookup
+ * @param EntityIdParser $idParser
+ * @param EntityLookup $entityLookup
*/
public function initServices(
SiteStore $siteStore,
diff --git a/repo/includes/store/sql/EntityPerPageTable.php
b/repo/includes/store/sql/EntityPerPageTable.php
index 9e752b7..da8a138 100644
--- a/repo/includes/store/sql/EntityPerPageTable.php
+++ b/repo/includes/store/sql/EntityPerPageTable.php
@@ -322,6 +322,7 @@
* @param EntityId $after Only return entities with IDs greater than
this.
* @param mixed $redirects A XXX_REDIRECTS constant (default is
NO_REDIRECTS).
*
+ * @throws InvalidArgumentException
* @return EntityId[]
*/
public function listEntities( $entityType, $limit, EntityId $after =
null, $redirects = self::NO_REDIRECTS ) {
diff --git a/repo/includes/store/sql/SqlStore.php
b/repo/includes/store/sql/SqlStore.php
index 231bc4b..798f58d 100644
--- a/repo/includes/store/sql/SqlStore.php
+++ b/repo/includes/store/sql/SqlStore.php
@@ -286,6 +286,7 @@
/**
* @param DatabaseUpdater $updater
+ * @param DatabaseBase $db
*/
private function updateItemsPerSiteTable( DatabaseUpdater $updater,
DatabaseBase $db ) {
// Make wb_items_per_site.ips_site_page VARCHAR(310) - T99459
@@ -301,6 +302,7 @@
/**
* @param DatabaseUpdater $updater
+ * @param DatabaseBase $db
*/
private function updateChangesTable( DatabaseUpdater $updater,
DatabaseBase $db ) {
// Make wb_changes.change_info MEDIUMBLOB - T108246
diff --git a/repo/tests/phpunit/MockEntityPerPage.php
b/repo/tests/phpunit/MockEntityPerPage.php
index 38789e2..701fdb5 100644
--- a/repo/tests/phpunit/MockEntityPerPage.php
+++ b/repo/tests/phpunit/MockEntityPerPage.php
@@ -116,7 +116,7 @@
* @param EntityId $entityId
* @param int $pageId
*
- * @throws InvalidArgumentException
+ * @throws BadMethodCallException always
* @return boolean Success indicator
*/
public function deleteEntityPage( EntityId $entityId, $pageId ) {
@@ -130,6 +130,7 @@
*
* @param EntityId $entityId
*
+ * @throws BadMethodCallException always
* @return boolean Success indicator
*/
public function deleteEntity( EntityId $entityId ) {
@@ -161,6 +162,7 @@
* @param integer $limit Limit of the query.
* @param integer $offset Offset of the query.
*
+ * @throws BadMethodCallException always
* @return EntityId[]
*/
public function getEntitiesWithoutTerm(
@@ -184,6 +186,7 @@
* @param integer $limit Limit of the query.
* @param integer $offset Offset of the query.
*
+ * @throws BadMethodCallException always
* @return EntityId[]
*/
public function getItemsWithoutSitelinks( $siteId = null, $limit = 50,
$offset = 0 ) {
diff --git a/repo/tests/phpunit/includes/ChangeOp/ChangeOpSiteLinkTest.php
b/repo/tests/phpunit/includes/ChangeOp/ChangeOpSiteLinkTest.php
index 9f81e6c..010fe3d 100644
--- a/repo/tests/phpunit/includes/ChangeOp/ChangeOpSiteLinkTest.php
+++ b/repo/tests/phpunit/includes/ChangeOp/ChangeOpSiteLinkTest.php
@@ -131,9 +131,6 @@
/**
* @dataProvider changeOpSiteLinkProvider
- * @param SiteLink[] $existingSitelinks
- * @param ChangeOpSiteLink $changeOpSiteLink
- * @param SiteLink[] $expectedSiteLinks
*/
public function testApply( array $existingSiteLinks, ChangeOpSiteLink
$changeOpSiteLink, array $expectedSiteLinks ) {
$item = new Item();
@@ -247,10 +244,6 @@
/**
* @dataProvider summaryTestProvider
- * @param string $expectedAction
- * @param array $expectedArguments
- * @param Item $entity
- * @param ChangeOpSiteLink $changeOpSiteLink
*/
public function testApplySummary(
$expectedAction,
--
To view, visit https://gerrit.wikimedia.org/r/245858
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ieef0d272f8546b8b0bb87903fa4c9f9033c51ff3
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