Skip to content

Latest commit

 

History

History
66 lines (44 loc) · 1.21 KB

README.md

File metadata and controls

66 lines (44 loc) · 1.21 KB

🌴 Palmtree PHP-CS-Fixer Config

PHP-CS-Fixer config for Palmtree components

Requirements

  • PHP >= 7.1

Installation

Use composer to add the package to your dev dependencies:

composer require palmtree/php-cs-fixer-config --dev
"scripts": {
    "sniff": "vendor/bin/php-cs-fixer fix -v --dry-run --stop-on-violation --using-cache=no --diff --diff-format=udiff",
    "fix": "vendor/bin/php-cs-fixer fix --diff",
}

Usage

Create a .php_cs.dist file in your project's root directory. You can copy a typical config file from this repository if desired:

$ cp vendor/palmtree/php-cs-fixer-config/.php_cs.dist .

Add the following entries to your .gitignore file:

/.php_cs.cache
/.php_cs

Fixing Issues

Manually

To fix issues manually, run the following command:

$ composer fix

To perform a dry run, run the following command:

$ composer sniff

Pre-commit hook

Run the following to have PHP-CS-Fixer run on changed files before every commit:

$ cp vendor/palmtree/php-cs-fixer-config/git-hooks/pre-commit .git/hooks/pre-commit
$ chmod +x .git/hooks/pre-commit

License

Released under the MIT license