Skip to content

Commit

Permalink
[Transform] Allow transform disableParallel() to withoutParallel() on…
Browse files Browse the repository at this point in the history
… RectorConfigBuilderRector (#5640)

* [Transform] Allow transform disableParallel() to withoutParallel()

* fix
  • Loading branch information
samsonasik committed Feb 20, 2024
1 parent 3eb1aa2 commit 70b1985
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
@@ -0,0 +1,21 @@
<?php

declare(strict_types=1);

use Rector\Config\RectorConfig;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->disableParallel();
};

?>
-----
<?php

declare(strict_types=1);

use Rector\Config\RectorConfig;

return \Rector\Config\RectorConfig::configure()->withoutParallel();

?>
Expand Up @@ -114,9 +114,17 @@ public function refactor(Node $node): ?Node
}

$args = $rectorConfigStmt->expr->getArgs();
$value = $args[0]->value;
$name = $this->getName($rectorConfigStmt->expr->name);

if ($name === 'disableParallel') {
$newExpr = $this->nodeFactory->createMethodCall($newExpr, 'withoutParallel');
$hasChanged = true;

continue;
}

$value = $args[0]->value;

if ($name === 'rule') {
Assert::isAOf($rules, Array_::class);
$rules->items[] = new ArrayItem($value);
Expand Down

0 comments on commit 70b1985

Please sign in to comment.