1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-21 21:31:13 +01:00

Fix #532 - register anonymous classes declared in file too

This commit is contained in:
Matthew Brown 2018-02-20 09:02:51 -05:00
parent d10212b393
commit ec74b82587
2 changed files with 19 additions and 2 deletions

View File

@ -154,10 +154,12 @@ class DependencyFinderVisitor extends PhpParser\NodeVisitorAbstract implements P
$fq_classlike_name = ClassChecker::getAnonymousClassName($node, $this->file_path);
} else {
$fq_classlike_name = ($this->aliases->namespace ? $this->aliases->namespace . '\\' : '') . $node->name;
$fq_classlike_name_lc = strtolower($fq_classlike_name);
$this->file_storage->classlikes_in_file[$fq_classlike_name_lc] = $fq_classlike_name;
}
$fq_classlike_name_lc = strtolower($fq_classlike_name);
$this->file_storage->classlikes_in_file[$fq_classlike_name_lc] = $fq_classlike_name;
$this->fq_classlike_names[] = $fq_classlike_name;
$storage = $this->codebase->createClassLikeStorage($fq_classlike_name);

15
src/matt.php Normal file
View File

@ -0,0 +1,15 @@
<?php
namespace Matt;
interface I {}
class C
{
public function getI(): I
{
return new class implements I
{
};
}
}