Re: [PHP-DEV] Bug #80248 - Swapping parameter names during inheritance does not throw

2020-10-28 Thread Rowan Tommins
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 na

Re: [PHP-DEV] Bug #80248 - Swapping parameter names during inheritance does not throw

2020-10-28 Thread Michael Voříšek - ČVUT FEL
Significant additional code in the engine to perform additional checks and/or name aliasing I know, but we can do very easily one thing - check and throw if overriding method has one or more named parameter on different position. On class creation time, ie. only once, no overhead per call. Th

Re: [PHP-DEV] Bug #80248 - Swapping parameter names during inheritance does not throw

2020-10-28 Thread Michael Voříšek - ČVUT FEL
see https://3v4l.org/X8omS As long as non-named parameters are supported (they always will be), calling different implementation can produce different results when called with named/not-named parametrs. Let say we have interface/class X with method test(int $offset, int $limit). Let's exten

Re: [PHP-DEV] Bug #80248 - Swapping parameter names during inheritance does not throw

2020-10-28 Thread Rowan Tommins
On 28/10/2020 15:14, Michael Voříšek - ČVUT FEL wrote: I agree - "it's harder to imagine a scenario in real life where". [...] If we can agree, that implementation is not guaranteed to be called with named parameters only, what real world usecase to defend this current php behaviour is left? Y

Re: [PHP-DEV] Bug #80248 - Swapping parameter names during inheritance does not throw

2020-10-28 Thread Chase Peeler
On Wed, Oct 28, 2020 at 11:15 AM Michael Voříšek - ČVUT FEL < voris...@fel.cvut.cz> wrote: > I agree - "it's harder to imagine a scenario in real life where". > > From php perspective, swapping parameters in inheritance SHOULD NOT be > allowed, as without named parameters the parameters are not sw

Re: [PHP-DEV] Bug #80248 - Swapping parameter names during inheritance does not throw

2020-10-28 Thread Michael Voříšek - ČVUT FEL
I agree - "it's harder to imagine a scenario in real life where". From php perspective, swapping parameters in inheritance SHOULD NOT be allowed, as without named parameters the parameters are not swapped. Also, if the parameters are typed differently, the example is even impossible (and nowday

Re: [PHP-DEV] Bug #80248 - Swapping parameter names during inheritance does not throw

2020-10-28 Thread Rowan Tommins
On 28/10/2020 10:45, Michael Voříšek - ČVUT FEL wrote: https://3v4l.org/X8omS parameters renamed, result with named parameters is different While it's easy to construct an example where this happens, it's harder to imagine a scenario in real life where: * a sub-class overloads the function

Re: [PHP-DEV] Bug #80248 - Swapping parameter names during inheritance does not throw

2020-10-28 Thread Michael Voříšek - ČVUT FEL
I see, guys, what is the single reason to allowing this dangerous inheritance? https://3v4l.org/X8omS parameters renamed, result with named parameters is different https://3v4l.org/kgHWf renamed parameter, call with named parameters does not succeed at all (which violated basic principe of O

Re: [PHP-DEV] Bug #80248 - Swapping parameter names during inheritance does not throw

2020-10-26 Thread Rowan Tommins
On 26/10/2020 13:12, Michael Voříšek - ČVUT FEL wrote: I am writing regarding bug 80248. Currently, PHP 8 allows parameter reuse at different position, which I belive is very dangerous, as passed parameters may be passed in a different order with different object impl. Hi Michael, Yes, this w

[PHP-DEV] Bug #80248 - Swapping parameter names during inheritance does not throw

2020-10-26 Thread Michael Voříšek - ČVUT FEL
Hi, I am writing regarding bug 80248. Currently, PHP 8 allows parameter reuse at different position, which I belive is very dangerous, as passed parameters may be passed in a different order with different object impl. See https://3v4l.org/X8omS , which is against OOP and LSP. I belive, we