appocular/coding-standard

Appocular PHP coding standard, PHP Code Sniffer rules.

Installs: 3 408

Dependents: 1

Suggesters: 0

Security: 0

Stars: 2

Watchers: 2

Forks: 2

Open Issues: 1

Type:phpcodesniffer-standard

2.2.4 2023-09-05 16:03 UTC

README

This is the PHP coding standard used by Appocular, based on PSR12 and Slevomat Coding Standard.

It incorporates PSR12 unmodified, and most of Slevomat, disabling Slevomat rules where they conflict with PSR12. Some other Slevomat rules have been disabled, see the changelog or the ruleset.xml for details.

Installation

composer require --dev appocular/coding-standard

Configuration

Example .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>