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 authored and Wirone committed May 7, 2024
1 parent 38559fc commit 4e8d5c1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 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\ParallelConfigFactory;

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

private string $name;

private ?ParallelConfig $parallelConfig;
private ParallelConfig $parallelConfig;

/**
* @var null|string
Expand All @@ -75,6 +75,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)) {

Check warning on line 80 in src/Config.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 mutation tests

Escaped Mutant for Mutator "LogicalOr": --- Original +++ New @@ @@ $this->rules = ['@psr12' => true]; } // @todo 4.0 cleanup - if (Utils::isFutureModeEnabled() || filter_var(getenv('PHP_CS_FIXER_PARALLEL'), FILTER_VALIDATE_BOOL)) { + if (Utils::isFutureModeEnabled() && filter_var(getenv('PHP_CS_FIXER_PARALLEL'), FILTER_VALIDATE_BOOL)) { $this->parallelConfig = ParallelConfigFactory::detect(); } else { $this->parallelConfig = ParallelConfigFactory::sequential();
$this->parallelConfig = ParallelConfigFactory::detect();
} else {
$this->parallelConfig = ParallelConfigFactory::sequential();
}
}

public function getCacheFile(): string
Expand Down Expand Up @@ -124,8 +131,6 @@ public function getName(): string

public function getParallelConfig(): ParallelConfig
{
$this->parallelConfig ??= ParallelConfigFactory::sequential();

return $this->parallelConfig;
}

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 4e8d5c1

Please sign in to comment.