kmcculloch / phpspec-code-sniffer
非常简单的PHPSpec代码检查,基于PSR1和PSR2
v1.1.0
2018-04-26 18:39 UTC
Requires
- squizlabs/php_codesniffer: ~2.0 || ~3.0
This package is not auto-updated.
Last update: 2024-09-14 19:04:11 UTC
README
非常简单的PHPSpec代码检查,基于PSR1和PSR2
Kevin McCulloch p.kevin.mcculloch@gmail.com
目的
我编写了这个模块,以便我能够轻松切换一个不会为PHPSpec的non-camel-case it_does_something()函数命名约定抛出错误的phpcs标准。它所做的只是应用PSR1和PSR2,同时忽略camel-case函数命名规则。实际上非常简单。如果其他人觉得这个规则集有用,我会愿意扩展它。
全局安装
如果您已全局安装了phpcs(通常涉及运行composer global require squizlabs/php_codesniffer:~2.0并将~/.composer/vendor/bin添加到您的$PATH),您可以像这样添加此规则集
composer global require kmcculloch/phpspec-code-sniffer:1.x-dev
# Tell phpcs where to find the ruleset:
phpcs --config-set installed_paths ~/.composer/vendor/kmcculloch/phpspec-code-sniffer/
# Run the following and confirm that you can see "PHPSpec" in the list of
# installed standards:
phpcs -i
# Sniff your code:
phpcs --standard=PHPSpec ~/path/to/MyClassSpec.php