1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-04 18:48:03 +01:00

bugfix: enable ClassLikes to properly detect implementing class aliases

Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com>
This commit is contained in:
Maximilian Bösing 2021-08-17 18:16:37 +02:00
parent 285fa13d3a
commit f8db5a0461
No known key found for this signature in database
GPG Key ID: 9A8988C93CEC81A3

View File

@ -26,6 +26,7 @@ use Psalm\Storage\ClassLikeStorage;
use Psalm\Type;
use ReflectionProperty;
use function array_keys;
use function array_merge;
use function array_pop;
use function count;
@ -675,7 +676,23 @@ class ClassLikes
}
$class_storage = $this->classlike_storage_provider->get($fq_class_name);
return isset($class_storage->class_implements[$interface_id]);
if (isset($class_storage->class_implements[$interface_id])) {
return true;
}
foreach (array_keys($class_storage->class_implements) as $implementing_interface_lc) {
if (!isset($this->classlike_aliases[$implementing_interface_lc])) {
continue;
}
$aliased_interface_lc = strtolower($this->classlike_aliases[$implementing_interface_lc]);
if ($aliased_interface_lc === $interface_id) {
return true;
}
}
return false;
}
public function interfaceExists(