Skip to content

Commit 9efef74

Browse files
authored
Remove NodeFinder from MutatingScope->restoreThis()
1 parent d451288 commit 9efef74

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/Analyser/MutatingScope.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3525,22 +3525,16 @@ public function restoreThis(self $restoreThisScope): self
35253525
$nativeExpressionTypes = $this->nativeExpressionTypes;
35263526

35273527
if ($restoreThisScope->isInClass()) {
3528-
$nodeFinder = new NodeFinder();
3529-
$cb = static fn ($expr) => $expr instanceof Variable && $expr->name === 'this';
35303528
foreach ($restoreThisScope->expressionTypes as $exprString => $expressionTypeHolder) {
3531-
$expr = $expressionTypeHolder->getExpr();
3532-
$thisExpr = $nodeFinder->findFirst([$expr], $cb);
3533-
if ($thisExpr === null) {
3529+
if (!str_starts_with($exprString, '$this')) {
35343530
continue;
35353531
}
35363532

35373533
$expressionTypes[$exprString] = $expressionTypeHolder;
35383534
}
35393535

35403536
foreach ($restoreThisScope->nativeExpressionTypes as $exprString => $expressionTypeHolder) {
3541-
$expr = $expressionTypeHolder->getExpr();
3542-
$thisExpr = $nodeFinder->findFirst([$expr], $cb);
3543-
if ($thisExpr === null) {
3537+
if (!str_starts_with($exprString, '$this')) {
35443538
continue;
35453539
}
35463540

0 commit comments

Comments
 (0)