Skip to content

UX: Do not run interactive configurator when rules are passed explicitly#9378

Merged
keradus merged 2 commits intoPHP-CS-Fixer:masterfrom
Wirone:codito/skip-interactive-configurator-when-rules-are-passed
Feb 8, 2026
Merged

UX: Do not run interactive configurator when rules are passed explicitly#9378
keradus merged 2 commits intoPHP-CS-Fixer:masterfrom
Wirone:codito/skip-interactive-configurator-when-rules-are-passed

Conversation

@Wirone
Copy link
Copy Markdown
Member

@Wirone Wirone commented Jan 23, 2026

Feature added in #9215 interferes greatly with an ad-hoc Docker usage on a project that does not have Fixer installed.

❯ docker run -v $(pwd):/code ghcr.io/php-cs-fixer/php-cs-fixer:3-php8.3 fix tests --rules='{"php_unit_attributes":true}' -vv --diff
Unable to find image 'ghcr.io/php-cs-fixer/php-cs-fixer:3-php8.3' locally
3-php8.3: Pulling from php-cs-fixer/php-cs-fixer

Digest: sha256:5bab06cc2f9a0c4384f2d7382da9f01d83c0f8160af933d01e283e9b9cd78404
Status: Downloaded newer image for ghcr.io/php-cs-fixer/php-cs-fixer:3-php8.3
PHP CS Fixer 3.92.5 Exceptional Exception by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.29
Loaded config default.

 Do you want to create the config file? [yes]:
  [0] yes
  [1] no
 > PHP CS Fixer 3.92.5 Exceptional Exception by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.29

 [WARNING] This command is experimental

 ! [NOTE] While we start, we must tell you that we put our diligence to NOT
 !        change the meaning of your codebase.
 !
 !        Yet, some of the rules are explicitly _risky_ to apply. A rule is
 !        _risky_ if it could change code behaviour, e.g. transforming `==` into
 !        `===` or removal of trailing whitespaces within multiline strings.
 !
 !        Such rules are improving your codebase even further, yet you shall
 !        always review changes proposed by _risky_ rules carefully.

 Do you want to enable _risky_ rules? [no]:
  [0] yes
  [1] no
 >
 ! [NOTE] We recommend usage of `@auto` rulesets. They take insights from your
 !        existing `composer.json` to configure project the best:

 * `@autoPHPMigration` - Migration rules to improve code towards the minimum ``PHP`` supported by your project (taken from ``composer.json`` file).
 * `@PER-CS` - Rules that follow `PER Coding Style <https://www.php-fig.org/per/coding-style/>`_, Set is an alias for the latest revision of ``PER-CS`` rules - use it if you always want to be in sync with newest ``PER-CS`` standard.

 Do you want to use `@auto` ruleset? [yes]:
  [0] yes
  [1] no
 >
 Do you want to use any of other recommended ruleset? (multi-choice) [none]:
  [@PhpCsFixer] Rules recommended by ``PHP CS Fixer`` team, highly opinionated. Extends ``@PER-CS`` and ``@Symfony``.
  [@Symfony   ] Rules that follow the official `Symfony Coding Standards <https://symfony.com/doc/current/contributing/code/standards.html>`_. Extends ``@PER-CS``.
  [none       ] none
 >

In InitCommand.php line 181:

  [Symfony\Component\Filesystem\Exception\IOException]
  Failed to read template file.


Exception trace:
  at /fixer/src/Console/Command/InitCommand.php:181
 PhpCsFixer\Console\Command\InitCommand->execute() at /fixer/vendor/symfony/console/Command/Command.php:341
 Symfony\Component\Console\Command\Command->run() at /fixer/vendor/symfony/console/Application.php:1079
 Symfony\Component\Console\Application->doRunCommand() at /fixer/src/Console/Application.php:214
 PhpCsFixer\Console\Application->doRunCommand() at /fixer/vendor/symfony/console/Application.php:356
 Symfony\Component\Console\Application->doRun() at /fixer/src/Console/Application.php:135
 PhpCsFixer\Console\Application->doRun() at /fixer/src/Console/Command/FixCommand.php:325
 PhpCsFixer\Console\Command\FixCommand->execute() at /fixer/vendor/symfony/console/Command/Command.php:341
 Symfony\Component\Console\Command\Command->run() at /fixer/vendor/symfony/console/Application.php:1079
 Symfony\Component\Console\Application->doRunCommand() at /fixer/src/Console/Application.php:214
 PhpCsFixer\Console\Application->doRunCommand() at /fixer/vendor/symfony/console/Application.php:356
 Symfony\Component\Console\Application->doRun() at /fixer/src/Console/Application.php:135
 PhpCsFixer\Console\Application->doRun() at /fixer/vendor/symfony/console/Application.php:195
 Symfony\Component\Console\Application->run() at /fixer/php-cs-fixer:110

init


❯ docker run -it --rm -v $(pwd):/code ghcr.io/php-cs-fixer/php-cs-fixer:3-php8.3 fix tests --rules='{"php_unit_attributes":true}' -vv --diff
PHP CS Fixer 3.92.5 Exceptional Exception by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.29
Loaded config default.

 Do you want to create the config file? [yes]:
  [0] yes
  [1] no
 > %

❯ docker run -t --rm -v $(pwd):/code ghcr.io/php-cs-fixer/php-cs-fixer:3-php8.3 fix tests --rules='{"php_unit_attributes":true}' -vv --diff
PHP CS Fixer 3.92.5 Exceptional Exception by Fabien Potencier, Dariusz Ruminski and contributors.
PHP runtime: 8.3.29
Loaded config default.

 Do you want to create the config file? [yes]:
  [0] yes
  [1] no
 > ^C%

Interactive configurator should not be executed when --rules are passed.

@Wirone Wirone self-assigned this Jan 23, 2026
Comment thread src/Console/Command/FixCommand.php Outdated
@keradus keradus changed the title fix: Do not run interactive configurator when rules are passed explicitly UX: Do not run interactive configurator when rules are passed explicitly Feb 8, 2026
@keradus keradus enabled auto-merge (squash) February 8, 2026 23:29
@keradus keradus merged commit 3e9f3e0 into PHP-CS-Fixer:master Feb 8, 2026
32 of 33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants