1
0
Fork 0

Fix class inheritance issue, fix parenthesized expression type resolution

pull/357/head
Sara Itani 2017-04-13 11:51:10 -07:00
parent 2ab7fc037a
commit 6d39d87278
1 changed files with 39 additions and 34 deletions

View File

@ -393,8 +393,8 @@ class TolerantDefinitionResolver implements DefinitionResolverInterface
$name = (string)($node->getNamespacedName()); $name = (string)($node->getNamespacedName());
} }
else if ( else if (
($scoped = $node) instanceof Tolerant\Node\Expression\ScopedPropertyAccessExpression || ($scoped = $node) instanceof Tolerant\Node\Expression\ScopedPropertyAccessExpression
($scoped = $node->parent) instanceof Tolerant\Node\Expression\ScopedPropertyAccessExpression || ($scoped = $node->parent) instanceof Tolerant\Node\Expression\ScopedPropertyAccessExpression
|| ($node->parent instanceof Tolerant\Node\Expression\CallExpression && ($scoped = $node->parent->callableExpression) instanceof Tolerant\Node\Expression\ScopedPropertyAccessExpression) || ($node->parent instanceof Tolerant\Node\Expression\CallExpression && ($scoped = $node->parent->callableExpression) instanceof Tolerant\Node\Expression\ScopedPropertyAccessExpression)
) { ) {
// if ($scoped->memberName instanceof Tolerant\Node\Expression) { // if ($scoped->memberName instanceof Tolerant\Node\Expression) {
@ -410,7 +410,7 @@ class TolerantDefinitionResolver implements DefinitionResolverInterface
} }
if ($className === 'parent') { if ($className === 'parent') {
// parent is resolved to the parent class // parent is resolved to the parent class
if (!isset($node->extends)) { if (!isset($classNode->extends)) {
return null; return null;
} }
$className = (string)$classNode->extends->getResolvedName(); $className = (string)$classNode->extends->getResolvedName();
@ -561,6 +561,11 @@ class TolerantDefinitionResolver implements DefinitionResolverInterface
// How do we handle this more generally? // How do we handle this more generally?
return new Types\Mixed; return new Types\Mixed;
} }
if ($expr instanceof Tolerant\Node\Expression\ParenthesizedExpression) {
$expr = $expr->expression;
}
if ($expr instanceof Tolerant\Node\Expression\Variable || $expr instanceof Tolerant\Node\UseVariableName) { if ($expr instanceof Tolerant\Node\Expression\Variable || $expr instanceof Tolerant\Node\UseVariableName) {
if ($expr instanceof Tolerant\Node\Expression\Variable && $expr->getName() === 'this') { if ($expr instanceof Tolerant\Node\Expression\Variable && $expr->getName() === 'this') {
return new Types\This; return new Types\This;