Clean up: Declare variables with public instead of var

Variables in classes should be declared using public $foo
instead of var $foo for various reasons. As we require PHP 5.3
we don't have to take care about that PHP4 left over, but can
get rid of it in favour of the more clear and better readable
public.
See also: http://php.net/manual/en/language.oop5.visibility.php
(Divided into several commits to keep reviewable)

Change-Id: Ic723d0347ab2e3c78bc0097345c68bbee3dc035a
This commit is contained in:
Marius Hoch 2012-09-14 20:57:14 +02:00
parent 1c21fb2aae
commit 652c4be7c2
22 changed files with 129 additions and 129 deletions

View file

@ -48,7 +48,7 @@ class FakeConverter {
/**
* @var Language
*/
var $mLang;
public $mLang;
function __construct( $langobj ) { $this->mLang = $langobj; }
function autoConvertToAllVariants( $text ) { return array( $this->mLang->getCode() => $text ); }
function convert( $t ) { return $t; }
@ -77,21 +77,21 @@ class Language {
/**
* @var LanguageConverter
*/
var $mConverter;
public $mConverter;
var $mVariants, $mCode, $mLoaded = false;
var $mMagicExtensions = array(), $mMagicHookDone = false;
public $mVariants, $mCode, $mLoaded = false;
public $mMagicExtensions = array(), $mMagicHookDone = false;
private $mHtmlCode = null;
var $dateFormatStrings = array();
var $mExtendedSpecialPageAliases;
public $dateFormatStrings = array();
public $mExtendedSpecialPageAliases;
protected $namespaceNames, $mNamespaceIds, $namespaceAliases;
/**
* ReplacementArray object caches
*/
var $transformData = array();
public $transformData = array();
/**
* @var LocalisationCache

View file

@ -47,28 +47,28 @@ class LanguageConverter {
'zh',
);
var $mMainLanguageCode;
var $mVariants, $mVariantFallbacks, $mVariantNames;
var $mTablesLoaded = false;
var $mTables;
public $mMainLanguageCode;
public $mVariants, $mVariantFallbacks, $mVariantNames;
public $mTablesLoaded = false;
public $mTables;
// 'bidirectional' 'unidirectional' 'disable' for each variant
var $mManualLevel;
public $mManualLevel;
/**
* @var String: memcached key name
*/
var $mCacheKey;
public $mCacheKey;
var $mLangObj;
var $mFlags;
var $mDescCodeSep = ':', $mDescVarSep = ';';
var $mUcfirst = false;
var $mConvRuleTitle = false;
var $mURLVariant;
var $mUserVariant;
var $mHeaderVariant;
var $mMaxDepth = 10;
var $mVarSeparatorPattern;
public $mLangObj;
public $mFlags;
public $mDescCodeSep = ':', $mDescVarSep = ';';
public $mUcfirst = false;
public $mConvRuleTitle = false;
public $mURLVariant;
public $mUserVariant;
public $mHeaderVariant;
public $mMaxDepth = 10;
public $mVarSeparatorPattern;
const CACHE_VERSION_KEY = 'VERSION 6';
@ -1113,17 +1113,17 @@ class LanguageConverter {
* @author fdcn <fdcn64@gmail.com>, PhiLiP <philip.npc@gmail.com>
*/
class ConverterRule {
var $mText; // original text in -{text}-
var $mConverter; // LanguageConverter object
var $mRuleDisplay = '';
var $mRuleTitle = false;
var $mRules = '';// string : the text of the rules
var $mRulesAction = 'none';
var $mFlags = array();
var $mVariantFlags = array();
var $mConvTable = array();
var $mBidtable = array();// array of the translation in each variant
var $mUnidtable = array();// array of the translation in each variant
public $mText; // original text in -{text}-
public $mConverter; // LanguageConverter object
public $mRuleDisplay = '';
public $mRuleTitle = false;
public $mRules = '';// string : the text of the rules
public $mRulesAction = 'none';
public $mFlags = array();
public $mVariantFlags = array();
public $mConvTable = array();
public $mBidtable = array();// array of the translation in each variant
public $mUnidtable = array();// array of the translation in each variant
/**
* Constructor

View file

@ -38,7 +38,7 @@ require_once( __DIR__ . '/../LanguageConverter.php' );
class IuConverter extends LanguageConverter {
protected $mDoContentConvert;
var $mToLatin = array(
public $mToLatin = array(
'ᐦ' => 'h', 'ᐃ' => 'i', 'ᐄ' => 'ii', 'ᐅ' => 'u', 'ᐆ' => 'uu', 'ᐊ' => 'a', 'ᐋ' => 'aa',
'ᑉ' => 'p', 'ᐱ' => 'pi', 'ᐲ' => 'pii', '' => 'pu', 'ᐴ' => 'puu', '' => 'pa', 'ᐹ' => 'paa',
'ᑦ' => 't', 'ᑎ' => 'ti', 'ᑏ' => 'tii', 'ᑐ' => 'tu', 'ᑑ' => 'tuu', 'ᑕ' => 'ta', 'ᑖ' => 'taa',
@ -58,7 +58,7 @@ class IuConverter extends LanguageConverter {
'ᖦ' => 'ɫ', 'ᖠ' => 'ɫi', 'ᖡ' => 'ɫii', 'ᖢ' => 'ɫu', 'ᖣ' => 'ɫuu', 'ᖤ' => 'ɫa', 'ᖥ' => 'ɫaa',
);
var $mUpperToLowerCaseLatin = array(
public $mUpperToLowerCaseLatin = array(
'A' => 'a', 'B' => 'b', 'C' => 'c', 'D' => 'd', 'E' => 'e',
'F' => 'f', 'G' => 'g', 'H' => 'h', 'I' => 'i', 'J' => 'j',
'K' => 'k', 'L' => 'l', 'M' => 'm', 'N' => 'n', 'O' => 'o',
@ -67,7 +67,7 @@ class IuConverter extends LanguageConverter {
'Z' => 'z',
);
var $mToSyllabics = array(
public $mToSyllabics = array(
'h' => 'ᐦ', 'i' => 'ᐃ', 'ii' => 'ᐄ', 'u' => 'ᐅ', 'uu' => 'ᐆ', 'a' => 'ᐊ', 'aa' => 'ᐋ',
'p' => 'ᑉ', 'pi' => 'ᐱ', 'pii' => 'ᐲ', 'pu' => '', 'puu' => 'ᐴ', 'pa' => '', 'paa' => 'ᐹ',
't' => 'ᑦ', 'ti' => 'ᑎ', 'tii' => 'ᑏ', 'tu' => 'ᑐ', 'tuu' => 'ᑑ', 'ta' => 'ᑕ', 'taa' => 'ᑖ',

View file

@ -30,7 +30,7 @@ require_once( __DIR__ . '/LanguageKu_ku.php' );
* @ingroup Language
*/
class KuConverter extends LanguageConverter {
var $mArabicToLatin = array(
public $mArabicToLatin = array(
'ب' => 'b', 'ج' => 'c', 'چ' => 'ç', 'د' => 'd', 'ف' => 'f', 'گ' => 'g', 'ھ' => 'h',
'ہ' => 'h', 'ه' => 'h', 'ح' => 'h', 'ژ' => 'j', 'ك' => 'k', 'ک' => 'k', 'ل' => 'l',
'م' => 'm', 'ن' => 'n', 'پ' => 'p', 'ق' => 'q', 'ر' => 'r', 'س' => 's', 'ش' => 'ş',
@ -72,7 +72,7 @@ class KuConverter extends LanguageConverter {
'٩' => '9', # &#x0669;
);
var $mLatinToArabic = array(
public $mLatinToArabic = array(
'b' => 'ب', 'c' => 'ج', 'ç' => 'چ', 'd' => 'د', 'f' => 'ف', 'g' => 'گ',
'h' => 'ه', 'j' => 'ژ', 'k' => 'ک', 'l' => 'ل',
'm' => 'م', 'n' => 'ن', 'p' => 'پ', 'q' => 'ق', 'r' => 'ر', 's' => 'س', 'ş' => 'ش',

View file

@ -39,7 +39,7 @@ class ShiConverter extends LanguageConverter {
protected $mDoContentConvert;
var $mToLatin = array(
public $mToLatin = array(
'ⴰ' => 'a', 'ⴱ' => 'b', 'ⴳ' => 'g', 'ⴷ' => 'd', '' => 'ḍ', 'ⴻ' => 'e',
'ⴼ' => 'f', 'ⴽ' => 'k', 'ⵀ' => 'h', 'ⵃ' => 'ḥ', 'ⵄ' => 'ε', 'ⵅ' => 'x',
'ⵇ' => 'q', 'ⵉ' => 'i', 'ⵊ' => 'j', 'ⵍ' => 'l', 'ⵎ' => 'm', '' => 'n',
@ -48,7 +48,7 @@ class ShiConverter extends LanguageConverter {
'ⵥ' => 'ẓ', 'ⵯ' => 'ʷ', 'ⵖ' => 'ɣ', 'ⵠ' => 'v', 'ⵒ' => 'p',
);
var $mUpperToLowerCaseLatin = array(
public $mUpperToLowerCaseLatin = array(
'A' => 'a', 'B' => 'b', 'C' => 'c', 'D' => 'd', 'E' => 'e',
'F' => 'f', 'G' => 'g', 'H' => 'h', 'I' => 'i', 'J' => 'j',
'K' => 'k', 'L' => 'l', 'M' => 'm', 'N' => 'n', 'O' => 'o',
@ -57,7 +57,7 @@ class ShiConverter extends LanguageConverter {
'Z' => 'z', 'Ɣ' => 'ɣ',
);
var $mToTifinagh = array(
public $mToTifinagh = array(
'a' => 'ⴰ', 'b' => 'ⴱ', 'g' => 'ⴳ', 'd' => 'ⴷ', 'ḍ' => '', 'e' => 'ⴻ',
'f' => 'ⴼ', 'k' => 'ⴽ', 'h' => 'ⵀ', 'ḥ' => 'ⵃ', 'ε' => 'ⵄ', 'x' => 'ⵅ',
'q' => 'ⵇ', 'i' => 'ⵉ', 'j' => 'ⵊ', 'l' => 'ⵍ', 'm' => 'ⵎ', 'n' => '',

View file

@ -35,7 +35,7 @@ require_once( __DIR__ . '/LanguageSr_el.php' );
* @ingroup Language
*/
class SrConverter extends LanguageConverter {
var $mToLatin = array(
public $mToLatin = array(
'а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'g', 'д' => 'd',
'ђ' => 'đ', 'е' => 'e', 'ж' => 'ž', 'з' => 'z', 'и' => 'i',
'ј' => 'j', 'к' => 'k', 'л' => 'l', 'љ' => 'lj', 'м' => 'm',
@ -51,7 +51,7 @@ class SrConverter extends LanguageConverter {
'Х' => 'H', 'Ц' => 'C', 'Ч' => 'Č', 'Џ' => 'Dž', 'Ш' => 'Š',
);
var $mToCyrillics = array(
public $mToCyrillics = array(
'a' => 'а', 'b' => 'б', 'c' => 'ц', 'č' => 'ч', 'ć' => 'ћ',
'd' => 'д', 'dž' => 'џ', 'đ' => 'ђ', 'e' => 'е', 'f' => 'ф',
'g' => 'г', 'h' => 'х', 'i' => 'и', 'j' => 'ј', 'k' => 'к',

View file

@ -27,7 +27,7 @@ require_once( __DIR__ . '/../LanguageConverter.php' );
* @ingroup Language
*/
class UzConverter extends LanguageConverter {
var $toLatin = array(
public $toLatin = array(
'а' => 'a', 'А' => 'A',
'б' => 'b', 'Б' => 'B',
'д' => 'd', 'Д' => 'D',
@ -65,7 +65,7 @@ class UzConverter extends LanguageConverter {
'ъ' => 'ʼ',
);
var $toCyrillic = array(
public $toCyrillic = array(
'a' => 'а', 'A' => 'А',
'b' => 'б', 'B' => 'Б',
'd' => 'д', 'D' => 'Д',

View file

@ -131,7 +131,7 @@ class CLDRPluralRuleEvaluator {
* Evaluator helper class representing a range list.
*/
class CLDRPluralRuleEvaluator_Range {
var $parts = array();
public $parts = array();
function __construct( $start, $end = false ) {
if ( $end === false ) {
@ -208,9 +208,9 @@ class CLDRPluralRuleEvaluator_Range {
* Helper class for converting rules to reverse polish notation (RPN).
*/
class CLDRPluralRuleConverter {
var $rule, $pos, $end;
var $operators = array();
var $operands = array();
public $rule, $pos, $end;
public $operators = array();
public $operands = array();
/**
* Precedence levels. Note that there's no need to worry about associativity
@ -447,7 +447,7 @@ class CLDRPluralRuleConverter {
* The base class for operators and expressions, describing a region of the input string.
*/
class CLDRPluralRuleConverter_Fragment {
var $parser, $pos, $length, $end;
public $parser, $pos, $length, $end;
function __construct( $parser, $pos, $length ) {
$this->parser = $parser;
@ -473,7 +473,7 @@ class CLDRPluralRuleConverter_Fragment {
* validation.
*/
class CLDRPluralRuleConverter_Expression extends CLDRPluralRuleConverter_Fragment {
var $type, $rpn;
public $type, $rpn;
function __construct( $parser, $type, $rpn, $pos, $length ) {
parent::__construct( $parser, $pos, $length );
@ -498,7 +498,7 @@ class CLDRPluralRuleConverter_Expression extends CLDRPluralRuleConverter_Fragmen
* messages), and the binary operator at that location.
*/
class CLDRPluralRuleConverter_Operator extends CLDRPluralRuleConverter_Fragment {
var $name;
public $name;
/**
* Each op type has three characters: left operand type, right operand type and result type

View file

@ -34,9 +34,9 @@ class UpdateLogging {
/**
* @var DatabaseBase
*/
var $dbw;
var $batchSize = 1000;
var $minTs = false;
public $dbw;
public $batchSize = 1000;
public $minTs = false;
function execute() {
$this->dbw = wfGetDB( DB_MASTER );

View file

@ -44,7 +44,7 @@ class GenerateSitemap extends Maintenance {
*
* @var int
*/
var $url_limit;
public $url_limit;
/**
* The maximum size of a sitemap file
@ -53,77 +53,77 @@ class GenerateSitemap extends Maintenance {
*
* @var int
*/
var $size_limit;
public $size_limit;
/**
* The path to prepend to the filename
*
* @var string
*/
var $fspath;
public $fspath;
/**
* The URL path to prepend to filenames in the index; should resolve to the same directory as $fspath
*
* @var string
*/
var $urlpath;
public $urlpath;
/**
* Whether or not to use compression
*
* @var bool
*/
var $compress;
public $compress;
/**
* Whether or not to include redirection pages
*
* @var bool
*/
var $skipRedirects;
public $skipRedirects;
/**
* The number of entries to save in each sitemap file
*
* @var array
*/
var $limit = array();
public $limit = array();
/**
* Key => value entries of namespaces and their priorities
*
* @var array
*/
var $priorities = array();
public $priorities = array();
/**
* A one-dimensional array of namespaces in the wiki
*
* @var array
*/
var $namespaces = array();
public $namespaces = array();
/**
* When this sitemap batch was generated
*
* @var string
*/
var $timestamp;
public $timestamp;
/**
* A database slave object
*
* @var object
*/
var $dbr;
public $dbr;
/**
* A resource pointing to the sitemap index file
*
* @var resource
*/
var $findex;
public $findex;
/**
@ -131,7 +131,7 @@ class GenerateSitemap extends Maintenance {
*
* @var resource
*/
var $file;
public $file;
/**
* Identifier to use in filenames, default $wgDBname

View file

@ -32,13 +32,13 @@ require_once( __DIR__ . '/Maintenance.php' );
* @ingroup Maintenance
*/
class BackupReader extends Maintenance {
var $reportingInterval = 100;
var $pageCount = 0;
var $revCount = 0;
var $dryRun = false;
var $uploads = false;
var $imageBasePath = false;
var $nsFilter = false;
public $reportingInterval = 100;
public $pageCount = 0;
public $revCount = 0;
public $dryRun = false;
public $uploads = false;
public $imageBasePath = false;
public $nsFilter = false;
function __construct() {
parent::__construct();

View file

@ -29,7 +29,7 @@ require_once( __DIR__ . '/Maintenance.php' );
* @ingroup Maintenance
*/
class JSParseHelper extends Maintenance {
var $errs = 0;
public $errs = 0;
public function __construct() {
parent::__construct();

View file

@ -30,19 +30,19 @@ require_once( __DIR__ .'/../Maintenance.php' );
*/
class GenerateCollationData extends Maintenance {
/** The directory with source data files in it */
var $dataDir;
public $dataDir;
/** The primary weights, indexed by codepoint */
var $weights;
public $weights;
/**
* A hashtable keyed by codepoint, where presence indicates that a character
* has a decomposition mapping. This makes it non-preferred for group header
* selection.
*/
var $mappedChars;
public $mappedChars;
var $debugOutFile;
public $debugOutFile;
/**
* Important tertiary weights from UTS #10 section 7.2
@ -285,12 +285,12 @@ class GenerateCollationData extends Maintenance {
}
class UcdXmlReader {
var $fileName;
var $callback;
var $groupAttrs;
var $xml;
var $blocks = array();
var $currentBlock;
public $fileName;
public $callback;
public $groupAttrs;
public $xml;
public $blocks = array();
public $currentBlock;
function __construct( $fileName ) {
$this->fileName = $fileName;

View file

@ -32,7 +32,7 @@ require_once( __DIR__ . '/../../includes/normal/UtfNormalUtil.php' );
* @ingroup MaintenanceLanguage
*/
class GenerateNormalizerData extends Maintenance {
var $dataFile;
public $dataFile;
public function __construct() {
parent::__construct();

View file

@ -29,7 +29,7 @@ require_once( __DIR__ . '/Maintenance.php' );
* @ingroup Maintenance
*/
class MinifyScript extends Maintenance {
var $outDir;
public $outDir;
public function __construct() {
parent::__construct();

View file

@ -26,7 +26,7 @@ require_once( __DIR__ . '/commandLine.inc' );
$wgHooks['BeforeParserFetchTemplateAndtitle'][] = 'PPFuzzTester::templateHook';
class PPFuzzTester {
var $hairs = array(
public $hairs = array(
'[[', ']]', '{{', '{{', '}}', '}}', '{{{', '}}}',
'<', '>', '<nowiki', '<gallery', '</nowiki>', '</gallery>', '<nOwIkI>', '</NoWiKi>',
'<!--' , '-->',
@ -39,12 +39,12 @@ class PPFuzzTester {
// extensions
// '<ref>', '</ref>', '<references/>',
);
var $minLength = 0;
var $maxLength = 20;
var $maxTemplates = 5;
// var $outputTypes = array( 'OT_HTML', 'OT_WIKI', 'OT_PREPROCESS' );
var $entryPoints = array( 'testSrvus', 'testPst', 'testPreprocess' );
var $verbose = false;
public $minLength = 0;
public $maxLength = 20;
public $maxTemplates = 5;
// public $outputTypes = array( 'OT_HTML', 'OT_WIKI', 'OT_PREPROCESS' );
public $entryPoints = array( 'testSrvus', 'testPst', 'testPreprocess' );
public $verbose = false;
static $currentTest = false;
function execute() {
@ -140,7 +140,7 @@ class PPFuzzTester {
}
class PPFuzzTest {
var $templates, $mainText, $title, $entryPoint, $output;
public $templates, $mainText, $title, $entryPoint, $output;
function __construct( $tester ) {
global $wgMaxSigChars;
@ -219,7 +219,7 @@ class PPFuzzTest {
}
class PPFuzzUser extends User {
var $ppfz_test, $mDataLoaded;
public $ppfz_test, $mDataLoaded;
function load() {
if ( $this->mDataLoaded ) {

View file

@ -30,7 +30,7 @@ require( __DIR__ . '/Maintenance.php' );
* @ingroup Maintenance
*/
class PurgeParserCache extends Maintenance {
var $lastProgress;
public $lastProgress;
function __construct() {
parent::__construct();

View file

@ -42,10 +42,10 @@ if ( !defined( 'MEDIAWIKI' ) ) {
*/
class CheckStorage {
const CONCAT_HEADER = 'O:27:"concatenatedgziphistoryblob"';
var $oldIdMap, $errors;
var $dbStore = null;
public $oldIdMap, $errors;
public $dbStore = null;
var $errorDescriptions = array(
public $errorDescriptions = array(
'restore text' => 'Damaged text, need to be restored from a backup',
'restore revision' => 'Damaged revision row, need to be restored from a backup',
'unfixable' => 'Unexpected errors with no automated fixing method',

View file

@ -24,10 +24,10 @@
require_once( __DIR__ . '/../Maintenance.php' );
class FixBug20757 extends Maintenance {
var $batchSize = 10000;
var $mapCache = array();
var $mapCacheSize = 0;
var $maxMapCacheSize = 1000000;
public $batchSize = 10000;
public $mapCache = array();
public $mapCacheSize = 0;
public $maxMapCacheSize = 1000000;
function __construct() {
parent::__construct();

View file

@ -43,19 +43,19 @@ $job = RecompressTracked::newFromCommandLine( $args, $options );
$job->execute();
class RecompressTracked {
var $destClusters;
var $batchSize = 1000;
var $orphanBatchSize = 1000;
var $reportingInterval = 10;
var $numProcs = 1;
var $useDiff, $pageBlobClass, $orphanBlobClass;
var $slavePipes, $slaveProcs, $prevSlaveId;
var $copyOnly = false;
var $isChild = false;
var $slaveId = false;
var $noCount = false;
var $debugLog, $infoLog, $criticalLog;
var $store;
public $destClusters;
public $batchSize = 1000;
public $orphanBatchSize = 1000;
public $reportingInterval = 10;
public $numProcs = 1;
public $useDiff, $pageBlobClass, $orphanBlobClass;
public $slavePipes, $slaveProcs, $prevSlaveId;
public $copyOnly = false;
public $isChild = false;
public $slaveId = false;
public $noCount = false;
public $debugLog, $infoLog, $criticalLog;
public $store;
static $optionsWithArgs = array( 'procs', 'slave-id', 'debug-log', 'info-log', 'critical-log' );
static $cmdLineOptionMap = array(
@ -670,10 +670,10 @@ class RecompressTracked {
* Class to represent a recompression operation for a single CGZ blob
*/
class CgzCopyTransaction {
var $parent;
var $blobClass;
var $cgz;
var $referrers;
public $parent;
public $blobClass;
public $cgz;
public $referrers;
/**
* Create a transaction from a RecompressTracked object

View file

@ -37,12 +37,12 @@ $tracker->run();
echo "All done.\n";
class TrackBlobs {
var $clusters, $textClause;
var $doBlobOrphans;
var $trackedBlobs = array();
public $clusters, $textClause;
public $doBlobOrphans;
public $trackedBlobs = array();
var $batchSize = 1000;
var $reportingInterval = 10;
public $batchSize = 1000;
public $reportingInterval = 10;
function __construct( $clusters ) {
$this->clusters = $clusters;

View file

@ -38,7 +38,7 @@ class UpdateCollation extends Maintenance {
const BATCH_SIZE = 50; // Number of rows to process in one batch
const SYNC_INTERVAL = 20; // Wait for slaves after this many batches
var $sizeHistogram = array();
public $sizeHistogram = array();
public function __construct() {
parent::__construct();