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

Fix #1113 - treat class_alias as always global

This commit is contained in:
Matthew Brown 2019-01-12 07:28:01 -05:00
parent 2195caaeae
commit cfcb65aaac
2 changed files with 7 additions and 9 deletions

View File

@ -615,10 +615,10 @@ class Scanner
foreach ($file_storage->constants as $name => $type) {
$this->codebase->addGlobalConstantType($name, $type);
}
}
foreach ($file_storage->classlike_aliases as $aliased_name => $unaliased_name) {
$this->codebase->classlikes->addClassAlias($unaliased_name, $aliased_name);
}
foreach ($file_storage->classlike_aliases as $aliased_name => $unaliased_name) {
$this->codebase->classlikes->addClassAlias($unaliased_name, $aliased_name);
}
}

View File

@ -384,12 +384,10 @@ class ReflectorVisitor extends PhpParser\NodeVisitorAbstract implements PhpParse
}
if ($first_arg_value && $second_arg_value) {
if ($this->codebase->register_stub_files || $this->codebase->register_autoload_files) {
$this->codebase->classlikes->addClassAlias(
$first_arg_value,
$second_arg_value
);
}
$this->codebase->classlikes->addClassAlias(
$first_arg_value,
$second_arg_value
);
$this->file_storage->classlike_aliases[strtolower($second_arg_value)] = $first_arg_value;
}