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 dee53c3

Browse filesBrowse files
Merge pull request #12 from N1ebieski/Fix-Undefined-property-MicrosoftPhpParserNodeArrayElement$memberName-#1
Fix Undefined property: Microsoft\PhpParser\Node\ArrayElement::$memberName
2 parents 5823a57 + 280deb8 commit dee53c3
Copy full SHA for dee53c3

File tree

1 file changed

+9
-5
lines changed
Filter options

1 file changed

+9
-5
lines changed

‎app/Parsers/MemberAccessExpressionParser.php

Copy file name to clipboardExpand all lines: app/Parsers/MemberAccessExpressionParser.php
+9-5Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ public function parse(MemberAccessExpression $node)
3030

3131
if ($child instanceof Variable) {
3232
if ($child->getName() === 'this') {
33-
if ($child->getParent()->getParent() instanceof CallExpression) {
33+
$parent = $child->getParent();
34+
35+
if ($parent?->getParent() instanceof CallExpression) {
3436
// They are calling a method on the current class
3537
$result = $this->context->nearestClassDefinition();
3638

@@ -41,12 +43,14 @@ public function parse(MemberAccessExpression $node)
4143
continue;
4244
}
4345

44-
$propName = $child->getParent()->memberName->getFullText($node->getRoot()->getFullText());
46+
if ($parent instanceof MemberAccessExpression) {
47+
$propName = $parent->memberName->getFullText($node->getRoot()->getFullText());
4548

46-
$result = $this->context->searchForProperty($propName);
49+
$result = $this->context->searchForProperty($propName);
4750

48-
if ($result) {
49-
$this->context->className = $result['types'][0] ?? null;
51+
if ($result) {
52+
$this->context->className = $result['types'][0] ?? null;
53+
}
5054
}
5155

5256
continue;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.