streamcommon/coding-standard

StreamCommon 团队编码规范

1.0.3 2019-02-16 22:27 UTC

This package is auto-updated.

Last update: 2024-09-13 06:56:34 UTC


README

Latest Stable Version Total Downloads License

安装

  1. 通过composer安装模块
    • 控制台运行
        composer require --dev streamcommon/coding-standard
    • 或者添加到你的composer.json
        "require-dev": {
            "streamcommon/coding-standard": "*"
        }
  2. 将composer脚本添加到你的composer.json
         "scripts": {
             "cs-check": "phpcs",
             "cs-fix": "phpcbf"
         }
  3. 创建文件phpcs.xml
        <?xml version="1.0"?>
            <ruleset name="StreamCommon Team Coding Standard">
            <rule ref="./vendor/streamcommon/coding-standard/ruleset.xml"/>
            <file>bin</file>
            <file>config</file>
            <file>lib</file>
            <file>src</file>
            <file>test</file>
        </ruleset>

用法

运行:composer cs-checkcomposer cs-fix

自定义

查看https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml