Skip to content

Commit

Permalink
Revert tweak start token pos compare (#3911)
Browse files Browse the repository at this point in the history
* Revert [Parser] Cover faster edge Expr in first token or end token of Stmt (#3907)

This reverts commit 78c35a0.

* Revert tweak
  • Loading branch information
samsonasik committed May 21, 2023
1 parent 1adea72 commit b1d123c
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/PhpParser/Node/BetterNodeFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -731,9 +731,10 @@ private function resolvePreviousNodeFromOtherNode(Node $node): ?Node
return null;
}

$nodes = $node->getStartTokenPos() === $startTokenPos
? []
: $this->find($currentStmt, static fn (Node $subNode): bool => $subNode->getEndTokenPos() < $startTokenPos);
$nodes = $this->find(
$currentStmt,
static fn (Node $subNode): bool => $subNode->getEndTokenPos() < $startTokenPos
);

if ($nodes === []) {
$parentNode = $currentStmt->getAttribute(AttributeKey::PARENT_NODE);
Expand Down Expand Up @@ -767,12 +768,10 @@ private function resolveNextNodeFromOtherNode(Node $node): ?Node
return null;
}

$nextNode = $node->getEndTokenPos() === $endTokenPos
? null
: $this->findFirst(
$currentStmt,
static fn (Node $subNode): bool => $subNode->getStartTokenPos() > $endTokenPos
);
$nextNode = $this->findFirst(
$currentStmt,
static fn (Node $subNode): bool => $subNode->getStartTokenPos() > $endTokenPos
);

if (! $nextNode instanceof Node) {
$parentNode = $currentStmt->getAttribute(AttributeKey::PARENT_NODE);
Expand Down

0 comments on commit b1d123c

Please sign in to comment.