Skip to content

Commit

Permalink
Fix #2645 - add workarounds for some edgecases
Browse files Browse the repository at this point in the history
  • Loading branch information
muglug committed Jan 17, 2020
1 parent 2c48d42 commit b582c49
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Expand Up @@ -2037,6 +2037,11 @@ protected static function getInstanceOfTypes(
$source->getAliases()
);

if ($source instanceof StatementsAnalyzer) {
$codebase = $source->getCodebase();
$instanceof_class = $codebase->classlikes->getUnAliasedName($instanceof_class);
}

return [$instanceof_class];
} elseif ($this_class_name
&& (in_array(strtolower($stmt->class->parts[0]), ['self', 'static'], true))
Expand Down
4 changes: 4 additions & 0 deletions src/Psalm/Internal/Visitor/ReflectorVisitor.php
Expand Up @@ -349,6 +349,10 @@ public function enterNode(PhpParser\Node $node)
$this->registerClassMapFunctionCall($function_id, $node);
}
} elseif ($node instanceof PhpParser\Node\Stmt\TraitUse) {
if ($this->skip_if_descendants) {
return;
}

if (!$this->classlike_storages) {
throw new \LogicException('$this->classlike_storages should not be empty');
}
Expand Down

0 comments on commit b582c49

Please sign in to comment.