1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00

Fix #2539 - use unaliased parent class name

This commit is contained in:
Matthew Brown 2020-01-01 17:23:13 -05:00
parent 7ea6c8097d
commit 872365f444
2 changed files with 13 additions and 1 deletions

View File

@ -1064,6 +1064,7 @@ class ReflectorVisitor extends PhpParser\NodeVisitorAbstract implements PhpParse
if ($node->extends) {
$parent_fqcln = ClassLikeAnalyzer::getFQCLNFromNameObject($node->extends, $this->aliases);
$parent_fqcln = $this->codebase->classlikes->getUnAliasedName($parent_fqcln);
$this->codebase->scanner->queueClassLikeForScanning(
$parent_fqcln,
$this->file_path,
@ -1087,6 +1088,7 @@ class ReflectorVisitor extends PhpParser\NodeVisitorAbstract implements PhpParse
foreach ($node->extends as $interface) {
$interface_fqcln = ClassLikeAnalyzer::getFQCLNFromNameObject($interface, $this->aliases);
$interface_fqcln = $this->codebase->classlikes->getUnAliasedName($interface_fqcln);
$this->codebase->scanner->queueClassLikeForScanning($interface_fqcln, $this->file_path);
$storage->parent_interfaces[strtolower($interface_fqcln)] = $interface_fqcln;
$this->file_storage->required_interfaces[strtolower($interface_fqcln)] = $interface_fqcln;

View File

@ -455,7 +455,17 @@ class ClassTest extends TestCase
class_alias(FeatureV1::class, Feature::class);
class App { use Feature; }
'
]
],
'classAliasParent' => [
'<?php
class NewA {}
class_alias(NewA::class, OldA::class);
function action(NewA $_m): void {}
class OldAChild extends OldA {}
action(new OldA());
action(new OldAChild());'
],
];
}