Tong-ûn tsik-sîng/PHP CodeSniffer
PHP CodeSniffer is a utility to detect code style errors in PHP code. We use composer as a wrapper to manage the CodeSniffer version, dependencies, and execution.
Siú-sian, thong-kue ūn-hîng lâi tit-tio̍h khai-huat i-lāi hāng.
For most MediaWiki extensions, skins and PHP libraries, executing
composer test will also execute CodeSniffer.
Due to the large size of MediaWiki core, it is exposed as a separate command,
Teh bô tsok-khik-ka ê tsîng-hóng hā teh pún-tē tsip-hîng
If you run into issues with composer timing out, you can run it directly with
vendor/bin/phpcs -p -s.
It's important to execute the version of PHP_CodeSniffer installed by Composer in your local project repository's vendor/bin so that all sniffs are found.
Don't use the system version found on your PATH.
If you get out of memory errors, you can run it with more memory:
vendor/bin/phpcs -p -s -d memory_limit=256M.
It is recommended that you pin a specific version in your
We try to adhere to the spirit of semver.org, but not the actual standard.
The main thing we are concerned about is ensuring that no matter what, if when you run
composer test, it will pass if it previously passed, and not randomly fail because a new version was released.
The build randomly failing is a pain when you're trying to backport a patch or just trying to develop something and need to interrupt your work to fix it.
We are currently using 0 as our major version, and will bump the minor version for new sniffs, and bump the patch version for bug fixes or enhancements to existing sniffs. No stability is guaranteed for the actual PHP code included.
- Manual:Coding conventions/PHP
- Extension:BoilerPlate - a skeleton extension, its
composer testContinuous integration entry point runs PHP CodeSniffer
- mediawiki-codesniffer - PHCS piau-tsún
- Continuous integration/Tsìn-ji̍p tiám#PHP
- Beh án-tsuánn an-tsong - Iú-kuan-tio̍h beh án-tsuánn khok-tián an-tsong CodeSniffer ê suat-bîng