digitalpulp / pre-commit-php

Pre-commit scripts appropiate for *any* PHP project. These hooks are made as custom plugins under the [pre-commit](http://pre-commit.com/#new-hooks) git hook framework.
https://www.digitalpulp.com
Apache License 2.0
54 stars 36 forks source link

Update php-cs-fixer --level option to --rules #14

Open Razoxane opened 3 years ago

Razoxane commented 3 years ago

When I tried using the php-cs-fixer hook for the first time, I got the following error: The "--level" option does not exist.

PHP CS Fixer's fix method args were changed in version 2.0 in 2015 in commit https://github.com/FriendsOfPHP/PHP-CS-Fixer/commit/d1aec7bc12918281f370b4a58533aa30fc147004. Specifically, the --level arg was deprecated and changed to --rules, with the requirement of an @ symbol to indicate a pre-defined ruleset.

Update the example args to user the new syntax, so the hook works for PHP CS Fixer versions 2.0 and up.