Fix mismatching type hints in PHPDoc tags

This is a collection of random bits from my local stashes. This patch
intentionally only touches comments, no code.

Notably:
* Use more specific string[] instead of array, if possible.
* Some comments mention "or null", but miss to list the type.

Change-Id: I712b28964f125c8e3dcb4e3fb993757a09f96644
This commit is contained in:
Thiemo Kreuz 2020-03-24 09:59:02 +01:00
parent b9f9edad6b
commit 1006aa41e6
9 changed files with 14 additions and 10 deletions

View file

@ -1789,7 +1789,7 @@ class Linker {
* Split a link trail, return the "inside" portion and the remainder of the trail
* as a two-element array
* @param string $trail
* @return array
* @return string[]
*/
public static function splitTrail( $trail ) {
$regex = MediaWikiServices::getInstance()->getContentLanguage()->linkTrail();

View file

@ -3914,7 +3914,7 @@ class OutputPage extends ContextSource {
* Transform "media" attribute based on request parameters
*
* @param string $media Current value of the "media" attribute
* @return string Modified value of the "media" attribute, or null to skip
* @return string|null Modified value of the "media" attribute, or null to skip
* this stylesheet
*/
public static function transformCssMedia( $media ) {

View file

@ -302,7 +302,7 @@ abstract class Action implements MessageLocalizer {
* must throw subclasses of ErrorPageError
* @since 1.17
*
* @param User $user The user to check, or null to use the context user
* @param User $user
* @throws UserBlockedError|ReadOnlyError|PermissionsError
*/
protected function checkCanExecute( User $user ) {

View file

@ -509,7 +509,7 @@ class RecentChange implements Taggable {
* @param bool $auto For automatic patrol
* @param string|string[]|null $tags Change tags to add to the patrol log entry
* ($user should be able to add the specified tags before this is called)
* @return array See doMarkPatrolled(), or null if $change is not an existing rc_id
* @return array[]|null See doMarkPatrolled(), or null if $change is not an existing rc_id
*/
public static function markPatrolled( $change, $auto = false, $tags = null ) {
wfDeprecated( __METHOD__, '1.35' );
@ -536,7 +536,7 @@ class RecentChange implements Taggable {
* @param bool $auto For automatic patrol
* @param string|string[]|null $tags Change tags to add to the patrol log entry
* ($user should be able to add the specified tags before this is called)
* @return array Array of permissions errors, see PermissionManager::getPermissionErrors()
* @return array[] Array of permissions errors, see PermissionManager::getPermissionErrors()
*/
public function doMarkPatrolled( User $user, $auto = false, $tags = null ) {
global $wgUseRCPatrol, $wgUseNPPatrol, $wgUseFilePatrol;

View file

@ -586,7 +586,7 @@ class WikiExporter {
/**
* @param IResultWrapper $resultset
* @return int the log_id value of the last item output, or null if none
* @return int|null the log_id value of the last item output, or null if none
*/
protected function outputLogStream( $resultset ) {
foreach ( $resultset as $row ) {

View file

@ -98,7 +98,7 @@ abstract class PrefixSearch {
* When implemented in a descendant class, receives an array of titles as strings and returns
* either an unmodified array or an array of Title objects corresponding to strings received.
*
* @param array $strings
* @param string[] $strings
*
* @return array
*/

View file

@ -52,8 +52,6 @@ class CommandFactory {
private $firejail;
/**
* Constructor
*
* @param array $limits See {@see Command::limits()}
* @param string|bool $cgroup See {@see Command::cgroup()}
* @param string|bool $restrictionMethod

View file

@ -1073,7 +1073,7 @@ class SpecialBlock extends FormSpecialPage {
* the wiki's content language
* @param bool $includeOther Whether to include the 'other' option in the list of
* suggestions
* @return array
* @return string[]
*/
public static function getSuggestedDurations( Language $lang = null, $includeOther = true ) {
$a = [];

View file

@ -6,6 +6,12 @@ namespace MediaWiki\Auth;
* @group AuthManager
*/
abstract class AuthenticationRequestTestCase extends \MediaWikiTestCase {
/**
* @param array $args
*
* @return AuthenticationRequest
*/
abstract protected function getInstance( array $args = [] );
/**