Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 009c486

Browse filesBrowse files
committed
Update MemberAccessExpressionParser.php
1 parent 3972812 commit 009c486
Copy full SHA for 009c486

File tree

1 file changed

+12
-0
lines changed
Filter options

1 file changed

+12
-0
lines changed

‎app/Parsers/MemberAccessExpressionParser.php

Copy file name to clipboardExpand all lines: app/Parsers/MemberAccessExpressionParser.php
+12Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.