I installed php-cs-fixer
globally by running
$ wget http://cs.sensiolabs.org/download/php-cs-fixer-v2.phar -O php-cs-fixer
followed by running
$ sudo chmod a+x php-cs-fixer
$ sudo mv php-cs-fixer /usr/local/bin/php-cs-fixer
When I try to run php-cs-fixer
with
$ php-cs-fixer -vv fix /home/xxx/host/master/src/AppBundle/Command/GenerateERPContractInvoicesCommand.php --config=sf2
this results in the following error message:
[PhpCsFixer\ConfigurationException\InvalidConfigurationException (16)]
Cannot read config file "sf2"
An attempt to run with --config=sf23
results in the same error message.
Trying to run like this
$ php-cs-fixer fix src/AppBundle/Command/GenerateERPContractInvoicesCommand.php --level=symfony
results in the error message
The "--level" option does not exist.
Then I create a configuration file.php_cs
with the content
<?php
$finder = Symfony\CS\Finder::create()
->exclude([
'app',
'spec',
'build',
'bin',
'web',
'vendor',
])
->in(__DIR__);
return Symfony\CS\Config::create()
->fixers([
'short_array_syntax',
'-phpdoc_align',
'ordered_use',
])
->finder($finder);
and receive the following error message:
[PhpCsFixer\ConfigurationException\InvalidConfigurationException]
The config file: "/home/ivan/host/master/.php_cs" does not return a "PhpCsFixer\ConfigInterface" instance. Got: "integer".
How do I use php-cs-fixer
for Symfony, can you help?
Where can I get the configuration for Symfony, and how do I correctly use php-cs-fixer
for a Symfony project ?
According to the documentation, you may want to run with rules
argument :
php php-cs-fixer.phar fix /path/to/project --rules=@Symfony