Skip to content

Commit

Permalink
major: use parallel config by default for future mode
Browse files Browse the repository at this point in the history
# Conflicts:
#	.php-cs-fixer.dist.php
#	src/Config.php
  • Loading branch information
keradus committed May 5, 2024
1 parent 4686a14 commit 4b8812e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use PhpCsFixer\Runner\Parallel\ParallelConfig;

return (new Config())
->setParallelConfig(ParallelConfig::detect())
->setParallelConfig(ParallelConfigFactory::detect()) // @TODO 4.0 no need to call this manually
->setRiskyAllowed(true)
->setRules([
'@PHP74Migration' => true,
Expand Down
11 changes: 9 additions & 2 deletions src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class Config implements ConfigInterface, ParallelRunnerConfigInterface

private string $name;

private ?ParallelConfig $parallelRunnerConfig;
private ParallelConfig $parallelConfig;

/**
* @var null|string
Expand All @@ -74,6 +74,13 @@ public function __construct(string $name = 'default')
$this->name = $name;
$this->rules = ['@PSR12' => true];
}

// @TODO 4.0 cleanup
if (Utils::isFutureModeEnabled() || filter_var(getenv('PHP_CS_FIXER_PARALLEL'), FILTER_VALIDATE_BOOL)) {
$this->parallelConfig = ParallelConfigFactory::detect();
} else {
$this->parallelConfig = ParallelConfigFactory::sequential();
}
}

public function getCacheFile(): string
Expand Down Expand Up @@ -125,7 +132,7 @@ public function getName(): string

public function getParallelConfig(): ParallelConfig
{
return $this->parallelRunnerConfig ?? ParallelConfig::sequential();
return $this->parallelConfig;
}

public function getPhpExecutable(): ?string
Expand Down
2 changes: 1 addition & 1 deletion src/Console/Command/FixCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
) : ' sequentially'
));

// @TODO remove when parallel runner is mature enough and works as expected
// @TODO v4 remove the warning
if ($isParallel) {
$stdErr->writeln(
sprintf(
Expand Down

0 comments on commit 4b8812e

Please sign in to comment.