geekmusclay/coding-standard

There is no license information available for the latest version (0.0.3) of this package.

GeekMusclay Coding Standard

Installs: 2

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:phpcodesniffer-standard

0.0.3 2023-07-08 08:49 UTC

This package is auto-updated.

Last update: 2024-05-08 10:31:57 UTC


README

Installation

  1. Install the module via composer by running:

    composer require --dev geekmusclay/coding-standard
  2. Add composer scripts into your composer.json:

    "scripts": {
      "cs-check": "phpcs",
      "cs-fix": "phpcbf"
    }
  3. Create file phpcs.xml on base path of your repository with this content:

    <?xml version="1.0"?>
    <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"/>
        <arg name="parallel" value="80"/>
    
        <!-- Show progress -->
        <arg value="p"/>
    
        <!-- Paths to check -->
        <file>config</file>
        <file>src</file>
        <file>test</file>
    
        <!-- Include all rules from the Laminas Coding Standard -->
        <rule ref="GeekmuaclayCodingStandard"/>
    </ruleset>

You can add or exclude some locations in that file. For a reference please see: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-Ruleset

Usage

  • To run checks only:

    composer cs-check
  • To automatically fix many CS issues:

    composer cs-fix

Ignoring parts of a File

Note: Before PHP_CodeSniffer version 3.2.0, // @codingStandardsIgnoreStart and // @codingStandardsIgnoreEnd were used. These are deprecated and will be removed in PHP_CodeSniffer version 4.0.