Override static in return types with self in final classes - #17724
Override static in return types with self in final classes#17724rekmixa wants to merge 23 commits into
Conversation
…verriding static with self in non-final classes
…self in final classes
…n final classes
…n final classes
dstogov
left a comment
There was a problem hiding this comment.
@rekmixa please define what exactly you propose. (e.g. some code didn't work as expected and started to work after the patch).
I'm not sure if this patch is a fix or a new feature that requries RFC and discussion, how it's going to coexists with type variance, etc
@iluuu1994 @nielsdos @arnaud-lb please take care about this PR.
…tests to folder Zend/tests/type_declarations/variance/override_static_with_self
ndossche
left a comment
There was a problem hiding this comment.
Conceptually, this seems correct to me. Please see my preliminary review comments.
…ability to replace static with self
|
@nielsdos do i need to squash all commits in this PR? |
…_union_types.phpt
No, we will squash on merge. Squashing makes it harder for us to review what has changed since our reviews. |
There was a problem hiding this comment.
I think this is right now, thanks. But I haven't worked with this code a lot, so this needs more eyes, especially since this is deep engine code.
cc @iluuu1994 @arnaud-lb
This may also need discussion on the ML so we know for sure there are no objections.
By the way, i already created discussion in the ML: https://externals.io/message/126367 |
Ah good to know, I missed this. |
…ng for static before checking for final
Thanks for your comments. Can you tell me if this PR will be merged in 8.4 or 8.5? |
|
8.5. Stable branches only receive bug fixes. |
|
Thanks @rekmixa! |
This PR adds the ability to replace static with self in the return types in the final classes, provided that the prototype of the final class has a static return method.
Example of how it should work:
More information in the issue: #17725