Artisan Command for FriendsOfPHP/PHP-CS_Fixer

Overview

Laravel PHP CS Fixer

The PHP CS Fixer is maintained on GitHub at https://github.com/FriendsOfPHP/PHP-CS-Fixer bug reports and ideas about new features are welcome there.

The PHP Coding Standards Fixer (PHP CS Fixer) tool fixes your code to follow standards; whether you want to follow PHP coding standards as defined in the PSR-1, PSR-2, etc., or other community driven ones like the Symfony one. You can also define your (teams) style through configuration.

This package makes it easier than ever to use PHP CS Fixer to maintain your laravel code by providing access to it via tools that you are already familiar with. An artisan command to fix the code, and manage the configuration the way you do all the other laravel packages you use.

Features of this package

  • Run PHP-CS-Fixer commands via Laravel Artisan CLI.
  • Laravel Code Style Configuration Used by Default.
  • No need to learn a new tool.

Versions and compatibility

Note: This documentation was written for Laravel 5.5.

  • PHP Version: "^7.1.3 || ^8.0"
  • Laravel/Lumen: "^5.4|^6.0|^7.0|^8.0"
  • PHP-CS-Fixer: "^3.0.0"

Installation

composer require stechstudio/laravel-php-cs-fixer

Configuration

The default rule configuration is in the fixer.php and is intended to match the rules used by Laravel Shift.

if you want to modify this yourself, just use artisan php artisan vendor:publish --provider="STS\Fixer\FixerServiceProvider" and it will put the default configuration in 'config/fixer.php'. Check the
PHP-CS-Fixer/README for valid rules.

Usage

Fix Your Code

Fix your code with Laravel Coding Standards.

Syntax:

$ php artisan fixer:fix [options]

Example:

Usage:
  fixer:fix [options] [--] [<path>...]

Arguments:
  path                               The path. Can be a list of space separated paths

Options:
      --path-mode=PATH-MODE          Specify path mode (can be override or intersection). [default: "override"]
      --allow-risky=ALLOW-RISKY      Are risky fixers allowed (can be yes or no).
      --config=CONFIG                The path to a .php-cs-fixer.php file.
      --dry-run                      Only shows which files would have been modified.
      --rules=RULES                  The rules.
      --using-cache=USING-CACHE      Does cache should be used (can be yes or no).
      --cache-file=CACHE-FILE        The path to the cache file.
      --diff                         Also produce diff for each file.
      --format=FORMAT                To output results in other formats.
      --stop-on-violation            Stop execution on first violation.
      --show-progress=SHOW-PROGRESS  Type of progress indicator (none, dots).
  -h, --help                         Display help for the given command. When no command is given display help for the list command
  -q, --quiet                        Do not output any message
  -V, --version                      Display this application version
      --ansi                         Force ANSI output
      --no-ansi                      Disable ANSI output
  -n, --no-interaction               Do not ask any interactive question
      --env[=ENV]                    The environment the command should run under
  -v|vv|vvv, --verbose               Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
  
Comments
  • Multiple --path options

    Multiple --path options

    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!

    Type: Question Status: In Progress Priority: Medium 
    opened by rodion-arr 6
  • Package does not run and here is the details and error.

    Package does not run and here is the details and error.

    Package does not run and here is the details and error. SYSTEM DETAILS LARAVEL 5.7 "stechstudio/laravel-php-cs-fixer": "^2.1"

    vagrant@homestead:~/code$ php artisan fixer:fix --dry-run
    
       TypeError
    
      Argument 1 passed to PhpCsFixer\Config::setRules() must be of the type array, null given, called in /home/vagrant/code/vendor/stechstudio/laravel-php-cs-fixer/src/Console/FixCommand.php on line 146
    
      at vendor/friendsofphp/php-cs-fixer/src/Config.php:259
        255|
        256|     /**
        257|      * {@inheritdoc}
        258|      */
      > 259|     public function setRules(array $rules)
        260|     {
        261|         $this->rules = $rules;
        262|
        263|         return $this;
    
          +17 vendor frames
      18  artisan:37
          Illuminate\Foundation\Console\Kernel::handle()
    
    
    opened by ap-coder 4
  • Laravel 7 support

    Laravel 7 support

    You have it in master but not released the version.

    composer require stechstudio/laravel-php-cs-fixer --dev
    Using version ^2.0 for stechstudio/laravel-php-cs-fixer
    ./composer.json has been updated
    Loading composer repositories with package information
    Updating dependencies (including require-dev)
    Your requirements could not be resolved to an installable set of packages.
    
      Problem 1
        - Conclusion: remove laravel/framework v7.0.4
        - Conclusion: don't install laravel/framework v7.0.4
        - stechstudio/laravel-php-cs-fixer v2.0.0 requires illuminate/support ^5.4|^6.0 -> satisfiable by illuminate/support[5.7.17, 5.7.18, 5.7.19, v5.4.0, v5.4.13, v5.4.17, v5.4.19, v5.4.27, v5.4.36, v5.4.9, v5.5.0, v5.5.16, v5.5.17, v5.5.2, v5.5.28, v5.5.33, v5.5.34, v5.5.35, v5.5.36, v5.5.37, v5.5.39, v5.5.40, v5.5.41, v5.5.43, v5.5.44, v5.6.0, v5.6.1, v5.6.10, v5.6.11, v5.6.12, v5.6.13, v5.6.14, v5.6.15, v5.6.16, v5.6.17, v5.6.19, v5.6.2, v5.6.20, v5.6.21, v5.6.22, v5.6.23, v5.6.24, v5.6.25, v5.6.26, v5.6.27, v5.6.28, v5.6.29, v5.6.3, v5.6.30, v5.6.31, v5.6.32, v5.6.33, v5.6.34, v5.6.35, v5.6.36, v5.6.37, v5.6.38, v5.6.39, v5.6.4, v5.6.5, v5.6.6, v5.6.7, v5.6.8, v5.6.9, v5.7.0, v5.7.1, v5.7.10, v5.7.11, v5.7.15, v5.7.2, v5.7.20, v5.7.21, v5.7.22, v5.7.23, v5.7.26, v5.7.27, v5.7.28, v5.7.3, v5.7.4, v5.7.5, v5.7.6, v5.7.7, v5.7.8, v5.7.9, v5.8.0, v5.8.11, v5.8.12, v5.8.14, v5.8.15, v5.8.17, v5.8.18, v5.8.19, v5.8.2, v5.8.20, v5.8.22, v5.8.24, v5.8.27, v5.8.28, v5.8.29, v5.8.3, v5.8.30, v5.8.31, v5.8.32, v5.8.33, v5.8.34, v5.8.35, v5.8.36, v5.8.4, v5.8.8, v5.8.9, v6.0.0, v6.0.1, v6.0.2, v6.0.3, v6.0.4, v6.1.0, v6.10.0, v6.11.0, v6.12.0, v6.13.0, v6.13.1, v6.14.0, v6.15.0, v6.15.1, v6.16.0, v6.17.0, v6.17.1, v6.18.0, v6.2.0, v6.3.0, v6.4.1, v6.5.0, v6.5.1, v6.5.2, v6.6.0, v6.6.1, v6.6.2, v6.7.0, v6.8.0].
        - stechstudio/laravel-php-cs-fixer v2.0.1 requires illuminate/support ^5.4|^6.0 -> satisfiable by illuminate/support[5.7.17, 5.7.18, 5.7.19, v5.4.0, v5.4.13, v5.4.17, v5.4.19, v5.4.27, v5.4.36, v5.4.9, v5.5.0, v5.5.16, v5.5.17, v5.5.2, v5.5.28, v5.5.33, v5.5.34, v5.5.35, v5.5.36, v5.5.37, v5.5.39, v5.5.40, v5.5.41, v5.5.43, v5.5.44, v5.6.0, v5.6.1, v5.6.10, v5.6.11, v5.6.12, v5.6.13, v5.6.14, v5.6.15, v5.6.16, v5.6.17, v5.6.19, v5.6.2, v5.6.20, v5.6.21, v5.6.22, v5.6.23, v5.6.24, v5.6.25, v5.6.26, v5.6.27, v5.6.28, v5.6.29, v5.6.3, v5.6.30, v5.6.31, v5.6.32, v5.6.33, v5.6.34, v5.6.35, v5.6.36, v5.6.37, v5.6.38, v5.6.39, v5.6.4, v5.6.5, v5.6.6, v5.6.7, v5.6.8, v5.6.9, v5.7.0, v5.7.1, v5.7.10, v5.7.11, v5.7.15, v5.7.2, v5.7.20, v5.7.21, v5.7.22, v5.7.23, v5.7.26, v5.7.27, v5.7.28, v5.7.3, v5.7.4, v5.7.5, v5.7.6, v5.7.7, v5.7.8, v5.7.9, v5.8.0, v5.8.11, v5.8.12, v5.8.14, v5.8.15, v5.8.17, v5.8.18, v5.8.19, v5.8.2, v5.8.20, v5.8.22, v5.8.24, v5.8.27, v5.8.28, v5.8.29, v5.8.3, v5.8.30, v5.8.31, v5.8.32, v5.8.33, v5.8.34, v5.8.35, v5.8.36, v5.8.4, v5.8.8, v5.8.9, v6.0.0, v6.0.1, v6.0.2, v6.0.3, v6.0.4, v6.1.0, v6.10.0, v6.11.0, v6.12.0, v6.13.0, v6.13.1, v6.14.0, v6.15.0, v6.15.1, v6.16.0, v6.17.0, v6.17.1, v6.18.0, v6.2.0, v6.3.0, v6.4.1, v6.5.0, v6.5.1, v6.5.2, v6.6.0, v6.6.1, v6.6.2, v6.7.0, v6.8.0].
        - don't install illuminate/support 5.7.17|don't install laravel/framework v7.0.4
        - don't install illuminate/support 5.7.18|don't install laravel/framework v7.0.4
        - don't install illuminate/support 5.7.19|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.5.0|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.5.16|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.5.17|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.5.2|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.5.28|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.5.33|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.5.34|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.5.35|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.5.36|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.5.37|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.5.39|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.5.40|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.5.41|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.5.43|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.5.44|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.6.0|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.6.1|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.6.10|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.6.11|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.6.12|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.6.13|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.6.14|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.6.15|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.6.16|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.6.17|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.6.19|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.6.2|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.6.20|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.6.21|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.6.22|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.6.23|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.6.24|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.6.25|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.6.26|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.6.27|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.6.28|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.6.29|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.6.3|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.6.30|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.6.31|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.6.32|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.6.33|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.6.34|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.6.35|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.6.36|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.6.37|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.6.38|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.6.39|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.6.4|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.6.5|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.6.6|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.6.7|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.6.8|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.6.9|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.7.0|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.7.1|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.7.10|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.7.11|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.7.15|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.7.2|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.7.20|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.7.21|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.7.22|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.7.23|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.7.26|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.7.27|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.7.28|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.7.3|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.7.4|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.7.5|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.7.6|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.7.7|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.7.8|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.7.9|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.8.0|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.8.11|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.8.12|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.8.14|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.8.15|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.8.17|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.8.18|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.8.19|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.8.2|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.8.20|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.8.22|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.8.24|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.8.27|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.8.28|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.8.29|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.8.3|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.8.30|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.8.31|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.8.32|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.8.33|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.8.34|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.8.35|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.8.36|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.8.4|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.8.8|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.8.9|don't install laravel/framework v7.0.4
        - don't install illuminate/support v6.0.0|don't install laravel/framework v7.0.4
        - don't install illuminate/support v6.0.1|don't install laravel/framework v7.0.4
        - don't install illuminate/support v6.0.2|don't install laravel/framework v7.0.4
        - don't install illuminate/support v6.0.3|don't install laravel/framework v7.0.4
        - don't install illuminate/support v6.0.4|don't install laravel/framework v7.0.4
        - don't install illuminate/support v6.1.0|don't install laravel/framework v7.0.4
        - don't install illuminate/support v6.10.0|don't install laravel/framework v7.0.4
        - don't install illuminate/support v6.11.0|don't install laravel/framework v7.0.4
        - don't install illuminate/support v6.12.0|don't install laravel/framework v7.0.4
        - don't install illuminate/support v6.13.0|don't install laravel/framework v7.0.4
        - don't install illuminate/support v6.13.1|don't install laravel/framework v7.0.4
        - don't install illuminate/support v6.14.0|don't install laravel/framework v7.0.4
        - don't install illuminate/support v6.15.0|don't install laravel/framework v7.0.4
        - don't install illuminate/support v6.15.1|don't install laravel/framework v7.0.4
        - don't install illuminate/support v6.16.0|don't install laravel/framework v7.0.4
        - don't install illuminate/support v6.17.0|don't install laravel/framework v7.0.4
        - don't install illuminate/support v6.17.1|don't install laravel/framework v7.0.4
        - don't install illuminate/support v6.18.0|don't install laravel/framework v7.0.4
        - don't install illuminate/support v6.2.0|don't install laravel/framework v7.0.4
        - don't install illuminate/support v6.3.0|don't install laravel/framework v7.0.4
        - don't install illuminate/support v6.4.1|don't install laravel/framework v7.0.4
        - don't install illuminate/support v6.5.0|don't install laravel/framework v7.0.4
        - don't install illuminate/support v6.5.1|don't install laravel/framework v7.0.4
        - don't install illuminate/support v6.5.2|don't install laravel/framework v7.0.4
        - don't install illuminate/support v6.6.0|don't install laravel/framework v7.0.4
        - don't install illuminate/support v6.6.1|don't install laravel/framework v7.0.4
        - don't install illuminate/support v6.6.2|don't install laravel/framework v7.0.4
        - don't install illuminate/support v6.7.0|don't install laravel/framework v7.0.4
        - don't install illuminate/support v6.8.0|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.4.0|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.4.13|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.4.17|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.4.19|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.4.27|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.4.36|don't install laravel/framework v7.0.4
        - don't install illuminate/support v5.4.9|don't install laravel/framework v7.0.4
        - Installation request for laravel/framework (locked at v7.0.4, required as ^7.0) -> satisfiable by laravel/framework[v7.0.4].
        - Installation request for stechstudio/laravel-php-cs-fixer ^2.0 -> satisfiable by stechstudio/laravel-php-cs-fixer[v2.0.0, v2.0.1].
    
    opened by mbalandis 4
  • license violation

    license violation

    https://github.com/stechstudio/Laravel-PHP-CS-Fixer/blob/v2.2.0/src/Console/FixCommand.php is almost copy-paste of https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/v2.14.6/src/Console/Command/FixCommand.php , especially the execute method.

    While it's OK to take benefit of the code, one doing that should respect the license and copyrights - especially the following

    The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

    right now, this package is claiming full copyrights for this package

    opened by keradus 3
  • Class PhpCsFixer\Report\ReportSummary not found

    Class PhpCsFixer\Report\ReportSummary not found

    I've found PhpCsFixer has a new release v2.18.6 and no have ReportSummary class anymore. I've got an error when running the fixer command.

    Class "PhpCsFixer\Report\ReportSummary" not found
    
      at vendor/stechstudio/laravel-php-cs-fixer/src/Console/FixCommand.php:97
         93▕         $progressOutput->printLegend();
         94▕ 
         95▕         $fixEvent = $this->stopwatch->getEvent('fixFiles');
         96▕ 
      ➜  97▕         $reportSummary = new ReportSummary(
         98▕             $changed,
         99▕             $fixEvent->getDuration(),
        100▕             $fixEvent->getMemory(),
        101▕             OutputInterface::VERBOSITY_VERBOSE <= $this->getOutput()->getVerbosity(),
    
          +13 vendor frames 
      14  artisan:37
          Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    

    Please let me know when you fix this issue. Now I fix the version of PhpCsFixer at 2.18.5 to avoid this issue.

    opened by ALTELMA 3
  • Verbosity level is not working

    Verbosity level is not working

    The command gives the same result as without the verbosity:

    php artisan fixer:fix --show-progress=dots -v

    This is because the verbosity is set by default, but not from the output.

    opened by stasadev 0
  • Too few arguments to function FixCommandExitStatusCalculator::calculate

    Too few arguments to function FixCommandExitStatusCalculator::calculate

    PHP-CS-Fixer

    • Version: 2.16.0

    composer.json

    {
    "stechstudio/laravel-php-cs-fixer": "^2.0"
    }
    

    Error

     Symfony\Component\Debug\Exception\FatalThrowableError  : Too few arguments to function PhpCsFixer\Console\Command\FixCommandExitStatusCalculator::calculate(), 4 passed in /Users/user/project/vendor/stechstudio/laravel-php-cs-fixer/src/Console/FixCommand.php on line 138 and exactly 5 expected
    
      at /Users/user/project/vendor/friendsofphp/php-cs-fixer/src/Console/Command/FixCommandExitStatusCalculator.php:38
        34|      * @param bool $hasLintErrorsAfterFixing
        35|      *
        36|      * @return int
        37|      */
      > 38|     public function calculate($isDryRun, $hasChangedFiles, $hasInvalidErrors, $hasExceptionErrors, $hasLintErrorsAfterFixing)
        39|     {
        40|         $exitStatus = 0;
        41|
        42|         if ($isDryRun) {
    
      Exception trace:
    
      1   PhpCsFixer\Console\Command\FixCommandExitStatusCalculator::calculate()
          /Users/user/project/vendor/stechstudio/laravel-php-cs-fixer/src/Console/FixCommand.php:138
    
      2   STS\Fixer\Console\FixCommand::handle()
          /Users/user/project/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:32
    

    Possible solution

    Seems like a $hasLintErrorsAfterFixing has to be passed to calculate() as well. This is new in Version 2.16.0, which (after SemVer) shouldn't be a breaking change. But it is 🤷‍♂.

    • File: vendor/stechstudio/laravel-php-cs-fixer/src/Console/FixCommand.php
    • Line: 132 - 139
    $exitStatusCalculator = new FixCommandExitStatusCalculator();
    
            return $exitStatusCalculator->calculate(
                $resolver->isDryRun(),
                count($changed) > 0,
                count($invalidErrors) > 0,
                count($exceptionErrors) > 0
            );
    

    Hope this helps @bubba-h57

    Type: Enhancement Status: In Progress Priority: Medium 
    opened by repat 0
  • Laravel-PHP-CS-Fixer with php-cs-fixer in vs-code

    Laravel-PHP-CS-Fixer with php-cs-fixer in vs-code

    • Is it possible to integrate with the extensionphp-cs-fixer in vs-code so that it formats with the configurations of Laravel-PHP-CS-Fixer where a file is saved?
    opened by Daespinosag 2
  • Support a exclude parameter

    Support a exclude parameter

    We need support to exclude parameters through config/fixer.php like 'exclude' => ['nodes_modules']. Also you can include that on FixCommand.php notPath('node_modules' ) as default.

    opened by andreseko 0
  • Custom fixer.php completely ignored

    Custom fixer.php completely ignored

    I am trying to customize the config/fixer.php that this package generates to tweak some of the rules, but they are completely ignored. No matter what I change in that file, none of the changes get picked up. Also, the fixer.php still uses rule names from the old php-cs-fixer version 2. For example lowercase_constants should now be constant_case.

    If I reimplement the rules as-is (no changes) inside a .php-cs-fixer.dist.php file and then run this command php artisan fixer:fix --config=.php-cs-fixer.dist.php then it clearly errors out with this error:

    The rules contain unknown fixers: "lowercase_constants" (did you mean "lowercase_cast"?), "phpdoc_inline_tag" (did you mean "phpdoc_line_span"?), "psr4", "trailing_comma_in_multiline_array" (did you mean "trailing_comma_in_multiline"?).

    So there seems to be 2 issues currently:

    • The optional config/fixer.php that can be generated through the package is completely ignored.
    • The rules used inside the fixer.php file haven't been updated to use the new php-cs-fixer version 3 names.
    opened by Krunch 2
Releases(v3.1.0)
Owner
Signature Tech Studio
Signature Tech Studio
Dispatcher is a Laravel artisan command scheduling tool used to schedule artisan commands within your project so you don't need to touch your crontab when deploying.

Dispatcher Dispatcher allows you to schedule your artisan commands within your Laravel project, eliminating the need to touch the crontab when deployi

Indatus 1.1k Dec 21, 2022
Your performance & security consultant, an artisan command away.

Enlightn A Laravel Tool To Boost Your App's Performance & Security Introduction Think of Enlightn as your performance and security consultant. Enlight

Enlightn 726 Jan 1, 2023
A Laravel package which helps you to flush sessions with an artisan command.

A simple laravel Package to flush sessions via artisan command. Sometimes we store data on sessions such as cart data or maybe any information regardi

Erfan Ahmed Siam 5 Jun 1, 2023
A collection of command line scripts for Magento 2 code generation, and a PHP module system for organizing command line scripts.

What is Pestle? Pestle is A PHP Framework for creating and organizing command line programs An experiment in implementing python style module imports

Alan Storm 526 Dec 5, 2022
Execute Artisan commands on remote servers

Execute Artisan commands on remote servers This package provides a command to execute Artisan command on a remote server. Here's an example that will

Spatie 238 Dec 29, 2022
A Laravel artisan based package to create the AWS (SES + SNS) infrastructure to receive email event notifications with Http/Https endpoint.

Laravel SES Tracking Setup the AWS infrastructure to handle email events using SES/SNS and http/s endpoints with a single Laravel artisan command. Thi

null 11 Apr 26, 2022
🖤Run Laravel artisan tinker from a Vim buffer with output in Ray

Tinkeray Heavily inspired by the absolutely awesome Tinkerwell, run Laravel artisan tinker from a Vim buffer with output in Ray ?? Installation Usage

Jesse Leite 22 Jan 2, 2023
Refresh artisan commands,table,migrations,models,controllers...

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Javier Fernández 11 Oct 18, 2022
A Laravel 9 package that allows you enforce security of your artisan commands by authenticating users before running.

Introduction This package allows you as a developer to restrict who can and cannot run artisan commands, especially in a production environment. For e

YOo Slim 2 Sep 15, 2022
Command bus package for PHP

#Chief Chief is a powerful standalone command bus package for PHP 5.4+. Contents What is a command bus Installation Usage Class-based command handlers

Adam Nicholson 49 Apr 29, 2021
salah eddine bendyab 18 Aug 17, 2021
From the team that brought you laravel-random-command comes another gem!

?? Why require one if you can require them all? From the team that brought you laravel-random-command comes another gem! Requiring all our packages se

Spatie 46 Oct 5, 2022
The swiss army knife for Magento developers, sysadmins and devops. The tool provides a huge set of well tested command line commands which save hours of work time. All commands are extendable by a module API.

netz98 magerun CLI tools for Magento 2 The n98 magerun cli tools provides some handy tools to work with Magento from command line. Build Status Latest

netz98 758 Dec 28, 2022
Heal and Feed Command For PocketMine-MP

Description Heal and Feed Command For PocketMine-MP. If you are have a question, please make a issues Features Simple Configuration With UI Can heal a

null 2 Feb 15, 2022
A PocketMine-MP Unregister-Command completely different from the others on Poggit.

This Unregister-Cmd plugin is completely different from the ones you see on Poggit while that much easier and constantly in active development. Featur

Arzxy Modz 1 Sep 12, 2022
m4b-tool is a command line utility to merge, split and chapterize audiobook files such as mp3, ogg, flac, m4a or m4b

m4b-tool m4b-tool is a is a wrapper for ffmpeg and mp4v2 to merge, split or and manipulate audiobook files with chapters. Although m4b-tool is designe

Andreas 798 Jan 8, 2023
Make a Laravel app respond to a slash command from Slack

Make a Laravel app respond to a slash command from Slack This package makes it easy to make your Laravel app respond to Slack's Slash commands. Once y

Spatie 239 Nov 18, 2022
bin/magento command to display configured preferences for classes or interfaces

bin/magento command to display configured preferences for classes or interfaces A bin/magento command that will show you the configured preferences fo

David Manners 14 Jul 18, 2022
Tango is a command-line tool for analyzing access logs 💃

Tango Tool to get insights from the server access logs Tango is a dependency-free command-line tool for analyzing access logs ?? Currently, work on th

Roman Glushko 94 Nov 22, 2022