Since mediawiki-codesniffer v41 (T325201), the FunctionComment and Cleanup PropertyDocumentation sniffs are more lenient about allowing missing doc comments as long as information is provided by static types, which removes the main reason we disabled them in Wikibase (I believe). We should reenable the sniffs, to catch legitimate errors like the ones seen below, as well as to discover places where neither a doc comment nor a static type is present.
Acceptance Criteria:
- MediaWiki.Commenting.FunctionComment.ParamNameNoMatch sniff is enabled in Wikibase
- MediaWiki.Commenting.FunctionComment.ParamPassByReference sniff is enabled in Wikibase
- All violations of these rules are fixed
- Remove any comments that were added in change 1064919 and replace them with type hints
Notes:
- In most cases we’ll want to resolve errors by adding static types, not doc comments.
- Example of legitimate violations:
FILE: /var/www/html/wiki1/extensions/Wikibase/client/includes/Serializer/ClientEntitySerializer.php
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
36 | ERROR | Doc comment for parameter $filterLangCodes does not match actual variable name $entityIdParser (MediaWiki.Commenting.FunctionComment.ParamNameNoMatch)
37 | ERROR | Doc comment for parameter $termFallbackChains does not match actual variable name $filterLangCodes
| | (MediaWiki.Commenting.FunctionComment.ParamNameNoMatch)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FILE: /var/www/html/wiki1/extensions/Wikibase/client/includes/Store/DescriptionLookup.php
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
67 | ERROR | [x] Pass-by-reference for parameter $actualSources does not match pass-by-reference of variable name $actualSources
| | (MediaWiki.Commenting.FunctionComment.ParamPassByReference)
105 | ERROR | [x] Pass-by-reference for parameter $actualSource does not match pass-by-reference of variable name $actualSource
| | (MediaWiki.Commenting.FunctionComment.ParamPassByReference)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------