code-atlantic / coding-standards
Code Atlantic 编码标准
1.1.0
2023-09-04 06:24 UTC
Requires
This package is auto-updated.
Last update: 2024-09-16 03:42:50 UTC
README
安装
可以使用Composer依赖管理器安装标准
composer require code-atlantic/coding-standards --dev
用法
基本用法
当通过Composer安装此包时,您可以使用以下命令检查您的文件是否符合编码标准:
vendor/bin/phpcs --standard="CodeAtlantic" <path>
其中 <path>
是至少一个要检查的文件或目录,例如 .
。
配置文件
为了避免需要在命令行中传递所有参数,并且还可以对您的项目进行自定义设置,请创建一个包含以下内容的phpcs.xml.dist
文件:
<?xml version="1.0"?> <ruleset name="MyProjectCodingStandard"> <description>My Project coding standard.</description> <file>.</file> <!-- Only check .php files --> <arg name="extensions" value="php" /> <!-- Set required text domain --> <config name="text_domain" value="my-project" /> <!-- PHP 7.0 and higher. --> <config name="testVersion" value="7.0-" /> <!-- Rules --> <rule ref="CodeAtlantic" /> </ruleset>