Skip to content

Commit d1410b9

Browse files
authored
arrow function scope is opened (#7861)
1 parent 16217b9 commit d1410b9

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/PhpParser/Node/BetterNodeFinder.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Rector\PhpParser\Node;
66

77
use PhpParser\Node;
8+
use PhpParser\Node\Expr\ArrowFunction;
89
use PhpParser\Node\Expr\Variable;
910
use PhpParser\Node\Expr\Yield_;
1011
use PhpParser\Node\Expr\YieldFrom;
@@ -240,7 +241,7 @@ public function findInstancesOfScoped(array $nodes, string|array $types): array
240241
$this->simpleCallableNodeTraverser->traverseNodesWithCallable(
241242
$nodes,
242243
static function (Node $subNode) use ($types, &$foundNodes): ?int {
243-
if ($subNode instanceof Class_ || ($subNode instanceof FunctionLike && ! $subNode instanceof ClassMethod)) {
244+
if ($subNode instanceof Class_ || ($subNode instanceof FunctionLike && ! $subNode instanceof ClassMethod && ! $subNode instanceof ArrowFunction)) {
244245
return NodeVisitor::DONT_TRAVERSE_CURRENT_AND_CHILDREN;
245246
}
246247

0 commit comments

Comments
 (0)