• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

PHP-CS-Fixer / PHP-CS-Fixer / 21295121775

23 Jan 2026 05:29PM UTC coverage: 92.942% (-0.02%) from 92.964%
21295121775

push

github

web-flow
feat: do not suggest config file creation if config explicitly skipped with `--config=-` (#9379)

1 of 1 new or added line in 1 file covered. (100.0%)

7 existing lines in 1 file now uncovered.

29272 of 31495 relevant lines covered (92.94%)

44.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

72.4
/src/Console/Command/FixCommand.php
1
<?php
2

3
declare(strict_types=1);
4

5
/*
6
 * This file is part of PHP CS Fixer.
7
 *
8
 * (c) Fabien Potencier <fabien@symfony.com>
9
 *     Dariusz Rumiński <dariusz.ruminski@gmail.com>
10
 *
11
 * This source file is subject to the MIT license that is bundled
12
 * with this source code in the file LICENSE.
13
 */
14

15
namespace PhpCsFixer\Console\Command;
16

17
use PhpCsFixer\Config;
18
use PhpCsFixer\ConfigInterface;
19
use PhpCsFixer\ConfigurationException\InvalidConfigurationException;
20
use PhpCsFixer\Console\Application;
21
use PhpCsFixer\Console\ConfigurationResolver;
22
use PhpCsFixer\Console\Output\ErrorOutput;
23
use PhpCsFixer\Console\Output\OutputContext;
24
use PhpCsFixer\Console\Output\Progress\ProgressOutputFactory;
25
use PhpCsFixer\Console\Output\Progress\ProgressOutputType;
26
use PhpCsFixer\Console\Report\FixReport\ReporterFactory;
27
use PhpCsFixer\Console\Report\FixReport\ReportSummary;
28
use PhpCsFixer\Error\ErrorsManager;
29
use PhpCsFixer\Fixer\FixerInterface;
30
use PhpCsFixer\FixerFactory;
31
use PhpCsFixer\RuleSet\RuleSets;
32
use PhpCsFixer\Runner\Event\FileProcessed;
33
use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;
34
use PhpCsFixer\Runner\Runner;
35
use PhpCsFixer\ToolInfoInterface;
36
use Symfony\Component\Console\Attribute\AsCommand;
37
use Symfony\Component\Console\Command\Command;
38
use Symfony\Component\Console\Formatter\OutputFormatter;
39
use Symfony\Component\Console\Input\ArrayInput;
40
use Symfony\Component\Console\Input\InputArgument;
41
use Symfony\Component\Console\Input\InputInterface;
42
use Symfony\Component\Console\Input\InputOption;
43
use Symfony\Component\Console\Output\ConsoleOutputInterface;
44
use Symfony\Component\Console\Output\OutputInterface;
45
use Symfony\Component\Console\Style\SymfonyStyle;
46
use Symfony\Component\Console\Terminal;
47
use Symfony\Component\EventDispatcher\EventDispatcher;
48
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
49
use Symfony\Component\Stopwatch\Stopwatch;
50

51
/**
52
 * @author Fabien Potencier <fabien@symfony.com>
53
 * @author Dariusz Rumiński <dariusz.ruminski@gmail.com>
54
 *
55
 * @final
56
 *
57
 * @TODO 4.0: mark as final
58
 *
59
 * @internal
60
 *
61
 * @no-named-arguments Parameter names are not covered by the backward compatibility promise.
62
 */
63
#[AsCommand(name: 'fix', description: 'Fixes a directory or a file.')]
64
/* final */ class FixCommand extends Command
65
{
66
    /** @TODO PHP 8.0 - remove the property */
67
    protected static $defaultName = 'fix';
68

69
    /** @TODO PHP 8.0 - remove the property */
70
    protected static $defaultDescription = 'Fixes a directory or a file.';
71

72
    private EventDispatcherInterface $eventDispatcher;
73

74
    private ErrorsManager $errorsManager;
75

76
    private Stopwatch $stopwatch;
77

78
    private ConfigInterface $defaultConfig;
79

80
    private ToolInfoInterface $toolInfo;
81

82
    private ProgressOutputFactory $progressOutputFactory;
83

84
    public function __construct(ToolInfoInterface $toolInfo)
85
    {
86
        parent::__construct();
5✔
87

88
        $this->eventDispatcher = new EventDispatcher();
5✔
89
        $this->errorsManager = new ErrorsManager();
5✔
90
        $this->stopwatch = new Stopwatch();
5✔
91
        $this->defaultConfig = new Config();
5✔
92
        $this->toolInfo = $toolInfo;
5✔
93
        $this->progressOutputFactory = new ProgressOutputFactory();
5✔
94
    }
95

96
    /**
97
     * {@inheritdoc}
98
     *
99
     * Override here to only generate the help copy when used.
100
     */
101
    public function getHelp(): string
102
    {
103
        return <<<'EOF'
×
104
            The <info>%command.name%</info> command tries to %command.name% as much coding standards
105
            problems as possible on a given file or files in a given directory and its subdirectories:
106

107
                <info>$ php %command.full_name% /path/to/dir</info>
108
                <info>$ php %command.full_name% /path/to/file</info>
109

110
            By default <comment>--path-mode</comment> is set to `override`, which means, that if you specify the path to a file or a directory via
111
            command arguments, then the paths provided to a `Finder` in config file will be ignored. You can use <comment>--path-mode=intersection</comment>
112
            to merge paths from the config file and from the argument:
113

114
                <info>$ php %command.full_name% --path-mode=intersection /path/to/dir</info>
115

116
            The <comment>--format</comment> option for the output format. Supported formats are `@auto` (default one on v4+), `txt` (default one on v3), `json`, `xml`, `checkstyle`, `junit` and `gitlab`.
117

118
            * `@auto` aims to auto-select best reporter for given CI or local execution (resolution into best format is outside of BC promise and is future-ready)
119
              * `gitlab` for GitLab
120
            * `@auto,{format}` takes `@auto` under CI, and {format} otherwise
121

122
            NOTE: the output for the following formats are generated in accordance with schemas
123

124
            * `checkstyle` follows the common `"checkstyle" XML schema </doc/schemas/fix/checkstyle.xsd>`_
125
            * `gitlab` follows the `codeclimate JSON schema </doc/schemas/fix/codeclimate.json>`_
126
            * `json` follows the `own JSON schema </doc/schemas/fix/schema.json>`_
127
            * `junit` follows the `JUnit XML schema from Jenkins </doc/schemas/fix/junit-10.xsd>`_
128
            * `xml` follows the `own XML schema </doc/schemas/fix/xml.xsd>`_
129

130
            The <comment>--quiet</comment> Do not output any message.
131

132
            The <comment>--verbose</comment> option will show the applied rules. When using the `txt` format it will also display progress notifications.
133

134
            NOTE: if there is an error like "errors reported during linting after fixing", you can use this to be even more verbose for debugging purpose
135

136
            * `-v`: verbose
137
            * `-vv`: very verbose
138
            * `-vvv`: debug
139

140
            EOF. /* @TODO: 4.0 - change to @PER */ <<<'EOF'
×
141

142
            The <comment>--rules</comment> option allows to explicitly select rules to use,
143
            overriding the default PSR-12 or your own project config:
144

145
                <info>$ php %command.full_name% . --rules=line_ending,full_opening_tag,indentation_type</info>
146

147
            You can also exclude the rules you don't want by placing a dash in front of the rule name, like <comment>-name_of_fixer</comment>.
148

149
                <info>$ php %command.full_name% . --rules=@Symfony,-@PSR1,-blank_line_before_statement,strict_comparison</info>
150

151
            Complete configuration for rules can be supplied using a `json` formatted string as well.
152

153
                <info>$ php %command.full_name% . --rules='{"concat_space": {"spacing": "none"}}'</info>
154

155
            The <comment>--dry-run</comment> flag will run the fixer without making changes to your files.
156

157
            The <comment>--sequential</comment> flag will enforce sequential analysis even if parallel config is provided.
158

159
            The <comment>--diff</comment> flag can be used to let the fixer output all the changes it makes.
160

161
            The <comment>--allow-risky</comment> option (pass `yes` or `no`) allows you to set whether risky rules may run. Default value is taken from config file.
162
            A rule is considered risky if it could change code behaviour. By default no risky rules are run.
163

164
            The <comment>--stop-on-violation</comment> flag stops the execution upon first file that needs to be fixed.
165

166
            The <comment>--show-progress</comment> option allows you to choose the way process progress is rendered:
167

168
            * <comment>none</comment>: disables progress output;
169
            * <comment>dots</comment>: multiline progress output with number of files and percentage on each line.
170
            * <comment>bar</comment>: single line progress output with number of files and calculated percentage.
171

172
            If the option is not provided, it defaults to <comment>bar</comment> unless a config file that disables output is used, in which case it defaults to <comment>none</comment>. This option has no effect if the verbosity of the command is less than <comment>verbose</comment>.
173

174
                <info>$ php %command.full_name% --verbose --show-progress=dots</info>
175

176
            By using <comment>--using-cache</comment> option with `yes` or `no` you can set if the caching
177
            mechanism should be used.
178

179
            The command can also read from standard input, in which case it won't
180
            automatically fix anything:
181

182
                <info>$ cat foo.php | php %command.full_name% --diff -</info>
183

184
            Finally, if you don't need BC kept on CLI level, you might use `PHP_CS_FIXER_FUTURE_MODE` to start using options that
185
            would be default in next MAJOR release and to forbid using deprecated configuration:
186

187
                <info>$ PHP_CS_FIXER_FUTURE_MODE=1 php %command.full_name% -v --diff</info>
188

189
            Exit code
190
            ---------
191

192
            Exit code of the `%command.name%` command is built using following bit flags:
193

194
            *  0 - OK.
195
            *  1 - General error (or PHP minimal requirement not matched).
196
            *  4 - Some files have invalid syntax (only in dry-run mode).
197
            *  8 - Some files need fixing (only in dry-run mode).
198
            * 16 - Configuration error of the application.
199
            * 32 - Configuration error of a Fixer.
200
            * 64 - Exception raised within the application.
201

202
            EOF;
×
203
    }
204

205
    protected function configure(): void
206
    {
207
        $reporterFactory = new ReporterFactory();
5✔
208
        $reporterFactory->registerBuiltInReporters();
5✔
209
        $formats = $reporterFactory->getFormats();
5✔
210
        array_unshift($formats, '@auto', '@auto,txt');
5✔
211

212
        $progressOutputTypes = ProgressOutputType::all();
5✔
213

214
        $this->setDefinition(
5✔
215
            [
5✔
216
                new InputArgument('path', InputArgument::IS_ARRAY, 'The path(s) that rules will be run against (each path can be a file or directory).'),
5✔
217
                new InputOption('path-mode', '', InputOption::VALUE_REQUIRED, HelpCommand::getDescriptionWithAllowedValues('Specify path mode (%s).', ConfigurationResolver::PATH_MODE_VALUES), ConfigurationResolver::PATH_MODE_OVERRIDE, ConfigurationResolver::PATH_MODE_VALUES),
5✔
218
                new InputOption('allow-risky', '', InputOption::VALUE_REQUIRED, HelpCommand::getDescriptionWithAllowedValues('Are risky fixers allowed (%s).', ConfigurationResolver::BOOL_VALUES), null, ConfigurationResolver::BOOL_VALUES),
5✔
219
                new InputOption('config', '', InputOption::VALUE_REQUIRED, 'The path to a config file.'),
5✔
220
                new InputOption('dry-run', '', InputOption::VALUE_NONE, 'Only shows which files would have been modified.'),
5✔
221
                new InputOption('rules', '', InputOption::VALUE_REQUIRED, 'List of rules that should be run against configured paths.', null, static function () {
5✔
222
                    $fixerFactory = new FixerFactory();
×
223
                    $fixerFactory->registerBuiltInFixers();
×
224
                    $fixers = array_map(static fn (FixerInterface $fixer) => $fixer->getName(), $fixerFactory->getFixers());
×
225

226
                    return array_merge(RuleSets::getSetDefinitionNames(), $fixers);
×
227
                }),
5✔
228
                new InputOption('using-cache', '', InputOption::VALUE_REQUIRED, HelpCommand::getDescriptionWithAllowedValues('Should cache be used (%s).', ConfigurationResolver::BOOL_VALUES), null, ConfigurationResolver::BOOL_VALUES),
5✔
229
                new InputOption('allow-unsupported-php-version', '', InputOption::VALUE_REQUIRED, HelpCommand::getDescriptionWithAllowedValues('Should the command refuse to run on unsupported PHP version (%s).', ConfigurationResolver::BOOL_VALUES), null, ConfigurationResolver::BOOL_VALUES),
5✔
230
                new InputOption('cache-file', '', InputOption::VALUE_REQUIRED, 'The path to the cache file.'),
5✔
231
                new InputOption('diff', '', InputOption::VALUE_NONE, 'Prints diff for each file.'),
5✔
232
                new InputOption('format', '', InputOption::VALUE_REQUIRED, HelpCommand::getDescriptionWithAllowedValues('To output results in other formats (%s).', $formats), null, $formats),
5✔
233
                new InputOption('stop-on-violation', '', InputOption::VALUE_NONE, 'Stop execution on first violation.'),
5✔
234
                new InputOption('show-progress', '', InputOption::VALUE_REQUIRED, HelpCommand::getDescriptionWithAllowedValues('Type of progress indicator (%s).', $progressOutputTypes), null, $progressOutputTypes),
5✔
235
                new InputOption('sequential', '', InputOption::VALUE_NONE, 'Enforce sequential analysis.'),
5✔
236
            ],
5✔
237
        );
5✔
238
    }
239

240
    protected function execute(InputInterface $input, OutputInterface $output): int
241
    {
242
        $verbosity = $output->getVerbosity();
5✔
243

244
        $passedConfig = $input->getOption('config');
5✔
245
        $passedRules = $input->getOption('rules');
5✔
246

247
        if (null !== $passedConfig && ConfigurationResolver::IGNORE_CONFIG_FILE !== $passedConfig && null !== $passedRules) {
5✔
248
            throw new InvalidConfigurationException('Passing both `--config` and `--rules` options is not allowed.');
×
249
        }
250

251
        $resolver = new ConfigurationResolver(
5✔
252
            $this->defaultConfig,
5✔
253
            [
5✔
254
                'allow-risky' => $input->getOption('allow-risky'),
5✔
255
                'config' => $passedConfig,
5✔
256
                'dry-run' => $this->isDryRun($input),
5✔
257
                'rules' => $passedRules,
5✔
258
                'path' => $input->getArgument('path'),
5✔
259
                'path-mode' => $input->getOption('path-mode'),
5✔
260
                'using-cache' => $input->getOption('using-cache'),
5✔
261
                'allow-unsupported-php-version' => $input->getOption('allow-unsupported-php-version'),
5✔
262
                'cache-file' => $input->getOption('cache-file'),
5✔
263
                'format' => $input->getOption('format'),
5✔
264
                'diff' => $input->getOption('diff'),
5✔
265
                'stop-on-violation' => $input->getOption('stop-on-violation'),
5✔
266
                'verbosity' => $verbosity,
5✔
267
                'show-progress' => $input->getOption('show-progress'),
5✔
268
                'sequential' => $input->getOption('sequential'),
5✔
269
            ],
5✔
270
            getcwd(), // @phpstan-ignore argument.type
5✔
271
            $this->toolInfo,
5✔
272
        );
5✔
273

274
        $reporter = $resolver->getReporter();
5✔
275

276
        $stdErr = $output instanceof ConsoleOutputInterface
5✔
277
            ? $output->getErrorOutput()
×
278
            : ('txt' === $reporter->getFormat() ? $output : null);
5✔
279

280
        if (null !== $stdErr) {
5✔
281
            $stdErr->writeln(Application::getAboutWithRuntime(true));
5✔
282

283
            if (version_compare(\PHP_VERSION, ConfigInterface::PHP_VERSION_SYNTAX_SUPPORTED.'.99', '>')) {
5✔
284
                $message = \sprintf(
×
285
                    'PHP CS Fixer currently supports PHP syntax only up to PHP %s, current PHP version: %s.',
×
286
                    ConfigInterface::PHP_VERSION_SYNTAX_SUPPORTED,
×
287
                    \PHP_VERSION,
×
288
                );
×
289

290
                if (!$resolver->getUnsupportedPhpVersionAllowed()) {
×
291
                    $message .= ' Add `Config::setUnsupportedPhpVersionAllowed(true)` to allow executions on unsupported PHP versions. Such execution may be unstable and you may experience code modified in a wrong way.';
×
292
                    $stdErr->writeln(\sprintf(
×
293
                        $stdErr->isDecorated() ? '<bg=red;fg=white;>%s</>' : '%s',
×
294
                        $message,
×
295
                    ));
×
296

297
                    return 1;
×
298
                }
299
                $message .= ' Execution may be unstable. You may experience code modified in a wrong way. Please report such cases at https://github.com/PHP-CS-Fixer/PHP-CS-Fixer. Remove Config::setUnsupportedPhpVersionAllowed(true) to allow executions only on supported PHP versions.';
×
300
                $stdErr->writeln(\sprintf(
×
301
                    $stdErr->isDecorated() ? '<bg=yellow;fg=black;>%s</>' : '%s',
×
302
                    $message,
×
303
                ));
×
304
            }
305

306
            $configFile = $resolver->getConfigFile();
5✔
307
            $stdErr->writeln(\sprintf('Loaded config <comment>%s</comment>%s.', $resolver->getConfig()->getName(), null === $configFile ? '' : ' from "'.$configFile.'"'));
5✔
308

309
            if (null === $configFile && ConfigurationResolver::IGNORE_CONFIG_FILE !== $passedConfig) {
5✔
UNCOV
310
                if (false === $input->isInteractive()) {
×
UNCOV
311
                    $stdErr->writeln(
×
UNCOV
312
                        \sprintf(
×
UNCOV
313
                            $stdErr->isDecorated() ? '<bg=yellow;fg=black;>%s</>' : '%s',
×
UNCOV
314
                            'No config file found. Please create one using `php-cs-fixer init`.',
×
UNCOV
315
                        ),
×
UNCOV
316
                    );
×
317
                } else {
318
                    $io = new SymfonyStyle($input, $stdErr);
×
319
                    $shallCreateConfigFile = 'yes' === $io->choice(
×
320
                        'Do you want to create the config file?',
×
321
                        ['yes', 'no'],
×
322
                        'yes',
×
323
                    );
×
324
                    if ($shallCreateConfigFile) {
×
325
                        $returnCode = $this->getApplication()->doRun(
×
326
                            new ArrayInput([
×
327
                                'command' => 'init',
×
328
                            ]),
×
329
                            $output,
×
330
                        );
×
331
                        $stdErr->writeln('Config file created, re-run the command to put it in action.');
×
332

333
                        return $returnCode;
×
334
                    }
335
                }
336
            }
337

338
            $isParallel = $resolver->getParallelConfig()->getMaxProcesses() > 1;
5✔
339

340
            $stdErr->writeln(\sprintf(
5✔
341
                'Running analysis on %d core%s.',
5✔
342
                $resolver->getParallelConfig()->getMaxProcesses(),
5✔
343
                $isParallel ? \sprintf(
5✔
344
                    's with %d file%s per process',
5✔
345
                    $resolver->getParallelConfig()->getFilesPerProcess(),
5✔
346
                    $resolver->getParallelConfig()->getFilesPerProcess() > 1 ? 's' : '',
5✔
347
                ) : ' sequentially',
5✔
348
            ));
5✔
349

350
            /** @TODO v4 remove warnings related to parallel runner */
351
            $availableMaxProcesses = ParallelConfigFactory::detect()->getMaxProcesses();
5✔
352
            if ($isParallel || $availableMaxProcesses > 1) {
5✔
353
                $usageDocs = 'https://cs.symfony.com/doc/usage.html';
5✔
354
                $stdErr->writeln(\sprintf(
5✔
355
                    $stdErr->isDecorated() ? '<bg=yellow;fg=black;>%s</>' : '%s',
5✔
356
                    $isParallel
5✔
357
                        ? 'Parallel runner is an experimental feature and may be unstable, use it at your own risk. Feedback highly appreciated!'
1✔
358
                        : \sprintf(
4✔
359
                            'You can enable parallel runner and speed up the analysis! Please see %s for more information.',
4✔
360
                            $stdErr->isDecorated()
4✔
361
                                ? \sprintf('<href=%s;bg=yellow;fg=red;bold>usage docs</>', OutputFormatter::escape($usageDocs))
×
362
                                : $usageDocs,
5✔
363
                        ),
4✔
364
                ));
5✔
365
            }
366

367
            if ($resolver->getUsingCache()) {
5✔
368
                $cacheFile = $resolver->getCacheFile();
×
369

370
                if (is_file($cacheFile)) {
×
371
                    $stdErr->writeln(\sprintf('Using cache file "%s".', $cacheFile));
×
372
                }
373
            }
374
        }
375

376
        $finder = new \ArrayIterator(array_filter(
4✔
377
            iterator_to_array($resolver->getFinder()),
4✔
378
            static fn (\SplFileInfo $fileInfo) => false !== $fileInfo->getRealPath(),
4✔
379
        ));
4✔
380

381
        if (null !== $stdErr) {
4✔
382
            if ($resolver->configFinderIsOverridden()) {
4✔
383
                $stdErr->writeln(
2✔
384
                    \sprintf($stdErr->isDecorated() ? '<bg=yellow;fg=black;>%s</>' : '%s', 'Paths from configuration have been overridden by paths provided as command arguments.'),
2✔
385
                );
2✔
386
            }
387

388
            if ($resolver->configRulesAreOverridden()) {
4✔
389
                $stdErr->writeln(
×
390
                    \sprintf($stdErr->isDecorated() ? '<bg=yellow;fg=black;>%s</>' : '%s', 'Rules from configuration have been overridden by rules provided as command argument.'),
×
391
                );
×
392
            }
393
        }
394

395
        $progressType = $resolver->getProgressType();
3✔
396
        $progressOutput = $this->progressOutputFactory->create(
3✔
397
            $progressType,
3✔
398
            new OutputContext(
3✔
399
                $stdErr,
3✔
400
                (new Terminal())->getWidth(),
3✔
401
                \count($finder),
3✔
402
            ),
3✔
403
        );
3✔
404

405
        $runner = new Runner(
3✔
406
            $finder,
3✔
407
            $resolver->getFixers(),
3✔
408
            $resolver->getDiffer(),
3✔
409
            ProgressOutputType::NONE !== $progressType ? $this->eventDispatcher : null,
3✔
410
            $this->errorsManager,
3✔
411
            $resolver->getLinter(),
3✔
412
            $resolver->isDryRun(),
3✔
413
            $resolver->getCacheManager(),
3✔
414
            $resolver->getDirectory(),
3✔
415
            $resolver->shouldStopOnViolation(),
3✔
416
            $resolver->getParallelConfig(),
3✔
417
            $input,
3✔
418
            $resolver->getConfigFile(),
3✔
419
            $resolver->getRuleCustomisationPolicy(),
3✔
420
        );
3✔
421

422
        $this->eventDispatcher->addListener(FileProcessed::NAME, [$progressOutput, 'onFixerFileProcessed']);
3✔
423
        $this->stopwatch->start('fixFiles');
3✔
424
        $changed = $runner->fix();
3✔
425
        $this->stopwatch->stop('fixFiles');
3✔
426
        $this->eventDispatcher->removeListener(FileProcessed::NAME, [$progressOutput, 'onFixerFileProcessed']);
3✔
427

428
        $progressOutput->printLegend();
3✔
429

430
        $fixEvent = $this->stopwatch->getEvent('fixFiles');
3✔
431

432
        $reportSummary = new ReportSummary(
3✔
433
            $changed,
3✔
434
            \count($finder),
3✔
435
            (int) $fixEvent->getDuration(), // ignore microseconds fraction
3✔
436
            memory_get_peak_usage(true) + $runner->getWorkersMemoryUsage(),
3✔
437
            OutputInterface::VERBOSITY_VERBOSE <= $verbosity,
3✔
438
            $resolver->isDryRun(),
3✔
439
            $output->isDecorated(),
3✔
440
        );
3✔
441

442
        $output->isDecorated()
3✔
443
            ? $output->write($reporter->generate($reportSummary))
×
444
            : $output->write($reporter->generate($reportSummary), false, OutputInterface::OUTPUT_RAW);
3✔
445

446
        $invalidErrors = $this->errorsManager->getInvalidErrors();
3✔
447
        $exceptionErrors = $this->errorsManager->getExceptionErrors();
3✔
448
        $lintErrors = $this->errorsManager->getLintErrors();
3✔
449

450
        if (null !== $stdErr) {
3✔
451
            $errorOutput = new ErrorOutput($stdErr);
3✔
452

453
            if (\count($invalidErrors) > 0) {
3✔
454
                $errorOutput->listErrors('linting before fixing', $invalidErrors);
×
455
            }
456

457
            if (\count($exceptionErrors) > 0) {
3✔
458
                $errorOutput->listErrors('fixing', $exceptionErrors);
×
459
                if ($isParallel) {
×
460
                    $stdErr->writeln('To see details of the error(s), re-run the command with `--sequential -vvv [file]`');
×
461
                }
462
            }
463

464
            if (\count($lintErrors) > 0) {
3✔
465
                $errorOutput->listErrors('linting after fixing', $lintErrors);
×
466
            }
467
        }
468

469
        $exitStatusCalculator = new FixCommandExitStatusCalculator();
3✔
470

471
        return $exitStatusCalculator->calculate(
3✔
472
            $resolver->isDryRun(),
3✔
473
            \count($changed) > 0,
3✔
474
            \count($invalidErrors) > 0,
3✔
475
            \count($exceptionErrors) > 0,
3✔
476
            \count($lintErrors) > 0,
3✔
477
        );
3✔
478
    }
479

480
    protected function isDryRun(InputInterface $input): bool
481
    {
482
        return $input->getOption('dry-run'); // @phpstan-ignore symfonyConsole.optionNotFound (Because PHPStan doesn't recognise the method is overridden in the child class and this parameter is _not_ used in the child class.)
5✔
483
    }
484
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc