Skip to content

nicwortel/coding-standard

Repository files navigation

Coding standard

Build status License Packagist version PHP version from Packagist

This is my ruleset for PHP CodeSniffer. It's based on the PSR-12 Extended Coding Style, enhanced with sniffs from the Slevomat Coding Standard.

Installation

composer require --dev squizlabs/php_codesniffer nicwortel/coding-standard

Usage

Create a phpcs.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">
    <arg name="basepath" value="."/>
    <arg name="cache" value=".phpcs-cache"/>
    <arg name="colors"/>
    <arg name="extensions" value="php"/>

    <!-- Show progress and sniff names -->
    <arg value="ps" />

    <file>src/</file>

    <rule ref="NicWortel"/>
</ruleset>

Then you can run vendor/bin/phpcs.