-
Notifications
You must be signed in to change notification settings - Fork 696
Closed
Labels
Description
Psalm is fine with method calls on phantom classes (those asserted to exist with class_exists), but it thinks class does not exist when accessing a constant on those same classes. I'd expect them to be mixed (apart from ::class, which is always string containing the class name), but valid otherwise.
https://psalm.dev/r/9861da4b25
<?php
if (class_exists('A') && method_exists('A', 'method')) {
echo A::method();
echo A::class;
echo A::SOME_CONST;
}Expected: no issues
Actual:
Psalm output (using commit 8dda8a0):
ERROR: UndefinedClass - 4:11 - Class or interface A does not exist
ERROR: UndefinedClass - 5:11 - Class or interface A does not exist
Reactions are currently unavailable