This commit is contained in:
TomasVotruba 2017-09-03 14:17:04 +02:00
parent 748e8218fe
commit 3611715075
2 changed files with 13 additions and 16 deletions

View File

@ -22,7 +22,7 @@ abstract class AbstractChangeParentClassRector extends AbstractRector
*/
public function refactor(Node $node): ?Node
{
$node->extends = new Name('\\' . $this->getNewClassName());
$node->extends = new Name\FullyQualified($this->getNewClassName());
return $node;
}

View File

@ -12,21 +12,17 @@ final class RemoveConfiguratorConstantsRector extends AbstractRector
{
public function isCandidate(Node $node): bool
{
if ($node instanceof ClassConstFetch) {
$className = $this->getClassNameFromClassConstFetch($node);
if ($className !== $this->getDesiredClass()) {
return false;
}
if (! in_array((string) $node->name, ['DEVELOPMENT', 'PRODUCTION'], true)) {
return false;
}
return true;
if (! $node instanceof ClassConstFetch) {
return false;
}
return false;
$className = $this->getClassNameFromClassConstFetch($node);
if ($className !== $this->getDesiredClass()) {
return false;
}
return in_array((string) $node->name, ['DEVELOPMENT', 'PRODUCTION'], true);
}
/**
@ -35,9 +31,10 @@ final class RemoveConfiguratorConstantsRector extends AbstractRector
public function refactor(Node $classConstFetchNode): ?Node
{
$constantName = (string) $classConstFetchNode->name;
$string = strtolower($constantName);
return new String_($string);
$originalConstantValue = strtolower($constantName);
return new String_($originalConstantValue);
}
public function getSetName(): string