-
Notifications
You must be signed in to change notification settings - Fork 667
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
query re: non-built-in extension functions #2620
Comments
Hey @SignpostMarv, can you reproduce the issue on https://psalm.dev ? |
nope, see weirdan/psalm-github-bot#22 |
One option would be to implement an option in psalm.xml mapping extension names to the path of a file to use if the extension isn't loaded. In addition to that, add a tool to generate stubs from an environment where the extension is enabled - https://github.com/phan/phan/blob/master/tool/make_stubs is how Phan does that. Phan has a similar config option to what you're requesting, which may be useful to refer to when implementing this
|
I think what's @SignpostMarv is describing is exactly the opposite: a stub that has to be loaded if the extension is loaded. Type information available via reflection is often not enough for what Psalm is doing, so Psalm have to use stubs, CallMap.php, etc. |
@weirdan yes but also if it is not actually loaded but is inside a matching condition. |
Oh, missed that part of the issue description. |
@TysonAndre @weirdan it occurs to me that the baseline attribute I added in #1936 could be a source of which stubs to load regardless of which extensions were actually loaded? |
Part of this is accomplished with #7107. I'd love to conditionally load stubs for specific contexts to support |
One would assume that doing a #2133 for all the things would spam up the config too much. Or are you referring to avoiding |
#7107 uses extensions required in composer.json to decide whether to enable them. I was referring to:
The conditionally loading part is a lot more difficult, but it would be very nice to have. |
If I were to patch in
ext-imap
stubs, is there a way that gets the function stubs into scope only if the extension is loaded or if the extension is not loaded but the code is inside anif (extension_loaded('imap')) {}
condition- similar to the xdebug stub, except without it being manual?The text was updated successfully, but these errors were encountered: