## About
PHP\_CodeSniffer is a set of two PHP scripts; the main `phpcs` script that tokenizes PHP, JavaScript and CSS files to detect violations of a defined coding standard, and a second `phpcbf` script to automatically correct coding standard violations. PHP\_CodeSniffer is an essential development tool that ensures your code remains clean and consistent.
[![Build Status](https://travis-ci.org/squizlabs/PHP_CodeSniffer.svg?branch=phpcs-fixer)](https://travis-ci.org/squizlabs/PHP_CodeSniffer) [![Code consistency](http://squizlabs.github.io/PHP_CodeSniffer/analysis/squizlabs/PHP_CodeSniffer/grade.svg)](http://squizlabs.github.io/PHP_CodeSniffer/analysis/squizlabs/PHP_CodeSniffer) [![Join the chat at https://gitter.im/squizlabs/PHP_CodeSniffer](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/squizlabs/PHP_CodeSniffer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
## Requirements
PHP\_CodeSniffer requires PHP version 5.4.0 or greater, although individual sniffs may have additional requirements such as external applications and scripts. See the [Configuration Options manual page](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Configuration-Options) for a list of these requirements.
## Installation
The easiest way to get started with PHP\_CodeSniffer is to download the Phar files for each of the commands:
```
# Download using curl
curl -OL https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar
curl -OL https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar
# Or download using wget
wget https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar
wget https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar
# Then test the downloaded PHARs
php phpcs.phar -h
php phpcbf.phar -h
```
### Composer
If you use Composer, you can install PHP_CodeSniffer system-wide with the following command:
composer global require "squizlabs/php_codesniffer=*"
Make sure you have the composer bin dir in your PATH. The default value is `~/.composer/vendor/bin/`, but you can check the value that you need to use by running `composer global config bin-dir --absolute`.
Or alternatively, include a dependency for `squizlabs/php_codesniffer` in your `composer.json` file. For example:
```json
{
"require-dev": {
"squizlabs/php_codesniffer": "3.*"
}
}
```
You will then be able to run PHP_CodeSniffer from the vendor bin directory:
./vendor/bin/phpcs -h
./vendor/bin/phpcbf -h
### Phive
If you use Phive, you can install PHP_CodeSniffer as a project tool using the following commands:
phive install phpcs
phive install phpcbf
You will then be able to run PHP_CodeSniffer from the tools directory:
./tools/phpcs -h
./tools/phpcbf -h
### PEAR
If you use PEAR, you can install PHP\_CodeSniffer using the PEAR installer. This will make the `phpcs` and `phpcbf` commands immediately available for use. To install PHP\_CodeSniffer using the PEAR installer, first ensure you have [installed PEAR](http://pear.php.net/manual/en/installation.getting.php) and then run the following command:
pear install PHP_CodeSniffer
### Git Clone
You can also download the PHP\_CodeSniffer source and run the `phpcs` and `phpcbf` commands directly from the Git clone:
git clone https://github.com/squizlabs/PHP_CodeSniffer.git
cd PHP_CodeSniffer
php bin/phpcs -h
php bin/phpcbf -h
## Documentation
The documentation for PHP\_CodeSniffer is available on the [Github wiki](https://github.com/squizlabs/PHP_CodeSniffer/wiki).
## Issues
Bug reports and feature requests can be submitted on the [Github Issue Tracker](https://github.com/squizlabs/PHP_CodeSniffer/issues).
## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md) for information.
## Versioning
PHP_CodeSniffer uses a `MAJOR.MINOR.PATCH` version number format.
The `MAJOR` version is incremented when:
- backwards-incompatible changes are made to how the `phpcs` or `phpcbf` commands are used, or
- backwards-incompatible changes are made to the `ruleset.xml` format, or
- backwards-incompatible changes are made to the API used by sniff developers, or
- custom PHP_CodeSniffer token types are removed
The `MINOR` version is incremented when:
- new backwards-compatible features are added to the `phpcs` and `phpcbf` commands, or
- backwards-compatible changes are made to the `ruleset.xml` format, or
- backwards-compatible changes are made to the API used by sniff developers, or
- new sniffs are added to an included standard
> NOTE: Backwards-compatible changes to the API used by sniff develpers will allow an existing sniff to continue running without producing fatal errors but may not result in the sniff reporting the same errors as it did previously without changes being required.
The `PATCH` version is incremented when:
- backwards-compatible bug fixes are made
> NOTE: As PHP_CodeSniffer exists to report and fix issues, most bugs are the result of coding standard errors being incorrectly reported or coding standard errors not being reported when they should be. This means that the messages produced by PHP_CodeSniffer, and the fixes it makes, are likely to be different between PATCH versions.
没有合适的资源?快使用搜索试试~ 我知道了~
PHP-CodeSniffer-3.3.2 PHP代码规范检查工具
需积分: 0 1 下载量 49 浏览量
2022-12-02
23:30:35
上传
评论
收藏 584KB TGZ 举报
温馨提示
共1138个文件
php:506个
inc:279个
fixed:130个
PHP_CodeSniffer是一款自动化的PHP代码规范检查工具。 CodeSniffer内置MySource、PEAR、PHPCS、PSR1、PSR2、Squiz和Zend等几套代码规范。当然,你也可以新增自己的代码规范。PHP_CodeSniffer包含两个工具,phpcs用来检查代码规范,phpcbf用来纠正代码规范。
资源推荐
资源详情
资源评论
收起资源包目录
PHP-CodeSniffer-3.3.2 PHP代码规范检查工具 (1138个子文件)
phpcbf.bat 423B
phpcs.bat 410B
ClassDefinitionNameSpacingUnitTest.css 1KB
IndentationUnitTest.css 1KB
ColonSpacingUnitTest.css 1003B
DuplicateClassDefinitionUnitTest.css 876B
ShorthandSizeUnitTest.css 777B
OpacityUnitTest.css 632B
ClassDefinitionOpeningBraceSpaceUnitTest.css 609B
DuplicateStyleDefinitionUnitTest.css 580B
DisallowMultipleStyleDefinitionsUnitTest.css 580B
ClassDefinitionClosingBraceSpaceUnitTest.css 533B
CommentedOutCodeUnitTest.css 489B
ForbiddenStylesUnitTest.css 480B
SuperfluousWhitespaceUnitTest.1.css 479B
SemicolonSpacingUnitTest.css 465B
LowercaseStyleDefinitionUnitTest.css 409B
NamedColoursUnitTest.css 337B
MissingColonUnitTest.css 290B
BrowserSpecificStylesUnitTest.css 281B
EmptyClassDefinitionUnitTest.css 256B
ColourDefinitionUnitTest.css 232B
EmptyStyleDefinitionUnitTest.css 232B
DisallowTabIndentUnitTest.css 62B
DisallowSpaceIndentUnitTest.css 61B
SuperfluousWhitespaceUnitTest.3.css 51B
SuperfluousWhitespaceUnitTest.2.css 50B
LineEndingsUnitTest.css 49B
EndFileNoNewlineUnitTest.1.css 22B
EndFileNewlineUnitTest.1.css 22B
EndFileNoNewlineUnitTest.2.css 21B
EndFileNewlineUnitTest.2.css 21B
EndFileNoNewlineUnitTest.3.css 20B
EndFileNewlineUnitTest.3.css 20B
phpcs.xml.dist 6KB
phpunit.xml.dist 315B
CodeSniffer.conf.dist 187B
ScopeIndentUnitTest.1.inc.fixed 22KB
LongConditionClosingCommentUnitTest.inc.fixed 16KB
ScopeIndentUnitTest.2.inc.fixed 16KB
FunctionCommentUnitTest.inc.fixed 16KB
MultipleStatementAlignmentUnitTest.inc.fixed 9KB
ArrayDeclarationUnitTest.1.inc.fixed 8KB
ArrayDeclarationUnitTest.2.inc.fixed 7KB
FunctionCallSignatureUnitTest.inc.fixed 6KB
FunctionCommentUnitTest.inc.fixed 6KB
VariableCommentUnitTest.inc.fixed 5KB
FunctionSpacingUnitTest.inc.fixed 5KB
InlineControlStructureUnitTest.inc.fixed 4KB
SwitchDeclarationUnitTest.inc.fixed 4KB
MemberVarSpacingUnitTest.inc.fixed 4KB
OperatorSpacingUnitTest.inc.fixed 4KB
OpeningFunctionBraceBsdAllmanUnitTest.inc.fixed 4KB
ScopeIndentUnitTest.1.js.fixed 4KB
MultiLineConditionUnitTest.inc.fixed 4KB
OperatorBracketUnitTest.inc.fixed 4KB
ArbitraryParenthesesSpacingUnitTest.inc.fixed 4KB
ControlSignatureUnitTest.inc.fixed 4KB
FunctionDeclarationUnitTest.inc.fixed 3KB
BlockCommentUnitTest.inc.fixed 3KB
OpeningFunctionBraceKernighanRitchieUnitTest.inc.fixed 3KB
MultiLineConditionUnitTest.js.fixed 3KB
ControlStructureSpacingUnitTest.inc.fixed 3KB
FunctionCallSignatureUnitTest.inc.fixed 3KB
MultiLineFunctionDeclarationUnitTest.inc.fixed 3KB
FunctionDeclarationArgumentSpacingUnitTest.inc.fixed 2KB
FunctionCallArgumentSpacingUnitTest.inc.fixed 2KB
ClassDeclarationUnitTest.inc.fixed 2KB
SelfMemberReferenceUnitTest.inc.fixed 2KB
ScopeClosingBraceUnitTest.inc.fixed 2KB
InlineCommentUnitTest.inc.fixed 2KB
OperatorBracketUnitTest.js.fixed 2KB
DisallowSpaceIndentUnitTest.2.inc.fixed 2KB
DisallowSpaceIndentUnitTest.1.inc.fixed 2KB
InlineCommentUnitTest.js.fixed 2KB
EmbeddedPhpUnitTest.inc.fixed 2KB
MultipleStatementAlignmentUnitTest.js.fixed 2KB
FunctionCallSignatureUnitTest.js.fixed 2KB
FunctionClosingBraceSpaceUnitTest.js.fixed 2KB
UseDeclarationUnitTest.5.inc.fixed 2KB
ClassDeclarationUnitTest.inc.fixed 2KB
DisallowTabIndentUnitTest.inc.fixed 2KB
IncludingFileUnitTest.inc.fixed 2KB
OpeningBraceSameLineUnitTest.inc.fixed 2KB
ControlSignatureUnitTest.js.fixed 2KB
ScopeClosingBraceUnitTest.inc.fixed 1KB
InlineIfDeclarationUnitTest.inc.fixed 1KB
DocCommentAlignmentUnitTest.inc.fixed 1KB
ScopeKeywordSpacingUnitTest.inc.fixed 1KB
IndentationUnitTest.css.fixed 1KB
MultiLineFunctionDeclarationUnitTest.js.fixed 1KB
DocCommentAlignmentUnitTest.js.fixed 1KB
LowerCaseConstantUnitTest.inc.fixed 1KB
OperatorSpacingUnitTest.js.fixed 1KB
LowerCaseTypeUnitTest.inc.fixed 1KB
UpperCaseConstantUnitTest.inc.fixed 1KB
ObjectOperatorIndentUnitTest.inc.fixed 1KB
ControlStructureSpacingUnitTest.js.fixed 1KB
FunctionDeclarationUnitTest.js.fixed 1KB
ObjectOperatorSpacingUnitTest.inc.fixed 1KB
共 1138 条
- 1
- 2
- 3
- 4
- 5
- 6
- 12
资源评论
joshua317
- 粉丝: 101
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功