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

Fix #2018 - prevent fatal error on class_aliased class reference

This commit is contained in:
Brown 2019-08-15 10:17:27 -04:00
parent 86264a736b
commit a4d57e5524
2 changed files with 16 additions and 1 deletions

View File

@ -716,7 +716,8 @@ class ClassLikes
public function getUnAliasedName(string $alias_name)
{
$alias_name_lc = strtolower($alias_name);
if (isset($this->existing_classlikes_lc[$alias_name_lc])) {
if ($this->existing_classlikes_lc[$alias_name_lc] ?? false) {
return $alias_name;
}

View File

@ -429,6 +429,20 @@ class ClassTest extends TestCase
[],
['PropertyNotSetInConstructor'],
],
'classAliasNoException' => [
'<?php
class_alias("Bar\F1", "Bar\F2");
namespace Bar {
class F1 {
public static function baz() : void {}
}
}
namespace {
Bar\F2::baz();
}',
],
];
}