1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 05:41:20 +01:00

Fix class casing issue when scanning ::class constants

This commit is contained in:
Matt Brown 2018-05-22 11:59:57 -04:00
parent 056194bde5
commit 9de5e1406d

View File

@ -341,7 +341,14 @@ class DependencyFinderVisitor extends PhpParser\NodeVisitorAbstract implements P
$fq_classlike_name = ClassLikeChecker::getFQCLNFromNameObject($node->class, $this->aliases); $fq_classlike_name = ClassLikeChecker::getFQCLNFromNameObject($node->class, $this->aliases);
if (!in_array(strtolower($fq_classlike_name), ['self', 'static', 'parent'], true)) { if (!in_array(strtolower($fq_classlike_name), ['self', 'static', 'parent'], true)) {
$this->codebase->scanner->queueClassLikeForScanning($fq_classlike_name, $this->file_path); $this->codebase->scanner->queueClassLikeForScanning(
$fq_classlike_name,
$this->file_path,
false,
!($node instanceof PhpParser\Node\Expr\ClassConstFetch)
|| !($node->name instanceof PhpParser\Node\Identifier)
|| strtolower($node->name->name) !== 'class'
);
$this->file_storage->referenced_classlikes[strtolower($fq_classlike_name)] = $fq_classlike_name; $this->file_storage->referenced_classlikes[strtolower($fq_classlike_name)] = $fq_classlike_name;
} }
} elseif ($node instanceof PhpParser\Node\Stmt\TryCatch) { } elseif ($node instanceof PhpParser\Node\Stmt\TryCatch) {