Closed kapdom closed 1 year ago
The pre-commit taks passes the changes files to the tool, so that only the changed files are being checked.
Normally, the config should only take one argument.
Can you try by explicitly setting the config file to .php.cs-fixer.php
in your grumphp php-cs-fixer config?
Just out of curiousity: any specific reason you don't validate all rules from config and overwrite them with a limited set of rules?
I have a very similar issue.
php-grumphp run
return success
but php-grumphp git:pre-commit
return error :
PHP CS Fixer 3.12.0 Oliva by Fabien Potencier and Dariusz Ruminski.
PHP runtime: 8.1.11
In ConfigurationResolver.php line 559:
[PhpCsFixer\ConfigurationException\InvalidConfigurationException (16)]
For multiple paths config parameter is required.
Did someone found the fix ?
Found the issue :
You need to provide the config
attribute in the grumphp.yaml
file.
In @kapdom case : config : 'php.cs-fixer.php'
I also had to remove the rules
attribute :-)
Hope this help
Looks like the filename you are using is not using the default filename
https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/blob/master/UPGRADE-v3.md#rename-of-files
You either have to pass the config option or use the supported default name for the tool. Does it work after renaming the file or do we need to change something at our end?
I currently feel like providing null for the config is the best option for grumphp at this moment. Butif you can think of a better default, feel free to change my mind.
Closing this one for now since an answer was provided. Feel free to reopen or create a new issue if the still persists
1.13.0
My configuration
.php.cs-fixer.php file
pre-commit hook
Hi. When I run grumphp from command line
vendor/bin/grumphp run
then everything is ok. But when grumphp run is triggered by git pre-commit hook then I have error.When I debug this error I see in line 546 I have following content in variable.
Why that second file in array this is a file I modified before commit. So why phpfixer take it as config?