amesplash/php-coding-standard

The amésplash PHP Coding Standard

Installs: 922

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:phpcodesniffer-standard

dev-master 2021-09-08 09:07 UTC

This package is auto-updated.

Last update: 2024-12-08 15:59:23 UTC


README

The amésplash coding standard definition for PHP_CodeSniffer used at amésplash. Our coding standard is heavily based on Slevomat Coding Standard and Doctrine Coding Standard.

$ php composer require --dev amesplash/php-coding-standard

You now use it to sniff your files like below:

$ ./vendor/bin/phpcs --standard=Amesplash /path/to/file/or/folder/to/sniff.php

Or to do automatic fixes using phpcbf like below:

$ ./vendor/bin/phpcbf --standard=Amesplash /path/to/file/or/folder/to/fix.php

Per project ruleset

To enable the amésplash coding standard for your project, create a phpcs.xml.dist file with the following content:

<?xml version="1.0"?>
<ruleset>
    <arg name="basepath" value="."/>
    <arg name="extensions" value="php"/>
    <arg name="parallel" value="80"/>
    <arg name="cache" value=".phpcs-cache"/>
    <arg name="colors"/>

    <!-- Ignore warnings, show progress of the run and show sniff names -->
    <arg value="nps"/>

    <!-- Directories to be checked -->
    <file>src</file>

    <!-- Reference the amésplash coding standard -->
    <rule ref="Amesplash"/>
</ruleset>