Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

zendframework/zend-coding-standard

This branch is 225 commits ahead of, 2 commits behind master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

4d14354 · Apr 4, 2018
Mar 29, 2018
Apr 4, 2018
Apr 4, 2018
Nov 14, 2016
Aug 8, 2017
Nov 14, 2016
Feb 14, 2018
Nov 9, 2016
Mar 29, 2018
Mar 29, 2018
Feb 21, 2018
Feb 21, 2018
Mar 28, 2018
Mar 29, 2018
Feb 15, 2018

Repository files navigation

Zend Framework Coding Standard

Build Status Coverage Status

Repository with all coding standard ruleset for Zend Framework repositories.

Installation

  1. Install the module via composer by running:

    $ composer require --dev zendframework/zend-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 content:

    <?xml version="1.0"?>
    <ruleset name="Zend Framework Coding Standard"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">
        <rule ref="./vendor/zendframework/zend-coding-standard/ruleset.xml"/>
    
        <!-- Paths to check -->
        <file>config</file>
        <file>src</file>
        <file>test</file>
    </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.xml

Usage

  • To run checks only:

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

    $ composer cs-fix