Skip to content

Commit

Permalink
[CodingStyle] Remove previous node attribute on WrapEncapsedVariableI…
Browse files Browse the repository at this point in the history
…nCurlyBracesRector (#3512)
  • Loading branch information
samsonasik committed Mar 23, 2023
1 parent 5d95d49 commit 6cec8c5
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use PhpParser\Node\Expr\Variable;
use PhpParser\Node\Scalar\Encapsed;
use Rector\Core\Rector\AbstractRector;
use Rector\NodeTypeResolver\Node\AttributeKey;
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;

Expand Down Expand Up @@ -56,7 +55,7 @@ public function refactor(Node $node): ?Node

foreach ($node->parts as $index => $nodePart) {
if ($nodePart instanceof Variable) {
$previousNode = $nodePart->getAttribute(AttributeKey::PREVIOUS_NODE);
$previousNode = $node->parts[$index - 1] ?? null;
$previousNodeEndTokenPosition = $previousNode instanceof Node ? $previousNode->getEndTokenPos() : $startTokenPos;

if ($previousNodeEndTokenPosition + 1 === $nodePart->getStartTokenPos()) {
Expand Down

0 comments on commit 6cec8c5

Please sign in to comment.