private $title = null;
/**
- * @var File
+ * @var LocalFile
*/
private $file = null;
/**
- * @var File
+ * @var LocalFile
*/
private $oldfile = null;
private $oldimage = '';
/**
- * @param File $file File object we're deleting
+ * @param LocalFile $file File object we're deleting
*/
public function __construct( $file ) {
$this->title = $file->getTitle();
* value was provided, does it correspond to an
* existing, local, old version of this file?
*
- * @param File &$file
- * @param File &$oldfile
- * @param File $oldimage
+ * @param LocalFile &$file
+ * @param LocalFile &$oldfile
+ * @param LocalFile $oldimage
* @return bool
*/
public static function haveDeletableFile( &$file, &$oldfile, $oldimage ) {
$this->addWarning( [ 'apierror-revwrongpage', $rev->getId(),
wfEscapeWikiText( $pTitleObj->getPrefixedText() ) ] );
}
- } else {
- // Consider the title derived from the revid as having
- // been provided.
- $titleProvided = true;
}
}
}
/**
+ * @codingStandardsIgnoreStart
+ * @template T
+ * @codingStandardsIgnoreEnd
* Select a request by class name.
* @param AuthenticationRequest[] $reqs
* @param string $class Class name
+ * @phan-param class-string<T> $class
* @param bool $allowSubclasses If true, also returns any request that's a subclass of the given
* class.
* @return AuthenticationRequest|null Returns null if there is not exactly
* one matching request.
+ * @phan-return T|null
*/
public static function getRequestByClass( array $reqs, $class, $allowSubclasses = false ) {
$requests = array_filter( $reqs, function ( $req ) use ( $class, $allowSubclasses ) {
}
}
+ /** @var PasswordAuthenticationRequest $needReq */
$needReq = $data->req ?? new PasswordAuthenticationRequest();
+ '@phan-var PasswordAuthenticationRequest $needReq';
if ( !$needReq->action ) {
$needReq->action = AuthManager::ACTION_CHANGE;
}
*/
private static $instance = null;
+ /**
+ * Boolean flag to guard against recursion in getLanguage
+ * @var bool
+ */
+ private $languageRecursion = false;
+
/**
* @param Config $config
*/
* @since 1.19
*/
public function getLanguage() {
- if ( isset( $this->recursion ) ) {
+ if ( $this->languageRecursion === true ) {
trigger_error( "Recursion detected in " . __METHOD__, E_USER_WARNING );
$e = new Exception;
wfDebugLog( 'recursion-guard', "Recursion detected:\n" . $e->getTraceAsString() );
$code = $this->getConfig()->get( 'LanguageCode' ) ?: 'en';
$this->lang = Language::factory( $code );
} elseif ( $this->lang === null ) {
- $this->recursion = true;
+ $this->languageRecursion = true;
try {
$request = $this->getRequest();
$this->lang = $obj;
}
} finally {
- unset( $this->recursion );
+ $this->languageRecursion = false;
}
}
* goal.
*/
class ConsoleLogger extends AbstractLogger {
+ /**
+ * @param string $channel
+ */
public function __construct( $channel ) {
$this->channel = $channel;
}
+ /**
+ * @inheritDoc
+ */
public function log( $level, $message, array $context = [] ) {
fwrite( STDERR, "[$level] " .
LegacyLogger::format( $this->channel, $message, $context ) );
* @ingroup SpecialPage
*/
class ImportStreamSource implements ImportSource {
+ /**
+ * @param resource $handle
+ */
function __construct( $handle ) {
$this->mHandle = $handle;
}
* @ingroup SpecialPage
*/
class ImportStringSource implements ImportSource {
+ /**
+ * @param string $string
+ */
function __construct( $string ) {
$this->mString = $string;
$this->mRead = false;
// See https://www.php.net/manual/en/migration71.windows-support.php
return 0;
} else {
- return FileBackend::ATTR_UNICODE_PATHS;
+ return self::ATTR_UNICODE_PATHS;
}
}
public function getFeatures() {
return (
- FileBackend::ATTR_UNICODE_PATHS |
- FileBackend::ATTR_HEADERS |
- FileBackend::ATTR_METADATA
+ self::ATTR_UNICODE_PATHS |
+ self::ATTR_HEADERS |
+ self::ATTR_METADATA
);
}
* @return StatusValue[]
*/
protected function doExecuteOpHandlesInternal( array $fileOpHandles ) {
+ /** @var SwiftFileOpHandle[] $fileOpHandles */
+ '@phan-var SwiftFileOpHandle[] $fileOpHandles';
+
/** @var StatusValue[] $statuses */
$statuses = [];
// Split the HTTP requests into stages that can be done concurrently
$httpReqsByStage = []; // map of (stage => index => HTTP request)
foreach ( $fileOpHandles as $index => $fileOpHandle ) {
- /** @var SwiftFileOpHandle $fileOpHandle */
$reqs = $fileOpHandle->httpOp;
// Convert the 'url' parameter to an actual URL using $auth
foreach ( $reqs as $stage => &$req ) {
parent::delete();
return;
}
+ '@phan-var LocalFile $file';
$deleter = new FileDeleteForm( $file );
$deleter->execute();
/**
* @ingroup Parser
+ *
+ * @property int $eqpos
+ * @property int $commentEnd
+ * @property int $visualEnd
*/
class PPDPart {
/**
/** @var PPDStackElement[] */
public $stack;
public $rootAccum;
+ /** @var string|array */
+ public $accum;
/**
* @var PPDStackElement|false
/**
* @ingroup Parser
+ *
+ * @property int $startPos
*/
class PPDStackElement {
/**
/**
* @ingroup Parser
+ *
+ * @property int $depth
+ * @property PPFrame $parent
*/
interface PPFrame {
const NO_ARGS = 1;
* Create a new child frame
* $args is optionally a multi-root PPNode or array containing the template arguments
*
- * @param bool|array $args
+ * @param bool|array|PPNode_DOM $args
* @param Title|bool $title
* @param int $indexOffset
* @return PPTemplateFrame_DOM
}
if ( $args !== false ) {
$xpath = false;
- if ( $args instanceof PPNode ) {
+ if ( $args instanceof PPNode_DOM ) {
$args = $args->node;
}
+ // @phan-suppress-next-line PhanTypeSuspiciousNonTraversableForeach
foreach ( $args as $arg ) {
- if ( $arg instanceof PPNode ) {
+ if ( $arg instanceof PPNode_DOM ) {
$arg = $arg->node;
}
if ( !$xpath || $xpath->document !== $arg->ownerDocument ) {
/**
* @throws MWException
- * @param string|PPNode_DOM|DOMNode $root
+ * @param string|PPNode_DOM|DOMNode|DOMNodeList $root
* @param int $flags
* @return string
*/
$namedArgs = [], $title = false
) {
parent::__construct( $preprocessor );
+ /** @var PPFrame_Hash parent */
+ '@phan-var PPFrame_Hash $parent';
$this->parent = $parent;
$this->numberedArgs = $numberedArgs;
const CACHE_VERSION = 1;
+ /**
+ * @var Parser
+ */
+ public $parser;
+
/**
* @var array Brace matching rules.
*/
*/
// phpcs:ignore Squiz.Classes.ValidClassName.NotCamelCaps
class Preprocessor_Hash extends Preprocessor {
-
- /**
- * @var Parser
- */
- public $parser;
-
const CACHE_PREFIX = 'preprocess-hash';
const CACHE_VERSION = 2;
}
public function countWatchersMultiple( array $targets, array $options = [] ) {
- return $this->actualStore->countVisitingWatchersMultiple( $targets, $options );
+ return $this->actualStore->countVisitingWatchersMultiple(
+ $targets,
+ $options['minimumWatchers'] ?? null
+ );
}
public function countVisitingWatchersMultiple(
*/
$fallback = 'hy';
+
+$magicWords['redirect'] = [ '0', '#ՎԵՐԱՅՂՈՒՄ', '#ՎԵՐԱՀՂՈՒՄ', '#REDIRECT' ];
+
+$namespaceNames[NS_CATEGORY] = 'Ստորոգութիւն';
}
}
+ /**
+ * @param string $name
+ * @return string
+ */
private function filePath( $name ) {
if ( !isset( $this->repo ) ) {
$this->repo = RepoGroup::singleton()->getLocalRepo();
$name = Preprocessor_DOM::class;
}
- MediaWikiServices::getInstance()->getParser()->firstCallInit();
- $this->mPreprocessor = new $name( $this );
+ $parser = MediaWikiServices::getInstance()->getParser();
+ $parser->firstCallInit();
+ $this->mPreprocessor = new $name( $parser );
}
/**
class PPFuzzTest {
public $templates, $mainText, $title, $entryPoint, $output;
+ /**
+ * @param PPFuzzTester $tester
+ */
function __construct( $tester ) {
global $wgMaxSigChars;
$this->parent = $tester;
$this->buildOldImage();
}
+ /**
+ * @param int $count
+ * @param string $table
+ */
function init( $count, $table ) {
$this->processed = 0;
$this->updated = 0;
/**
* Dispatch a command to the next available replica DB.
* This may block until a replica DB finishes its work and becomes available.
- * @param array ...$args
+ * @param array|string ...$args
*/
function dispatch( ...$args ) {
$pipes = $this->replicaPipes;