From ca2d289c8907b56bf8c9aed6fa25b4da206cff91 Mon Sep 17 00:00:00 2001 From: thiemowmde Date: Tue, 19 Sep 2023 10:02:20 +0200 Subject: [PATCH] Many small fixes to incomplete/unspecific/broken PHPDoc comments E.g. adding missing types or fixing inconsistencies. This patch is exclusively about comments and should be fairly easy to review, I hope. It should be impossible such a patch can break anything. Mistakes like this happen because the relevant MediaWiki CodeSniffer sniff is disabled in this codebase. I would love to enable it at least partially, if possible. This is done in preparation. Change-Id: Ie6a676df1ac88eb65d1cb1b923e29d0e20d893e2 --- client/includes/ClientHooks.php | 5 +++-- client/includes/DataAccess/ParserFunctions/Runner.php | 3 ++- .../Scribunto/CachingFallbackBasedTermLookup.php | 2 +- client/includes/DataAccess/Scribunto/EntityAccessor.php | 2 +- client/includes/Hooks/ChangesListLinesHandler.php | 2 +- client/includes/Hooks/SkinAfterPortletHandler.php | 2 +- client/includes/Hooks/TrivialHookHandler.php | 2 +- client/includes/Hooks/WikibaseClientHookRunner.php | 3 ++- client/includes/Hooks/WikibaseHandleChangeHook.php | 4 +++- client/includes/Store/DescriptionLookup.php | 4 ++-- .../ParserFunctions/LanguageAwareRendererTest.php | 2 +- .../unit/includes/Hooks/ExtensionLoadHandlerTest.php | 2 +- data-access/src/DatabaseEntitySource.php | 2 +- .../tests/phpunit/InMemoryPrefetchingTermLookup.php | 4 ++-- lib/includes/Modules/SitesModuleBase.php | 1 + lib/includes/Serialization/SerializationModifier.php | 2 +- .../Sql/TypeDispatchingWikiPageEntityMetaDataAccessor.php | 2 +- .../data-model/src/Entity/SerializableEntityId.php | 1 + .../wikibase/data-model/src/Snak/PropertyValueSnak.php | 1 + .../Formatters/ItemPropertyIdHtmlLinkFormatterTest.php | 1 + lib/tests/phpunit/MockEntityRevisionLookup.php | 7 +++++-- lib/tests/phpunit/SimpleCacheTestCase.php | 2 +- lib/tests/phpunit/SimpleCacheWithBagOStuffTest.php | 1 + repo/includes/Content/EntityContent.php | 5 +++-- repo/includes/Content/EntityHandler.php | 6 +----- repo/includes/Content/PropertyContent.php | 2 +- .../Hooks/Helpers/UserPreferredContentLanguagesLookup.php | 2 +- .../Hooks/MakeGlobalVariablesScriptHookHandler.php | 2 +- repo/includes/ParserOutput/TermboxView.php | 4 +--- repo/includes/Parsers/MwEraParser.php | 2 +- repo/includes/RepoHooks.php | 4 ++-- repo/includes/Store/ItemTermsRebuilder.php | 2 +- .../phpunit/includes/Dumpers/JsonDumpGeneratorTest.php | 2 +- .../phpunit/includes/EntityModificationTestHelper.php | 2 +- .../includes/Hooks/LabelPrefetchHookHandlerTestBase.php | 2 -- .../phpunit/includes/Hooks/ShowSearchHitHandlerTest.php | 2 +- .../phpunit/includes/Store/Sql/WikiPageEntityStoreTest.php | 3 --- .../ImportFederatedPropertiesSampleDataTest.php | 4 ---- .../phpunit/maintenance/RebuildEntityQuantityUnitTest.php | 2 +- view/tests/phpunit/PropertyViewTest.php | 2 +- 40 files changed, 52 insertions(+), 53 deletions(-) diff --git a/client/includes/ClientHooks.php b/client/includes/ClientHooks.php index 6fa58714d28..df9e7dbbd0c 100644 --- a/client/includes/ClientHooks.php +++ b/client/includes/ClientHooks.php @@ -2,6 +2,7 @@ namespace Wikibase\Client; +use CirrusSearch\SearchConfig; use MediaWiki\MediaWikiServices; use MediaWiki\Title\Title; use Skin; @@ -165,7 +166,7 @@ public static function onGetDoubleUnderscoreIDs( &$doubleUnderscoreIDs ) { /** * Add morelikewithwikibase keyword. - * @param $config + * @param SearchConfig $config * @param array &$extraFeatures */ public static function onCirrusSearchAddQueryFeatures( @@ -260,7 +261,7 @@ function () { ); } - /** @param ContentLanguages[] $contentLanguages */ + /** @param ContentLanguages[] &$contentLanguages */ public static function onWikibaseContentLanguages( array &$contentLanguages ): void { if ( !WikibaseClient::getSettings()->getSetting( 'tmpEnableMulLanguageCode' ) ) { return; diff --git a/client/includes/DataAccess/ParserFunctions/Runner.php b/client/includes/DataAccess/ParserFunctions/Runner.php index 5e0e30596d8..0fd844680db 100644 --- a/client/includes/DataAccess/ParserFunctions/Runner.php +++ b/client/includes/DataAccess/ParserFunctions/Runner.php @@ -4,6 +4,7 @@ use Parser; use PPFrame; +use PPNode; use Wikibase\Client\DataAccess\DataAccessSnakFormatterFactory; use Wikibase\Client\WikibaseClient; use Wikibase\DataModel\Entity\EntityId; @@ -76,7 +77,7 @@ public function __construct( /** * @param Parser $parser * @param PPFrame $frame - * @param array $args + * @param PPNode[] $args * @param string $type One of DataAccessSnakFormatterFactory::TYPE_* * * @return array Wikitext in element 0, flags in named elements diff --git a/client/includes/DataAccess/Scribunto/CachingFallbackBasedTermLookup.php b/client/includes/DataAccess/Scribunto/CachingFallbackBasedTermLookup.php index 43e8475f300..4d430831f79 100644 --- a/client/includes/DataAccess/Scribunto/CachingFallbackBasedTermLookup.php +++ b/client/includes/DataAccess/Scribunto/CachingFallbackBasedTermLookup.php @@ -170,7 +170,7 @@ private function getLookup( Language $language ): LanguageFallbackLabelDescripti /** * @param EntityId $entityId * @param Language $language - * @param $termType + * @param string $termType * @return TermFallback|null */ private function lookupWithoutCache( EntityId $entityId, Language $language, $termType ): ?TermFallback { diff --git a/client/includes/DataAccess/Scribunto/EntityAccessor.php b/client/includes/DataAccess/Scribunto/EntityAccessor.php index 426775545e8..f4ce3b1330a 100644 --- a/client/includes/DataAccess/Scribunto/EntityAccessor.php +++ b/client/includes/DataAccess/Scribunto/EntityAccessor.php @@ -251,7 +251,7 @@ private function newClientStatementListSerializer() { /** * @see UnresolvedEntityRedirectException - * @param $prefixedEntityId + * @param string $prefixedEntityId */ private function logPossibleDoubleRedirect( $prefixedEntityId ) { $this->logger->info( 'Unresolved redirect encountered loading {prefixedEntityId}. This is typically cleaned up asynchronously.', diff --git a/client/includes/Hooks/ChangesListLinesHandler.php b/client/includes/Hooks/ChangesListLinesHandler.php index c6e4ed6a146..48d89589246 100644 --- a/client/includes/Hooks/ChangesListLinesHandler.php +++ b/client/includes/Hooks/ChangesListLinesHandler.php @@ -72,7 +72,7 @@ public static function factory( } /** - * @param OldChangesList &$changesList + * @param OldChangesList $changesList * @param string &$s * @param RecentChange $rc * @param string[] &$classes diff --git a/client/includes/Hooks/SkinAfterPortletHandler.php b/client/includes/Hooks/SkinAfterPortletHandler.php index b348e8cf154..e8c25df917a 100644 --- a/client/includes/Hooks/SkinAfterPortletHandler.php +++ b/client/includes/Hooks/SkinAfterPortletHandler.php @@ -50,7 +50,7 @@ public static function factory( /** * @param Skin $skin * @param string $portlet - * @param string $html + * @param string &$html */ public function onSkinAfterPortlet( $skin, $portlet, &$html ): void { if ( $portlet === 'lang' ) { diff --git a/client/includes/Hooks/TrivialHookHandler.php b/client/includes/Hooks/TrivialHookHandler.php index a04236a52c9..515c9a67b2b 100644 --- a/client/includes/Hooks/TrivialHookHandler.php +++ b/client/includes/Hooks/TrivialHookHandler.php @@ -99,7 +99,7 @@ public function onSearchDataForIndex2( } /** - * @param array $fields + * @param array &$fields * @param ParserOutput $parserOutput */ private function doSearchDataForIndex( array &$fields, ParserOutput $parserOutput ): void { diff --git a/client/includes/Hooks/WikibaseClientHookRunner.php b/client/includes/Hooks/WikibaseClientHookRunner.php index 7e829e3f75e..a7642369d17 100644 --- a/client/includes/Hooks/WikibaseClientHookRunner.php +++ b/client/includes/Hooks/WikibaseClientHookRunner.php @@ -3,6 +3,7 @@ namespace Wikibase\Client\Hooks; use MediaWiki\HookContainer\HookContainer; +use Wikibase\Lib\Changes\EntityChange; /** * Handle Changes' hooks @@ -24,7 +25,7 @@ public function __construct( HookContainer $hookContainer ) { /** * Hook runner for the 'WikibaseHandleChange' hook * - * @param $change + * @param EntityChange $change * @param array $rootJobParams * @return bool */ diff --git a/client/includes/Hooks/WikibaseHandleChangeHook.php b/client/includes/Hooks/WikibaseHandleChangeHook.php index d58e39903fb..06dbfb21339 100644 --- a/client/includes/Hooks/WikibaseHandleChangeHook.php +++ b/client/includes/Hooks/WikibaseHandleChangeHook.php @@ -2,6 +2,8 @@ namespace Wikibase\Client\Hooks; +use Wikibase\Lib\Changes\EntityChange; + /** * @license GPL-2.0-or-later */ @@ -10,7 +12,7 @@ interface WikibaseHandleChangeHook { /** * Hook runner for the 'WikibaseHandleChange' hook * - * @param $change + * @param EntityChange $change * @param array $rootJobParams * @return bool */ diff --git a/client/includes/Store/DescriptionLookup.php b/client/includes/Store/DescriptionLookup.php index d25b69d8ce2..aa468e8e9b9 100644 --- a/client/includes/Store/DescriptionLookup.php +++ b/client/includes/Store/DescriptionLookup.php @@ -64,7 +64,7 @@ public function __construct( * @param Title[] $titles Titles to look up (will be loaded). * @param array|string $sources One or both of the DescriptionLookup::SOURCE_* constants. * When an array is provided, the second element will be used as fallback. - * @param null $actualSources Will be set to an associative array of page ID => SOURCE_*, + * @param array|null &$actualSources Will be set to an associative array of page ID => SOURCE_*, * indicating where each description came from, or null if no description was found. * @return string[] Associative array of page ID => description. Pages with no description * will be omitted. @@ -102,7 +102,7 @@ public function getDescriptions( array $titles, $sources, &$actualSources = null * @param Title $title Title to look up (will be loaded). * @param array|string $sources One or both of the DescriptionLookup::SOURCE_* constants. * When an array is provided, the second element will be used as fallback. - * @param null $actualSource Will be set to one of the DescriptionLookup::SOURCE_* constants, + * @param string|null &$actualSource Will be set to one of the DescriptionLookup::SOURCE_* constants, * indicating where the description came from, or null if no description was found. * @return string|null The description, or null if none was found. */ diff --git a/client/tests/phpunit/unit/includes/DataAccess/ParserFunctions/LanguageAwareRendererTest.php b/client/tests/phpunit/unit/includes/DataAccess/ParserFunctions/LanguageAwareRendererTest.php index b4eb1b61bd2..baba10c4bf2 100644 --- a/client/tests/phpunit/unit/includes/DataAccess/ParserFunctions/LanguageAwareRendererTest.php +++ b/client/tests/phpunit/unit/includes/DataAccess/ParserFunctions/LanguageAwareRendererTest.php @@ -76,7 +76,7 @@ private function getRenderer( /** * Return a mock ParserOutput object that checks how many times it adds a tracking category. - * @param $num Number of times a tracking category should be added + * @param int $num Number of times a tracking category should be added * * @return ParserOutput */ diff --git a/client/tests/phpunit/unit/includes/Hooks/ExtensionLoadHandlerTest.php b/client/tests/phpunit/unit/includes/Hooks/ExtensionLoadHandlerTest.php index 306ab2f1dd3..207657680c0 100644 --- a/client/tests/phpunit/unit/includes/Hooks/ExtensionLoadHandlerTest.php +++ b/client/tests/phpunit/unit/includes/Hooks/ExtensionLoadHandlerTest.php @@ -20,7 +20,7 @@ class ExtensionLoadHandlerTest extends TestCase { /** - * @param &$hooks + * @param array &$hooks * * @return MockObject&HookContainer */ diff --git a/data-access/src/DatabaseEntitySource.php b/data-access/src/DatabaseEntitySource.php index 78d993fdc7c..a9cfbffb77f 100644 --- a/data-access/src/DatabaseEntitySource.php +++ b/data-access/src/DatabaseEntitySource.php @@ -56,7 +56,7 @@ class DatabaseEntitySource implements EntitySource { * @param string $name Unique name for the source for a given configuration / site, used for indexing the sources internally. * This does not have to be a wikiname, sitename or dbname, it can for example just be 'properties'. * @param string|false $databaseName The name of the database to use (use false for the local db) - * @param array $entityNamespaceIdsAndSlots Associative array indexed by entity type (string), values are + * @param array $entityNamespaceIdsAndSlots Associative array indexed by entity type (string), values are * array of form [ 'namespaceId' => int, 'slot' => string ] * @param string $conceptBaseUri * @param string $rdfNodeNamespacePrefix diff --git a/data-access/tests/phpunit/InMemoryPrefetchingTermLookup.php b/data-access/tests/phpunit/InMemoryPrefetchingTermLookup.php index c7011061ec8..e4f2698526d 100644 --- a/data-access/tests/phpunit/InMemoryPrefetchingTermLookup.php +++ b/data-access/tests/phpunit/InMemoryPrefetchingTermLookup.php @@ -49,8 +49,8 @@ public function setData( array $entityData ) { /** * @param array $entityIds - * @param array $termTypes if null, defaults to labels and descriptions only - * @param array $languageCodes if null, defaults to nothing + * @param array|null $termTypes if null, defaults to labels and descriptions only + * @param array|null $languageCodes if null, defaults to nothing * @note These defaults do not strictly obey the definitions of the interface * but instead are similar to the FakePrefetchingTermLookup */ diff --git a/lib/includes/Modules/SitesModuleBase.php b/lib/includes/Modules/SitesModuleBase.php index 92b5f718d20..5da9e2a149e 100644 --- a/lib/includes/Modules/SitesModuleBase.php +++ b/lib/includes/Modules/SitesModuleBase.php @@ -58,6 +58,7 @@ public function enableModuleContentVersion(): bool { /** * Get a setting from the repo or client settings, with repo overriding client. + * @return mixed */ public function getSetting( string $settingName ) { if ( $this->repoSettings->hasSetting( $settingName ) ) { diff --git a/lib/includes/Serialization/SerializationModifier.php b/lib/includes/Serialization/SerializationModifier.php index 0fcb1f643a2..0e330a7e844 100644 --- a/lib/includes/Serialization/SerializationModifier.php +++ b/lib/includes/Serialization/SerializationModifier.php @@ -38,7 +38,7 @@ public function modifyUsingCallbacks( array $array, array $modifications ): arra * Iterates the value and modifications and runs all the needed sub-modifications, * then runs the modifications of the current array level ('' key), if any. * - * @param mixed $value The value to modify (usually an array except on leaf nodes). + * @param mixed &$value The value to modify (usually an array except on leaf nodes). * @param array $modifications Modifications as returned by {@link unflattenPaths}. */ private function modifyUsingUnflattenedCallbacks( &$value, array $modifications ): void { diff --git a/lib/includes/Store/Sql/TypeDispatchingWikiPageEntityMetaDataAccessor.php b/lib/includes/Store/Sql/TypeDispatchingWikiPageEntityMetaDataAccessor.php index 33465a5c7ca..1b5d10f926f 100644 --- a/lib/includes/Store/Sql/TypeDispatchingWikiPageEntityMetaDataAccessor.php +++ b/lib/includes/Store/Sql/TypeDispatchingWikiPageEntityMetaDataAccessor.php @@ -45,7 +45,7 @@ class TypeDispatchingWikiPageEntityMetaDataAccessor implements WikiPageEntityMet * An associative array mapping entity types to instansiator callbacks. * Callback signature: function( $databaseName, $repositoryName ): WikiPageEntityMetaDataAccessor * Parameter Types: string|false $databaseName, string $repositoryName - * @param WikiPageEntityMetaDataAccessor $defaultAccessor, + * @param WikiPageEntityMetaDataAccessor $defaultAccessor * @param string|false $databaseName * @param string $repositoryName */ diff --git a/lib/packages/wikibase/data-model/src/Entity/SerializableEntityId.php b/lib/packages/wikibase/data-model/src/Entity/SerializableEntityId.php index 7b341d930e5..ac643d5749d 100644 --- a/lib/packages/wikibase/data-model/src/Entity/SerializableEntityId.php +++ b/lib/packages/wikibase/data-model/src/Entity/SerializableEntityId.php @@ -10,6 +10,7 @@ */ abstract class SerializableEntityId implements EntityId { + /** @var string */ protected $serialization; public const PATTERN = '/^[^:]+\z/'; diff --git a/lib/packages/wikibase/data-model/src/Snak/PropertyValueSnak.php b/lib/packages/wikibase/data-model/src/Snak/PropertyValueSnak.php index 424107e924f..e6b69655361 100644 --- a/lib/packages/wikibase/data-model/src/Snak/PropertyValueSnak.php +++ b/lib/packages/wikibase/data-model/src/Snak/PropertyValueSnak.php @@ -19,6 +19,7 @@ */ class PropertyValueSnak extends SnakObject { + /** @var DataValue */ protected $dataValue; /** diff --git a/lib/tests/phpunit/Formatters/ItemPropertyIdHtmlLinkFormatterTest.php b/lib/tests/phpunit/Formatters/ItemPropertyIdHtmlLinkFormatterTest.php index fc723917b4c..66909332f3e 100644 --- a/lib/tests/phpunit/Formatters/ItemPropertyIdHtmlLinkFormatterTest.php +++ b/lib/tests/phpunit/Formatters/ItemPropertyIdHtmlLinkFormatterTest.php @@ -609,6 +609,7 @@ private function givenPropertyDoesNotExist( $propertyId ) { /** * @param string $propertyId + * @return object */ private function givenPropertyExists( $propertyId ) { $title = $this->createMock( Title::class ); diff --git a/lib/tests/phpunit/MockEntityRevisionLookup.php b/lib/tests/phpunit/MockEntityRevisionLookup.php index 06fe26f2aac..fdf3788250d 100644 --- a/lib/tests/phpunit/MockEntityRevisionLookup.php +++ b/lib/tests/phpunit/MockEntityRevisionLookup.php @@ -8,6 +8,7 @@ use Wikibase\Lib\Store\EntityRevisionLookup; use Wikibase\Lib\Store\LatestRevisionIdResult; use Wikibase\Lib\Store\LookupConstants; +use Wikibase\Lib\Store\RedirectRevision; use Wikibase\Lib\Store\RevisionedUnresolvedRedirectException; use Wikibase\Lib\Store\StorageException; @@ -19,8 +20,10 @@ class MockEntityRevisionLookup implements EntityRevisionLookup { private $entities; /** - * @param [ Serialised EntityId ][ int $revisionId ][ RedirectEntityRevision $revision ] $redirects - * @param [ Serialised EntityId ][ int $revisionId ][ EntityRevision $revision ] $entities + * @param array $redirects + * [ Serialised EntityId ][ RedirectEntityRevision $revision ] + * @param array> $entities + * [ Serialised EntityId ][ int $revisionId ][ EntityRevision $revision ] */ public function __construct( array $redirects, array $entities ) { $this->redirects = $redirects; diff --git a/lib/tests/phpunit/SimpleCacheTestCase.php b/lib/tests/phpunit/SimpleCacheTestCase.php index 64466dabecd..b4be5ae416b 100644 --- a/lib/tests/phpunit/SimpleCacheTestCase.php +++ b/lib/tests/phpunit/SimpleCacheTestCase.php @@ -23,7 +23,7 @@ abstract class SimpleCacheTestCase extends TestCase { /** - * @var array with functionName => reason. + * @var array with functionName => reason. */ protected $skippedTests = []; diff --git a/lib/tests/phpunit/SimpleCacheWithBagOStuffTest.php b/lib/tests/phpunit/SimpleCacheWithBagOStuffTest.php index fb05ce567c7..c8e11b3dddf 100644 --- a/lib/tests/phpunit/SimpleCacheWithBagOStuffTest.php +++ b/lib/tests/phpunit/SimpleCacheWithBagOStuffTest.php @@ -16,6 +16,7 @@ */ class SimpleCacheWithBagOStuffTest extends SimpleCacheTestCase { + /** @var string[] */ protected $skippedTests = [ 'testClear' => 'Not possible to implement for BagOStuff', ]; diff --git a/repo/includes/Content/EntityContent.php b/repo/includes/Content/EntityContent.php index 874c8e5d51b..c09ccf83840 100644 --- a/repo/includes/Content/EntityContent.php +++ b/repo/includes/Content/EntityContent.php @@ -238,7 +238,8 @@ public function getTextForSummary( $maxLength = 250 ) { * Returns an array structure for the redirect represented by this EntityContent, if any. * * @note This may or may not be consistent with what EntityContentCodec does. - * It it intended to be used primarily for diffing. + * It is intended to be used primarily for diffing. + * @return string[] */ private function getRedirectData(): array { // NOTE: keep in sync with getPatchedRedirect @@ -261,7 +262,7 @@ private function getRedirectData(): array { * @note Avoid relying on this method! It bypasses EntityContentCodec, and does * not make any guarantees about the structure of the array returned. * - * @return array|EntityDocument An undefined data structure representing the content. This is + * @return string[]|EntityDocument An undefined data structure representing the content. This is * not guaranteed to conform to any serialization structure used in the database or externally. */ public function getNativeData() { diff --git a/repo/includes/Content/EntityHandler.php b/repo/includes/Content/EntityHandler.php index 1183fbb52e3..7e2048e6d83 100644 --- a/repo/includes/Content/EntityHandler.php +++ b/repo/includes/Content/EntityHandler.php @@ -166,11 +166,7 @@ public function showMissingEntity( Title $title, IContextSource $context ) { ] ) . "\n$text\n" ); } - /** - * @see ContentHandler::getDiffEngineClass - * - * @return string - */ + /** @inheritDoc */ protected function getDiffEngineClass() { return EntityContentDiffView::class; } diff --git a/repo/includes/Content/PropertyContent.php b/repo/includes/Content/PropertyContent.php index ac8f8b8abe7..d03f10aabd2 100644 --- a/repo/includes/Content/PropertyContent.php +++ b/repo/includes/Content/PropertyContent.php @@ -120,7 +120,7 @@ public function getEntityPageProperties() { * * Returns false if the entity does not have a DataType set. * - * @see Content::isValid() + * @inheritDoc */ public function isValid() { // TODO: provide a way to get the data type from the holder directly! diff --git a/repo/includes/Hooks/Helpers/UserPreferredContentLanguagesLookup.php b/repo/includes/Hooks/Helpers/UserPreferredContentLanguagesLookup.php index 4a0951bd8b1..b9dd80d4404 100644 --- a/repo/includes/Hooks/Helpers/UserPreferredContentLanguagesLookup.php +++ b/repo/includes/Hooks/Helpers/UserPreferredContentLanguagesLookup.php @@ -37,7 +37,7 @@ public function __construct( } /** - * @param $uiLanguage - user interface language; will be returned as the first language in the list if valid + * @param string $uiLanguage User interface language; will be returned as the first language in the list if valid * @param User $user * * @return array language codes diff --git a/repo/includes/Hooks/MakeGlobalVariablesScriptHookHandler.php b/repo/includes/Hooks/MakeGlobalVariablesScriptHookHandler.php index ef0ac02bed3..1ffdde5a9fa 100644 --- a/repo/includes/Hooks/MakeGlobalVariablesScriptHookHandler.php +++ b/repo/includes/Hooks/MakeGlobalVariablesScriptHookHandler.php @@ -102,7 +102,7 @@ public static function factory( } /** - * @param array $vars + * @param array &$vars * @param OutputPage $out */ public function onMakeGlobalVariablesScript( &$vars, $out ): void { diff --git a/repo/includes/ParserOutput/TermboxView.php b/repo/includes/ParserOutput/TermboxView.php index 76167d674db..d90885360ca 100644 --- a/repo/includes/ParserOutput/TermboxView.php +++ b/repo/includes/ParserOutput/TermboxView.php @@ -68,9 +68,7 @@ public function getTitleHtml( EntityId $entityId = null ) { return $this->textProvider->getEscaped( 'parentheses', [ $entityId->getSerialization() ] ); } - /** - * @see \Wikibase\View\ViewPlaceHolderEmitter - */ + /** @inheritDoc */ public function getPlaceholders( EntityDocument $entity, $revision, diff --git a/repo/includes/Parsers/MwEraParser.php b/repo/includes/Parsers/MwEraParser.php index e476ccb1845..5cdc994b9f8 100644 --- a/repo/includes/Parsers/MwEraParser.php +++ b/repo/includes/Parsers/MwEraParser.php @@ -103,7 +103,7 @@ private function parseEraWithMessage( string $value, string $msgText ): ?string /** * Transform the message to a pattern we can match era against. - * @param $msgText string + * @param string $msgText * @return string */ private function getRegexpFromMessageText( $msgText ) { diff --git a/repo/includes/RepoHooks.php b/repo/includes/RepoHooks.php index a0742fadf66..575938f0a53 100644 --- a/repo/includes/RepoHooks.php +++ b/repo/includes/RepoHooks.php @@ -1122,7 +1122,7 @@ public static function onRegistration() { * or the 'edit' rate limit if no 'create' limit is defined, * unless the 'wikibase-idgenerator' rate limit was itself customized. * - * @param array $rateLimits should be $wgRateLimits or a similar array + * @param array &$rateLimits should be $wgRateLimits or a similar array */ public static function inheritDefaultRateLimits( array &$rateLimits ) { if ( isset( $rateLimits['wikibase-idgenerator']['&inherit-create-edit'] ) ) { @@ -1160,7 +1160,7 @@ public static function onApiMainOnException( $apiMain, $e ) { $apiMain->getUser()->pingLimiter( RateLimitingIdGenerator::RATELIMIT_NAME, $idGeneratorInErrorPingLimiterValue ); } - /** @param ContentLanguages[] $contentLanguages */ + /** @param ContentLanguages[] &$contentLanguages */ public static function onWikibaseContentLanguages( array &$contentLanguages ): void { if ( !WikibaseRepo::getSettings()->getSetting( 'tmpEnableMulLanguageCode' ) ) { return; diff --git a/repo/includes/Store/ItemTermsRebuilder.php b/repo/includes/Store/ItemTermsRebuilder.php index 210f81d804d..399a51168c6 100644 --- a/repo/includes/Store/ItemTermsRebuilder.php +++ b/repo/includes/Store/ItemTermsRebuilder.php @@ -35,7 +35,7 @@ class ItemTermsRebuilder { /** * @param ItemTermStoreWriter $itemTermStoreWriter - * @param $itemIdIterable + * @param iterable $itemIdIterable * @param MessageReporter $progressReporter * @param MessageReporter $errorReporter * @param RepoDomainDb $db diff --git a/repo/tests/phpunit/includes/Dumpers/JsonDumpGeneratorTest.php b/repo/tests/phpunit/includes/Dumpers/JsonDumpGeneratorTest.php index 249ad4874c4..a7a16da07ec 100644 --- a/repo/tests/phpunit/includes/Dumpers/JsonDumpGeneratorTest.php +++ b/repo/tests/phpunit/includes/Dumpers/JsonDumpGeneratorTest.php @@ -145,7 +145,7 @@ protected function newDumpGenerator( array $ids = [], array $missingIds = [], ar * @param EntityId[] $ids * @param string $entityType * @param int $limit - * @param int $offset + * @param int &$offset * * @return EntityId[] */ diff --git a/repo/tests/phpunit/includes/EntityModificationTestHelper.php b/repo/tests/phpunit/includes/EntityModificationTestHelper.php index bddf5dacb48..f03e5f3a909 100644 --- a/repo/tests/phpunit/includes/EntityModificationTestHelper.php +++ b/repo/tests/phpunit/includes/EntityModificationTestHelper.php @@ -172,7 +172,7 @@ public function serializeEntity( EntityDocument $entity ) { * Strip any fields we will likely not have in the arrays that are provided as * expected values. This includes empty fields, and automatic id or hash fields. * - * @param array $data + * @param array &$data */ private function unsetSpuriousFieldsRecursively( array &$data ) { // unset empty fields diff --git a/repo/tests/phpunit/includes/Hooks/LabelPrefetchHookHandlerTestBase.php b/repo/tests/phpunit/includes/Hooks/LabelPrefetchHookHandlerTestBase.php index 124ac350806..87cb403dc0a 100644 --- a/repo/tests/phpunit/includes/Hooks/LabelPrefetchHookHandlerTestBase.php +++ b/repo/tests/phpunit/includes/Hooks/LabelPrefetchHookHandlerTestBase.php @@ -9,7 +9,6 @@ use Wikibase\DataModel\Entity\BasicEntityIdParser; use Wikibase\DataModel\Entity\EntityId; use Wikibase\DataModel\Entity\EntityIdParsingException; -use Wikibase\DataModel\Services\Lookup\EntityLookup; use Wikibase\DataModel\Services\Term\TermBuffer; use Wikibase\Lib\LanguageFallbackChainFactory; use Wikibase\Lib\Store\EntityIdLookup; @@ -55,7 +54,6 @@ public function titlesToIds( array $titles ) { * @param string[] $termTypes * @param string[] $languageCodes * @param PrefetchingTermLookup|null $prefetchingTermLookup - * @param EntityLookup|null $entityLookup * @param bool $federatedPropertiesEnabled * @return LabelPrefetchHookHandler */ diff --git a/repo/tests/phpunit/includes/Hooks/ShowSearchHitHandlerTest.php b/repo/tests/phpunit/includes/Hooks/ShowSearchHitHandlerTest.php index 873b51a7a14..752d5ebbf22 100644 --- a/repo/tests/phpunit/includes/Hooks/ShowSearchHitHandlerTest.php +++ b/repo/tests/phpunit/includes/Hooks/ShowSearchHitHandlerTest.php @@ -183,7 +183,7 @@ private function getMockFallbackChain( array $languages ) { } /** - * @param Item[] $entities Map ID -> Entity + * @param Item[]|null $entities Map ID -> Entity * @return EntityLookup */ private function getEntityLookup( array $entities = null ) { diff --git a/repo/tests/phpunit/includes/Store/Sql/WikiPageEntityStoreTest.php b/repo/tests/phpunit/includes/Store/Sql/WikiPageEntityStoreTest.php index b9219670d34..c138b662b3d 100644 --- a/repo/tests/phpunit/includes/Store/Sql/WikiPageEntityStoreTest.php +++ b/repo/tests/phpunit/includes/Store/Sql/WikiPageEntityStoreTest.php @@ -1082,9 +1082,6 @@ private function extractConcreteRevisionId( LatestRevisionIdResult $result ) { ->map(); } - /** - * @param $latestRevisionIdResult - */ private function assertNonexistentRevision( LatestRevisionIdResult $latestRevisionIdResult ) { $shouldNotBeCalled = function () { $this->fail( 'Not a nonexistent revision given' ); diff --git a/repo/tests/phpunit/maintenance/ImportFederatedPropertiesSampleDataTest.php b/repo/tests/phpunit/maintenance/ImportFederatedPropertiesSampleDataTest.php index c6aa44846a1..21b5394417d 100644 --- a/repo/tests/phpunit/maintenance/ImportFederatedPropertiesSampleDataTest.php +++ b/repo/tests/phpunit/maintenance/ImportFederatedPropertiesSampleDataTest.php @@ -39,10 +39,6 @@ public function testStoreEntityWithTermData() { $this->assertEquals( 'somedescription', $item->getDescriptions()->getByLanguage( 'en' )->getText() ); } - /** - * @param $dataFile - * @param $expectedDataLines - */ public function testGetDataToImport() { $dataFile = __DIR__ . '/../data/maintenance/federatedPropertiesTestDataFile.tsv'; $expectedDataLines = [ diff --git a/repo/tests/phpunit/maintenance/RebuildEntityQuantityUnitTest.php b/repo/tests/phpunit/maintenance/RebuildEntityQuantityUnitTest.php index f3bee6cbdaa..23d5585f083 100644 --- a/repo/tests/phpunit/maintenance/RebuildEntityQuantityUnitTest.php +++ b/repo/tests/phpunit/maintenance/RebuildEntityQuantityUnitTest.php @@ -71,7 +71,7 @@ protected function getMaintenanceClass() { } /** - * @param $unitValue + * @param string $unitValue * @return ItemId|null * @throws PermissionsError * @throws StorageException diff --git a/view/tests/phpunit/PropertyViewTest.php b/view/tests/phpunit/PropertyViewTest.php index cd8ffcccca9..57d70e66fdd 100644 --- a/view/tests/phpunit/PropertyViewTest.php +++ b/view/tests/phpunit/PropertyViewTest.php @@ -66,7 +66,7 @@ protected function makeEntityId( $n ) { * That is, this method should add any extra data from $entity to $entityData. * * @param EntityDocument $entity - * @param array $entityData + * @param array &$entityData */ protected function prepareEntityData( EntityDocument $entity, array &$entityData ) { /** @var Property $entity */