-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Add support for generating class entries from stubs #6289
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
Conversation
d7435a2
to
24bd541
Compare
Beautiful! I noticed that some properties have a PHPDoc type and some have a native type. Is there still time to take the major version opportunity to turn more of them to native type (not just in stubs but in the actual implementation)? It’d be beneficial because overriden properties in child classes need to have the same native type (they’re invariant). |
@ondrejmirtes No, unfortunately, it's way too late to do so, despite how tempting it is. |
Looking at the milestone - this isn't gonna make PHP 8.0? |
At first, I was also a tiny little bit surprised, but after rethinking, it's a substantial change (especially the code generation part), and we've already after the very last days. The only reason why it could make sense to still allow this into PHP 8.0 is to avoid merge conflicts due to changes in stub hashes. I'm not sure how often we'll have to fix php 8.0. signatures, but I'd expect a non-negligible amount, since they are very new. personally, I'd also be ok with a compromise, and just add the properties for php 8.0 without code generation, but it's Nikita's and the release managers' call. |
OK, thanks for the heads up. I just realized I can use the stubs in PHPStan in a little bit different way and essentially just read the parameter names and types and the return types (instead of using them as the full reflection representation), which is how they're meant to be used anyway :) |
24bd541
to
2b87043
Compare
Alright, managed to make it work :) https://twitter.com/OndrejMirtes/status/1314218370682818561 |
4da323a
to
4506600
Compare
a8c168f
to
cdc8f3a
Compare
cdc8f3a
to
b496e50
Compare
b496e50
to
b908fc5
Compare
5a936ed
to
149da82
Compare
6f795fe
to
e207879
Compare
e207879
to
ace5552
Compare
@nikic Now that PHP 8.0.0 is done (although methodsynopsis generation is yet to be finished), can you please take a look at this PR again sometime soon? AFAIR the main concern currently is how it works for classes overriding the |
ace5552
to
dae5dfa
Compare
RepresentableType has been replaced by ArginfoType. This is only a partial fix, in that we still need to handle class union types.
dae5dfa
to
ca7d0e0
Compare
I think ultimately, setting get_iterator after doing the implements is okay as well. I think the only negative effect this has is that an unnecessary zend_class_iterator_funcs structure can be created. But apart from that, I think everything will work correctly. |
Okay, my first fix for the exception issue wasn't quite right. It caused phpdbg failures on windows. Hopefully this one works. |
This generally looks good to me, nice work! |
Thanks for the review and the fixes! I can take care of the rest later this week :) |
410e274
to
0e46245
Compare
0e46245
to
0d03441
Compare
@nikic Thanks again for the help! I'll start migrating the stubs to use |
No description provided.