Skip to content

Commit

Permalink
[Transform] Allow transform phpVersion() to withPhpVersion() on Recto…
Browse files Browse the repository at this point in the history
…rConfigBuilderRector (#5678)
  • Loading branch information
samsonasik committed Mar 3, 2024
1 parent dea2e16 commit c9fe3ca
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
@@ -0,0 +1,23 @@
<?php

declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\ValueObject\PhpVersion;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->phpVersion(PhpVersion::PHP_74);
};

?>
-----
<?php

declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\ValueObject\PhpVersion;

return \Rector\Config\RectorConfig::configure()->withPhpVersion(PhpVersion::PHP_74);

?>
Expand Up @@ -194,6 +194,13 @@ public function refactor(Node $node): ?Node
continue;
}

if ($name === 'phpVersion') {
$newExpr = $this->nodeFactory->createMethodCall($newExpr, 'withPhpVersion', [$value]);
$hasChanged = true;

continue;
}

// implementing method by method
return null;
}
Expand Down

0 comments on commit c9fe3ca

Please sign in to comment.