Updated Rector to commit 5a5ea60f6dffdd0a63e04a64f8061f53facd46b3

5a5ea60f6d [Transform] Transform paths() to withPaths() on RectorConfigBuilderRector (#5574)
This commit is contained in:
Tomas Votruba 2024-02-07 13:11:49 +00:00
parent ed0dadf714
commit 0d0320e989
3 changed files with 16 additions and 5 deletions

View File

@ -72,6 +72,7 @@ CODE_SAMPLE
}
$newExpr = new StaticCall(new FullyQualified('Rector\\Config\\RectorConfig'), 'configure');
$rules = new Array_();
$paths = new Array_();
foreach ($stmts as $rectorConfigStmt) {
// complex stmts should be skipped, eg: with if else
if (!$rectorConfigStmt instanceof Expression) {
@ -93,15 +94,25 @@ CODE_SAMPLE
} elseif ($this->isName($rectorConfigStmt->expr->name, 'rules')) {
Assert::isAOf($rectorConfigStmt->expr->getArgs()[0]->value, Array_::class);
$rules->items = \array_merge($rules->items, $rectorConfigStmt->expr->getArgs()[0]->value->items);
} elseif ($this->isName($rectorConfigStmt->expr->name, 'paths')) {
Assert::isAOf($rectorConfigStmt->expr->getArgs()[0]->value, Array_::class);
$paths = $rectorConfigStmt->expr->getArgs()[0]->value;
} else {
// implementing method by method
return null;
}
}
if ($rules->items !== []) {
$stmt->expr = $this->nodeFactory->createMethodCall($newExpr, 'withRules', [$rules]);
if ($paths->items !== []) {
$newExpr = $this->nodeFactory->createMethodCall($newExpr, 'withPaths', [$paths]);
$hasChanged = \true;
}
if ($rules->items !== []) {
$newExpr = $this->nodeFactory->createMethodCall($newExpr, 'withRules', [$rules]);
$hasChanged = \true;
}
if ($hasChanged) {
$stmt->expr = $newExpr;
}
}
if ($hasChanged) {
return $node;

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = 'bd37496639378be3e1b72dec430ef906f0a6e94d';
public const PACKAGE_VERSION = '5a5ea60f6dffdd0a63e04a64f8061f53facd46b3';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2024-02-07 19:29:08';
public const RELEASE_DATE = '2024-02-07 20:09:38';
/**
* @var int
*/

View File

@ -14,7 +14,7 @@ $loader = (static function () {
// Restore the backup and ensure the excluded files are properly marked as loaded
$GLOBALS['__composer_autoload_files'] = \array_merge(
$existingComposerAutoloadFiles,
\array_fill_keys(['0e6d7bf4a5811bfa5cf40c5ccd6fae6a', '5928a00fa978807cf85d90ec3f4b0147'], true)
\array_fill_keys(['5928a00fa978807cf85d90ec3f4b0147', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a'], true)
);
return $loader;