-
Notifications
You must be signed in to change notification settings - Fork 0
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
[Feature Request]: support WP constants #5
Comments
One of the reasons this repo exists is because alternative packages don't have constants. So yes, we should have constants. Here the config that includes constants: https://github.com/inpsyde/wp-stubs/blob/main/generate.php#L41 So not sure why constants are not there... |
I ran into this as well just last week. I don't know if, by default, the parser only looks at |
Oh, it does indeed seem to be the issue. Since it is possible to supply a custom visitor, I guess we may want to create one that parses function bodies, maybe of select function names only...? |
@tfrommen we already have a custom visitor which is used to generate some class/function stubs from fixtures instead of the WP code. The purpose is to use advanced Psalm types for argument and return types. Extending that visitor to also parse functions to extract constants looks like a good idea to me. |
This has been implemented in #7. Closing. |
Is your feature request related to a problem?
The stubs does not include WP constants like DAY_IN_SECONDS so we get psalm issues in our PR's
Describe the desired solution
A file with WP defined constants is included into latest.php
Describe the alternatives that you have considered
havent thought in an alternative
Additional context
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: