-
Notifications
You must be signed in to change notification settings - Fork 662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enum Interfaces cannot be found #11030
Comments
I found these snippets: https://psalm.dev/r/8c09bf5115<?php
/** @var class-string $class */
$class = 'test';
if (is_a($class, \IntBackedEnum::class, true)) {
return $class::from((int) $v->toString());
}
|
You also cant type-hint via a class string |
I found these snippets: https://psalm.dev/r/d0694ad217<?php
/** @var class-string<\IntBackedEnum> $class */
$enum = 'MyEnum';
$enum::cases();
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here is an example of trying to unmarshal a value based on reflecting the type expected
$class
. Psalm complains that theInBackedNum
interface cannot be found. Does this need to be stubbed?I have had a read of the previous enum issues, and there's no mention of this type of use-case.
https://psalm.dev/r/8c09bf5115
The text was updated successfully, but these errors were encountered: