altelma/cs-fixer

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

php-cs-fixer with Github hook and config

v1.0.1 2019-11-13 06:39 UTC

This package is auto-updated.

Last update: 2024-04-17 01:33:02 UTC


README

This package is based on https://github.com/FriendsOfPHP/PHP-CS-Fixer with addition of git pre-commit hook installation.

The hook will prevent the commit if the code does not comply with the coding standard rules

Default set of rules that are fully extendable

Installation

Require a package

composer require --dev altelma/cs-fixer

Add composer init-hook command

"scripts": {
    "init-hook": "composer run-script post-install-cmd -d ./vendor/altelma/cs-fixer"
}

Install the git hook

composer run-script init-hook

Manual Usage

vendor/bin/cs-fixer help

Note: Composer can install the binaries in custom dir instead of vendor/bin/ (sylius installs in bin/)

Rules configuration

To override default rules add .php_cs_rules.php file in the root of the project

<?php

return [
    'finder' => [
        'exclude' => [
            'var'
        ],
        'notName' => [
           'autoload.php',
        ],
    'fixer' => [
        'single_blank_line_at_eof' => true
    ]
]

Changelog