"PhanCommentParamWithoutRealParam",
// approximate error count: 2
"PhanCompatibleNegativeStringOffset",
- // approximate error count: 1
- "PhanEmptyFQSENInCallable",
- // approximate error count: 1
- "PhanInvalidCommentForDeclarationType",
- // approximate error count: 6
- "PhanNonClassMethodCall",
// approximate error count: 21
"PhanParamReqAfterOpt",
- // approximate error count: 27
+ // approximate error count: 26
"PhanParamSignatureMismatch",
// approximate error count: 4
"PhanParamSignatureMismatchInternal",
- // approximate error count: 1
- "PhanParamSignatureRealMismatchTooFewParameters",
- // approximate error count: 1
- "PhanParamSuspiciousOrder",
// approximate error count: 127
"PhanParamTooMany",
// approximate error count: 2
- "PhanParamTooManyCallable",
- // approximate error count: 1
- "PhanParamTooManyInternal",
- // approximate error count: 2
"PhanPluginDuplicateExpressionBinaryOp",
// approximate error count: 2
"PhanTraitParentReference",
- // approximate error count: 27
+ // approximate error count: 26
"PhanTypeArraySuspicious",
// approximate error count: 33
"PhanTypeArraySuspiciousNullable",
"PhanTypeComparisonFromArray",
// approximate error count: 2
"PhanTypeComparisonToArray",
- // approximate error count: 1
- "PhanTypeConversionFromArray",
// approximate error count: 2
"PhanTypeExpectedObjectOrClassName",
// approximate error count: 7
"PhanTypeExpectedObjectPropAccess",
- // approximate error count: 3
- "PhanTypeInstantiateAbstract",
- // approximate error count: 1
- "PhanTypeInvalidCallableArraySize",
// approximate error count: 62
"PhanTypeInvalidDimOffset",
// approximate error count: 10
"PhanTypeInvalidExpressionArrayDestructuring",
- // approximate error count: 1
- "PhanTypeInvalidLeftOperand",
// approximate error count: 7
"PhanTypeInvalidLeftOperandOfIntegerOp",
// approximate error count: 2
"PhanTypeInvalidRightOperand",
// approximate error count: 2
"PhanTypeInvalidRightOperandOfIntegerOp",
- // approximate error count: 1
- "PhanTypeMagicVoidWithReturn",
// approximate error count: 152
"PhanTypeMismatchArgument",
- // approximate error count: 28
+ // approximate error count: 27
"PhanTypeMismatchArgumentInternal",
// approximate error count: 1
"PhanTypeMismatchBitwiseBinaryOperands",
- // approximate error count: 1
- "PhanTypeMismatchDeclaredParam",
// approximate error count: 2
"PhanTypeMismatchDimEmpty",
// approximate error count: 29
"PhanTypeMismatchDimFetch",
// approximate error count: 10
"PhanTypeMismatchForeach",
- // approximate error count: 77
+ // approximate error count: 78
"PhanTypeMismatchProperty",
- // approximate error count: 88
+ // approximate error count: 85
"PhanTypeMismatchReturn",
- // approximate error count: 43
- "PhanTypeMissingReturn",
- // approximate error count: 1
- "PhanTypeNoAccessiblePropertiesForeach",
- // approximate error count: 4
- "PhanTypeNonVarPassByRef",
// approximate error count: 12
"PhanTypeObjectUnsetDeclaredProperty",
// approximate error count: 9
"PhanUndeclaredConstant",
// approximate error count: 3
"PhanUndeclaredInvokeInCallable",
- // approximate error count: 242
+ // approximate error count: 239
"PhanUndeclaredMethod",
// approximate error count: 847
"PhanUndeclaredProperty",
- // approximate error count: 1
- "PhanUndeclaredTypeReturnType",
- // approximate error count: 3
- "PhanUndeclaredTypeThrowsType",
// approximate error count: 2
"PhanUndeclaredVariableAssignOp",
// approximate error count: 55
"PhanUndeclaredVariableDim",
- // approximate error count: 4
+ // approximate error count: 3
"PhanUnextractableAnnotationElementName",
// approximate error count: 4
"PhanUnextractableAnnotationSuffix",
"jakub-onderka/php-console-highlighter": "0.3.2",
"jakub-onderka/php-parallel-lint": "0.9.2",
"justinrainbow/json-schema": "~5.2",
- "mediawiki/mediawiki-codesniffer": "24.0.0",
+ "mediawiki/mediawiki-codesniffer": "25.0.0",
"monolog/monolog": "~1.22.1",
"nikic/php-parser": "3.1.5",
"seld/jsonlint": "1.7.1",
) {
if ( !$this->hasMcrSchemaFlags( SCHEMA_COMPAT_READ_NEW ) ) {
$mainSlot = $this->emulateMainSlot_1_29( $revisionRow, $queryFlags, $title );
+ // @phan-suppress-next-line PhanTypeInvalidCallableArraySize false positive
$slots = new RevisionSlots( [ SlotRecord::MAIN => $mainSlot ] );
} else {
// XXX: do we need the same kind of caching here
// Allow unicode if a single high-bit character appears
$r0 = sprintf( '\x%02x', $ord0 );
$allowUnicode = true;
+ // @phan-suppress-next-line PhanParamSuspiciousOrder false positive
} elseif ( strpos( '-\\[]^', $d0 ) !== false ) {
$r0 = '\\' . $d0;
} else {
protected $undo = 0, $undoafter = 0, $cur = 0;
- /** @param RevisionRecord|null */
+ /** @var RevisionRecord|null */
protected $curRev = null;
public function getName() {
// $results if all are done.
unset( $targets[$placeholder] );
$placeholder = '{' . $placeholder . '}';
+ // @phan-suppress-next-line PhanTypeNoAccessiblePropertiesForeach
foreach ( $results[$target] as $value ) {
if ( !preg_match( '/^[^{}]*$/', $value ) ) {
// Skip values that make invalid parameter names.
// Some modules are unfinished: include those params, and copy
// the generator params.
foreach ( $continuationData as $module => $kvp ) {
+ // XXX: Not sure why phan is complaining here...
+ // @phan-suppress-next-line PhanTypeInvalidLeftOperand
$data += $kvp;
}
$generatorParams = [];
* @return AuthenticationRequest
*/
public static function __set_state( $data ) {
+ // @phan-suppress-next-line PhanTypeInstantiateAbstract
$ret = new static();
foreach ( $data as $k => $v ) {
$ret->$k = $v;
use MediaWiki\Block\Restriction\NamespaceRestriction;
use MediaWiki\Block\Restriction\PageRestriction;
use MediaWiki\Block\Restriction\Restriction;
+use MWException;
use Wikimedia\Rdbms\IResultWrapper;
use Wikimedia\Rdbms\IDatabase;
* @inheritDoc
*/
public static function newFromRow( \stdClass $row ) {
+ // @phan-suppress-next-line PhanTypeInstantiateAbstract
return new static( $row->ir_ipb_id, $row->ir_value );
}
* HTML to build the textbox1 on edit conflicts
*
* @param array $customAttribs
- * @return string HTML
*/
public function getEditConflictMainTextBox( array $customAttribs = [] ) {
$builder = new TextboxBuilder();
}
$config['logger'] = LoggerFactory::getInstance( 'LockManager' );
+ // @phan-suppress-next-line PhanTypeInstantiateAbstract
$this->managers[$name]['instance'] = new $class( $config );
}
* @ingroup FileAbstraction
*/
+// @phan-file-suppress PhanTypeMissingReturn false positives
/**
* Implements some public methods and some protected utility functions which
* are required by multiple child classes. Contains stub functionality for
/**
* @param int $page
- * @return int|number
+ * @return int
*/
public function getWidth( $page = 1 ) {
return isset( $this->mInfo['width'] ) ? intval( $this->mInfo['width'] ) : 0;
use MediaWiki\MediaWikiServices;
use Wikimedia\Rdbms\DBUnexpectedError;
+// @phan-file-suppress PhanTypeMissingReturn false positives
/**
* Foreign file with an accessible MediaWiki database
*
/** isVisible inherited */
/**
+ * Checks if this file exists in its parent repo, as referenced by its
+ * virtual URL.
+ *
* @return bool
*/
function isMissing() {
if ( $this->missing === null ) {
- list( $fileExists ) = $this->repo->fileExists( $this->getVirtualUrl() );
+ $fileExists = $this->repo->fileExists( $this->getVirtualUrl() );
$this->missing = !$fileExists;
}
[ 'class' => 'mw-htmlform-submit-buttons' ], "\n$buttons" ) . "\n";
}
+ /**
+ * @inheritDoc
+ * @return OOUI\PanelLayout
+ */
protected function wrapFieldSetSection( $legend, $section, $attributes, $isRoot ) {
// to get a user visible effect, wrap the fieldset into a framed panel layout
$layout = new OOUI\PanelLayout( [
/** @var array */
public static $sourceRegistrations = [];
- /** @var string */
+ /** @var ImportSource */
private $mSource;
/** @var string */
parent::applyPatch( $path, $isFullPath, $msg );
$this->db->scrollableCursor( $prevScroll );
$this->db->prepareStatements( $prevPrep );
+ return true;
}
/**
if ( !$this->db->tableExists( $table, __METHOD__ ) ) {
$this->output( "...skipping: '$table' table doesn't exist yet.\n" );
- return;
+ return true;
}
// Second requirement: the new index must be missing
" $old should be manually removed if not needed anymore.\n" );
}
- return;
+ return true;
}
// Third requirement: the old index must exist
if ( !$this->db->indexExists( $table, $old, __METHOD__ ) ) {
$this->output( "...skipping: index $old doesn't exist.\n" );
- return;
+ return true;
}
$this->db->query( "ALTER INDEX $old RENAME TO $new" );
+ return true;
}
protected function dropPgField( $table, $field ) {
$this->parent->restoreLinkPopups();
$this->endForm( false, false );
+ return '';
}
}
$this->parent->output->addWikiTextAsInterface( $text );
$this->startForm();
$this->endForm( false );
+ return '';
}
/**
/**
* @param string $command
- * @param array|Title $params
+ * @param array|Title|null $params
*/
- public function __construct( $command, $params = [] ) {
+ public function __construct( $command, $params = null ) {
if ( $params instanceof Title ) {
// Backwards compatibility for old signature ($command, $title, $params)
$title = $params;
- $params = func_num_args() >= 3 ? func_get_arg( 2 ) : [];
+ $params = func_get_arg( 2 );
} else {
// Subclasses can override getTitle() to return something more meaningful
$title = Title::makeTitle( NS_SPECIAL, 'Blankpage' );
$this->command = $command;
$this->title = $title;
- $this->params = is_array( $params ) ? $params : []; // sanity
+ $this->params = is_array( $params ) ? $params : [];
if ( !isset( $this->params['requestId'] ) ) {
$this->params['requestId'] = WebRequest::getRequestId();
}
$firstBatch = false;
}
} while ( $idsToUpdate );
+ return true;
}
}
if ( $eocdrPos !== false ) {
$this->logger->info( __METHOD__ . ": ZIP signature present in $file\n" );
// Check if it really is a ZIP file, make sure the EOCDR is at the end (T40432)
+ // FIXME: unpack()'s third argument was added in PHP 7.1
+ // @phan-suppress-next-line PhanParamTooManyInternal
$commentLength = unpack( "n", $tail, $eocdrPos + 20 )[0];
if ( $eocdrPos + 22 + $commentLength !== strlen( $tail ) ) {
$this->logger->info( __METHOD__ . ": ZIP EOCDR not at end. Not a ZIP file." );
* Additional parsing options
*/
private $parserOptions = [
- 'processing_instruction_handler' => '',
+ 'processing_instruction_handler' => null,
'external_dtd_handler' => '',
'dtd_handler' => '',
'require_safe_dtd' => true
* Memcache initializer
*
* @param array $args Associative array of settings
- *
- * @return mixed
*/
public function __construct( $args ) {
$this->set_servers( $args['servers'] ?? array() );
return $params;
}
+ /**
+ * @suppress PhanTypeNonVarPassByRef
+ */
protected function doGet( $key, $flags = 0, &$casToken = null ) {
$this->debugLog( "get($key)" );
if ( defined( Memcached::class . '::GET_EXTENDED' ) ) { // v3.0.0
/**
* @param BagOStuff $store
- * @param array[] $client Map of (ip: <IP>, agent: <user-agent> [, clientId: <hash>] )
+ * @param array $client Map of (ip: <IP>, agent: <user-agent> [, clientId: <hash>] )
* @param int|null $posIndex Write counter index [optional]
* @since 1.27
*/
list( $phpCallback ) = $callback;
$this->clearFlag( self::DBO_TRX ); // make each query its own transaction
try {
+ // @phan-suppress-next-line PhanParamTooManyCallable
call_user_func( $phpCallback, $trigger, $this );
} catch ( Exception $ex ) {
call_user_func( $this->errorLogger, $ex );
*
* @param callable $callback
* @param string $fname Caller name
- * @return mixed
* @since 1.28
*/
public function onTransactionResolution( callable $callback, $fname = __METHOD__ );
*
* @param callable $callback
* @param string $fname
- * @return mixed
* @since 1.20
* @deprecated Since 1.32
*/
*
* @param string $name Callback name
* @param callable|null $callback Use null to unset a listener
- * @return mixed
* @since 1.28
*/
public function setTransactionListener( $name, callable $callback = null );
* the aliases can be removed, and then the old X-named indexes dropped.
*
* @param string[] $aliases
- * @return mixed
* @since 1.31
*/
public function setIndexAliases( array $aliases );
/** @noinspection PhpMissingParentConstructorInspection */
/**
- * @param string $data
+ * @param Blob|array|string $data
*/
public function __construct( $data ) {
if ( $data instanceof MssqlBlob ) {
- return $data;
+ $this->data = $data->data;
} elseif ( $data instanceof Blob ) {
$this->data = $data->fetch();
} elseif ( is_array( $data ) && is_object( $data ) ) {
* the aliases can be removed, and then the old X-named indexes dropped.
*
* @param string[] $aliases
- * @return mixed
* @since 1.31
*/
public function setIndexAliases( array $aliases );
*
* @see ILoadBalancer::getConnection() for parameter information
*
- * @param int $db Server index or DB_MASTER/DB_REPLICA
+ * @param int $i Server index or DB_MASTER/DB_REPLICA
* @param array|string|bool $groups Query group(s), or false for the generic reader
* @param string|bool $domain Domain ID, or false for the current domain
* @param int $flags Bitfield of CONN_* class constants (e.g. CONN_TRX_AUTOCOMMIT)
* @return MaintainableDBConnRef
*/
- public function getMaintenanceConnectionRef( $db, $groups = [], $domain = false, $flags = 0 );
+ public function getMaintenanceConnectionRef( $i, $groups = [], $domain = false, $flags = 0 );
/**
* Open a connection to the server given by the specified index
* the aliases can be removed, and then the old X-named indexes dropped.
*
* @param string[] $aliases
- * @return mixed
* @since 1.31
*/
public function setIndexAliases( array $aliases );
* @return TitleArray|Title[]
*/
public function getForeignCategories() {
- $this->mPage->getForeignCategories();
+ return $this->mPage->getForeignCategories();
}
}
* @param Content|null $content Page content to be used when determining
* the required updates. This may be needed because $this->getContent()
* may already return null when the page proper was deleted.
- * @param RevisionRecord|Revision|null $revision The current page revision at the time of
+ * @param Revision|null $revision The current page revision at the time of
* deletion, used when determining the required updates. This may be needed because
* $this->getRevision() may already return null when the page proper was deleted.
* @param User|null $user The user that caused the deletion
}
public function getFunctionStats() {
+ return [];
}
public function getOutput() {
+ return '';
}
public function close() {
public function send( array $feed, $line ) {
$transport = UDPTransport::newFromString( $feed['uri'] );
$transport->emit( $line );
+ return true;
}
}
* @throws MWException If a duplicate module registration is attempted
* @throws MWException If a module name contains illegal characters (pipes or commas)
* @throws MWException If something other than a ResourceLoaderModule is being registered
- * @return bool False if there were any errors, in which case one or more modules were
- * not registered
*/
public function register( $name, $info = null ) {
$moduleSkinStyles = $this->config->get( 'ResourceModuleSkinStyles' );
* @return $this
*/
public function setFlag( $flag, $unset = false ) {
+ return $this;
}
/**
* are shown closer to the bottom; weight defaults to 0. Negative weight is allowed.)
* Keep order if weights are equal.
* @param array &$formDescriptor
- * @return array
*/
protected static function sortFormDescriptorFields( array &$formDescriptor ) {
$i = 0;
$filterDefinition = $this->transformFilterDefinition( $filterDefinition );
}
+ // @phan-suppress-next-line PhanNonClassMethodCall
$this->registerFilterGroup( new $className( $groupDefinition ) );
}
}
// Gotta override this since it's abstract
function formatResult( $skin, $result ) {
+ return false;
}
/**
* the HTMLForm
* @param WebRequest|null $request Optionally try and get data from a request too
* @return array [ User|string|null, Block::TYPE_ constant|null ]
+ * @phan-return array{0:User|string|null,1:int|null}
*/
public static function getTargetAndType( $par, WebRequest $request = null ) {
$i = 0;
* Show a form for filtering namespace and username
*
* @param string|null $par
- * @return string
*/
public function execute( $par ) {
$this->setHeaders();
* Form to ask for target user name.
*
* @param string $name User name submitted.
- * @return string Form asking for user name.
*/
protected function userForm( $name ) {
$htmlForm = HTMLForm::factory( 'ooui', [
*
* @param string $title Value for context title field
* @param string $input Value for input textbox
- * @return string
*/
private function makeForm( $title, $input ) {
$fields = [
->setMethod( 'get' )
->prepareForm()
->displayForm( false );
+ return '';
}
protected function getSuggestionsForTypes() {
protected function preText() {
$this->getOutput()->addModules( 'mediawiki.special.pageLanguage' );
+ return parent::preText();
}
protected function getFormFields() {
*
* @param Revision $previousRev
* @param Revision $currentRev
- * @return string HTML
*/
function showDiff( $previousRev, $currentRev ) {
$diffContext = clone $this->getContext();
*/
public function show() {
$this->addUploadJS();
- parent::show();
+ return parent::show();
}
/**
. htmlspecialchars( $time )
. "</i><br />\n"
);
+ return '';
}
}
$this->reader = $reader;
$this->writer = $writer;
$this->generator = $generator;
- $this->output = function () {
+ $this->output = function ( $text ) {
}; // nop
}
public $mVariantFallbacks;
public $mVariantNames;
public $mTablesLoaded = false;
+
+ /**
+ * @var ReplacementArray[]
+ * @phan-var array<string,ReplacementArray>
+ */
public $mTables;
+
// 'bidirectional' 'unidirectional' 'disable' for each variant
public $mManualLevel;
}
$this->output( "Populating page_props.pp_sortkey complete.\n" );
+ return true;
}
protected function getUpdateKey() {
class PPFuzzUser extends User {
public $ppfz_test, $mDataLoaded;
- function load() {
+ function load( $flags = null ) {
if ( $this->mDataLoaded ) {
return;
}
function dispatch( /*...*/ ) {
$args = func_get_args();
$pipes = $this->replicaPipes;
- $numPipes = stream_select( $x = [], $pipes, $y = [], 3600 );
+ $x = [];
+ $y = [];
+ $numPipes = stream_select( $x, $pipes, $y, 3600 );
if ( !$numPipes ) {
$this->critical( "Error waiting to write to replica DBs. Aborting" );
exit( 1 );
JobQueueGroup::singleton()->get( $type )->delete();
}
+ // T219673: close any connections from code that failed to call reuseConnection()
+ // or is still holding onto a DBConnRef instance (e.g. in a singleton).
+ MediaWikiServices::getInstance()->getDBLoadBalancerFactory()->closeAll();
CloneDatabase::changePrefix( self::$oldTablePrefix );
self::$oldTablePrefix = false;