Fix more Squiz.Scope.MethodScope.Missing

Change-Id: If48a16c4c1139342d597c2f6204348c1070dfc71
This commit is contained in:
Reedy 2020-05-17 23:39:57 +01:00
parent 98a2ef8608
commit a5a6cc3495
11 changed files with 88 additions and 108 deletions

View file

@ -22,18 +22,8 @@
<exclude-pattern>includes/parser/Sanitizer.php</exclude-pattern>
<exclude-pattern>includes/filerepo/</exclude-pattern>
<exclude-pattern>includes/media/</exclude-pattern>
<exclude-pattern>includes/skins/SkinTemplate.php</exclude-pattern>
<exclude-pattern>includes/skins/Skin.php</exclude-pattern>
<exclude-pattern>includes/skins/QuickTemplate.php</exclude-pattern>
<exclude-pattern>includes/skins/BaseTemplate.php</exclude-pattern>
<exclude-pattern>includes/specials/</exclude-pattern>
<exclude-pattern>includes/user/User.php</exclude-pattern>
<exclude-pattern>includes/user/UserRightsProxy.php</exclude-pattern>
<exclude-pattern>includes/user/UserArrayFromResult.php</exclude-pattern>
<exclude-pattern>includes/user/UserArray.php</exclude-pattern>
<exclude-pattern>includes/search/SearchMySQL.php</exclude-pattern>
<exclude-pattern>includes/search/SearchEngine.php</exclude-pattern>
<exclude-pattern>includes/search/SearchHighlighter.php</exclude-pattern>
</rule>
<!-- See T238572 -->
<rule ref="MediaWiki.Commenting.FunctionComment.MissingParamTag">

View file

@ -275,7 +275,7 @@ abstract class SearchEngine {
* @param int $limit
* @param int $offset
*/
function setLimitOffset( $limit, $offset = 0 ) {
public function setLimitOffset( $limit, $offset = 0 ) {
$this->limit = intval( $limit );
$this->offset = intval( $offset );
}
@ -286,7 +286,7 @@ abstract class SearchEngine {
*
* @param int[]|null $namespaces
*/
function setNamespaces( $namespaces ) {
public function setNamespaces( $namespaces ) {
if ( $namespaces ) {
// Filter namespaces to only keep valid ones
$validNs = MediaWikiServices::getInstance()->getSearchEngineConfig()->searchableNamespaces();
@ -306,7 +306,7 @@ abstract class SearchEngine {
*
* @param bool $showSuggestion Should the searcher try to build suggestions
*/
function setShowSuggestion( $showSuggestion ) {
public function setShowSuggestion( $showSuggestion ) {
$this->showSuggestion = $showSuggestion;
}
@ -356,7 +356,7 @@ abstract class SearchEngine {
* @param string $query
* @return string
*/
function replacePrefixes( $query ) {
public function replacePrefixes( $query ) {
return $query;
}
@ -476,7 +476,7 @@ abstract class SearchEngine {
* @param int $id Page id that was deleted
* @param string $title Title of page that was deleted
*/
function delete( $id, $title ) {
public function delete( $id, $title ) {
// no-op
}

View file

@ -310,7 +310,7 @@ class SearchHighlighter {
* @param int &$count
* @param string $text
*/
function splitAndAdd( &$extracts, &$count, $text ) {
private function splitAndAdd( &$extracts, &$count, $text ) {
$split = explode( "\n", $this->mCleanWikitext ? $this->removeWiki( $text ) : $text );
foreach ( $split as $line ) {
$tt = trim( $line );
@ -326,7 +326,7 @@ class SearchHighlighter {
* @param array $matches
* @return string
*/
function caseCallback( $matches ) {
private function caseCallback( $matches ) {
if ( strlen( $matches[0] ) > 1 ) {
$contLang = MediaWikiServices::getInstance()->getContentLanguage();
return '[' . $contLang->lc( $matches[0] ) .
@ -346,7 +346,7 @@ class SearchHighlighter {
* @param int|null &$posEnd (out) actual end position
* @return string
*/
function extract( $text, $start, $end, &$posStart = null, &$posEnd = null ) {
private function extract( $text, $start, $end, &$posStart = null, &$posEnd = null ) {
if ( $start != 0 ) {
$start = $this->position( $text, $start, 1 );
}
@ -378,7 +378,7 @@ class SearchHighlighter {
* @param int $offset Offset to found index
* @return int Nearest nonletter index, or beginning of utf8 char if none
*/
function position( $text, $point, $offset = 0 ) {
private function position( $text, $point, $offset = 0 ) {
$tolerance = 10;
$s = max( 0, $point - $tolerance );
$l = min( strlen( $text ), $point + $tolerance ) - $s;
@ -419,7 +419,7 @@ class SearchHighlighter {
* @param array &$offsets Map of starting points of snippets
* @protected
*/
function process( $pattern, $extracts, &$linesleft, &$contextchars, &$out, &$offsets ) {
private function process( $pattern, $extracts, &$linesleft, &$contextchars, &$out, &$offsets ) {
if ( $linesleft == 0 ) {
return; // nothing to do
}
@ -462,7 +462,7 @@ class SearchHighlighter {
* @param string $text
* @return mixed
*/
function removeWiki( $text ) {
private function removeWiki( $text ) {
$text = preg_replace( "/\\{\\{([^|]+?)\\}\\}/", "", $text );
$text = preg_replace( "/\\{\\{([^|]+\\|)(.*?)\\}\\}/", "\\2", $text );
$text = preg_replace( "/\\[\\[([^|]+?)\\]\\]/", "\\1", $text );
@ -490,7 +490,7 @@ class SearchHighlighter {
* @param array $matches
* @return string
*/
function linkReplace( $matches ) {
private function linkReplace( $matches ) {
$colon = strpos( $matches[1], ':' );
if ( $colon === false ) {
return $matches[2]; // replace with caption

View file

@ -237,7 +237,7 @@ class SearchMySQL extends SearchDatabase {
* @param array &$query
* @since 1.18 (changed)
*/
function queryNamespaces( &$query ) {
private function queryNamespaces( &$query ) {
if ( is_array( $this->namespaces ) ) {
if ( count( $this->namespaces ) === 0 ) {
$this->namespaces[] = '0';
@ -378,7 +378,7 @@ class SearchMySQL extends SearchDatabase {
* @param int $id Page id that was deleted
* @param string $title Title of page that was deleted
*/
function delete( $id, $title ) {
public function delete( $id, $title ) {
$dbw = $this->lb->getConnectionRef( DB_MASTER );
$dbw->delete( 'searchindex', [ 'si_page' => $id ], __METHOD__ );
}
@ -389,7 +389,7 @@ class SearchMySQL extends SearchDatabase {
* @param string $string
* @return mixed|string
*/
function normalizeText( $string ) {
public function normalizeText( $string ) {
$out = parent::normalizeText( $string );
// MySQL fulltext index doesn't grok utf-8, so we

View file

@ -39,14 +39,14 @@ abstract class BaseTemplate extends QuickTemplate {
return $this->getSkin()->msg( $name, ...$params );
}
function msg( $str ) {
public function msg( $str ) {
echo $this->getMsg( $str )->escaped();
}
/**
* @deprecated since 1.33 Use ->msg() or ->getMsg() instead.
*/
function msgWiki( $str ) {
public function msgWiki( $str ) {
wfDeprecated( __METHOD__, '1.33' );
echo $this->getMsg( $str )->parseAsBlock();
}
@ -246,7 +246,7 @@ abstract class BaseTemplate extends QuickTemplate {
* @deprecated since 1.35 use Skin::makeLink
* @return string
*/
function makeLink( $key, $item, $options = [] ) {
protected function makeLink( $key, $item, $options = [] ) {
return $this->getSkin()->makeLink( $key, $item, $options );
}
@ -254,21 +254,21 @@ abstract class BaseTemplate extends QuickTemplate {
* @deprecated since 1.35 use Skin::makeListItem
* @return string
*/
function makeListItem( $key, $item, $options = [] ) {
public function makeListItem( $key, $item, $options = [] ) {
return $this->getSkin()->makeListItem( $key, $item, $options );
}
/**
* @deprecated since 1.35 use Skin::makeSearchInput
*/
function makeSearchInput( $attrs = [] ) {
protected function makeSearchInput( $attrs = [] ) {
return $this->getSkin()->makeSearchInput( $attrs );
}
/**
* @deprecated since 1.35 use Skin::makeSearchButton
*/
function makeSearchButton( $mode, $attrs = [] ) {
protected function makeSearchButton( $mode, $attrs = [] ) {
return $this->getSkin()->makeSearchButton( $mode, $attrs );
}
@ -281,7 +281,7 @@ abstract class BaseTemplate extends QuickTemplate {
* @param string|null $option
* @return array|mixed
*/
function getFooterLinks( $option = null ) {
protected function getFooterLinks( $option = null ) {
$footerlinks = $this->get( 'footerlinks' );
// Reduce footer links down to only those which are being used
@ -319,7 +319,7 @@ abstract class BaseTemplate extends QuickTemplate {
* @deprecated 1.35 read FooterIcons from getConfig instead.
* @return array
*/
function getFooterIcons( $option = null ) {
protected function getFooterIcons( $option = null ) {
// Generate additional footer icons
$footericons = $this->get( 'footericons' );
@ -446,7 +446,7 @@ abstract class BaseTemplate extends QuickTemplate {
/**
* Output getTrail
*/
function printTrail() {
protected function printTrail() {
echo $this->getTrail();
}

View file

@ -88,28 +88,25 @@ abstract class QuickTemplate {
abstract public function execute();
/**
* @private
* @param string $str
* @suppress SecurityCheck-DoubleEscaped $this->data can be either
*/
function text( $str ) {
protected function text( $str ) {
echo htmlspecialchars( $this->data[$str] );
}
/**
* @private
* @param string $str
* @suppress SecurityCheck-XSS phan-taint-check cannot tell if $str is pre-escaped
*/
function html( $str ) {
public function html( $str ) {
echo $this->data[$str];
}
/**
* @private
* @param string $msgKey
*/
function msg( $msgKey ) {
public function msg( $msgKey ) {
echo htmlspecialchars( wfMessage( $msgKey )->text() );
}
@ -118,7 +115,7 @@ abstract class QuickTemplate {
* @deprecated since 1.33 Use ->msg() instead.
* @param string $msgKey
*/
function msgWiki( $msgKey ) {
public function msgWiki( $msgKey ) {
wfDeprecated( __METHOD__, '1.33' );
global $wgOut;
@ -127,21 +124,18 @@ abstract class QuickTemplate {
}
/**
* @private
* @param string $str
* @return bool
*/
function haveData( $str ) {
private function haveData( $str ) {
return isset( $this->data[$str] );
}
/**
* @private
*
* @param string $msgKey
* @return bool
*/
function haveMsg( $msgKey ) {
protected function haveMsg( $msgKey ) {
$msg = wfMessage( $msgKey );
return $msg->exists() && !$msg->isDisabled();
}

View file

@ -55,7 +55,7 @@ abstract class Skin extends ContextSource {
* Fetch the set of available skins.
* @return array Associative array of strings
*/
static function getSkinNames() {
public static function getSkinNames() {
$skinFactory = MediaWikiServices::getInstance()->getSkinFactory();
return $skinFactory->getSkinNames();
}
@ -92,7 +92,7 @@ abstract class Skin extends ContextSource {
* @param string $key 'monobook', 'vector', etc.
* @return string
*/
static function normalizeKey( $key ) {
public static function normalizeKey( $key ) {
global $wgDefaultSkin, $wgFallbackSkin;
$skinNames = self::getSkinNames();
@ -378,7 +378,7 @@ abstract class Skin extends ContextSource {
/**
* Outputs the HTML generated by other functions.
*/
abstract function outputPage();
abstract public function outputPage();
/**
* @param array $data
@ -424,7 +424,7 @@ abstract class Skin extends ContextSource {
* @param Title $title
* @return string
*/
function getPageClasses( $title ) {
public function getPageClasses( $title ) {
$numeric = 'ns-' . $title->getNamespace();
$user = $this->getUser();
@ -478,7 +478,7 @@ abstract class Skin extends ContextSource {
* @param OutputPage $out
* @param array &$bodyAttrs
*/
function addToBodyAttributes( $out, &$bodyAttrs ) {
public function addToBodyAttributes( $out, &$bodyAttrs ) {
// does nothing by default
}
@ -487,7 +487,7 @@ abstract class Skin extends ContextSource {
* Please use ResourceLoaderSkinModule::getAvailableLogos
* @return string
*/
function getLogo() {
protected function getLogo() {
return ResourceLoaderSkinModule::getAvailableLogos( $this->getConfig() )[ '1x' ];
}
@ -507,7 +507,7 @@ abstract class Skin extends ContextSource {
/**
* @return string HTML
*/
function getCategoryLinks() {
public function getCategoryLinks() {
$out = $this->getOutput();
$allCats = $out->getCategoryLinks();
$linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
@ -574,7 +574,7 @@ abstract class Skin extends ContextSource {
* @param array $tree Categories tree returned by Title::getParentCategoryTree
* @return string Separated by &gt;, terminate with "\n"
*/
function drawCategoryBrowser( $tree ) {
protected function drawCategoryBrowser( $tree ) {
$return = '';
$linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
@ -598,7 +598,7 @@ abstract class Skin extends ContextSource {
/**
* @return string HTML
*/
function getCategories() {
public function getCategories() {
$out = $this->getOutput();
$catlinks = $this->getCategoryLinks();
@ -668,7 +668,7 @@ abstract class Skin extends ContextSource {
*
* @return string|WrappedStringList HTML containing scripts to put before `</body>`
*/
function bottomScripts() {
public function bottomScripts() {
// TODO and the suckage continues. This function is really just a wrapper around
// OutputPage::getBottomScripts() which takes a Skin param. This should be cleaned
// up at some point
@ -690,7 +690,7 @@ abstract class Skin extends ContextSource {
*
* @return string HTML text with an URL
*/
function printSource() {
public function printSource() {
$oldid = $this->getOutput()->getRevisionId();
if ( $oldid ) {
$canonicalUrl = $this->getTitle()->getCanonicalURL( 'oldid=' . $oldid );
@ -708,7 +708,7 @@ abstract class Skin extends ContextSource {
/**
* @return string HTML
*/
function getUndeleteLink() {
public function getUndeleteLink() {
$action = $this->getRequest()->getVal( 'action', 'view' );
$title = $this->getTitle();
$linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
@ -756,7 +756,7 @@ abstract class Skin extends ContextSource {
* @param OutputPage|null $out Defaults to $this->getOutput() if left as null
* @return string
*/
function subPageSubtitle( $out = null ) {
public function subPageSubtitle( $out = null ) {
$linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
if ( $out === null ) {
$out = $this->getOutput();
@ -815,7 +815,7 @@ abstract class Skin extends ContextSource {
/**
* @return string
*/
function getSearchLink() {
protected function getSearchLink() {
$searchPage = SpecialPage::getTitleFor( 'Search' );
return $searchPage->getLocalURL();
}
@ -824,7 +824,7 @@ abstract class Skin extends ContextSource {
* @param string $type
* @return string
*/
function getCopyright( $type = 'detect' ) {
public function getCopyright( $type = 'detect' ) {
$linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
if ( $type == 'detect' ) {
if ( !$this->getOutput()->isRevisionCurrent()
@ -867,7 +867,7 @@ abstract class Skin extends ContextSource {
/**
* @return null|string
*/
function getCopyrightIcon() {
protected function getCopyrightIcon() {
$out = '';
$config = $this->getConfig();
@ -897,7 +897,7 @@ abstract class Skin extends ContextSource {
* Gets the powered by MediaWiki icon.
* @return string
*/
function getPoweredBy() {
protected function getPoweredBy() {
$resourceBasePath = $this->getConfig()->get( 'ResourceBasePath' );
$url1 = htmlspecialchars(
"$resourceBasePath/resources/assets/poweredby_mediawiki_88x31.png"
@ -949,7 +949,7 @@ abstract class Skin extends ContextSource {
* @param string $align
* @return string
*/
function logoText( $align = '' ) {
public function logoText( $align = '' ) {
if ( $align != '' ) {
$a = " style='float: {$align};'";
} else {
@ -961,9 +961,7 @@ abstract class Skin extends ContextSource {
$url = ( is_object( $mptitle ) ? htmlspecialchars( $mptitle->getLocalURL() ) : '' );
$logourl = $this->getLogo();
$s = "<a href='{$url}'><img{$a} src='{$logourl}' alt='[{$mp}]' /></a>";
return $s;
return "<a href='{$url}'><img{$a} src='{$logourl}' alt='[{$mp}]' /></a>";
}
/**
@ -974,7 +972,7 @@ abstract class Skin extends ContextSource {
* a text-only footericon.
* @return string HTML
*/
function makeFooterIcon( $icon, $withImage = 'withImage' ) {
public function makeFooterIcon( $icon, $withImage = 'withImage' ) {
if ( is_string( $icon ) ) {
$html = $icon;
} else { // Assuming array
@ -999,7 +997,7 @@ abstract class Skin extends ContextSource {
* Gets the link to the wiki's main page.
* @return string
*/
function mainPageLink() {
public function mainPageLink() {
$linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
$s = $linkRenderer->makeKnownLink(
Title::newMainPage(),
@ -1088,7 +1086,7 @@ abstract class Skin extends ContextSource {
* Gets the link to the wiki's privacy policy page.
* @return string HTML
*/
function privacyLink() {
public function privacyLink() {
return $this->footerLink( 'privacy', 'privacypage' );
}
@ -1096,7 +1094,7 @@ abstract class Skin extends ContextSource {
* Gets the link to the wiki's about page.
* @return string HTML
*/
function aboutLink() {
public function aboutLink() {
return $this->footerLink( 'aboutsite', 'aboutpage' );
}
@ -1104,7 +1102,7 @@ abstract class Skin extends ContextSource {
* Gets the link to the wiki's general disclaimers page.
* @return string HTML
*/
function disclaimerLink() {
public function disclaimerLink() {
return $this->footerLink( 'disclaimers', 'disclaimerpage' );
}
@ -1115,7 +1113,7 @@ abstract class Skin extends ContextSource {
* @return array
* @private
*/
function editUrlOptions() {
public function editUrlOptions() {
$options = [ 'action' => 'edit' ];
if ( !$this->getOutput()->isRevisionCurrent() ) {
@ -1129,7 +1127,7 @@ abstract class Skin extends ContextSource {
* @param User|int $id
* @return bool
*/
function showEmailUser( $id ) {
public function showEmailUser( $id ) {
if ( $id instanceof User ) {
$targetUser = $id;
} else {
@ -1153,7 +1151,7 @@ abstract class Skin extends ContextSource {
* @return string The fully resolved style path URL
* @throws MWException
*/
function getSkinStylePath( $name ) {
public function getSkinStylePath( $name ) {
if ( $this->stylename === null ) {
$class = static::class;
throw new MWException( "$class::\$stylename must be set to use getSkinStylePath()" );
@ -1168,7 +1166,7 @@ abstract class Skin extends ContextSource {
* @param string|array $urlaction
* @return string
*/
static function makeMainPageUrl( $urlaction = '' ) {
public static function makeMainPageUrl( $urlaction = '' ) {
$title = Title::newMainPage();
self::checkTitle( $title, '' );
@ -1186,7 +1184,7 @@ abstract class Skin extends ContextSource {
* @param string|null $proto Protocol to use or null for a local URL
* @return string
*/
static function makeSpecialUrl( $name, $urlaction = '', $proto = null ) {
public static function makeSpecialUrl( $name, $urlaction = '', $proto = null ) {
$title = SpecialPage::getSafeTitleFor( $name );
if ( $proto === null ) {
return $title->getLocalURL( $urlaction );
@ -1201,7 +1199,7 @@ abstract class Skin extends ContextSource {
* @param string|array $urlaction
* @return string
*/
static function makeSpecialUrlSubpage( $name, $subpage, $urlaction = '' ) {
public static function makeSpecialUrlSubpage( $name, $subpage, $urlaction = '' ) {
$title = SpecialPage::getSafeTitleFor( $name, $subpage );
return $title->getLocalURL( $urlaction );
}
@ -1212,7 +1210,7 @@ abstract class Skin extends ContextSource {
* @return string
* @deprecated since 1.35, no longer used
*/
static function makeI18nUrl( $name, $urlaction = '' ) {
public static function makeI18nUrl( $name, $urlaction = '' ) {
wfDeprecated( __METHOD__, '1.35' );
$title = Title::newFromText( wfMessage( $name )->inContentLanguage()->text() );
self::checkTitle( $title, $name );
@ -1224,7 +1222,7 @@ abstract class Skin extends ContextSource {
* @param string|array $urlaction
* @return string
*/
static function makeUrl( $name, $urlaction = '' ) {
public static function makeUrl( $name, $urlaction = '' ) {
$title = Title::newFromText( $name );
self::checkTitle( $title, $name );
@ -1237,7 +1235,7 @@ abstract class Skin extends ContextSource {
* @param string $name
* @return string URL
*/
static function makeInternalOrExternalUrl( $name ) {
public static function makeInternalOrExternalUrl( $name ) {
if ( preg_match( '/^(?i:' . wfUrlProtocols() . ')/', $name ) ) {
return $name;
} else {
@ -1253,7 +1251,7 @@ abstract class Skin extends ContextSource {
* @return string
* @deprecated since 1.35, no longer used
*/
static function makeNSUrl( $name, $urlaction = '', $namespace = NS_MAIN ) {
public static function makeNSUrl( $name, $urlaction = '', $namespace = NS_MAIN ) {
wfDeprecated( __METHOD__, '1.35' );
$title = Title::makeTitleSafe( $namespace, $name );
self::checkTitle( $title, $name );
@ -1267,7 +1265,7 @@ abstract class Skin extends ContextSource {
* @param string|array $urlaction
* @return array
*/
static function makeUrlDetails( $name, $urlaction = '' ) {
protected static function makeUrlDetails( $name, $urlaction = '' ) {
$title = Title::newFromText( $name );
self::checkTitle( $title, $name );
@ -1283,7 +1281,7 @@ abstract class Skin extends ContextSource {
* @param string|array $urlaction
* @return array
*/
static function makeKnownUrlDetails( $name, $urlaction = '' ) {
protected static function makeKnownUrlDetails( $name, $urlaction = '' ) {
$title = Title::newFromText( $name );
self::checkTitle( $title, $name );
@ -1299,7 +1297,7 @@ abstract class Skin extends ContextSource {
* @param Title &$title
* @param string $name
*/
static function checkTitle( &$title, $name ) {
public static function checkTitle( &$title, $name ) {
if ( !is_object( $title ) ) {
$title = Title::newFromText( $name );
if ( !is_object( $title ) ) {
@ -1389,7 +1387,7 @@ abstract class Skin extends ContextSource {
* @param string $text
* @return array
*/
function addToSidebarPlain( &$bar, $text ) {
public function addToSidebarPlain( &$bar, $text ) {
$lines = explode( "\n", $text );
$heading = '';

View file

@ -235,7 +235,7 @@ class SkinTemplate extends Skin {
/**
* Initialize various variables and generate the template
*/
function outputPage() {
public function outputPage() {
Profiler::instance()->setAllowOutput();
$out = $this->getOutput();
@ -664,9 +664,8 @@ class SkinTemplate extends Skin {
*
* @param string $name Language name, e.g. "English" or "español"
* @return string
* @private
*/
function formatLanguageName( $name ) {
private function formatLanguageName( $name ) {
return $this->getLanguage()->ucfirst( $name );
}
@ -689,9 +688,8 @@ class SkinTemplate extends Skin {
* For the base class, assume strings all around.
*
* @param string $str
* @private
*/
function printOrError( $str ) {
private function printOrError( $str ) {
echo $str;
}
@ -704,7 +702,7 @@ class SkinTemplate extends Skin {
* a reason it can't output one of the two modes.
* @return bool
*/
function useCombinedLoginLink() {
private function useCombinedLoginLink() {
global $wgUseCombinedLoginLink;
return $wgUseCombinedLoginLink;
}
@ -890,7 +888,7 @@ class SkinTemplate extends Skin {
*
* @return array
*/
function tabAction( $title, $message, $selected, $query = '', $checkEdit = false ) {
public function tabAction( $title, $message, $selected, $query = '', $checkEdit = false ) {
$classes = [];
if ( $selected ) {
$classes[] = 'selected';
@ -951,7 +949,7 @@ class SkinTemplate extends Skin {
* @param string|array $urlaction
* @return array
*/
function makeTalkUrlDetails( $name, $urlaction = '' ) {
private function makeTalkUrlDetails( $name, $urlaction = '' ) {
$title = Title::newFromText( $name );
if ( !is_object( $title ) ) {
throw new MWException( __METHOD__ . " given invalid pagename $name" );
@ -970,7 +968,7 @@ class SkinTemplate extends Skin {
* @param string|array $urlaction
* @return array
*/
function makeArticleUrlDetails( $name, $urlaction = '' ) {
public function makeArticleUrlDetails( $name, $urlaction = '' ) {
wfDeprecated( __METHOD__, '1.35' );
$title = Title::newFromText( $name );
$title = $title->getSubjectPage();

View file

@ -27,7 +27,7 @@ abstract class UserArray implements Iterator {
* @param IResultWrapper $res
* @return UserArrayFromResult
*/
static function newFromResult( $res ) {
public static function newFromResult( $res ) {
$userArray = null;
if ( !Hooks::run( 'UserArrayFromResult', [ &$userArray, $res ] ) ) {
return null;
@ -39,7 +39,7 @@ abstract class UserArray implements Iterator {
* @param array $ids
* @return UserArrayFromResult|ArrayIterator
*/
static function newFromIDs( $ids ) {
public static function newFromIDs( $ids ) {
$ids = array_map( 'intval', (array)$ids ); // paranoia
if ( !$ids ) {
// Database::select() doesn't like empty arrays
@ -63,7 +63,7 @@ abstract class UserArray implements Iterator {
* @param array $names
* @return UserArrayFromResult|ArrayIterator
*/
static function newFromNames( $names ) {
public static function newFromNames( $names ) {
$names = array_map( 'strval', (array)$names ); // paranoia
if ( !$names ) {
// Database::select() doesn't like empty arrays

View file

@ -63,21 +63,21 @@ class UserArrayFromResult extends UserArray implements Countable {
/**
* @return User
*/
function current() {
public function current() {
return $this->current;
}
function key() {
public function key() {
return $this->key;
}
function next() {
public function next() {
$row = $this->res->next();
$this->setCurrent( $row );
$this->key++;
}
function rewind() {
public function rewind() {
$this->res->rewind();
$this->key = 0;
$this->setCurrent( $this->res->current() );
@ -86,7 +86,7 @@ class UserArrayFromResult extends UserArray implements Countable {
/**
* @return bool
*/
function valid() {
public function valid() {
return $this->current !== false;
}
}

View file

@ -196,7 +196,7 @@ class UserRightsProxy {
* Replaces User::getUserGroups()
* @return array
*/
function getGroups() {
public function getGroups() {
return array_keys( self::getGroupMemberships() );
}
@ -206,7 +206,7 @@ class UserRightsProxy {
* @return array
* @since 1.29
*/
function getGroupMemberships() {
public function getGroupMemberships() {
return UserGroupMembership::getMembershipsForUser( $this->id, $this->db );
}
@ -217,7 +217,7 @@ class UserRightsProxy {
* @param string|null $expiry
* @return bool
*/
function addGroup( $group, $expiry = null ) {
public function addGroup( $group, $expiry = null ) {
if ( $expiry ) {
$expiry = wfTimestamp( TS_MW, $expiry );
}
@ -232,7 +232,7 @@ class UserRightsProxy {
* @param string $group
* @return bool
*/
function removeGroup( $group ) {
public function removeGroup( $group ) {
$ugm = UserGroupMembership::getMembership( $this->id, $group, $this->db );
if ( !$ugm ) {
return false;
@ -270,7 +270,7 @@ class UserRightsProxy {
/**
* Replaces User::touchUser()
*/
function invalidateCache() {
public function invalidateCache() {
$this->db->update(
'user',
[ 'user_touched' => $this->db->timestamp() ],