Re: Bug #80248 - Swapping parameter names during inheritance does not throw
| From: | Rowan Tommins | Date: | Wed, 28 Oct 2020 17:38:46 +0000 |
| Subject: | Re: Bug #80248 - Swapping parameter names during inheritance does not throw | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-112138@lists.php.net to get a copy of this message | ||
On 28/10/2020 17:06, Michael Voříšek - ČVUT FEL wrote:
For better names, I propose to allow rename "to never used name", thus position is never changed and everything behave consistently across named/unnamed params. I also propose to accept the old names, as currently, if not used with the new names, the parameter names are not resolved, so OOP/LSP is violated.This is precisely the behaviour discussed as an alternative in the RFC: https://wiki.php.net/rfc/named_params#to_parameter_name_changes_during_inheritance The reasons it was not implemented are given at the end of that section.
How confident are you that we can "very easily" do this? Have you looked into how it would need to be implemented, and what edge cases we would need to consider? At risk of sounding like a broken record: Nikita did look into it, and documented his conclusions in the RFC. Regards, -- Rowan Tommins (né Collins) [IMSoP]Significant additional code in the engine to perform additional checks and/or name aliasingI know, but we can do very easily one thing - check and throw if overriding method has one or more named parameter on different position.