-
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
Stubs in Reflection.phpstub should implement \Reflector
.
#6618
Comments
I found these snippets: https://psalm.dev/r/374b6ca3b8<?php
function f(\Reflector $r): \Reflector {
return $r;
}
function g(\ReflectionClassConstant $r) {
return f($r);
}
class C {
const X = 5;
}
g(new \ReflectionClassConstant(C::class, 'X'));
|
See also #6619 , it seems that reflection stubs are generally a bit weird.. |
We have three sources of knowledge for classes/methods
The stubs may not need to be complete if we have intel from callmap. Please submit a PR for inheritance if it's missing from stubs. Let's see if it fixes your case |
donquixote
added a commit
to donquixote/psalm
that referenced
this issue
Jan 6, 2022
Here we go :) |
Fixed in #7317 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://psalm.dev/r/374b6ca3b8 (EDIT: fixed the link)
When passing a
\ReflectionClassConstant
object to a function that requires a\Reflector
, I get:This works just fine here: https://3v4l.org/iBjV7
The reason, I suspect, is that in Reflection.phpstub, some classes do not implement
\Reflector
.This said, I am not really sure how these stubs are supposed to work at all, considering they have only a small subset of the methods available for those classes.
The text was updated successfully, but these errors were encountered: