Hi there,
just found this now when applying some changes for language level compatibility.
I noticed that ReturnTypeCanBeDeclaredInspection apply the fix to the method but in case this method has overrides, those overrides are not refactored by the quick fix.
Consequences of this is that children classes has signature errors in override methods.
I'll give it a try: not sure if IDE will allow this from QFes.
I don't know how difficult can be from QFes. But it can became problematic. For example children classes overrides but return a subclass type :P then we can get type errors regarding method signature not being the same as parent method etc..
Really not sure if something can be automatize from the Inspection point of view. Just brought the topic into table to check ideas.
Feel free to close the issue if it is too complicated or not possible. In ultimate case I will be adding this points into docs later on so people became aware of it.
@davidmpaz PhpStorm implement this feature inside "Change signature" action
https://blog.jetbrains.com/phpstorm/2017/06/phpstorm-2017-2-eap-172-2827/
Scroll down to the Return types support for Change Signature refactoring
Oh there it was :) .. thanks @funivan I tried to do that but you made me just realize I have outdated version, that's why refactor through signature was not enough to me.
I will close this then @kalessil? or do you want to do something else related to this?
From my side will make only a point on my self for docs later on.
Thanks!!
@kalessil Sometimes is possible uses the PhpStorm API, like the "Change signature" (mentioned by @funivan). Then it should help a lot.
Well, in this case, I want at least update the message and encourage people to use the action instead of our QF.
Done, now if a method is overridden the QF is not available and warning message suggests using the change signature intention.
Fresh binary pushed, have fun guys =)
Most helpful comment
Done, now if a method is overridden the QF is not available and warning message suggests using the change signature intention.
Fresh binary pushed, have fun guys =)