Skip to content

Commit 009c486

Browse files
committed
Update MemberAccessExpressionParser.php
1 parent 3972812 commit 009c486

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

app/Parsers/MemberAccessExpressionParser.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use App\Contexts\AbstractContext;
66
use App\Contexts\AssignmentValue;
77
use App\Contexts\MethodCall;
8+
use Microsoft\PhpParser\Node\Expression\CallExpression;
89
use Microsoft\PhpParser\Node\Expression\MemberAccessExpression;
910
use Microsoft\PhpParser\Node\Expression\Variable;
1011
use Microsoft\PhpParser\Node\QualifiedName;
@@ -29,6 +30,17 @@ public function parse(MemberAccessExpression $node)
2930

3031
if ($child instanceof Variable) {
3132
if ($child->getName() === 'this') {
33+
if ($node->getParent() instanceof CallExpression) {
34+
// They are calling a method on the current class
35+
$result = $this->context->nearestClassDefinition();
36+
37+
if ($result) {
38+
$this->context->className = $result->className;
39+
}
40+
41+
continue;
42+
}
43+
3244
$propName = $child->getParent()->memberName->getFullText($node->getRoot()->getFullText());
3345

3446
$result = $this->context->searchForProperty($propName);

0 commit comments

Comments
 (0)