Thiemo Kreuz (WMDE) has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/403954 )
Change subject: Improve type hints and remove 100% redundant PHPDoc blocks
......................................................................
Improve type hints and remove 100% redundant PHPDoc blocks
The main reason for this patch are the missing type hints and & I am
adding in certain places.
I'm also removing PHPDoc block that repeat 100% exactly what the method
header already states. We already did this once, that's why only a few
of such comment blocks could be found for this patch.
Change-Id: I222660937fc7f3ce6a0ea5fbf7198199d6b08bef
---
M client/WikibaseClient.hooks.php
M client/includes/Changes/InjectRCRecordsJob.php
M client/includes/Hooks/ChangesListLinesHandler.php
M client/includes/Hooks/NoLangLinkHandler.php
M client/includes/Serializer/ClientStatementListSerializer.php
M client/includes/Usage/UsageTrackingSnakFormatter.php
M lib/includes/Store/CacheRetrievingEntityRevisionLookup.php
M lib/includes/Store/CachingEntityRevisionLookup.php
M repo/Wikibase.hooks.php
M repo/includes/Diff/DispatchingEntityDiffVisualizer.php
M repo/includes/EditEntityFactory.php
M repo/includes/Rdf/Values/ExternalIdentifierRdfBuilder.php
M repo/includes/WikibaseRepo.php
M repo/tests/phpunit/includes/Store/MockEntityIdPager.php
14 files changed, 12 insertions(+), 71 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/54/403954/1
diff --git a/client/WikibaseClient.hooks.php b/client/WikibaseClient.hooks.php
index b53ef3c..1176ab4 100644
--- a/client/WikibaseClient.hooks.php
+++ b/client/WikibaseClient.hooks.php
@@ -238,7 +238,7 @@
/**
* Register the parser functions.
*
- * @param Parser $parser
+ * @param Parser &$parser
*
* @return bool
*/
diff --git a/client/includes/Changes/InjectRCRecordsJob.php
b/client/includes/Changes/InjectRCRecordsJob.php
index 545fdd2..021b3ef 100644
--- a/client/includes/Changes/InjectRCRecordsJob.php
+++ b/client/includes/Changes/InjectRCRecordsJob.php
@@ -159,30 +159,18 @@
$this->logger = new NullLogger();
}
- /**
- * @param RecentChangesDuplicateDetector $rcDuplicateDetector
- */
public function setRecentChangesDuplicateDetector(
RecentChangesDuplicateDetector $rcDuplicateDetector ) {
$this->rcDuplicateDetector = $rcDuplicateDetector;
}
- /**
- * @param TitleFactory $titleFactory
- */
public function setTitleFactory( TitleFactory $titleFactory ) {
$this->titleFactory = $titleFactory;
}
- /**
- * @param LoggerInterface $logger
- */
public function setLogger( LoggerInterface $logger ) {
$this->logger = $logger;
}
- /**
- * @param StatsdDataFactoryInterface $stats
- */
public function setStats( StatsdDataFactoryInterface $stats ) {
$this->stats = $stats;
}
diff --git a/client/includes/Hooks/ChangesListLinesHandler.php
b/client/includes/Hooks/ChangesListLinesHandler.php
index 73d69c3..fb05c83 100644
--- a/client/includes/Hooks/ChangesListLinesHandler.php
+++ b/client/includes/Hooks/ChangesListLinesHandler.php
@@ -65,7 +65,7 @@
* @param ChangesList $changesList
* @return self
*/
- private static function getInstance( $changesList ) {
+ private static function getInstance( ChangesList $changesList ) {
if ( self::$instance === null ) {
self::$instance = self::newFromGlobalState(
$changesList );
}
diff --git a/client/includes/Hooks/NoLangLinkHandler.php
b/client/includes/Hooks/NoLangLinkHandler.php
index 3675d91..f6b8f90 100644
--- a/client/includes/Hooks/NoLangLinkHandler.php
+++ b/client/includes/Hooks/NoLangLinkHandler.php
@@ -30,7 +30,7 @@
*
* @return string
*/
- public static function handle( &$parser /*...*/ ) {
+ public static function handle( Parser &$parser /*...*/ ) {
$langs = func_get_args();
// Remove the first member, which is the parser.
@@ -88,12 +88,12 @@
/**
* Parser function
*
- * @param Parser &$parser
+ * @param Parser $parser
* @param string[] $langs
*
* @return string
*/
- public function doHandle( &$parser, array $langs ) {
+ public function doHandle( Parser $parser, array $langs ) {
if ( !$this->namespaceChecker->isWikibaseEnabled(
$parser->getTitle()->getNamespace() ) ) {
// shorten out
return '';
diff --git a/client/includes/Serializer/ClientStatementListSerializer.php
b/client/includes/Serializer/ClientStatementListSerializer.php
index 00440c1..8cab514 100644
--- a/client/includes/Serializer/ClientStatementListSerializer.php
+++ b/client/includes/Serializer/ClientStatementListSerializer.php
@@ -18,10 +18,6 @@
*/
private $statementListSerializer;
- /**
- * @param Serializer $statementListSerializer
- * @param PropertyDataTypeLookup $dataTypeLookup
- */
public function __construct(
Serializer $statementListSerializer,
PropertyDataTypeLookup $dataTypeLookup
diff --git a/client/includes/Usage/UsageTrackingSnakFormatter.php
b/client/includes/Usage/UsageTrackingSnakFormatter.php
index 37b7a6e..e0bd420 100644
--- a/client/includes/Usage/UsageTrackingSnakFormatter.php
+++ b/client/includes/Usage/UsageTrackingSnakFormatter.php
@@ -43,12 +43,6 @@
*/
private $usageTrackingLabelDescriptionLookup;
- /**
- * @param SnakFormatter $snakFormatter
- * @param UsageAccumulator $usageAccumulator
- * @param EntityIdParser $repoItemUriParser
- * @param UsageTrackingLanguageFallbackLabelDescriptionLookup
$usageTrackingLabelDescriptionLookup
- */
public function __construct(
SnakFormatter $snakFormatter,
UsageAccumulator $usageAccumulator,
@@ -99,9 +93,6 @@
return $this->snakFormatter->formatSnak( $snak );
}
- /**
- * @param EntityId $id
- */
private function addLabelUsage( EntityId $id ) {
// Just get the label from
UsageTrackingLanguageFallbackLabelDescriptionLookup::getLabel,
// which will record the appropriate usage(s) for us.
diff --git a/lib/includes/Store/CacheRetrievingEntityRevisionLookup.php
b/lib/includes/Store/CacheRetrievingEntityRevisionLookup.php
index 2913e1d..89bf411 100644
--- a/lib/includes/Store/CacheRetrievingEntityRevisionLookup.php
+++ b/lib/includes/Store/CacheRetrievingEntityRevisionLookup.php
@@ -30,10 +30,6 @@
*/
private $shouldVerifyRevision = false;
- /**
- * @param EntityRevisionCache $cache
- * @param EntityRevisionLookup $lookup
- */
public function __construct( EntityRevisionCache $cache,
EntityRevisionLookup $lookup ) {
$this->cache = $cache;
$this->lookup = $lookup;
diff --git a/lib/includes/Store/CachingEntityRevisionLookup.php
b/lib/includes/Store/CachingEntityRevisionLookup.php
index 3c50bbc..f1afd70 100644
--- a/lib/includes/Store/CachingEntityRevisionLookup.php
+++ b/lib/includes/Store/CachingEntityRevisionLookup.php
@@ -34,10 +34,6 @@
*/
private $shouldVerifyRevision = false;
- /**
- * @param EntityRevisionCache $entityRevisionCache
- * @param EntityRevisionLookup $entityRevisionLookup
- */
public function __construct(
EntityRevisionCache $entityRevisionCache,
EntityRevisionLookup $entityRevisionLookup
diff --git a/repo/Wikibase.hooks.php b/repo/Wikibase.hooks.php
index c157ab5..cfebf27 100644
--- a/repo/Wikibase.hooks.php
+++ b/repo/Wikibase.hooks.php
@@ -58,8 +58,8 @@
* Handler for the BeforePageDisplay hook, simply injects
wikibase.ui.entitysearch module
* replacing the native search box with the entity selector widget.
*
- * @param OutputPage $out
- * @param Skin $skin
+ * @param OutputPage &$out
+ * @param Skin &$skin
*/
public static function onBeforePageDisplay( OutputPage &$out, Skin
&$skin ) {
$out->addModules( 'wikibase.ui.entitysearch' );
@@ -68,8 +68,8 @@
/**
* Handler for the BeforePageDisplayMobile hook that adds the wikibase
mobile styles.
*
- * @param OutputPage $out
- * @param Skin $skin
+ * @param OutputPage &$out
+ * @param Skin &$skin
*/
public static function onBeforePageDisplayMobile( OutputPage &$out,
Skin &$skin ) {
$title = $out->getTitle();
@@ -436,8 +436,8 @@
* Alter the structured navigation links in SkinTemplates.
* @see
https://www.mediawiki.org/wiki/Manual:Hooks/SkinTemplateNavigation
*
- * @param SkinTemplate $skinTemplate
- * @param array $links
+ * @param SkinTemplate &$skinTemplate
+ * @param array &$links
*/
public static function onPageTabs( SkinTemplate &$skinTemplate, array
&$links ) {
$entityContentFactory =
WikibaseRepo::getDefaultInstance()->getEntityContentFactory();
diff --git a/repo/includes/Diff/DispatchingEntityDiffVisualizer.php
b/repo/includes/Diff/DispatchingEntityDiffVisualizer.php
index b784b1a..fb9c25d 100644
--- a/repo/includes/Diff/DispatchingEntityDiffVisualizer.php
+++ b/repo/includes/Diff/DispatchingEntityDiffVisualizer.php
@@ -17,9 +17,6 @@
*/
private $diffVisualizerFactory;
- /**
- * @param EntityDiffVisualizerFactory $diffVisualizerFactory
- */
public function __construct( EntityDiffVisualizerFactory
$diffVisualizerFactory ) {
$this->diffVisualizerFactory = $diffVisualizerFactory;
}
diff --git a/repo/includes/EditEntityFactory.php
b/repo/includes/EditEntityFactory.php
index 3fc1820..0bd44bf 100644
--- a/repo/includes/EditEntityFactory.php
+++ b/repo/includes/EditEntityFactory.php
@@ -53,15 +53,6 @@
*/
private $editFilterHookRunner;
- /**
- * @param EntityTitleStoreLookup $titleLookup
- * @param EntityRevisionLookup $entityLookup
- * @param EntityStore $entityStore
- * @param EntityPermissionChecker $permissionChecker
- * @param EntityDiffer $entityDiffer
- * @param EntityPatcher $entityPatcher
- * @param EditFilterHookRunner $editFilterHookRunner
- */
public function __construct(
EntityTitleStoreLookup $titleLookup,
EntityRevisionLookup $entityLookup,
diff --git a/repo/includes/Rdf/Values/ExternalIdentifierRdfBuilder.php
b/repo/includes/Rdf/Values/ExternalIdentifierRdfBuilder.php
index ebce921..758b4fe 100644
--- a/repo/includes/Rdf/Values/ExternalIdentifierRdfBuilder.php
+++ b/repo/includes/Rdf/Values/ExternalIdentifierRdfBuilder.php
@@ -27,12 +27,7 @@
*/
private $uriPatternProvider;
- /**
- * @param PropertyInfoProvider $uriPatternProvider
- */
- public function __construct(
- PropertyInfoProvider $uriPatternProvider
- ) {
+ public function __construct( PropertyInfoProvider $uriPatternProvider )
{
$this->uriPatternProvider = $uriPatternProvider;
}
diff --git a/repo/includes/WikibaseRepo.php b/repo/includes/WikibaseRepo.php
index 86041f2..ac500cc 100644
--- a/repo/includes/WikibaseRepo.php
+++ b/repo/includes/WikibaseRepo.php
@@ -488,12 +488,6 @@
);
}
- /**
- * @param SettingsArray $settings
- * @param DataTypeDefinitions $dataTypeDefinitions
- * @param EntityTypeDefinitions $entityTypeDefinitions
- * @param RepositoryDefinitions $repositoryDefinitions
- */
public function __construct(
SettingsArray $settings,
DataTypeDefinitions $dataTypeDefinitions,
diff --git a/repo/tests/phpunit/includes/Store/MockEntityIdPager.php
b/repo/tests/phpunit/includes/Store/MockEntityIdPager.php
index 5516926..439b365 100644
--- a/repo/tests/phpunit/includes/Store/MockEntityIdPager.php
+++ b/repo/tests/phpunit/includes/Store/MockEntityIdPager.php
@@ -21,9 +21,6 @@
*/
private $offset = 0;
- /**
- * @param EntityId $entityId
- */
public function addEntityId( EntityId $entityId ) {
$this->entityIds[] = $entityId;
}
--
To view, visit https://gerrit.wikimedia.org/r/403954
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I222660937fc7f3ce6a0ea5fbf7198199d6b08bef
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Thiemo Kreuz (WMDE) <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits