diff options
23 files changed, 56 insertions, 61 deletions
diff --git a/.phpcs.xml b/.phpcs.xml index 1c4fa2ffe581..b00bf4da0dfa 100644 --- a/.phpcs.xml +++ b/.phpcs.xml @@ -25,15 +25,10 @@ <exclude-pattern>includes/api/</exclude-pattern> <exclude-pattern>includes/block/</exclude-pattern> <exclude-pattern>includes/cache/</exclude-pattern> - <exclude-pattern>includes/changes/</exclude-pattern> <exclude-pattern>includes/diff/</exclude-pattern> - <exclude-pattern>includes/exception/</exclude-pattern> <exclude-pattern>includes/filerepo/</exclude-pattern> <exclude-pattern>includes/htmlform/fields/</exclude-pattern> <exclude-pattern>includes/http/</exclude-pattern> - <exclude-pattern>includes/installer/</exclude-pattern> - <exclude-pattern>includes/jobqueue/</exclude-pattern> - <exclude-pattern>includes/language/</exclude-pattern> <exclude-pattern>includes/libs/</exclude-pattern> <exclude-pattern>includes/logging/</exclude-pattern> <exclude-pattern>includes/parser/</exclude-pattern> diff --git a/includes/changes/CategoryMembershipChange.php b/includes/changes/CategoryMembershipChange.php index bb70774d37bb..1fec8188cccb 100644 --- a/includes/changes/CategoryMembershipChange.php +++ b/includes/changes/CategoryMembershipChange.php @@ -30,8 +30,8 @@ use MediaWiki\Revision\RevisionStore; class CategoryMembershipChange { - const CATEGORY_ADDITION = 1; - const CATEGORY_REMOVAL = -1; + private const CATEGORY_ADDITION = 1; + private const CATEGORY_REMOVAL = -1; /** * @var string Current timestamp, set during CategoryMembershipChange::__construct() diff --git a/includes/changes/ChangesList.php b/includes/changes/ChangesList.php index 3600a4247c72..cd68eb422a66 100644 --- a/includes/changes/ChangesList.php +++ b/includes/changes/ChangesList.php @@ -33,7 +33,7 @@ use Wikimedia\Rdbms\IResultWrapper; class ChangesList extends ContextSource { use ProtectedHookAccessorTrait; - const CSS_CLASS_PREFIX = 'mw-changeslist-'; + public const CSS_CLASS_PREFIX = 'mw-changeslist-'; /** * @var Skin diff --git a/includes/changes/ChangesListBooleanFilterGroup.php b/includes/changes/ChangesListBooleanFilterGroup.php index 59f59d1541ee..d7f8882ab136 100644 --- a/includes/changes/ChangesListBooleanFilterGroup.php +++ b/includes/changes/ChangesListBooleanFilterGroup.php @@ -14,7 +14,7 @@ class ChangesListBooleanFilterGroup extends ChangesListFilterGroup { /** * Type marker, used by JavaScript */ - const TYPE = 'send_unselected_if_any'; + public const TYPE = 'send_unselected_if_any'; /** * Create a new filter group with the specified configuration diff --git a/includes/changes/ChangesListFilter.php b/includes/changes/ChangesListFilter.php index cce9d82aa6ae..b07721142c74 100644 --- a/includes/changes/ChangesListFilter.php +++ b/includes/changes/ChangesListFilter.php @@ -107,7 +107,7 @@ abstract class ChangesListFilter { */ protected $defaultHighlightColor; - const RESERVED_NAME_CHAR = '_'; + private const RESERVED_NAME_CHAR = '_'; /** * Creates a new filter with the specified configuration, and registers it to the diff --git a/includes/changes/ChangesListFilterGroup.php b/includes/changes/ChangesListFilterGroup.php index a89676a8e6cc..72b4340fe1fd 100644 --- a/includes/changes/ChangesListFilterGroup.php +++ b/includes/changes/ChangesListFilterGroup.php @@ -123,9 +123,9 @@ abstract class ChangesListFilterGroup { */ protected $conflictingFilters = []; - const DEFAULT_PRIORITY = -100; + private const DEFAULT_PRIORITY = -100; - const RESERVED_NAME_CHAR = '_'; + private const RESERVED_NAME_CHAR = '_'; /** * Create a new filter group with the specified configuration diff --git a/includes/changes/ChangesListStringOptionsFilterGroup.php b/includes/changes/ChangesListStringOptionsFilterGroup.php index 20880c72716e..b272ad07cc71 100644 --- a/includes/changes/ChangesListStringOptionsFilterGroup.php +++ b/includes/changes/ChangesListStringOptionsFilterGroup.php @@ -38,17 +38,17 @@ class ChangesListStringOptionsFilterGroup extends ChangesListFilterGroup { /** * Type marker, used by JavaScript */ - const TYPE = 'string_options'; + public const TYPE = 'string_options'; /** * Delimiter */ - const SEPARATOR = ';'; + public const SEPARATOR = ';'; /** * Signifies that all options in the group are selected. */ - const ALL = 'all'; + public const ALL = 'all'; /** * Signifies that no options in the group are selected, meaning the group has no effect. @@ -56,7 +56,7 @@ class ChangesListStringOptionsFilterGroup extends ChangesListFilterGroup { * For full-coverage groups, this is the same as ALL if all filters are allowed. * For others, it is not. */ - const NONE = ''; + public const NONE = ''; /** * Defaul parameter value diff --git a/includes/changes/RecentChange.php b/includes/changes/RecentChange.php index 06bd75635195..d1467b6354a9 100644 --- a/includes/changes/RecentChange.php +++ b/includes/changes/RecentChange.php @@ -71,25 +71,25 @@ use Wikimedia\IPUtils; class RecentChange implements Taggable { // Constants for the rc_source field. Extensions may also have // their own source constants. - const SRC_EDIT = 'mw.edit'; - const SRC_NEW = 'mw.new'; - const SRC_LOG = 'mw.log'; - const SRC_EXTERNAL = 'mw.external'; // obsolete - const SRC_CATEGORIZE = 'mw.categorize'; + public const SRC_EDIT = 'mw.edit'; + public const SRC_NEW = 'mw.new'; + public const SRC_LOG = 'mw.log'; + public const SRC_EXTERNAL = 'mw.external'; // obsolete + public const SRC_CATEGORIZE = 'mw.categorize'; - const PRC_UNPATROLLED = 0; - const PRC_PATROLLED = 1; - const PRC_AUTOPATROLLED = 2; + public const PRC_UNPATROLLED = 0; + public const PRC_PATROLLED = 1; + public const PRC_AUTOPATROLLED = 2; /** * @var bool For save() - save to the database only, without any events. */ - const SEND_NONE = true; + public const SEND_NONE = true; /** * @var bool For save() - do emit the change to RCFeeds (usually public). */ - const SEND_FEED = false; + public const SEND_FEED = false; /** @var array */ public $mAttribs = []; diff --git a/includes/exception/ErrorPageError.php b/includes/exception/ErrorPageError.php index 64216a4f4c90..114219719e7e 100644 --- a/includes/exception/ErrorPageError.php +++ b/includes/exception/ErrorPageError.php @@ -25,8 +25,8 @@ * @ingroup Exception */ class ErrorPageError extends MWException implements ILocalizedException { - const SEND_OUTPUT = 0; - const STAGE_OUTPUT = 1; + public const SEND_OUTPUT = 0; + public const STAGE_OUTPUT = 1; public $title, $msg, $params; /** diff --git a/includes/exception/MWExceptionHandler.php b/includes/exception/MWExceptionHandler.php index b792a05ab09f..84dd2c57d769 100644 --- a/includes/exception/MWExceptionHandler.php +++ b/includes/exception/MWExceptionHandler.php @@ -28,8 +28,8 @@ use Wikimedia\Rdbms\DBError; * @ingroup Exception */ class MWExceptionHandler { - const CAUGHT_BY_HANDLER = 'mwe_handler'; // error reported by this exception handler - const CAUGHT_BY_OTHER = 'other'; // error reported by direct logException() call + public const CAUGHT_BY_HANDLER = 'mwe_handler'; // error reported by this exception handler + public const CAUGHT_BY_OTHER = 'other'; // error reported by direct logException() call /** * @var string $reservedMemory diff --git a/includes/exception/MWExceptionRenderer.php b/includes/exception/MWExceptionRenderer.php index f880395cc6c0..b873a93d3de3 100644 --- a/includes/exception/MWExceptionRenderer.php +++ b/includes/exception/MWExceptionRenderer.php @@ -29,8 +29,8 @@ use Wikimedia\Rdbms\DBReadOnlyError; * @since 1.28 */ class MWExceptionRenderer { - const AS_RAW = 1; // show as text - const AS_PRETTY = 2; // show as HTML + public const AS_RAW = 1; // show as text + public const AS_PRETTY = 2; // show as HTML /** * @param Throwable $e Original exception diff --git a/includes/installer/DatabaseUpdater.php b/includes/installer/DatabaseUpdater.php index dd1058345588..e0bf0fe1fc9d 100644 --- a/includes/installer/DatabaseUpdater.php +++ b/includes/installer/DatabaseUpdater.php @@ -34,7 +34,7 @@ require_once __DIR__ . '/../../maintenance/Maintenance.php'; * @since 1.17 */ abstract class DatabaseUpdater { - const REPLICATION_WAIT_TIMEOUT = 300; + public const REPLICATION_WAIT_TIMEOUT = 300; /** * Array of updates to perform on the database diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index 2624362940d6..c06d6d4138be 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -57,7 +57,7 @@ abstract class Installer { * Defining this is necessary because PHP may be linked with a system version * of PCRE, which may be older than that bundled with the minimum PHP version. */ - const MINIMUM_PCRE_VERSION = '7.2'; + public const MINIMUM_PCRE_VERSION = '7.2'; /** * @var array diff --git a/includes/jobqueue/JobQueue.php b/includes/jobqueue/JobQueue.php index 58cd9b3658fa..8fa670b7c018 100644 --- a/includes/jobqueue/JobQueue.php +++ b/includes/jobqueue/JobQueue.php @@ -52,9 +52,9 @@ abstract class JobQueue { /** @var WANObjectCache */ protected $wanCache; - const QOS_ATOMIC = 1; // integer; "all-or-nothing" job insertions + protected const QOS_ATOMIC = 1; // integer; "all-or-nothing" job insertions - const ROOTJOB_TTL = 2419200; // integer; seconds to remember root jobs (28 days) + protected const ROOTJOB_TTL = 2419200; // integer; seconds to remember root jobs (28 days) /** * @param array $params diff --git a/includes/jobqueue/JobQueueDB.php b/includes/jobqueue/JobQueueDB.php index af6fccb6eabf..d89e94e7605d 100644 --- a/includes/jobqueue/JobQueueDB.php +++ b/includes/jobqueue/JobQueueDB.php @@ -34,10 +34,10 @@ use Wikimedia\ScopedCallback; * @since 1.21 */ class JobQueueDB extends JobQueue { - const CACHE_TTL_SHORT = 30; // integer; seconds to cache info without re-validating - const MAX_AGE_PRUNE = 604800; // integer; seconds a job can live once claimed - const MAX_JOB_RANDOM = 2147483647; // integer; 2^31 - 1, used for job_random - const MAX_OFFSET = 255; // integer; maximum number of rows to skip + private const CACHE_TTL_SHORT = 30; // integer; seconds to cache info without re-validating + private const MAX_AGE_PRUNE = 604800; // integer; seconds a job can live once claimed + private const MAX_JOB_RANDOM = 2147483647; // integer; 2^31 - 1, used for job_random + private const MAX_OFFSET = 255; // integer; maximum number of rows to skip /** @var IMaintainableDatabase|DBError|null */ protected $conn; diff --git a/includes/jobqueue/JobQueueGroup.php b/includes/jobqueue/JobQueueGroup.php index 5347b88f5aee..f15140bba619 100644 --- a/includes/jobqueue/JobQueueGroup.php +++ b/includes/jobqueue/JobQueueGroup.php @@ -44,14 +44,14 @@ class JobQueueGroup { /** @var array Map of (bucket => (queue => JobQueue, types => list of types) */ protected $coalescedQueues; - const TYPE_DEFAULT = 1; // integer; jobs popped by default - const TYPE_ANY = 2; // integer; any job + public const TYPE_DEFAULT = 1; // integer; jobs popped by default + private const TYPE_ANY = 2; // integer; any job - const USE_CACHE = 1; // integer; use process or persistent cache + public const USE_CACHE = 1; // integer; use process or persistent cache - const PROC_CACHE_TTL = 15; // integer; seconds + private const PROC_CACHE_TTL = 15; // integer; seconds - const CACHE_VERSION = 1; // integer; cache version + private const CACHE_VERSION = 1; // integer; cache version /** * @param string $domain Wiki domain ID diff --git a/includes/jobqueue/JobQueueRedis.php b/includes/jobqueue/JobQueueRedis.php index 76d1f46d37a1..cd7063d6c069 100644 --- a/includes/jobqueue/JobQueueRedis.php +++ b/includes/jobqueue/JobQueueRedis.php @@ -76,7 +76,7 @@ class JobQueueRedis extends JobQueue { /** @var string Compression method to use */ protected $compression; - const MAX_PUSH_SIZE = 25; // avoid tying up the server + private const MAX_PUSH_SIZE = 25; // avoid tying up the server /** * @param array $params Possible keys: diff --git a/includes/jobqueue/RunnableJob.php b/includes/jobqueue/RunnableJob.php index dba2ae989185..095572378479 100644 --- a/includes/jobqueue/RunnableJob.php +++ b/includes/jobqueue/RunnableJob.php @@ -34,7 +34,7 @@ */ interface RunnableJob extends IJobSpecification { /** @var int Job must not be wrapped in the usual explicit LBFactory transaction round */ - const JOB_NO_EXPLICIT_TRX_ROUND = 1; + public const JOB_NO_EXPLICIT_TRX_ROUND = 1; /** * Run the job diff --git a/includes/jobqueue/jobs/CategoryMembershipChangeJob.php b/includes/jobqueue/jobs/CategoryMembershipChangeJob.php index 7395510d03db..b41a5274f7a5 100644 --- a/includes/jobqueue/jobs/CategoryMembershipChangeJob.php +++ b/includes/jobqueue/jobs/CategoryMembershipChangeJob.php @@ -42,7 +42,7 @@ class CategoryMembershipChangeJob extends Job { /** @var int|null */ private $ticket; - const ENQUEUE_FUDGE_SEC = 60; + private const ENQUEUE_FUDGE_SEC = 60; /** * @param Title $title The title of the page for which to update category membership. diff --git a/includes/jobqueue/jobs/RefreshLinksJob.php b/includes/jobqueue/jobs/RefreshLinksJob.php index ba0ddda31fcd..e72816115b65 100644 --- a/includes/jobqueue/jobs/RefreshLinksJob.php +++ b/includes/jobqueue/jobs/RefreshLinksJob.php @@ -40,9 +40,9 @@ use MediaWiki\Revision\RevisionRenderer; */ class RefreshLinksJob extends Job { /** @var int Lag safety margin when comparing root job times to last-refresh times */ - const NORMAL_MAX_LAG = 10; + private const NORMAL_MAX_LAG = 10; /** @var int How many seconds to wait for replica DBs to catch up */ - const LAG_WAIT_TIMEOUT = 15; + private const LAG_WAIT_TIMEOUT = 15; public function __construct( Title $title, array $params ) { parent::__construct( 'refreshLinks', $title, $params ); diff --git a/includes/language/LanguageFallback.php b/includes/language/LanguageFallback.php index 1b4f2556376f..d8ab3cc9a296 100644 --- a/includes/language/LanguageFallback.php +++ b/includes/language/LanguageFallback.php @@ -33,13 +33,13 @@ class LanguageFallback { * Return a fallback chain for messages in getAll * @since 1.35 */ - const MESSAGES = 0; + public const MESSAGES = 0; /** * Return a strict fallback chain in getAll * @since 1.35 */ - const STRICT = 1; + public const STRICT = 1; /** @var string */ private $siteLangCode; diff --git a/includes/language/LanguageNameUtils.php b/includes/language/LanguageNameUtils.php index f9cb64b953d1..3bc284b0f8e7 100644 --- a/includes/language/LanguageNameUtils.php +++ b/includes/language/LanguageNameUtils.php @@ -42,22 +42,22 @@ class LanguageNameUtils { /** * Return autonyms in getLanguageName(s). */ - const AUTONYMS = null; + public const AUTONYMS = null; /** * Return all known languages in getLanguageName(s). */ - const ALL = 'all'; + public const ALL = 'all'; /** * Return in getLanguageName(s) only the languages that are defined by MediaWiki. */ - const DEFINED = 'mw'; + public const DEFINED = 'mw'; /** * Return in getLanguageName(s) only the languages for which we have at least some localisation. */ - const SUPPORTED = 'mwfile'; + public const SUPPORTED = 'mwfile'; /** @var ServiceOptions */ private $options; diff --git a/includes/language/Message.php b/includes/language/Message.php index dc3bec1802cd..d6b5240c7c68 100644 --- a/includes/language/Message.php +++ b/includes/language/Message.php @@ -159,15 +159,15 @@ use MediaWiki\MediaWikiServices; */ class Message implements MessageSpecifier, Serializable { /** Use message text as-is */ - const FORMAT_PLAIN = 'plain'; + public const FORMAT_PLAIN = 'plain'; /** Use normal wikitext -> HTML parsing (the result will be wrapped in a block-level HTML tag) */ - const FORMAT_BLOCK_PARSE = 'block-parse'; + public const FORMAT_BLOCK_PARSE = 'block-parse'; /** Use normal wikitext -> HTML parsing but strip the block-level wrapper */ - const FORMAT_PARSE = 'parse'; + public const FORMAT_PARSE = 'parse'; /** Transform {{..}} constructs but don't transform to HTML */ - const FORMAT_TEXT = 'text'; + public const FORMAT_TEXT = 'text'; /** Transform {{..}} constructs, HTML-escape the result */ - const FORMAT_ESCAPED = 'escaped'; + public const FORMAT_ESCAPED = 'escaped'; /** * Mapping from Message::listParam() types to Language methods. |