-
Notifications
You must be signed in to change notification settings - Fork 668
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
Add extension documentation. #7577
base: master
Are you sure you want to change the base?
Add extension documentation. #7577
Conversation
- [Templates](../annotating_code/templated_annotations.md) | ||
|
||
To use the extension stub generator, download the latest phar at | ||
https://github.com/AndrolGenhald/php-extension-stub-generator/releases and run `php-extension-stub-generator.phar dump |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does someone want to create psalm/php-extension-stub-generator and move this there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'd have to ask Matt I think. Let's do that when it's finished
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I think it is finished, more or less 😛
I was thinking this would be merged as mostly a documentation/process update.
To add a bit more clarity here, the intention is that after this is merged, I'll open an issue for each of the extensions here to update the actual stubfile that Psalm uses. I figured it'd be best to do a separate PR for each extension. See |
@@ -0,0 +1,1019 @@ | |||
<?php | |||
// Generated with PHP version 8.1.2 dom version 20031129 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I named the file dom-8.1.2 because I'm pretty sure this dom version is misleading and the dom extension has actually changed along with php. I'm not sure why it doesn't show the php version like the other php-bundled extensions, but I'm guessing that's a bug on their end.
Edit: Opened php/php-src#8038
@orklah I'm wondering if we should keep the reflection-generated stubs in a separate repo, there are getting to be quite a number of them and they're not directly needed by Psalm anyway. Do you have any preference there? Maybe I should stick them in the stub generator repo? I've been working through the extension stubs and updating them to include everything defined by the extensions instead of just stuff to override, do you want me to put that here or open a separate pull request? |
well, you'll end up requiring them anyway and always in the latest version. Also I'm not sure I want to know what will happen the day someone will try using Psalm 5 with stubs made for Psalm 7 :p But I'm undecided, I don't have much experience on advantages or drawbacks of making separate repos |
Well the generated stubs aren't used directly, I'm just using them to simplify seeing what's changed between versions. Some of the extensions I'm taking one of the generated stubs as a base and applying stuff from the CallMap/PropertyMap/existing stub on top of that, and I'm using I tried to explain this as best I could in |
Yeah, I need to start the review first :p |
1b2ac47
to
edfe00e
Compare
I went ahead and removed them. Should be ready for review. |
Mind rebasing? There seems to be a few build errors that I would not expect. Otherwise this seems good @weirdan we might want to create a new repo on psalm org for the stub generator. Is this something you can do? |
@orklah I can, but I'll need the name for the repo. |
I think we can keep the current name |
Fixes #7513.
Psalm's stub generator had enough issues that I decided to fork https://github.com/sasezaki/php-extension-stub-generator and get it working again.
I added documentation on how to add/improve support for extensions, and some generated stubs for the extensions I have installed.