mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Remove slashes from is_a and is_subclass_of string classes, and scan them
This commit is contained in:
parent
01e41951e7
commit
d3324b42fa
@ -274,6 +274,10 @@ class Scanner
|
||||
$analyze_too = false,
|
||||
$store_failure = true
|
||||
) {
|
||||
if ($fq_classlike_name[0] === '\\') {
|
||||
$fq_classlike_name = substr($fq_classlike_name, 1);
|
||||
}
|
||||
|
||||
$fq_classlike_name_lc = strtolower($fq_classlike_name);
|
||||
|
||||
// avoid checking classes that we know will just end in failure
|
||||
|
@ -342,6 +342,17 @@ class ReflectorVisitor extends PhpParser\NodeVisitorAbstract implements PhpParse
|
||||
}
|
||||
}
|
||||
|
||||
if ($function_id === 'is_a' || $function_id === 'is_subclass_of') {
|
||||
$second_arg = $node->args[1]->value ?? null;
|
||||
|
||||
if ($second_arg instanceof PhpParser\Node\Scalar\String_) {
|
||||
$this->codebase->scanner->queueClassLikeForScanning(
|
||||
$second_arg->value,
|
||||
$this->file_path
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ($function_id === 'class_alias') {
|
||||
$first_arg = $node->args[0]->value ?? null;
|
||||
$second_arg = $node->args[1]->value ?? null;
|
||||
|
Loading…
x
Reference in New Issue
Block a user