figlab / coding-standard
适用于Laravel应用的PHPCS编码规范。
1.0.4
2024-08-06 01:40 UTC
Requires
README
为Laravel应用和包提供的PHPCS编码规范。基于出色的IxDF编码规范。
安装
- 通过运行以下命令通过composer安装包:
composer require --dev figlab/coding-standard
- 将composer脚本添加到你的
composer.json
文件中
"scripts": { "cs:check": "phpcs -p -s --colors --report-full --report-summary", "cs:fix": "phpcbf -p --colors" }
- 在你的仓库基本路径上创建名为
phpcs.xml
的文件,内容如下
<?xml version="1.0"?> <ruleset name="My Coding Standard"> <!-- Include all rules from the IxDF Coding Standard --> <rule ref="FigLabCodingStandard"/> <!-- Paths to check --> <file>app</file> <file>config</file> <file>database</file> <file>lang</file> <file>routes</file> <file>tests</file> </ruleset>
用法
- 仅运行检查
composer cs:check
- 自动修复CS问题
composer cs:fix