Skip to content

Conversation

@alongosz
Copy link
Member

@alongosz alongosz commented Oct 23, 2025

🎫 Issue n/a

Related PRs:

Description:

As it seems, while parallel run has been available since Ibexa Code Style v2.1.0 (via PHP CS Fixer v3.75+), it was somewhat difficult to configure it, because it's exposed on another interface:

use Ibexa\CodeStyle\PhpCsFixer\InternalConfigFactory;
use PhpCsFixer\ParallelAwareConfigInterface;
use PhpCsFixer\Runner\Parallel\ParallelConfigFactory;

$factory = new InternalConfigFactory();
$factory->withRules([
    'declare_strict_types' => false,
]);

$config = $factory->buildConfig()
    ->setFinder(
        PhpCsFixer\Finder::create()
            ->in([
                __DIR__ . '/src',
                __DIR__ . '/tests',
            ])
            ->files()->name('*.php')
    );

if ($config instanceof ParallelAwareConfigInterface){
    $config->setParallelConfig(ParallelConfigFactory::detect());
}

return $config;

This PR adds syntax sugar for the InternalConfigFactory:

use Ibexa\CodeStyle\PhpCsFixer\InternalConfigFactory;

$factory = new InternalConfigFactory();
$factory->withRules([
    'declare_strict_types' => false,
]);

return $factory->runInParallel()->buildConfig()
    ->setFinder(
        PhpCsFixer\Finder::create()
            ->in([
                __DIR__ . '/src',
                __DIR__ . '/tests',
            ])
            ->files()->name('*.php')
    );

@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant