phpantastic / coding-standard
PHPantastic 编码规范
1.0
2020-03-29 10:13 UTC
Requires
This package is auto-updated.
Last update: 2024-09-29 06:02:39 UTC
README
包含 PHPantastic 仓库所有编码规范规则的仓库。
安装
-
通过运行以下命令通过 composer 安装模块
$ composer require --dev phpantastic/coding-standard
-
将 composer 脚本添加到您的
composer.json"scripts": { "cs-check": "phpcs", "cs-fix": "phpcbf" }
-
在您的仓库基本路径上创建文件
phpcs.xml,内容如下<?xml version="1.0"?> <ruleset name="Laminas Coding Standard"> <rule ref="./vendor/phpantastic/coding-standard/ruleset.xml"/> <!-- Paths to check --> <file>config</file> <file>src</file> <file>test</file> </ruleset>
您可以在该文件中添加或排除一些位置。有关参考,请参阅:https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml
使用方法
-
仅运行检查
$ composer cs-check
-
自动修复许多 CS 问题
$ composer cs-fix