Skip to content
Permalink
Browse files

Fix #2539 - use unaliased parent class name

  • Loading branch information
muglug committed Jan 1, 2020
1 parent 7ea6c80 commit 872365f4440c4d322ef7f605c49fdf208dc7b180
Showing with 13 additions and 1 deletion.
  1. +2 −0 src/Psalm/Internal/Visitor/ReflectorVisitor.php
  2. +11 −1 tests/ClassTest.php
@@ -1064,6 +1064,7 @@ private function registerClassLike(PhpParser\Node\Stmt\ClassLike $node)

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 @@ private function registerClassLike(PhpParser\Node\Stmt\ClassLike $node)

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;
@@ -455,7 +455,17 @@ trait FeatureV1 {}
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());'
],
];
}

0 comments on commit 872365f

Please sign in to comment.
You can’t perform that action at this time.