-
Notifications
You must be signed in to change notification settings - Fork 665
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
UndefinedDocblockClass: Docblock-defined class, interface or enum named UnitEnum does not exist #7703
Comments
What's the return type of |
True, it contains UnitEnum https://github.com/symfony/symfony/blob/92d183eb0c1423821657f0e6d598534a9da15788/src/Symfony/Component/DependencyInjection/Container.php#L110. But there is no way around that, Symfony supports both PHP 7 and 8.1, while psalm in SncRedisBundle is running on PHP 7. Not sure why is psalm reporting issue that's actually in vendor/ and not in SncRedisBundle. |
You call on a method that returns an unknown class, how is that an issue in vendors? What is Psalm supposed to do when you try to cast to string a type that is not known? I think this is more an issue with Symfony here. What if you use Symfony in a PHP 7 codebase where you have a class named UnitEnum? (or polyfills?). The docblock they use is dangerous I guess a stub could be added to the symfony plugin to prevent psalm/stubs/CoreGenericFunctions.phpstub Line 1000 in 8cd5ccd
|
You're attempting to call I think the easiest way around this is to define that interface conditionally somewhere, e.g.
|
Psalm error message doesn't indicate it's complaining about trying to cast an unknown class. It indicates it doesn't like mere presence of unknown type in union of return type that's defined in vendor/. Hence the confusion. Expected issue type should be |
Discussion at vimeo/psalm#7703
We have no matches of "UnitEnum" in entire SncRedisBundle codebase, but psalm is reporting such issue on psalm @dev branch https://github.com/snc/SncRedisBundle/actions/runs/1871801246
Could be related to #7404 @orklah ?
The text was updated successfully, but these errors were encountered: