Updated Rector to commit 77ec96e4e8ec9e3a1d514df878e6eadcd199feb8

77ec96e4e8 [Transform] Allow class const fetch value on rules() on RectorConfigBuilderRector (#5596)
This commit is contained in:
Tomas Votruba 2024-02-10 13:37:38 +00:00
parent 7004efd93b
commit 54904b716f
2 changed files with 21 additions and 15 deletions

View File

@ -90,31 +90,37 @@ CODE_SAMPLE
if ($rectorConfigStmt->expr->isFirstClassCallable()) {
return null;
}
if ($this->isName($rectorConfigStmt->expr->name, 'rule')) {
$args = $rectorConfigStmt->expr->getArgs();
$value = $args[0]->value;
$name = $this->getName($rectorConfigStmt->expr->name);
if ($name === 'rule') {
Assert::isAOf($rules, Array_::class);
$rules->items[] = new ArrayItem($rectorConfigStmt->expr->getArgs()[0]->value);
} 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;
} elseif ($this->isName($rectorConfigStmt->expr->name, 'skip')) {
Assert::isAOf($rectorConfigStmt->expr->getArgs()[0]->value, Array_::class);
$skips = $rectorConfigStmt->expr->getArgs()[0]->value;
} elseif ($name === 'rules') {
if ($value instanceof Array_) {
Assert::isAOf($rules, Array_::class);
$rules->items = \array_merge($rules->items, $value->items);
} else {
$rules = $value;
}
} elseif ($name === 'paths') {
$paths = $value;
} elseif ($name === 'skip') {
$skips = $value;
} else {
// implementing method by method
return null;
}
}
if ($paths->items !== []) {
if (!$paths instanceof Array_ || $paths->items !== []) {
$newExpr = $this->nodeFactory->createMethodCall($newExpr, 'withPaths', [$paths]);
$hasChanged = \true;
}
if ($skips->items !== []) {
if (!$skips instanceof Array_ || $skips->items !== []) {
$newExpr = $this->nodeFactory->createMethodCall($newExpr, 'withSkip', [$skips]);
$hasChanged = \true;
}
if ($rules->items !== []) {
if (!$rules instanceof Array_ || $rules->items !== []) {
$newExpr = $this->nodeFactory->createMethodCall($newExpr, 'withRules', [$rules]);
$hasChanged = \true;
}

View File

@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = '7e637860a069b8ef0f54360664b722578306b994';
public const PACKAGE_VERSION = '77ec96e4e8ec9e3a1d514df878e6eadcd199feb8';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2024-02-10 12:00:43';
public const RELEASE_DATE = '2024-02-10 20:35:32';
/**
* @var int
*/