-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Add return types to internal methods #6548
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
99cace9
to
78cf458
Compare
This probably also needs some adjustments inside opcache to not make use of "optional" return type information, for cases that are subject to inheritance. |
Yeah, this was my assumption as well :) But I wanted to defer additional work until we decide what the preferable direction is to go. |
744b55c
to
60af931
Compare
The word "optional" in the code sounds very bad, so I want to change it to something meaningful... Would be "tentative" a more suitable term?
How is it possible that no opcache/jit tests fail, even though I have not addressed the possible issues with return type information? UPDATE: because only ext/date method return types were updated. |
42989bb
to
60ff17c
Compare
99ee3a5
to
2f25f9d
Compare
2f25f9d
to
70d6645
Compare
In my recent push, I tried to tidy my commits up, so that hopefully they became easier to review. Besides, I also tried to cater to OPcache and JIT... I'm not really sure if I left out anything.. However, as far as normal behavior is concerned, the PR should be ready for review, since the implementation seems to be done. My only problem is that I'm sure there are some tentative return types which are not really compatible with each other, so they should be found - and possibly fixed or excluded via |
70d6645
to
9892c35
Compare
9892c35
to
8438e51
Compare
In terms of general approach, I don't like the fact that this is picking up types from phpdoc and using them as tentative return types automatically. This makes it hard to see the actual impact, and may be problematic for extensions (if they regenerate their stubs, they'll probably become PHP-8.1-only.) I think the way this should work is that tentative return types are added as real return types, and the "tentativeness" is indicated through a |
I understand your concerns, and I have to agree that your suggestion should be the way forward (even though I'll have quite a bit of extra work) :) That said, I'll separate this PR into two new ones. |
I'm closing this in favor of the new, separated PRs. |
RFC: https://wiki.php.net/rfc/internal_method_return_types