Add and fix various type hints in PHPDocs

Random fixes I collected the past weeks in my local dev
environment.

Change-Id: Ic8a6262fd28e05cb57335f2faf390a47ff97dbaa
This commit is contained in:
Thiemo Kreuz 2021-06-17 13:34:09 +02:00 committed by Thiemo Kreuz (WMDE)
parent 224fca0c6c
commit 51777ee8c1
5 changed files with 17 additions and 12 deletions

View file

@ -1255,9 +1255,9 @@ class Parser {
* '<element param="x">tag content</element>' ]
* @endcode
*
* @param array $elements List of element names. Comments are always extracted.
* @param string[] $elements List of element names. Comments are always extracted.
* @param string $text Source text string.
* @param array &$matches Out parameter, Array: extracted tags
* @param array[] &$matches Out parameter, Array: extracted tags
* @return string Stripped text
*/
public static function extractTagsAndParams( array $elements, $text, &$matches ) {

View file

@ -213,7 +213,7 @@ class ParserCache {
* Retrieve the ParserOutput from ParserCache, even if it's outdated.
* @param PageRecord $page
* @param ParserOptions $popts
* @return ParserOutput|bool False on failure
* @return ParserOutput|false
*/
public function getDirty( PageRecord $page, $popts ) {
$page->assertWiki( PageRecord::LOCAL );
@ -394,7 +394,7 @@ class ParserCache {
* @param ParserOptions $popts
* @param bool $useOutdated (default false)
*
* @return ParserOutput|bool False on failure
* @return ParserOutput|false
*/
public function get( PageRecord $page, $popts, $useOutdated = false ) {
$page->assertWiki( PageRecord::LOCAL );

View file

@ -36,7 +36,7 @@ class MalformedTitleException extends Exception implements ILocalizedException {
* @stable to call
* @param string $errorMessage Localisation message describing the error (since MW 1.26)
* @param string|null $titleText The invalid title text (since MW 1.26)
* @param string[] $errorMessageParameters Additional parameters for the error message.
* @param array $errorMessageParameters Additional parameters for the error message.
* $titleText will be appended if it's not null. (since MW 1.26)
*/
public function __construct(
@ -73,7 +73,7 @@ class MalformedTitleException extends Exception implements ILocalizedException {
/**
* @since 1.26
* @return string[]
* @return array
*/
public function getErrorMessageParameters() {
return $this->errorMessageParameters;

View file

@ -140,8 +140,8 @@ class UserEditTracker {
* Get the user's first edit timestamp
*
* @param UserIdentity $user
* @return string|bool Timestamp of first edit, or false for
* non-existent/anonymous user accounts.
* @return string|false Timestamp of first edit, or false for non-existent/anonymous user
* accounts.
*/
public function getFirstEditTimestamp( UserIdentity $user ) {
return $this->getUserEditTimestamp( $user, self::FIRST_EDIT );
@ -151,8 +151,8 @@ class UserEditTracker {
* Get the user's latest edit timestamp
*
* @param UserIdentity $user
* @return string|bool Timestamp of latest edit, or false for
* non-existent/anonymous user accounts.
* @return string|false Timestamp of latest edit, or false for non-existent/anonymous user
* accounts.
*/
public function getLatestEditTimestamp( UserIdentity $user ) {
return $this->getUserEditTimestamp( $user, self::LATEST_EDIT );
@ -163,8 +163,7 @@ class UserEditTracker {
*
* @param UserIdentity $user
* @param int $type either self::FIRST_EDIT or ::LATEST_EDIT
* @return string|bool Timestamp of edit, or false for
* non-existent/anonymous user accounts.
* @return string|false Timestamp of edit, or false for non-existent/anonymous user accounts.
*/
private function getUserEditTimestamp( UserIdentity $user, int $type ) {
if ( $user->getId() === 0 ) {

View file

@ -14,6 +14,12 @@ use Wikimedia\TestingAccessWrapper;
*/
class BlockUtilsTest extends MediaWikiUnitTestCase {
/**
* @param array $options
* @param UserFactory|null $userFactory
*
* @return BlockUtils
*/
private function getUtils(
array $options = [],
UserFactory $userFactory = null