appocular/coding-standard

Appocular PHP编码标准,PHP Code Sniffer 规则。

安装次数: 3,547

依赖关系: 1

建议者: 0

安全性: 0

星级: 2

关注者: 2

分支: 2

开放问题: 1

类型:phpcodesniffer-standard

2.2.4 2023-09-05 16:03 UTC

README

这是Appocular使用的PHP编码标准,基于PSR12和Slevomat编码标准

它保留了PSR12的不变性,以及大部分Slevomat规则,在与PSR12冲突的地方禁用了Slevomat规则。一些其他Slevomat规则已被禁用,具体请参阅变更日志ruleset.xml以获取详细信息。

安装

composer require --dev appocular/coding-standard

配置

示例.phpcs.xml

<?xml version="1.0"?>
<ruleset>
    <file>./app</file>
    <file>./bootstrap</file>
    <file>./database</file>
    <file>./routes</file>
    <file>./tests</file>
    <rule ref="AppocularCodingStandard"/>
    <rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName">
      <properties>
        <!-- Tell Slevomat the root directories of our namespaces, so
             it can check if the filepath is correct. -->
      <property name="rootNamespaces" type="array">
        <element key="app" value="Appocular\Assessor"/>
        <element key="tests" value="Appocular\Assessor"/>
      </property>
      </properties>
    </rule>
</ruleset>