webimpress / coding-standard
Webimpress 编码标准
    1.3.2
    2023-12-18 07:25 UTC
Requires
- php: ^7.3 || ^8.0
- squizlabs/php_codesniffer: ^3.7.2
Requires (Dev)
- phpunit/phpunit: ^9.6.15
README
安装
- 
通过运行以下命令安装模块 $ composer require --dev webimpress/coding-standard 
- 
将 composer 脚本添加到您的 composer.json"scripts": { "cs-check": "phpcs", "cs-fix": "phpcbf" } 
- 
在您的存储库基本路径下创建文件 phpcs.xml,内容如下<?xml version="1.0"?> <ruleset name="Webimpress Coding Standard" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="./vendor/squizlabs/php_codesniffer/phpcs.xsd"> <rule ref="./vendor/webimpress/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
使用方法
- 
仅运行检查 $ composer cs-check 
- 
自动修复许多 CS 问题 $ composer cs-fix