Remove unused default values from class properties
In all these cases the property is unconditionally set in the constructor. The extra initialisation is effectively dead code and an extra source of errors and confusion. Change-Id: Icae13390d5ca5c14e2754f3be4eb956dd7f54ac4
This commit is contained in:
parent
64b8677ca2
commit
6805f39a30
29 changed files with 51 additions and 44 deletions
|
|
@ -244,7 +244,7 @@ class EditPage implements IEditObject {
|
|||
private $watchthis = false;
|
||||
|
||||
/** @var bool Corresponds to $wgWatchlistExpiry */
|
||||
private $watchlistExpiryEnabled = false;
|
||||
private $watchlistExpiryEnabled;
|
||||
|
||||
/** @var WatchedItemStoreInterface */
|
||||
private $watchedItemStore;
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ class PageProps {
|
|||
private const CACHE_SIZE = 100; // integer; max cached pages
|
||||
|
||||
/** @var MapCacheLRU */
|
||||
private $cache = null;
|
||||
private $cache;
|
||||
|
||||
/**
|
||||
* @return PageProps
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ namespace MediaWiki\Rest;
|
|||
class HttpException extends \Exception {
|
||||
|
||||
/** @var array|null */
|
||||
private $errorData = null;
|
||||
private $errorData;
|
||||
|
||||
/**
|
||||
* @stable to call
|
||||
|
|
|
|||
|
|
@ -14,7 +14,10 @@ namespace MediaWiki\Rest;
|
|||
* fill with null bytes as in a real file, it throws an exception instead.
|
||||
*/
|
||||
class StringStream implements CopyableStreamInterface {
|
||||
private $contents = '';
|
||||
|
||||
/** @var string */
|
||||
private $contents;
|
||||
/** @var int */
|
||||
private $offset = 0;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ class NameTableStore {
|
|||
private $tableCache = null;
|
||||
|
||||
/** @var bool|string */
|
||||
private $domain = false;
|
||||
private $domain;
|
||||
|
||||
/** @var int */
|
||||
private $cacheTTL;
|
||||
|
|
@ -60,9 +60,9 @@ class NameTableStore {
|
|||
/** @var string */
|
||||
private $nameField;
|
||||
/** @var null|callable */
|
||||
private $normalizationCallback = null;
|
||||
private $normalizationCallback;
|
||||
/** @var null|callable */
|
||||
private $insertCallback = null;
|
||||
private $insertCallback;
|
||||
|
||||
/**
|
||||
* @param ILoadBalancer $dbLoadBalancer A load balancer for acquiring database connections
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class ApiContinuationManager {
|
|||
private $source;
|
||||
|
||||
private $allModules = [];
|
||||
private $generatedModules = [];
|
||||
private $generatedModules;
|
||||
|
||||
/** @var array[] */
|
||||
private $continuationData = [];
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
* @ingroup API
|
||||
*/
|
||||
class ApiOpenSearchFormatJson extends ApiFormatJson {
|
||||
private $warningsAsError = false;
|
||||
private $warningsAsError;
|
||||
|
||||
public function __construct( ApiMain $main, $fm, $warningsAsError ) {
|
||||
parent::__construct( $main, "json$fm" );
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class ApiPageSet extends ApiBase {
|
|||
private const DISABLE_GENERATORS = 1;
|
||||
|
||||
private $mDbSource;
|
||||
private $mParams = [];
|
||||
private $mParams;
|
||||
private $mResolveRedirects;
|
||||
private $mConvertTitles;
|
||||
private $mAllowGenerator;
|
||||
|
|
@ -82,7 +82,7 @@ class ApiPageSet extends ApiBase {
|
|||
/** @var array */
|
||||
private $mRequestedPageFields = [];
|
||||
/** @var int */
|
||||
private $mDefaultNamespace = NS_MAIN;
|
||||
private $mDefaultNamespace;
|
||||
/** @var callable|null */
|
||||
private $mRedirectMergePolicy;
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class LocalisationCache {
|
|||
* Setting this reduces the overhead of cache freshness checking, which
|
||||
* requires doing a stat() for every extension i18n file.
|
||||
*/
|
||||
private $manualRecache = false;
|
||||
private $manualRecache;
|
||||
|
||||
/**
|
||||
* The cache data. 3-d array, where the first key is the language code,
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ use Wikimedia\Assert\Assert;
|
|||
* @since 1.34
|
||||
*/
|
||||
class ServiceOptions {
|
||||
private $keys = [];
|
||||
private $keys;
|
||||
private $options = [];
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ final class ContentHandlerFactory implements IContentHandlerFactory {
|
|||
/**
|
||||
* @var string[]|callable[]
|
||||
*/
|
||||
private $handlerSpecs = [];
|
||||
private $handlerSpecs;
|
||||
|
||||
/**
|
||||
* @var ContentHandler[] Registry of ContentHandler instances by model id
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ use Wikimedia\Assert\Assert;
|
|||
*/
|
||||
class HtmlFileCacheUpdate implements DeferrableUpdate, MergeableUpdate {
|
||||
/** @var PageIdentity[] List of pages */
|
||||
private $pages = [];
|
||||
private $pages;
|
||||
|
||||
/**
|
||||
* @param PageIdentity[] $pages List of pages
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class ForeignAPIFile extends File {
|
|||
/** @var bool */
|
||||
private $mExists;
|
||||
/** @var array */
|
||||
private $mInfo = [];
|
||||
private $mInfo;
|
||||
|
||||
protected $repoClass = ForeignAPIRepo::class;
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class LocalFileRestoreBatch {
|
|||
private $all;
|
||||
|
||||
/** @var bool Whether to remove all settings for suppressed fields */
|
||||
private $unsuppress = false;
|
||||
private $unsuppress;
|
||||
|
||||
/**
|
||||
* @param LocalFile $file
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
* Wrapper around strtr() that holds replacements
|
||||
*/
|
||||
class ReplacementArray {
|
||||
private $data = [];
|
||||
private $data;
|
||||
|
||||
/**
|
||||
* Create an object with the specified replacement array
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class LBFactorySimple extends LBFactory {
|
|||
private $loadMonitorConfig;
|
||||
|
||||
/** @var array[] Map of (server index => server config map) */
|
||||
private $mainServers = [];
|
||||
private $mainServers;
|
||||
/** @var array[][] Map of (cluster => server index => server config map) */
|
||||
private $externalServersByCluster = [];
|
||||
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@ class SVGReader {
|
|||
public const LANG_PREFIX_MATCH = 1;
|
||||
public const LANG_FULL_MATCH = 2;
|
||||
|
||||
/** @var null|XMLReader */
|
||||
private $reader = null;
|
||||
/** @var XMLReader */
|
||||
private $reader;
|
||||
|
||||
/** @var bool */
|
||||
private $mDebug = false;
|
||||
|
|
|
|||
|
|
@ -43,17 +43,17 @@ class VersionChecker {
|
|||
/**
|
||||
* @var string[] List of installed PHP extensions
|
||||
*/
|
||||
private $phpExtensions = [];
|
||||
private $phpExtensions;
|
||||
|
||||
/**
|
||||
* @var bool[] List of provided abilities
|
||||
*/
|
||||
private $abilities = [];
|
||||
private $abilities;
|
||||
|
||||
/**
|
||||
* @var string[] List of provided ability errors
|
||||
*/
|
||||
private $abilityErrors = [];
|
||||
private $abilityErrors;
|
||||
|
||||
/**
|
||||
* @var array Loaded extensions
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ final class SessionBackend {
|
|||
private $delaySave = 0;
|
||||
|
||||
/** @var bool */
|
||||
private $usePhpSessionHandling = true;
|
||||
private $usePhpSessionHandling;
|
||||
/** @var bool */
|
||||
private $checkPHPSessionRecursionGuard = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -36,13 +36,13 @@ class Token {
|
|||
public const SUFFIX = '+\\';
|
||||
|
||||
/** @var string */
|
||||
private $secret = '';
|
||||
private $secret;
|
||||
|
||||
/** @var string */
|
||||
private $salt = '';
|
||||
private $salt;
|
||||
|
||||
/** @var bool */
|
||||
private $new = false;
|
||||
private $new;
|
||||
|
||||
/**
|
||||
* @param string $secret Token secret
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class SkinFactory {
|
|||
*
|
||||
* @var string[]
|
||||
*/
|
||||
private $skipSkins = [];
|
||||
private $skipSkins;
|
||||
|
||||
/**
|
||||
* @internal For ServiceWiring only
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class SpecialBotPasswords extends FormSpecialPage {
|
|||
private $password = null;
|
||||
|
||||
/** @var Psr\Log\LoggerInterface */
|
||||
private $logger = null;
|
||||
private $logger;
|
||||
|
||||
/** @var PasswordFactory */
|
||||
private $passwordFactory;
|
||||
|
|
|
|||
|
|
@ -28,10 +28,10 @@ use MediaWiki\MediaWikiServices;
|
|||
class ImportReporter extends ContextSource {
|
||||
use ProtectedHookAccessorTrait;
|
||||
|
||||
private $reason = false;
|
||||
private $reason;
|
||||
private $logTags = [];
|
||||
private $mOriginalLogCallback = null;
|
||||
private $mOriginalPageOutCallback = null;
|
||||
private $mOriginalLogCallback;
|
||||
private $mOriginalPageOutCallback;
|
||||
private $mLogItemCount = 0;
|
||||
private $mPageCount;
|
||||
private $mIsUpload;
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class ContribsPager extends RangeChronologicalPager {
|
|||
/**
|
||||
* @var string|int A single namespace number, or an empty string for all namespaces
|
||||
*/
|
||||
private $namespace = '';
|
||||
private $namespace;
|
||||
|
||||
/**
|
||||
* @var string|false Name of tag to filter, or false to ignore tags
|
||||
|
|
|
|||
|
|
@ -24,9 +24,13 @@
|
|||
* @since 1.23
|
||||
*/
|
||||
class MalformedTitleException extends Exception implements ILocalizedException {
|
||||
private $titleText = null;
|
||||
private $errorMessage = null;
|
||||
private $errorMessageParameters = [];
|
||||
|
||||
/** @var string|null */
|
||||
private $titleText;
|
||||
/** @var string */
|
||||
private $errorMessage;
|
||||
/** @var array */
|
||||
private $errorMessageParameters;
|
||||
|
||||
/**
|
||||
* @stable to call
|
||||
|
|
|
|||
|
|
@ -68,8 +68,8 @@ class BotPassword implements IDBAccessObject {
|
|||
/** @var string[] */
|
||||
private $grants;
|
||||
|
||||
/** @var int */
|
||||
private $flags = self::READ_NORMAL;
|
||||
/** @var int Defaults to {@see READ_NORMAL} */
|
||||
private $flags;
|
||||
|
||||
/**
|
||||
* @param stdClass $row bot_passwords database row
|
||||
|
|
|
|||
|
|
@ -31,12 +31,12 @@ class ExternalUserNames {
|
|||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $usernamePrefix = 'imported';
|
||||
private $usernamePrefix;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $assignKnownUsers = false;
|
||||
private $assignKnownUsers;
|
||||
|
||||
/**
|
||||
* @var bool[]
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ use Psr\Log\LogLevel;
|
|||
* @since 1.27
|
||||
*/
|
||||
class TestLogger extends \Psr\Log\AbstractLogger {
|
||||
private $collect = false;
|
||||
private $collectContext = false;
|
||||
private $collect;
|
||||
private $collectContext;
|
||||
private $buffer = [];
|
||||
/** @var callable|null */
|
||||
private $filter;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ class ParserIntegrationTest extends PHPUnit\Framework\TestCase {
|
|||
private $ptRunner;
|
||||
|
||||
/** @var string|null */
|
||||
private $skipMessage = null;
|
||||
private $skipMessage;
|
||||
|
||||
public function __construct( $runner, $fileName, $test, $skipMessage = null ) {
|
||||
parent::__construct( 'testParse', [ ( $test['parsoid'] ?? false ) ? 'parsoid' : 'legacy parser' ],
|
||||
|
|
|
|||
Loading…
Reference in a new issue