mirror of
https://github.com/rectorphp/rector.git
synced 2025-02-25 20:23:49 +01:00
FluentReplaceRector: simplify inner return call
This commit is contained in:
parent
c58d0c1414
commit
b84bc6d120
@ -41,6 +41,7 @@ final class FluentReplaceRector extends AbstractRector
|
|||||||
|
|
||||||
public function isCandidate(Node $node): bool
|
public function isCandidate(Node $node): bool
|
||||||
{
|
{
|
||||||
|
// @todo this run has to be first, dual run?
|
||||||
if ($node instanceof Return_) {
|
if ($node instanceof Return_) {
|
||||||
if (! $node->expr instanceof Variable) {
|
if (! $node->expr instanceof Variable) {
|
||||||
return false;
|
return false;
|
||||||
@ -76,17 +77,8 @@ final class FluentReplaceRector extends AbstractRector
|
|||||||
// method call to prepend
|
// method call to prepend
|
||||||
$this->decoupleMethodCall($node);
|
$this->decoupleMethodCall($node);
|
||||||
|
|
||||||
/** @var MethodCall $previousMethodNodeCall */
|
/** @var MethodCall $node->var */
|
||||||
$previousMethodNodeCall = $node->var;
|
return $node->var;
|
||||||
|
|
||||||
// move method call one up
|
|
||||||
$node->name = $previousMethodNodeCall->name;
|
|
||||||
$node->var = $previousMethodNodeCall->var;
|
|
||||||
|
|
||||||
// to clear indent
|
|
||||||
$node->setAttribute(Attribute::ORIGINAL_NODE, null);
|
|
||||||
|
|
||||||
return $node;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $node;
|
return $node;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user