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:
parent
86264a736b
commit
a4d57e5524
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
}',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user