Download the PHP package mediawiki/mediawiki-codesniffer without Composer
On this page you can find all versions of the php package mediawiki/mediawiki-codesniffer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mediawiki/mediawiki-codesniffer
More information about mediawiki/mediawiki-codesniffer
Files in mediawiki/mediawiki-codesniffer
Package mediawiki-codesniffer
Short Description MediaWiki CodeSniffer Standards
License GPL-2.0-or-later
Homepage https://www.mediawiki.org/wiki/Manual:Coding_conventions/PHP
Informations about the package mediawiki-codesniffer
MediaWiki coding conventions
Abstract
This project implements a set of rules for use with PHP CodeSniffer.
See MediaWiki conventions on our wiki for a detailed description of the coding conventions that are validated by these rules. :-)
How to install
-
Create a composer.json which adds this project as a dependency:
-
Create a .phpcs.xml with our configuration:
- Install:
composer update
- Run:
composer test
- Run:
composer fix
to auto-fix some of the errors, others might need manual intervention. - Commit!
Note that for most MediaWiki projects, we'd also recommend adding a PHP linter
to your composer.json
– see the full documentation for more details.
Configuration
Some of the sniffs provided by this codesniffer standard allow you to configure details of how they work.
-
MediaWiki.Classes.FullQualifiedClassName
: This sniff is disabled by default. -
MediaWiki.Usage.ExtendClassUsage
: This sniff lets you exclude globals from being reported by the sniff, in case they cannot be replaced with a Config::getConfig() call. Examples that are already in the list include$wgTitle
and$wgUser
. -
MediaWiki.Commenting.ClassLevelLicense
: This sniff does nothing by default. -
MediaWiki.NamingConventions.PrefixedGlobalFunctions
: This sniff lets you define a list of ignored global functions and a list of allowed prefixes. By default the only allowed prefix is 'wf', corresponding to the global functionwf...()
. -
MediaWiki.NamingConventions.ValidGlobalName
: This sniff lets you define a list of ignored globals and a list of allowed prefixes. By default the only allowed prefix is 'wg', for global variables$wg...
. MediaWiki.Arrays.TrailingComma
: This sniff lets you enforce that multi-line arrays have trailing commas, which makes Git diffs nicer. It can also enforce that single-line arrays have no trailing comma. By default, it does nothing.
All versions of mediawiki-codesniffer with dependencies
ext-json Version *
ext-mbstring Version *
composer/semver Version 3.4.2 || 3.4.3
composer/spdx-licenses Version ~1.5.2
squizlabs/php_codesniffer Version 3.10.3
symfony/polyfill-php80 Version ^1.26.0
phpcsstandards/phpcsextra Version 1.2.1