stechstudio / Laravel-PHP-CS-Fixer

Artisan Command for FriendsOfPHP/PHP-CS_Fixer
MIT License
146 stars 28 forks source link

Multiple --path options #19

Closed rodion-arr closed 3 years ago

rodion-arr commented 4 years ago

First of all - thanks for the package!

Faced next issue: I'd like to specify 2 project folders (app and tests) for fixer command using --path option.

According to README it supports multiple values:

Options:
      --path[=PATH]                    The path. (multiple values allowed)

Here is my command:

php artisan fixer:fix --path app --path tests --dry-run

Error in result For multiple paths config parameter is required.:

   PhpCsFixer\ConfigurationException\InvalidConfigurationException  : For multiple paths config parameter is required.

  at path_to_project\vendor\friendsofphp\php-cs-fixer\src\Console\ConfigurationResolver.php:582
    578|
    579|         if ($this->isStdIn() || 0 === \count($path)) {
    580|             $configDir = $this->cwd;
    581|         } elseif (1 < \count($path)) {
  > 582|             throw new InvalidConfigurationException('For multiple paths config parameter is required.');
    583|         } elseif (is_file($path[0]) && $dirName = pathinfo($path[0], PATHINFO_DIRNAME)) {
    584|             $configDir = $dirName;
    585|         } else {
    586|             $configDir = $path[0];

So here are questions from my side:

  1. Do we have an example of config file for multiple paths?
  2. Do we need to remove (multiple values allowed) from --path docs?

Thanks in advance!

tai-sho commented 4 years ago

I am also interested in this topic. Is there any way?

bubba-h57 commented 4 years ago

I'll dig into it and get back to you.

bubba-h57 commented 3 years ago

I believe all of the issues discussed here are solved in PR https://github.com/stechstudio/Laravel-PHP-CS-Fixer/pull/31 which will be the next major version with support for PHP-CS-Fixer 3.0. If you want to pull that branch and take a look at, I'd appreciate any feedback.

rodion-arr commented 3 years ago

Hi, it looks like --path option was dropped?

bubba-h57 commented 3 years ago

Doh, yea ... I moved those to arguments ... but they really should be optional. I'll update that shortly.

rodion-arr commented 3 years ago

Ok from my side. I believe my issue can be closed for now.