Bug #80248 - Swapping parameter names during inheritance does not throw
| From: | Michael Voříšek - ČVUT FEL | Date: | Mon, 26 Oct 2020 13:12:05 +0000 |
| Subject: | Bug #80248 - Swapping parameter names during inheritance does not throw | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-112121@lists.php.net to get a copy of this message | ||
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 can allow parameter rename, but we should throw if "already
seen parameter name is at a different position".
I am not that good in C to fix this, so only reporting. I belive, we
should fix this issue asap and merge into PHP 8.
Also - for further discussion - I think, we can even allow parameter
rename, but still allow to use the old name (which, with fix above, will
always result to the same param position). Example:
https://3v4l.org/kgHWf (now an error, it violates OOP/LSP again)
With kind regards / Mit freundlichen Grüßen / S přátelským pozdravem,
Michael Voříšek