PHP-CS-Fixer config for Palmtree components
- PHP >= 7.1
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",
}
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
To fix issues manually, run the following command:
$ composer fix
To perform a dry run, run the following command:
$ composer sniff
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
Released under the MIT license